|
BWAPI
|
#include <PositionPath.h>
Public Member Functions | |
| PositionPath () | |
| void | addNode (Position pos) |
| void | drawPath () |
| int | getLength () |
Public Attributes | |
| bool | isComplete |
| std::list< Position > | path |
Definition at line 5 of file PositionPath.h.
Definition at line 3 of file PositionPath.cpp.
: isComplete(false) { }
| void PositionPath::addNode | ( | Position | pos | ) |
Definition at line 8 of file PositionPath.cpp.
References path.
Referenced by PathFinderClass::CreateCheapWalkPath().
{
path.push_front(pos);
}

| void PositionPath::drawPath | ( | ) |
Definition at line 13 of file PositionPath.cpp.
References BWAPI::Broodwar, BWAPI::Game::drawLineMap(), BWAPI::Positions::None, BWAPI::BulletTypes::None, path, BWAPI::Position::x(), BWAPI::Position::y(), and BWAPI::Colors::Yellow.
{
Position previousPosition = BWAPI::Positions::None;
for each(const Position &pos in path)
{
if(previousPosition != BWAPI::Positions::None)
BWAPI::Broodwar->drawLineMap(pos.x(), pos.y(), previousPosition.x(), previousPosition.y(), BWAPI::Colors::Yellow);
previousPosition = pos;
}
}

| int PositionPath::getLength | ( | ) |
Definition at line 25 of file PositionPath.cpp.
References BWAPI::Position::getApproxDistance(), BWAPI::Positions::None, BWAPI::BulletTypes::None, and path.
{
int totalLength = 0;
Position previousPosition = BWAPI::Positions::None;
for each(const Position &pos in path)
{
if(previousPosition != BWAPI::Positions::None)
totalLength += pos.getApproxDistance(previousPosition);
previousPosition = pos;
}
return totalLength;
}
Definition at line 12 of file PositionPath.h.
Referenced by PathFinderClass::CreateCheapWalkPath().
| std::list<Position> PositionPath::path |
Definition at line 16 of file PositionPath.h.
Referenced by addNode(), PathFinderClass::CreateCheapWalkPath(), drawPath(), and getLength().
1.7.6.1