| 15 | running = false; |
| 16 | } |
| 17 | void 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 | } |
| 47 | void GatherTest::update() |
| 48 | { |
| 49 | if (running == false) return; |
nothing calls this directly
no test coverage detected