|
BWAPI
|
00001 #pragma once 00002 #include "../../../../Utils/FSM/Condition.h" 00003 00004 class BuildingStarted : public Condition 00005 { 00006 public: 00007 BuildingStarted(BWAPI::TilePosition target, BWAPI::UnitType type) 00008 : m_target(target), 00009 m_type(type) 00010 { 00011 } 00012 00013 bool evaluate() const 00014 { 00015 std::set<BWAPI::Unit*> units = BWAPI::Broodwar->getUnitsOnTile(m_target.x(),m_target.y()); 00016 for(std::set<BWAPI::Unit*>::iterator it = units.begin() ; it!=units.end() ; ++it) 00017 { 00018 if((*it)->getType() == m_type) 00019 return true; 00020 } 00021 return false; 00022 } 00023 00024 protected: 00025 const BWAPI::TilePosition m_target; 00026 const BWAPI::UnitType m_type; 00027 };
1.7.6.1