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

Method onStart

bwapi/BWScriptEmulator/BWScriptEmulator.cpp:19–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17DWORD dwCount = 0;
18
19void BWScriptEmulator::onStart()
20{
21 // enable stuff
22 bw->enableFlag(Flag::UserInput);
23 bw->enableFlag(Flag::CompleteMapInformation);
24 farcasting = true;
25
26 // Save some BW info locally for easier access
27 self = bw->self();
28 mapW = bw->mapWidth();
29 mapH = bw->mapHeight();
30
31 // Access full map just like the normal AI
32 if ( !bw->isMultiplayer() )
33 bw->sendText("black sheep wall");
34
35 if ( !self )
36 return;
37
38 if ( !LoadAIBinary("bwapi-data\\AISCRIPT.BIN") )
39 Broodwar << Text::Red << "Failed to load AISCRIPT binary!" << std::endl;
40
41 Race selfRace(self->getRace());
42 Position sLoc(self->getStartLocation());
43
44 srand(GetTickCount());
45
46 /*
47 // Run default melee script
48 if ( selfRace == Races::Zerg )
49 AICreateThread("ZMCx", sLoc );
50 else if ( selfRace == Races::Protoss )
51 AICreateThread("PMCx", sLoc );
52 else // ( selfRace == Races::Terran )
53 AICreateThread("TMCx", sLoc );
54 */
55
56 // Run map test script if it has a 4-letter title
57 std::string title = Broodwar->mapName();
58 if ( title.size() == 4 )
59 AICreateThread(title.c_str(), sLoc);
60}
61
62void BWScriptEmulator::onEnd(bool isWinner)
63{

Callers

nothing calls this directly

Calls 13

LoadAIBinaryFunction · 0.85
AICreateThreadFunction · 0.85
sendTextMethod · 0.80
c_strMethod · 0.80
enableFlagMethod · 0.45
selfMethod · 0.45
mapWidthMethod · 0.45
mapHeightMethod · 0.45
isMultiplayerMethod · 0.45
getRaceMethod · 0.45
getStartLocationMethod · 0.45
mapNameMethod · 0.45

Tested by

no test coverage detected