MCPcopy Create free account
hub / github.com/bwapi/bwapi / onUnitCreate

Method onUnitCreate

bwapi/ExampleAIModule/Source/ExampleAIModule.cpp:253–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253void ExampleAIModule::onUnitCreate(BWAPI::Unit unit)
254{
255 if ( Broodwar->isReplay() )
256 {
257 // if we are in a replay, then we will print out the build order of the structures
258 if ( unit->getType().isBuilding() && !unit->getPlayer()->isNeutral() )
259 {
260 int seconds = Broodwar->getFrameCount()/24;
261 int minutes = seconds/60;
262 seconds %= 60;
263 Broodwar->sendText("%.2d:%.2d: %s creates a %s", minutes, seconds, unit->getPlayer()->getName().c_str(), unit->getType().c_str());
264 }
265 }
266}
267
268void ExampleAIModule::onUnitDestroy(BWAPI::Unit unit)
269{

Callers

nothing calls this directly

Calls 9

isBuildingMethod · 0.80
sendTextMethod · 0.80
c_strMethod · 0.80
isReplayMethod · 0.45
getTypeMethod · 0.45
isNeutralMethod · 0.45
getPlayerMethod · 0.45
getFrameCountMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected