MCPcopy Create free account
hub / github.com/bwapi/bwapi / update

Method update

bwapi/TestAIModule/Source/CancelUpgradeTest.cpp:43–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42}
43void CancelUpgradeTest::update()
44{
45 if (running == false) return;
46 if (fail)
47 {
48 running = false;
49 return;
50 }
51 int thisFrame = Broodwar->getFrameCount();
52 BWAssert(thisFrame==nextFrame);
53 nextFrame++;
54 Broodwar->setScreenPosition(upgrader->getPosition() - Position(320,240));
55 BWAssertF(upgrader!=NULL,{fail=true;return;});
56 if (thisFrame<startFrame+20)
57 {
58 BWAssertF(upgrader->getBuildType()==UnitTypes::None,{fail=true;return;});
59 BWAssertF(upgrader->isMorphing()==false,{fail=true;return;});
60 BWAssertF(upgrader->isConstructing()==false,{fail=true;return;});
61 BWAssertF(upgrader->isTraining()==false,{fail=true;return;});
62 BWAssertF(upgrader->isResearching()==false,{fail=true;return;});
63 BWAssertF(upgrader->isUpgrading()==true,{fail=true;return;});
64 BWAssertF(upgrader->getTech()==TechTypes::None,{fail=true;return;});
65 BWAssertF(upgrader->getUpgrade()==upgradeType,{fail=true;return;});
66 BWAssertF(upgrader->isIdle()==false,{fail=true;return;});
67 }
68 if (thisFrame==startFrame+20)
69 {
70 upgrader->cancelUpgrade();
71 }
72 if (thisFrame>=startFrame+20)
73 {
74 BWAssertF(upgrader->getBuildType()==UnitTypes::None,{fail=true;return;});
75 BWAssertF(upgrader->isMorphing()==false,{fail=true;return;});
76 BWAssertF(upgrader->isConstructing()==false,{fail=true;return;});
77 BWAssertF(upgrader->isTraining()==false,{fail=true;return;});
78 BWAssertF(upgrader->isResearching()==false,{fail=true;return;});
79 BWAssertF(upgrader->isUpgrading()==false,{fail=true;return;});
80 BWAssertF(upgrader->getTech()==TechTypes::None,{fail=true;return;});
81 BWAssertF(upgrader->getUpgrade()==UpgradeTypes::None,{fail=true;return;});
82 BWAssertF(upgrader->isIdle()==true,{fail=true;return;});
83 BWAssertF(upgrader->getRemainingBuildTime()==0,{fail=true;return;});
84 BWAssertF(upgrader->getRemainingTrainTime()==0,{fail=true;return;});
85 BWAssertF(upgrader->getRemainingResearchTime()==0,{fail=true;return;});
86 BWAssertF(upgrader->getRemainingUpgradeTime()==0,{fail=true;return;});
87 BWAssertF(Broodwar->self()->minerals()==correctMineralCount,{fail=true;return;});
88 BWAssertF(Broodwar->self()->gas()==correctGasCount,{fail=true;return;});
89 BWAssertF(Broodwar->self()->supplyUsed()==correctSupplyUsedCount,{fail=true;return;});
90 }
91 if (thisFrame>=startFrame+40)
92 {
93 running = false;
94 }
95}
96
97void CancelUpgradeTest::stop()
98{

Callers

nothing calls this directly

Calls 15

getBuildTypeMethod · 0.80
isMorphingMethod · 0.80
isConstructingMethod · 0.80
isTrainingMethod · 0.80
getUpgradeMethod · 0.80
isIdleMethod · 0.80
getRemainingBuildTimeMethod · 0.80
getRemainingTrainTimeMethod · 0.80
mineralsMethod · 0.80
gasMethod · 0.80

Tested by

no test coverage detected