| 89 | } |
| 90 | |
| 91 | void TransportTest::update() |
| 92 | { |
| 93 | if (running == false) return; |
| 94 | if (fail) |
| 95 | { |
| 96 | running = false; |
| 97 | return; |
| 98 | } |
| 99 | int thisFrame = Broodwar->getFrameCount(); |
| 100 | BWAssert(thisFrame==nextFrame); |
| 101 | nextFrame++; |
| 102 | Broodwar->setScreenPosition(transport->getPosition() - Position(320,240)); |
| 103 | if (state == Start) |
| 104 | { |
| 105 | state = WaitForFirstUnit; |
| 106 | currentUnit = *unloadedUnits.begin(); |
| 107 | transport->load(currentUnit); |
| 108 | BWAssertF(unloadedUnits.size()==4,{fail=true;return;}); |
| 109 | BWAssertF(loadedUnits.size()==0,{fail=true;return;}); |
| 110 | state=WaitForFirstUnit; |
| 111 | } |
| 112 | else if (state == WaitForFirstUnit) |
| 113 | { |
| 114 | if (currentUnit->isLoaded()) |
| 115 | { |
| 116 | loadedUnits.insert(currentUnit); |
| 117 | unloadedUnits.erase(currentUnit); |
| 118 | if (verifyLoadedUnits()==false) return; |
| 119 | BWAssertF(unloadedUnits.size()==3,{fail=true;return;}); |
| 120 | BWAssertF(loadedUnits.size()==1,{fail=true;return;}); |
| 121 | currentUnit = *unloadedUnits.begin(); |
| 122 | if (!transport->load(currentUnit)) |
| 123 | Broodwar->printf("%s",Broodwar->getLastError().c_str()); |
| 124 | state=WaitForSecondUnit; |
| 125 | } |
| 126 | } |
| 127 | else if (state == WaitForSecondUnit) |
| 128 | { |
| 129 | if (currentUnit->isLoaded()) |
| 130 | { |
| 131 | loadedUnits.insert(currentUnit); |
| 132 | unloadedUnits.erase(currentUnit); |
| 133 | if (verifyLoadedUnits()==false) return; |
| 134 | BWAssertF(unloadedUnits.size()==2,{fail=true;return;}); |
| 135 | BWAssertF(loadedUnits.size()==2,{fail=true;return;}); |
| 136 | currentUnit = *unloadedUnits.begin(); |
| 137 | if (!transport->load(currentUnit)) |
| 138 | Broodwar->printf("%s",Broodwar->getLastError().c_str()); |
| 139 | state=WaitForThirdUnit; |
| 140 | } |
| 141 | } |
| 142 | else if (state == WaitForThirdUnit) |
| 143 | { |
| 144 | if (currentUnit->isLoaded()) |
| 145 | { |
| 146 | loadedUnits.insert(currentUnit); |
| 147 | unloadedUnits.erase(currentUnit); |
| 148 | if (verifyLoadedUnits()==false) return; |
nothing calls this directly
no test coverage detected