----------------------------------------------- PARSE TEXT -----------------------------------------------
| 144 | } |
| 145 | //----------------------------------------------- PARSE TEXT ----------------------------------------------- |
| 146 | bool GameImpl::parseText(const std::string &text) |
| 147 | { |
| 148 | // analyze the string |
| 149 | std::stringstream ss(text); |
| 150 | std::string cmd; |
| 151 | int n; |
| 152 | |
| 153 | ss >> cmd; |
| 154 | |
| 155 | // commands list |
| 156 | if (cmd == "/leave") |
| 157 | { |
| 158 | this->leaveGame(); |
| 159 | } |
| 160 | else if (cmd == "/speed") |
| 161 | { |
| 162 | n = -1; |
| 163 | ss >> n; |
| 164 | setLocalSpeedDirect(n); |
| 165 | Broodwar << "Changed game speed" << std::endl; |
| 166 | } |
| 167 | else if (cmd == "/fs") |
| 168 | { |
| 169 | n = 1; |
| 170 | ss >> n; |
| 171 | setFrameSkip(n); |
| 172 | Broodwar << "Altered frame skip" << std::endl; |
| 173 | } |
| 174 | else if (cmd == "/cheats") |
| 175 | { |
| 176 | sendText("power overwhelming"); |
| 177 | sendText("operation cwal"); |
| 178 | sendText("the gathering"); |
| 179 | sendText("medieval man"); |
| 180 | sendText("black sheep wall"); |
| 181 | sendText("food for thought"); |
| 182 | sendText("modify the phase variance"); |
| 183 | sendText("something for nothing"); |
| 184 | sendText("something for nothing"); |
| 185 | sendText("something for nothing"); |
| 186 | sendText("show me the money"); |
| 187 | sendText("show me the money"); |
| 188 | sendText("show me the money"); |
| 189 | sendText("show me the money"); |
| 190 | sendText("show me the money"); |
| 191 | } |
| 192 | else if (cmd == "/restart") |
| 193 | { |
| 194 | restartGame(); |
| 195 | } |
| 196 | else if (cmd == "/nogui") |
| 197 | { |
| 198 | setGUI(!data->hasGUI); |
| 199 | Broodwar << "GUI: " << (data->hasGUI ? "enabled" : "disabled") << std::endl; |
| 200 | } |
| 201 | else if (cmd == "/wmode") |
| 202 | { |
| 203 | SetWMode(BW::BWDATA::GameScreenBuffer.width(), BW::BWDATA::GameScreenBuffer.height(), !wmode); |