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

Method update

bwapi/TestAIModule/Source/BurrowTest.cpp:48–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47}
48void BurrowTest::update()
49{
50 if (running == false) return;
51 if (fail)
52 {
53 running = false;
54 return;
55 }
56 int thisFrame = Broodwar->getFrameCount();
57 BWAssert(thisFrame==nextFrame);
58 nextFrame++;
59 Broodwar->setScreenPosition(unit->getPosition() - Position(320,240));
60
61 if (completedBurrow==false)
62 {
63 if (unit->getOrder()!=Orders::Burrowing && thisFrame>startFrame+60)
64 {
65 FAILTEST(unit->isBurrowed()==true);
66 completedBurrow=true;
67 unit->unburrow();
68 FAILTEST(unit->getOrder()==Orders::Unburrowing);
69 startFrame=thisFrame;
70 }
71 else
72 {
73 if (thisFrame>startFrame+300)
74 fail = true;
75 }
76 }
77 else
78 {
79 if (unit->getOrder()!=Orders::Unburrowing && thisFrame>startFrame+60)
80 {
81 FAILTEST(unit->isBurrowed()==false);
82 running = false;
83 }
84 else
85 {
86 if (thisFrame>startFrame+300)
87 fail = true;
88 }
89 }
90}
91
92void BurrowTest::stop()
93{

Callers

nothing calls this directly

Calls 7

isBurrowedMethod · 0.80
PositionClass · 0.50
getFrameCountMethod · 0.45
setScreenPositionMethod · 0.45
getPositionMethod · 0.45
getOrderMethod · 0.45
unburrowMethod · 0.45

Tested by

no test coverage detected