| 86 | |
| 87 | } |
| 88 | void BuildTest::update() |
| 89 | { |
| 90 | if (running == false) return; |
| 91 | if (fail) |
| 92 | { |
| 93 | running = false; |
| 94 | return; |
| 95 | } |
| 96 | int thisFrame = Broodwar->getFrameCount(); |
| 97 | BWAssert(thisFrame==nextFrame); |
| 98 | FAILTEST(builder!=NULL); |
| 99 | nextFrame++; |
| 100 | if (unitType==UnitTypes::Zerg_Extractor && builder->exists()==false) |
| 101 | { |
| 102 | Unitset buildingsOnTile( Broodwar->getUnitsOnTile(buildLocation.x,buildLocation.y, BWAPI::Filter::GetType == unitType ) ); |
| 103 | if ( !buildingsOnTile.empty() ) |
| 104 | { |
| 105 | if (unitType==UnitTypes::Zerg_Extractor) |
| 106 | { |
| 107 | builder = *buildingsOnTile.begin(); |
| 108 | } |
| 109 | } |
| 110 | FAILTEST(builder!=NULL); |
| 111 | } |
| 112 | FAILTEST(builder->exists()); |
| 113 | Broodwar->setScreenPosition(builder->getPosition() - Position(320,240)); |
| 114 | |
| 115 | if (finishingBuilding==true) |
| 116 | { |
| 117 | FAILTEST(builder!=NULL); |
| 118 | if (builder->isIdle()==false && unitType.isRefinery() && builder->getType().getRace()!=Races::Zerg) |
| 119 | { |
| 120 | FAILTEST(builder->isIdle()==false); |
| 121 | builder->stop(); |
| 122 | FAILTEST(builder->isIdle()==true); |
| 123 | } |
| 124 | else |
| 125 | { |
| 126 | if (thisFrame==finishFrame+1 && unitType.isAddon()==false && builder->getType().getRace()!=Races::Protoss) |
| 127 | { |
| 128 | FAILTEST(builder->isIdle()==false); |
| 129 | } |
| 130 | else |
| 131 | { |
| 132 | if (thisFrame<finishFrame+8 && builder->getType().getRace()==Races::Zerg) |
| 133 | { |
| 134 | FAILTEST(builder->isIdle()==false); |
| 135 | } |
| 136 | else |
| 137 | { |
| 138 | FAILTEST(builder->isIdle()==true); |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | if (thisFrame<finishFrame+8 && builder->getType().getRace()==Races::Zerg) |
| 143 | { |
| 144 | FAILTEST(builder->isConstructing()==true); |
| 145 | FAILTEST(builder->getBuildType()==unitType); |
nothing calls this directly
no test coverage detected