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

Method update

bwapi/TestAIModule/Source/RepairTest.cpp:43–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 stopped = false;
42}
43void RepairTest::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(unit->getPosition() - Position(320,240));
55
56 if (target->getHitPoints()==targetType.maxHitPoints() && !stopped)
57 {
58 stopped=true;
59 startFrame=thisFrame;
60 }
61 if (!stopped)
62 {
63 BWAssertF(unit->getOrder()==Orders::Repair,{Broodwar->printf("%s",unit->getOrder().c_str());fail=true;return;});
64 BWAssertF(unit->getTarget()==target || unit->getOrderTarget()==target,{fail=true;return;});
65 }
66 else
67 {
68 if (thisFrame>startFrame+20)
69 {
70 BWAssertF(unit->isIdle()==true,{fail=true;return;});
71 BWAssertF(unit->isRepairing()==false,{fail=true;return;});
72 }
73 if (thisFrame>startFrame+60)
74 {
75 running = false;
76 }
77 }
78}
79
80void RepairTest::stop()
81{

Callers

nothing calls this directly

Calls 13

getHitPointsMethod · 0.80
maxHitPointsMethod · 0.80
printfMethod · 0.80
c_strMethod · 0.80
getOrderTargetMethod · 0.80
isIdleMethod · 0.80
isRepairingMethod · 0.80
PositionClass · 0.50
getFrameCountMethod · 0.45
setScreenPositionMethod · 0.45
getPositionMethod · 0.45
getOrderMethod · 0.45

Tested by

no test coverage detected