| 13 | running = false; |
| 14 | } |
| 15 | void RepairTest::start() |
| 16 | { |
| 17 | if (fail) return; |
| 18 | running = true; |
| 19 | |
| 20 | int userCount = Broodwar->self()->completedUnitCount(unitType); |
| 21 | BWAssertF(userCount>=1,{fail=true;return;}); |
| 22 | for (Unit u : Broodwar->self()->getUnits()) |
| 23 | if (u->getType()==unitType) |
| 24 | unit = u; |
| 25 | BWAssertF(unit!=NULL,{fail=true;return;}); |
| 26 | BWAssertF(unit->exists(),{fail=true;return;}); |
| 27 | |
| 28 | int targetCount = Broodwar->self()->completedUnitCount(targetType); |
| 29 | BWAssertF(targetCount>=1,{fail=true;return;}); |
| 30 | for (Unit u : Broodwar->self()->getUnits()) |
| 31 | if (u->getType()==targetType && u->getHitPoints()<targetType.maxHitPoints()) |
| 32 | target = u; |
| 33 | BWAssertF(target!=NULL,{fail=true;return;}); |
| 34 | BWAssertF(target->exists(),{fail=true;return;}); |
| 35 | BWAssertF(unit->isIdle()==true,{fail=true;return;}); |
| 36 | BWAssertF(unit->repair(target),{Broodwar->printf("%s",Broodwar->getLastError().c_str());fail=true;return;}); |
| 37 | BWAssertF(unit->getOrder()==Orders::Repair,{Broodwar->printf("%s",unit->getOrder().c_str());fail=true;return;}); |
| 38 | BWAssertF(unit->getTarget()==target,{fail=true;return;}); |
| 39 | startFrame = Broodwar->getFrameCount(); |
| 40 | nextFrame = Broodwar->getFrameCount(); |
| 41 | stopped = false; |
| 42 | } |
| 43 | void RepairTest::update() |
| 44 | { |
| 45 | if (running == false) return; |
nothing calls this directly
no test coverage detected