| 15 | running = false; |
| 16 | } |
| 17 | void RightClickTest::start() |
| 18 | { |
| 19 | if (fail) return; |
| 20 | running = true; |
| 21 | |
| 22 | int userCount = Broodwar->self()->completedUnitCount(unitType); |
| 23 | BWAssertF(userCount>=1,{fail=true;return;}); |
| 24 | for (Unit u : Broodwar->self()->getUnits()) |
| 25 | if (u->getType()==unitType) |
| 26 | unit = u; |
| 27 | |
| 28 | int enemyCount = Broodwar->self()->completedUnitCount(enemyType); |
| 29 | BWAssertF(enemyCount >= 1, { fail = true; return; }); |
| 30 | for (Unit u : Broodwar->getAllUnits()) |
| 31 | if (u->getType()==enemyType && u->getPlayer()->isEnemy(Broodwar->self())) |
| 32 | enemyUnit = u; |
| 33 | |
| 34 | int friendCount = Broodwar->self()->completedUnitCount(friendlyType); |
| 35 | BWAssertF(friendCount >= 1, { fail = true; return; }); |
| 36 | for (Unit u : Broodwar->getAllUnits()) |
| 37 | if (u->getType()==friendlyType && u->getPlayer()->isAlly(Broodwar->self())) |
| 38 | friendUnit = u; |
| 39 | BWAssertF(unit!=NULL,{fail=true;return;}); |
| 40 | BWAssertF(unit->exists(),{fail=true;return;}); |
| 41 | BWAssertF(enemyUnit!=NULL,{fail=true;return;}); |
| 42 | BWAssertF(enemyUnit->exists(),{fail=true;return;}); |
| 43 | BWAssertF(friendUnit!=NULL,{fail=true;return;}); |
| 44 | BWAssertF(friendUnit->exists(),{fail=true;return;}); |
| 45 | targetPosition = unit->getPosition(); |
| 46 | targetPosition.y-=30*32; |
| 47 | targetPosition.makeValid(); |
| 48 | unit->rightClick(targetPosition); |
| 49 | BWAssertF(unit->getOrder()==Orders::Move,{fail=true;return;}); |
| 50 | BWAssertF(unit->getTargetPosition()==targetPosition,{fail=true;return;}); |
| 51 | startFrame = Broodwar->getFrameCount(); |
| 52 | nextFrame = Broodwar->getFrameCount(); |
| 53 | } |
| 54 | void RightClickTest::update() |
| 55 | { |
| 56 | if (running == false) return; |
nothing calls this directly
no test coverage detected