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

Method update

bwapi/TestAIModule/Source/CancelConstructionTest.cpp:98–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97}
98void CancelConstructionTest::update()
99{
100 if (running == false) return;
101 if (fail)
102 {
103 running = false;
104 return;
105 }
106 int thisFrame = Broodwar->getFrameCount();
107 BWAssert(thisFrame==nextFrame);
108 FAILTEST(builder!=NULL);
109 nextFrame++;
110 if (unitType==UnitTypes::Zerg_Extractor && builder->exists()==false)
111 {
112 Unitset buildingsOnTile;
113 Unitset unitsOnTile = Broodwar->getUnitsOnTile(buildLocation.x,buildLocation.y);
114 for (Unit u : unitsOnTile)
115 {
116 if (u->getType()==unitType)
117 {
118 buildingsOnTile.insert(u);
119 }
120 }
121 if (buildingsOnTile.empty()==false)
122 {
123 if (unitType==UnitTypes::Zerg_Extractor)
124 {
125 builder=*buildingsOnTile.begin();
126 }
127 }
128 FAILTEST(builder!=NULL);
129 }
130 FAILTEST(builder->exists());
131 Broodwar->setScreenPosition(builder->getPosition() - Position(320,240));
132
133 if (building==NULL && builder->getBuildUnit()!=NULL)
134 {
135 building = builder->getBuildUnit();
136 }
137 if (building==NULL && builder->getAddon()!=NULL)
138 {
139 building = builder->getAddon();
140 }
141
142 Unitset buildingsOnTile;
143 Unitset unitsOnTile = Broodwar->getUnitsOnTile(buildLocation.x,buildLocation.y);
144 for (Unit u : unitsOnTile)
145 {
146 if (u->getType()==unitType)
147 {
148 buildingsOnTile.insert(u);
149 }
150 }
151 if (building==NULL && buildingsOnTile.empty()==false)
152 {
153 building = *buildingsOnTile.begin();
154 if (unitType==UnitTypes::Zerg_Extractor)
155 {

Callers

nothing calls this directly

Calls 15

logFunction · 0.85
getUnitsOnTileMethod · 0.80
beginMethod · 0.80
getBuildUnitMethod · 0.80
getAddonMethod · 0.80
isAddonMethod · 0.80
completedUnitCountMethod · 0.80
getBuildTypeMethod · 0.80
isConstructingMethod · 0.80
isBeingConstructedMethod · 0.80
c_strMethod · 0.80
getSecondaryOrderMethod · 0.80

Tested by

no test coverage detected