| 8 | char const* BuildDate = __DATE__ " " __TIME__; |
| 9 | |
| 10 | void DebugConsole::SubmitTaskAndWait(bool server, std::function<void()> task) |
| 11 | { |
| 12 | if (server) { |
| 13 | auto state = GetStaticSymbols().GetServerState(); |
| 14 | if (!state) { |
| 15 | ERR("Cannot queue server commands when the server state machine is not initialized"); |
| 16 | } else if (*state == esv::GameState::Paused || *state == esv::GameState::Running) { |
| 17 | gExtender->GetServer().SubmitTaskAndWait(task); |
| 18 | } else { |
| 19 | ERR("Cannot queue server commands in game state %s", EnumInfo<esv::GameState>::Find(*state).GetString()); |
| 20 | } |
| 21 | } else { |
| 22 | auto state = GetStaticSymbols().GetClientState(); |
| 23 | if (!state) { |
| 24 | ERR("Cannot queue client commands when the client state machine is not initialized"); |
| 25 | } else if (*state == ecl::GameState::Menu |
| 26 | || *state == ecl::GameState::Lobby |
| 27 | || *state == ecl::GameState::Paused |
| 28 | || *state == ecl::GameState::Running) { |
| 29 | gExtender->GetClient().SubmitTaskAndWait(task); |
| 30 | } else { |
| 31 | ERR("Cannot queue client commands in game state %s", EnumInfo<ecl::GameState>::Find(*state).GetString()); |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | void DebugConsole::PrintHelp() |
| 37 | { |
no test coverage detected