BWAPI
Skynet/Skynet/PositionPath.cpp
Go to the documentation of this file.
00001 #include "PositionPath.h"
00002 
00003 PositionPath::PositionPath()
00004         : isComplete(false)
00005 {
00006 }
00007 
00008 void PositionPath::addNode(Position pos)
00009 {
00010         path.push_front(pos);
00011 }
00012 
00013 void PositionPath::drawPath()
00014 {
00015         Position previousPosition = BWAPI::Positions::None;
00016         for each(const Position &pos in path)
00017         {
00018                 if(previousPosition != BWAPI::Positions::None)
00019                         BWAPI::Broodwar->drawLineMap(pos.x(), pos.y(), previousPosition.x(), previousPosition.y(), BWAPI::Colors::Yellow);
00020 
00021                 previousPosition = pos;
00022         }
00023 }
00024 
00025 int PositionPath::getLength()
00026 {
00027         int totalLength = 0;
00028         Position previousPosition = BWAPI::Positions::None;
00029         for each(const Position &pos in path)
00030         {
00031                 if(previousPosition != BWAPI::Positions::None)
00032                         totalLength += pos.getApproxDistance(previousPosition);
00033 
00034                 previousPosition = pos;
00035         }
00036 
00037         return totalLength;
00038 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines