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

Method update

bwapi/TestAIModule/Source/BuildTest.cpp:88–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87}
88void BuildTest::update()
89{
90 if (running == false) return;
91 if (fail)
92 {
93 running = false;
94 return;
95 }
96 int thisFrame = Broodwar->getFrameCount();
97 BWAssert(thisFrame==nextFrame);
98 FAILTEST(builder!=NULL);
99 nextFrame++;
100 if (unitType==UnitTypes::Zerg_Extractor && builder->exists()==false)
101 {
102 Unitset buildingsOnTile( Broodwar->getUnitsOnTile(buildLocation.x,buildLocation.y, BWAPI::Filter::GetType == unitType ) );
103 if ( !buildingsOnTile.empty() )
104 {
105 if (unitType==UnitTypes::Zerg_Extractor)
106 {
107 builder = *buildingsOnTile.begin();
108 }
109 }
110 FAILTEST(builder!=NULL);
111 }
112 FAILTEST(builder->exists());
113 Broodwar->setScreenPosition(builder->getPosition() - Position(320,240));
114
115 if (finishingBuilding==true)
116 {
117 FAILTEST(builder!=NULL);
118 if (builder->isIdle()==false && unitType.isRefinery() && builder->getType().getRace()!=Races::Zerg)
119 {
120 FAILTEST(builder->isIdle()==false);
121 builder->stop();
122 FAILTEST(builder->isIdle()==true);
123 }
124 else
125 {
126 if (thisFrame==finishFrame+1 && unitType.isAddon()==false && builder->getType().getRace()!=Races::Protoss)
127 {
128 FAILTEST(builder->isIdle()==false);
129 }
130 else
131 {
132 if (thisFrame<finishFrame+8 && builder->getType().getRace()==Races::Zerg)
133 {
134 FAILTEST(builder->isIdle()==false);
135 }
136 else
137 {
138 FAILTEST(builder->isIdle()==true);
139 }
140 }
141 }
142 if (thisFrame<finishFrame+8 && builder->getType().getRace()==Races::Zerg)
143 {
144 FAILTEST(builder->isConstructing()==true);
145 FAILTEST(builder->getBuildType()==unitType);

Callers

nothing calls this directly

Calls 15

logFunction · 0.85
getUnitsOnTileMethod · 0.80
beginMethod · 0.80
isIdleMethod · 0.80
isRefineryMethod · 0.80
isAddonMethod · 0.80
isConstructingMethod · 0.80
getBuildTypeMethod · 0.80
isCompletedMethod · 0.80
completedUnitCountMethod · 0.80
getBuildUnitMethod · 0.80
getAddonMethod · 0.80

Tested by

no test coverage detected