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

Method onUnitCreate

bwapi/BWScriptEmulator/BWScriptEmulator.cpp:135–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133{}
134
135void BWScriptEmulator::onUnitCreate(BWAPI::Unit unit)
136{
137 if ( unit->getPlayer() == self ) // If we own it
138 {
139 UnitWrap u(unit);
140
141 // Run computer idle order
142 u.AssignComputerIdleOrder();
143
144 // Assign control types
145 if ( u->getType().isWorker() )
146 u.SetControlType(ControlTypes::Worker);
147 else
148 {
149 u.SetControlType(ControlTypes::Guard);
150 u.SetGuardReturnPosition(u->getPosition());
151 }
152 }
153}
154
155void BWScriptEmulator::onUnitDestroy(BWAPI::Unit unit)
156{

Callers

nothing calls this directly

Calls 7

isWorkerMethod · 0.80
SetControlTypeMethod · 0.80
getPlayerMethod · 0.45
getTypeMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected