Codechange: Stringify config file paths.

This commit is contained in:
Michael Lutz
2020-12-06 21:11:42 +01:00
parent 860c270c73
commit dd138fc460
16 changed files with 56 additions and 64 deletions

View File

@@ -88,7 +88,7 @@ bool HandleBootstrap();
extern Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY);
extern void ShowOSErrorBox(const char *buf, bool system);
extern char *_config_file;
extern std::string _config_file;
bool _save_config = false;
@@ -316,8 +316,6 @@ static void ShutdownGame()
/* Uninitialize variables that are allocated dynamically */
GamelogReset();
free(_config_file);
LinkGraphSchedule::Clear();
PoolBase::Clean(PT_ALL);
@@ -566,7 +564,6 @@ int openttd_main(int argc, char *argv[])
_game_mode = GM_MENU;
_switch_mode = SM_MENU;
_config_file = nullptr;
GetOptData mgo(argc - 1, argv + 1, _options);
int ret = 0;
@@ -672,7 +669,7 @@ int openttd_main(int argc, char *argv[])
return ret;
}
case 'G': scanner->generation_seed = strtoul(mgo.opt, nullptr, 10); break;
case 'c': free(_config_file); _config_file = stredup(mgo.opt); break;
case 'c': _config_file = mgo.opt; break;
case 'x': scanner->save_config = false; break;
case 'h':
i = -2; // Force printing of help.