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

Method start

bwapi/TestAIModule/Source/FollowTest.cpp:15–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 running = false;
14}
15void FollowTest::start()
16{
17 if (fail) return;
18 running = true;
19
20 int userCount = Broodwar->self()->completedUnitCount(unitType);
21 BWAssertF(userCount>=1,{fail=true;return;});
22 for (Unit u : Broodwar->self()->getUnits())
23 if (u->getType()==unitType)
24 unit = u;
25 BWAssertF(unit!=NULL,{fail=true;return;});
26 BWAssertF(unit->exists(),{fail=true;return;});
27
28 int targetCount = Broodwar->self()->completedUnitCount(targetType);
29 BWAssertF(targetCount>=1,{fail=true;return;});
30 for (Unit u : Broodwar->self()->getUnits())
31 if (u->getType()==targetType)
32 target = u;
33 BWAssertF(target!=NULL,{fail=true;return;});
34 BWAssertF(target->exists(),{fail=true;return;});
35 BWAssertF(unit->isIdle()==true,{fail=true;return;});
36 BWAssertF(unit->rightClick(Position(target->getPosition().x-32*20,target->getPosition().y)),{Broodwar->printf("%s",Broodwar->getLastError().c_str());fail=true;return;});
37 startFrame = Broodwar->getFrameCount();
38 nextFrame = Broodwar->getFrameCount();
39 started=false;
40}
41void FollowTest::update()
42{
43 if (running == false) return;

Callers

nothing calls this directly

Calls 13

completedUnitCountMethod · 0.80
isIdleMethod · 0.80
printfMethod · 0.80
c_strMethod · 0.80
getLastErrorMethod · 0.80
PositionClass · 0.50
selfMethod · 0.45
getUnitsMethod · 0.45
getTypeMethod · 0.45
existsMethod · 0.45
rightClickMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected