* Write the (crash) savegame to a file. * @note The filename will be written to \c savegame_filename. * @return true when the crash save was successfully made. */
| 221 | * @return true when the crash save was successfully made. |
| 222 | */ |
| 223 | bool CrashLog::WriteSavegame() |
| 224 | { |
| 225 | /* If the map doesn't exist, saving will fail too. If the map got |
| 226 | * initialised, there is a big chance the rest is initialised too. */ |
| 227 | if (!Map::IsInitialized()) return false; |
| 228 | |
| 229 | try { |
| 230 | _gamelog.Emergency(); |
| 231 | |
| 232 | this->savegame_filename = this->CreateFileName(".sav"); |
| 233 | |
| 234 | /* Don't do a threaded saveload. */ |
| 235 | return SaveOrLoad(this->savegame_filename, SLO_SAVE, DFT_GAME_FILE, NO_DIRECTORY, false) == SL_OK; |
| 236 | } catch (...) { |
| 237 | return false; |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Write the (crash) screenshot to a file. |
no test coverage detected