| 39 | |
| 40 | } |
| 41 | void CloakTest::update() |
| 42 | { |
| 43 | if (running == false) return; |
| 44 | if (fail) |
| 45 | { |
| 46 | running = false; |
| 47 | return; |
| 48 | } |
| 49 | int thisFrame = Broodwar->getFrameCount(); |
| 50 | BWAssert(thisFrame==nextFrame); |
| 51 | nextFrame++; |
| 52 | Broodwar->setScreenPosition(unit->getPosition() - Position(320,240)); |
| 53 | if (unit->getEnergy()!=currentEnergy) |
| 54 | { |
| 55 | currentEnergy++; |
| 56 | BWAssertF(abs(unit->getEnergy()-currentEnergy)<5,{Broodwar->printf("%d != %d",unit->getEnergy(),currentEnergy);fail=true;return;}); |
| 57 | currentEnergy=unit->getEnergy(); |
| 58 | } |
| 59 | |
| 60 | if (completedCloak==false) |
| 61 | { |
| 62 | if (unit->getOrder()!=Orders::Cloak && thisFrame>startFrame+60) |
| 63 | { |
| 64 | BWAssertF(unit->isCloaked()==true,{fail=true;return;}); |
| 65 | completedCloak=true; |
| 66 | unit->decloak(); |
| 67 | BWAssertF(unit->getOrder()==Orders::Decloak,{fail=true;return;}); |
| 68 | startFrame=thisFrame; |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | if (thisFrame>startFrame+300) |
| 73 | fail = true; |
| 74 | } |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | if (unit->getOrder()!=Orders::Decloak && thisFrame>startFrame+60) |
| 79 | { |
| 80 | BWAssertF(unit->isCloaked()==false,{fail=true;return;}); |
| 81 | running = false; |
| 82 | } |
| 83 | else |
| 84 | { |
| 85 | if (thisFrame>startFrame+300) |
| 86 | fail = true; |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | void CloakTest::stop() |
| 92 | { |
nothing calls this directly
no test coverage detected