| 274 | } |
| 275 | |
| 276 | void ODServer::handleConsoleCommand(Player* player, GameMap* gameMap, const std::vector<std::string>& args) |
| 277 | { |
| 278 | if(args.empty()) |
| 279 | { |
| 280 | OD_LOG_WRN("Invalid empty console command"); |
| 281 | return; |
| 282 | } |
| 283 | |
| 284 | if(mConsoleInterface.tryExecuteServerCommand(args, *gameMap) != Command::Result::SUCCESS) |
| 285 | { |
| 286 | std::string msg = "Cannot execute console command"; |
| 287 | for(const std::string& str : args) |
| 288 | { |
| 289 | msg += " " + str; |
| 290 | } |
| 291 | OD_LOG_WRN(msg); |
| 292 | return; |
| 293 | } |
| 294 | |
| 295 | // We notify all players that a console command has been executed |
| 296 | ServerNotification *serverNotification = new ServerNotification( |
| 297 | ServerNotificationType::chatServer, nullptr); |
| 298 | |
| 299 | std::string msg = "Console cmd launched: " + args[0]; |
| 300 | serverNotification->mPacket << msg << EventShortNoticeType::genericGameInfo; |
| 301 | ODServer::getSingleton().queueServerNotification(serverNotification); |
| 302 | } |
| 303 | |
| 304 | void ODServer::startNewTurn(double timeSinceLastTurn) |
| 305 | { |
nothing calls this directly
no test coverage detected