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

Method update

bwapi/TestAIModule/Source/SiegeTest.cpp:33–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32}
33void SiegeTest::update()
34{
35 if (running == false) return;
36 if (fail)
37 {
38 running = false;
39 return;
40 }
41 int thisFrame = Broodwar->getFrameCount();
42 BWAssert(thisFrame==nextFrame);
43 nextFrame++;
44 Broodwar->setScreenPosition(unit->getPosition() - Position(320,240));
45 if (completedSiege==false)
46 {
47 if (unit->getOrder()!=Orders::Sieging)
48 {
49 BWAssertF(unit->isSieged()==true,{fail=true;return;});
50 BWAssertF(unit->getType()==UnitTypes::Terran_Siege_Tank_Siege_Mode,{fail=true;return;});
51 completedSiege=true;
52 unit->unsiege();
53 BWAssertF(unit->getOrder()==Orders::Unsieging,{fail=true;return;});
54 }
55 else
56 {
57 if (thisFrame>startFrame+300)
58 fail = true;
59 }
60 }
61 else
62 {
63 if (unit->getOrder()!=Orders::Unsieging)
64 {
65 BWAssertF(unit->isSieged()==false,{fail=true;return;});
66 BWAssertF(unit->getType()==UnitTypes::Terran_Siege_Tank_Tank_Mode,{fail=true;return;});
67 running = false;
68 }
69 else
70 {
71 if (thisFrame>startFrame+300)
72 fail = true;
73 }
74 }
75}
76
77void SiegeTest::stop()
78{

Callers

nothing calls this directly

Calls 8

isSiegedMethod · 0.80
PositionClass · 0.50
getFrameCountMethod · 0.45
setScreenPositionMethod · 0.45
getPositionMethod · 0.45
getOrderMethod · 0.45
getTypeMethod · 0.45
unsiegeMethod · 0.45

Tested by

no test coverage detected