* If the loading fails, it shows an error, otherwise moves on to the game. */
| 152 | * If the loading fails, it shows an error, otherwise moves on to the game. |
| 153 | */ |
| 154 | void StartState::think() |
| 155 | { |
| 156 | State::think(); |
| 157 | _timer->think(this, 0); |
| 158 | |
| 159 | switch (loading) |
| 160 | { |
| 161 | case LOADING_FAILED: |
| 162 | CrossPlatform::flashWindow(); |
| 163 | addLine(L""); |
| 164 | addLine(L"ERROR: " + Language::utf8ToWstr(error)); |
| 165 | addLine(L"Make sure you installed OpenXcom correctly."); |
| 166 | addLine(L"Check the wiki documentation for more details."); |
| 167 | addLine(L""); |
| 168 | addLine(L"Press any key to continue."); |
| 169 | loading = LOADING_DONE; |
| 170 | break; |
| 171 | case LOADING_SUCCESSFUL: |
| 172 | CrossPlatform::flashWindow(); |
| 173 | Log(LOG_INFO) << "OpenXcom started successfully!"; |
| 174 | if (!Options::reload && Options::playIntro) |
| 175 | { |
| 176 | bool letterbox = Options::keepAspectRatio; |
| 177 | Options::keepAspectRatio = true; |
| 178 | Options::baseXResolution = Screen::ORIGINAL_WIDTH; |
| 179 | Options::baseYResolution = Screen::ORIGINAL_HEIGHT; |
| 180 | _game->getScreen()->resetDisplay(false); |
| 181 | _game->setState(new IntroState(_game, letterbox)); |
| 182 | } |
| 183 | else |
| 184 | { |
| 185 | Screen::updateScale(Options::geoscapeScale, Options::geoscapeScale, Options::baseXGeoscape, Options::baseYGeoscape, true); |
| 186 | _game->getScreen()->resetDisplay(false); |
| 187 | State *state = new MainMenuState(_game); |
| 188 | _game->setState(state); |
| 189 | // Check for mod loading errors |
| 190 | if (!Options::badMods.empty()) |
| 191 | { |
| 192 | std::wostringstream error; |
| 193 | error << tr("STR_MOD_UNSUCCESSFUL") << L'\x02'; |
| 194 | for (std::vector<std::string>::iterator i = Options::badMods.begin(); i != Options::badMods.end(); ++i) |
| 195 | { |
| 196 | error << Language::fsToWstr(*i) << L'\n'; |
| 197 | } |
| 198 | Options::badMods.clear(); |
| 199 | _game->pushState(new ErrorMessageState(_game, error.str(), state->getPalette(), Palette::blockOffset(8)+10, "BACK01.SCR", 6)); |
| 200 | } |
| 201 | Options::reload = false; |
| 202 | } |
| 203 | _game->getCursor()->setVisible(true); |
| 204 | _game->getFpsCounter()->setVisible(Options::fpsCounter); |
| 205 | break; |
| 206 | default: |
| 207 | break; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | /** |
nothing calls this directly
no test coverage detected