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

Method onStart

bwapi/TestAIModule/Source/TestMap1.cpp:35–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void TestMap1::onStart()
36{
37 assert_success_count=0;
38 assert_fail_count=0;
39 BWAssert(Broodwar->mapFileName()=="testmap1.scm");
40 BWAssert(Broodwar->mapWidth()==128);
41 BWAssert(Broodwar->mapHeight()==128);
42 for(int x=0;x<128;++x)
43 {
44 BWAssert(Broodwar->isBuildable(x,0)==true);
45 }
46 for(int x=0;x<512;++x)
47 {
48 BWAssert(Broodwar->isWalkable(x,0)==true);
49 }
50 BWAssert(Broodwar->isFlagEnabled(Flag::CompleteMapInformation)==false);
51 BWAssert(Broodwar->isFlagEnabled(Flag::UserInput)==false);
52 BWAssert(Broodwar->getScreenPosition()==Positions::Unknown);
53 BWAssert(Broodwar->getMousePosition()==Positions::Unknown);
54 BWAssert(Broodwar->isInGame()==true);
55 BWAssert(Broodwar->isMultiplayer()==false);
56 BWAssert(Broodwar->isPaused()==false); // Why would this fail?
57 BWAssert(Broodwar->isReplay()==false);
58 BWAssert(Broodwar->getFrameCount()==0);
59 BWAssert(Broodwar->self()!=NULL);
60 BWAssert(Broodwar->enemy()!=NULL);
61 BWAssert(Broodwar->self()!=Broodwar->enemy());
62
63 BWAssert(Broodwar->getPlayers().size()==3);
64 Playerset players = Broodwar->getPlayers();
65 findAndRemove(players,Broodwar->self());
66 findAndRemove(players,Broodwar->enemy());
67 BWAssert(players.size()==1);
68 Player neutral = *players.begin();
69 BWAssert(neutral->isNeutral()==true);
70
71 BWAssert(Broodwar->self()->getUnits().size()==24);
72 Unitset units = Broodwar->self()->getUnits();
73 for (Unit unit : units)
74 {
75 BWAssert(unit->exists()==true);
76 BWAssert(unit->isAccelerating()==false);
77 BWAssert(unit->isAttacking()==false);
78 BWAssert(unit->isBeingConstructed()==false);
79 BWAssert(unit->isBeingGathered()==false);
80 BWAssert(unit->isBeingHealed()==false);
81 BWAssert(unit->isBlind()==false);
82 BWAssert(unit->isBraking()==false);
83 BWAssert(unit->isBurrowed()==false);
84 BWAssert(unit->isCarryingGas()==false);
85 BWAssert(unit->isCarryingMinerals()==false);
86 BWAssert(unit->isCloaked()==false);
87 BWAssert(unit->isCompleted()==true);
88 BWAssert(unit->isConstructing()==false);
89 BWAssert(unit->isDefenseMatrixed()==false);
90 BWAssert(unit->isEnsnared()==false);
91 BWAssert(unit->isFollowing()==false);
92 BWAssert(unit->isGatheringGas()==false);

Callers

nothing calls this directly

Calls 15

findAndRemoveTypeFunction · 0.85
logFunction · 0.85
beginMethod · 0.80
isAcceleratingMethod · 0.80
isBeingConstructedMethod · 0.80
isBeingGatheredMethod · 0.80
isBeingHealedMethod · 0.80
isBlindMethod · 0.80
isBrakingMethod · 0.80
isBurrowedMethod · 0.80
isCarryingGasMethod · 0.80
isCarryingMineralsMethod · 0.80

Tested by

no test coverage detected