* Reset and reload data. */
| 126 | * Reset and reload data. |
| 127 | */ |
| 128 | void StartState::init() |
| 129 | { |
| 130 | State::init(); |
| 131 | |
| 132 | // Silence! |
| 133 | Sound::stop(); |
| 134 | Music::stop(); |
| 135 | _game->setResourcePack(0); |
| 136 | if (!Options::mute && Options::reload) |
| 137 | { |
| 138 | Mix_CloseAudio(); |
| 139 | _game->initAudio(); |
| 140 | } |
| 141 | |
| 142 | // Load the game data in a separate thread |
| 143 | _thread = SDL_CreateThread(load, (void*)_game); |
| 144 | if (_thread == 0) |
| 145 | { |
| 146 | // If we can't create the thread, just load it as usual |
| 147 | load((void*)_game); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * If the loading fails, it shows an error, otherwise moves on to the game. |
no test coverage detected