From 4e0240732dfdb29f1f77207f8c98447bedbe701f Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Fri, 1 Jun 2018 23:08:57 +0300 Subject: [PATCH] Filthy hack: after the app update, restore config file from the backup created by Java code --- src/openttd.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openttd.cpp b/src/openttd.cpp index 78d115e754..a30e47dfcd 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -499,7 +499,11 @@ struct AfterNewGRFScan : NewGRFScanCallback { if (!checked && _settings_newgame.vehicle.max_trains == 0 && _settings_newgame.vehicle.max_roadveh == 0 && _settings_newgame.vehicle.max_aircraft == 0 && _settings_newgame.vehicle.max_ships == 0) { - unlink("libsdl-DownloadFinished-1.flag"); + if (access(".openttd/openttd-backup.cfg", F_OK) == 0) { + system("mv -f .openttd/openttd-backup.cfg .openttd/openttd.cfg"); + } else { + unlink("libsdl-DownloadFinished-1.flag"); + } //_exit_game = true; //_restart_game = true; _exit(0); // kill(getpid(), SIG_KILL); //abort(); // Kill myself with contempt, user will restart the app, because otherwise we enter infinite restart loop