| 74 | } |
| 75 | |
| 76 | void ModeManager::checkModeChange() |
| 77 | { |
| 78 | if (mRequestedMode == NONE) |
| 79 | return; |
| 80 | |
| 81 | ModeType previousMode = NONE; |
| 82 | if(mCurrentApplicationMode != nullptr) |
| 83 | { |
| 84 | if (mCurrentApplicationMode->getModeType() == mRequestedMode) |
| 85 | return; |
| 86 | |
| 87 | // Keep the previous mode in mind. |
| 88 | previousMode = mCurrentApplicationMode->getModeType(); |
| 89 | |
| 90 | mCurrentApplicationMode->deactivate(); |
| 91 | mCurrentApplicationMode = nullptr; |
| 92 | } |
| 93 | |
| 94 | switch(mRequestedMode) |
| 95 | { |
| 96 | case MENU_MAIN: |
| 97 | mCurrentApplicationMode = Utils::make_unique<MenuModeMain>(this); |
| 98 | // In that case, we are at the root menu and should ensure to have |
| 99 | // a clean mode type history |
| 100 | mPreviousModeTypes.clear(); |
| 101 | previousMode = NONE; |
| 102 | break; |
| 103 | case MENU_SKIRMISH: |
| 104 | mCurrentApplicationMode = Utils::make_unique<MenuModeSkirmish>(this); |
| 105 | break; |
| 106 | case MENU_REPLAY: |
| 107 | mCurrentApplicationMode = Utils::make_unique<MenuModeReplay>(this); |
| 108 | break; |
| 109 | case MENU_MULTIPLAYER_CLIENT: |
| 110 | mCurrentApplicationMode = Utils::make_unique<MenuModeMultiplayerClient>(this); |
| 111 | break; |
| 112 | case MENU_MULTIPLAYER_SERVER: |
| 113 | mCurrentApplicationMode = Utils::make_unique<MenuModeMultiplayerServer>(this, false); |
| 114 | break; |
| 115 | case MENU_EDITOR_NEW: |
| 116 | mCurrentApplicationMode = Utils::make_unique<MenuModeEditorNew>(this); |
| 117 | break; |
| 118 | case MENU_EDITOR_LOAD: |
| 119 | mCurrentApplicationMode = Utils::make_unique<MenuModeEditorLoad>(this); |
| 120 | break; |
| 121 | case MENU_CONFIGURE_SEATS: |
| 122 | mCurrentApplicationMode = Utils::make_unique<MenuModeConfigureSeats>(this); |
| 123 | break; |
| 124 | case GAME: |
| 125 | mCurrentApplicationMode = Utils::make_unique<GameMode>(this); |
| 126 | break; |
| 127 | case EDITOR: |
| 128 | mCurrentApplicationMode = Utils::make_unique<EditorMode>(this); |
| 129 | break; |
| 130 | case MENU_LOAD_SAVEDGAME: |
| 131 | mCurrentApplicationMode = Utils::make_unique<MenuModeLoad>(this); |
| 132 | break; |
| 133 | case MENU_MASTERSERVER_HOST: |
nothing calls this directly
no test coverage detected