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

Method AddUnit

bwapi/BWScriptEmulator/Town.cpp:20–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18{}
19
20void Town::AddUnit(BWAPI::Unit pUnit)
21{
22 if ( !pUnit )
23 return;
24
25 if ( pUnit->getType().isWorker() )
26 {
27 // New Worker
28 UnitWrap(pUnit).SetControlType(ControlTypes::Worker);
29 }
30 else if ( (IsBuilding || GetType == UnitTypes::Zerg_Egg || GetType == UnitTypes::Zerg_Larva || GetType == UnitTypes::Zerg_Overlord)(pUnit) )
31 {
32 // New Task
33
34 // Something make guard
35
36 //
37 if ( pUnit->getType().isResourceDepot() )
38 {
39 if ( !this->pTownCenter )
40 this->pTownCenter = pUnit;
41 }
42 else if ( pUnit->getType().isRefinery() )
43 {
44 this->gasGeysers.insert(pUnit);
45 }
46 }
47}
48

Callers

nothing calls this directly

Calls 6

UnitWrapClass · 0.85
isWorkerMethod · 0.80
SetControlTypeMethod · 0.80
isResourceDepotMethod · 0.80
isRefineryMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected