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

Method start

bwapi/TestAIModule/Source/GatherTest.cpp:17–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 running = false;
16}
17void GatherTest::start()
18{
19 if (fail) return;
20 running = true;
21
22 int userCount = Broodwar->self()->completedUnitCount(Broodwar->self()->getRace().getWorker());
23 BWAssertF(userCount>=1,{fail=true;return;});
24 for (Unit u : Broodwar->self()->getUnits())
25 if (u->getType().isWorker())
26 worker = u;
27 for (Unit u : Broodwar->getMinerals())
28 if ( u->getType().isMineralField() )
29 mineral = u;
30 for (Unit u : Broodwar->self()->getUnits())
31 if (u->getType().isRefinery())
32 refinery = u;
33 BWAssertF(worker!=NULL,{fail=true;return;});
34 BWAssertF(worker->exists(),{fail=true;return;});
35 BWAssertF(mineral!=NULL,{fail=true;return;});
36 BWAssertF(mineral->exists(),{fail=true;return;});
37 BWAssertF(refinery!=NULL,{fail=true;return;});
38 BWAssertF(refinery->exists(),{fail=true;return;});
39 worker->gather(mineral);
40 BWAssertF(worker->isGatheringMinerals(),{fail=true;return;});
41 startFrame = Broodwar->getFrameCount();
42 nextFrame = Broodwar->getFrameCount();
43 initialMinerals = Broodwar->self()->minerals();
44 initialGas = Broodwar->self()->gas();
45 state=1;
46}
47void GatherTest::update()
48{
49 if (running == false) return;

Callers

nothing calls this directly

Calls 15

completedUnitCountMethod · 0.80
getWorkerMethod · 0.80
isWorkerMethod · 0.80
isMineralFieldMethod · 0.80
isRefineryMethod · 0.80
isGatheringMineralsMethod · 0.80
mineralsMethod · 0.80
gasMethod · 0.80
selfMethod · 0.45
getRaceMethod · 0.45
getUnitsMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected