BWAPI
|
00001 /* 00002 * ProductionManager.cpp 00003 * 00004 * Used to train new units 00005 */ 00006 #include "ProductionManager.h" 00007 #include "Agent.h" 00008 00009 #include <BWAPI.h> 00010 00011 using namespace BWAPI; 00012 00013 00014 void ProductionManager::update() 00015 { 00016 // currently once you put the command center in train state 00017 // it will never transition out of it 00018 // should tell it to be idle at some point, especially if 00019 // you want to build an addon 00020 for (AgentSetIter agent = agents.begin(); agent != agents.end(); agent++) 00021 { 00022 // Tell command centers to produce SCVs 00023 if ((*agent)->getUnit().getType().isResourceDepot()) 00024 { 00025 (*agent)->setState(TrainState); 00026 (*agent)->setUnitTypeTarget(UnitTypes::Terran_SCV); 00027 } 00028 } 00029 00030 // Update agents 00031 Manager::update(); 00032 }