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

Method update

bwapi/TestAIModule/Source/LiftTest.cpp:40–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39}
40void LiftTest::update()
41{
42 if (running == false) return;
43 if (fail)
44 {
45 running = false;
46 return;
47 }
48 int thisFrame = Broodwar->getFrameCount();
49 BWAssert(thisFrame==nextFrame);
50 nextFrame++;
51 Broodwar->setScreenPosition(unit->getPosition() - Position(320,240));
52
53 if (completedLift==false)
54 {
55 if (unit->getOrder()!=Orders::BuildingLiftOff && unit->getOrder()!=Orders::LiftingOff && thisFrame>startFrame+300)
56 {
57 BWAssertF(unit->isLifted()==true,{fail=true;return;});
58 completedLift=true;
59 unit->land(originalTilePosition);
60 BWAssertF(unit->getOrder() == Orders::BuildingLand, { fail = true; log("originalTilePosition=(%d,%d)", originalTilePosition.x, originalTilePosition.y); return; });
61 startFrame=thisFrame;
62 }
63 else
64 {
65 if (thisFrame>startFrame+600)
66 fail = true;
67 }
68 }
69 else
70 {
71 if (unit->getOrder()!=Orders::BuildingLand && thisFrame>startFrame+300)
72 {
73 BWAssertF(unit->isLifted()==false,{fail=true;return;});
74 running = false;
75 }
76 else
77 {
78 if (thisFrame>startFrame+600)
79 fail = true;
80 }
81 }
82}
83
84void LiftTest::stop()
85{

Callers

nothing calls this directly

Calls 8

logFunction · 0.85
isLiftedMethod · 0.80
PositionClass · 0.50
getFrameCountMethod · 0.45
setScreenPositionMethod · 0.45
getPositionMethod · 0.45
getOrderMethod · 0.45
landMethod · 0.45

Tested by

no test coverage detected