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

Method onSendText

bwapi/BWScriptEmulator/BWScriptEmulator.cpp:90–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void BWScriptEmulator::onSendText(std::string text)
91{
92 std::stringstream ss(text);
93 std::string cmd;
94 ss >> cmd;
95
96 if ( cmd == "/fc" || cmd == "/farcast" )
97 {
98 farcasting = !farcasting;
99 Broodwar << "Farcasting " << (farcasting ? "ENABLED" : "DISABLED") << std::endl;
100 }
101 else if ( cmd == "/r" || cmd == "/run" || cmd == "/script" )
102 {
103 std::string script;
104 ss >> script;
105
106 AICreateThread(script.c_str(), Broodwar->getScreenPosition() + Broodwar->getMousePosition() );
107 }
108 else
109 {
110 Broodwar->sendText("%s", text.c_str());
111 }
112}
113
114void BWScriptEmulator::onReceiveText(BWAPI::Player player, std::string text)
115{}

Callers

nothing calls this directly

Calls 5

AICreateThreadFunction · 0.85
c_strMethod · 0.80
sendTextMethod · 0.80
getScreenPositionMethod · 0.45
getMousePositionMethod · 0.45

Tested by

no test coverage detected