From 1422f6a17a50e78f2debb6d3ccdeda033356f606 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sat, 9 Dec 2006 10:56:12 +0000 Subject: (svn r7449) -Codechange: Rename _path to _paths as it is technically more correct, but mainly because it interferes with OS/2 symbol in libc (psmedley) --- console_cmds.c | 2 +- fileio.c | 10 +++++----- fios.c | 6 +++--- gfxinit.c | 4 ++-- misc_gui.c | 8 ++++---- music_gui.c | 4 ++-- network_client.c | 2 +- network_server.c | 2 +- newgrf_config.c | 6 +++--- openttd.c | 8 ++++---- os2.c | 58 ++++++++++++++++++++++++++++---------------------------- saveload.c | 2 +- screenshot.c | 2 +- strings.c | 6 +++--- unix.c | 58 ++++++++++++++++++++++++++++---------------------------- variables.h | 2 +- win32.c | 30 ++++++++++++++--------------- 17 files changed, 105 insertions(+), 105 deletions(-) diff --git a/console_cmds.c b/console_cmds.c index ad0efb817..addc9a799 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -187,7 +187,7 @@ DEF_CONSOLE_CMD(ConSave) if (argc == 2) { char buf[200]; - snprintf(buf, lengthof(buf), "%s%s%s.sav", _path.save_dir, PATHSEP, argv[1]); + snprintf(buf, lengthof(buf), "%s%s%s.sav", _paths.save_dir, PATHSEP, argv[1]); IConsolePrint(_icolour_def, "Saving map..."); if (SaveOrLoad(buf, SL_SAVE) != SL_OK) { diff --git a/fileio.c b/fileio.c index 2bd01f16d..2a09916ea 100644 --- a/fileio.c +++ b/fileio.c @@ -117,19 +117,19 @@ FILE *FioFOpenFile(const char *filename) FILE *f; char buf[MAX_PATH]; - snprintf(buf, lengthof(buf), "%s%s", _path.data_dir, filename); + snprintf(buf, lengthof(buf), "%s%s", _paths.data_dir, filename); f = fopen(buf, "rb"); #if !defined(WIN32) if (f == NULL) { - strtolower(buf + strlen(_path.data_dir) - 1); + strtolower(buf + strlen(_paths.data_dir) - 1); f = fopen(buf, "rb"); #if defined SECOND_DATA_DIR // tries in the 2nd data directory if (f == NULL) { - snprintf(buf, lengthof(buf), "%s%s", _path.second_data_dir, filename); - strtolower(buf + strlen(_path.second_data_dir) - 1); + snprintf(buf, lengthof(buf), "%s%s", _paths.second_data_dir, filename); + strtolower(buf + strlen(_paths.second_data_dir) - 1); f = fopen(buf, "rb"); } #endif @@ -143,7 +143,7 @@ void FioOpenFile(int slot, const char *filename) { FILE *f = FioFOpenFile(filename); - if (f == NULL) error("Cannot open file '%s%s'", _path.data_dir, filename); + if (f == NULL) error("Cannot open file '%s%s'", _paths.data_dir, filename); FioCloseFile(slot); // if file was opened before, close it _fio.handles[slot] = f; diff --git a/fios.c b/fios.c index e7e7d0eba..950e26a23 100644 --- a/fios.c +++ b/fios.c @@ -324,7 +324,7 @@ FiosItem *FiosGetSavegameList(int mode) if (_fios_save_path == NULL) { _fios_save_path = malloc(MAX_PATH); - ttd_strlcpy(_fios_save_path, _path.save_dir, MAX_PATH); + ttd_strlcpy(_fios_save_path, _paths.save_dir, MAX_PATH); } _fios_path = _fios_save_path; @@ -372,7 +372,7 @@ FiosItem *FiosGetScenarioList(int mode) if (_fios_scn_path == NULL) { _fios_scn_path = malloc(MAX_PATH); - ttd_strlcpy(_fios_scn_path, _path.scenario_dir, MAX_PATH); + ttd_strlcpy(_fios_scn_path, _paths.scenario_dir, MAX_PATH); } _fios_path = _fios_scn_path; @@ -403,7 +403,7 @@ FiosItem *FiosGetHeightmapList(int mode) if (_fios_hmap_path == NULL) { _fios_hmap_path = malloc(MAX_PATH); - strcpy(_fios_hmap_path, _path.heightmap_dir); + strcpy(_fios_hmap_path, _paths.heightmap_dir); } _fios_path = _fios_hmap_path; diff --git a/gfxinit.c b/gfxinit.c index 24d2027f0..1ac0a30d6 100644 --- a/gfxinit.c +++ b/gfxinit.c @@ -111,12 +111,12 @@ static bool FileMD5(const MD5File file, bool warn) char buf[MAX_PATH]; // open file - snprintf(buf, lengthof(buf), "%s%s", _path.data_dir, file.filename); + snprintf(buf, lengthof(buf), "%s%s", _paths.data_dir, file.filename); f = fopen(buf, "rb"); #if !defined(WIN32) if (f == NULL) { - strtolower(buf + strlen(_path.data_dir) - 1); + strtolower(buf + strlen(_paths.data_dir) - 1); f = fopen(buf, "rb"); } #endif diff --git a/misc_gui.c b/misc_gui.c index 82a6bf944..66ef62ebf 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -1346,20 +1346,20 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) switch (_saveload_mode) { case SLD_SAVE_GAME: case SLD_LOAD_GAME: - ttd_strlcpy(&o_dir.name[0], _path.save_dir, sizeof(o_dir.name)); + ttd_strlcpy(&o_dir.name[0], _paths.save_dir, sizeof(o_dir.name)); break; case SLD_SAVE_SCENARIO: case SLD_LOAD_SCENARIO: - ttd_strlcpy(&o_dir.name[0], _path.scenario_dir, sizeof(o_dir.name)); + ttd_strlcpy(&o_dir.name[0], _paths.scenario_dir, sizeof(o_dir.name)); break; case SLD_LOAD_HEIGHTMAP: - ttd_strlcpy(&o_dir.name[0], _path.heightmap_dir, sizeof(o_dir.name)); + ttd_strlcpy(&o_dir.name[0], _paths.heightmap_dir, sizeof(o_dir.name)); break; default: - ttd_strlcpy(&o_dir.name[0], _path.personal_dir, sizeof(o_dir.name)); + ttd_strlcpy(&o_dir.name[0], _paths.personal_dir, sizeof(o_dir.name)); } break; } diff --git a/music_gui.c b/music_gui.c index e3fa0dcc8..84a6324c2 100644 --- a/music_gui.c +++ b/music_gui.c @@ -90,7 +90,7 @@ static void DoPlaySong(void) { char filename[256]; snprintf(filename, sizeof(filename), "%s%s", - _path.gm_dir, origin_songs_specs[_music_wnd_cursong - 1].filename); + _paths.gm_dir, origin_songs_specs[_music_wnd_cursong - 1].filename); _music_driver->play_song(filename); } @@ -109,7 +109,7 @@ static void SelectSongToPlay(void) do { if (_playlists[msf.playlist][i] != 0) { // Don't evaluate playlist terminator snprintf(filename, sizeof(filename), "%s%s", - _path.gm_dir, origin_songs_specs[(_playlists[msf.playlist][i]) - 1].filename); + _paths.gm_dir, origin_songs_specs[(_playlists[msf.playlist][i]) - 1].filename); /* we are now checking for the existence of that file prior * to add it to the list of available songs */ diff --git a/network_client.c b/network_client.c index 881dc1cbc..c0eb71751 100644 --- a/network_client.c +++ b/network_client.c @@ -457,7 +457,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP) // First packet, init some stuff if (maptype == MAP_PACKET_START) { // The name for the temp-map - snprintf(filename, lengthof(filename), "%s%snetwork_client.tmp", _path.autosave_dir, PATHSEP); + snprintf(filename, lengthof(filename), "%s%snetwork_client.tmp", _paths.autosave_dir, PATHSEP); file_pointer = fopen(filename, "wb"); if (file_pointer == NULL) { diff --git a/network_server.c b/network_server.c index 32050672e..3b2861f91 100644 --- a/network_server.c +++ b/network_server.c @@ -281,7 +281,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP) Packet *p; // Make a dump of the current game - snprintf(filename, lengthof(filename), "%s%snetwork_server.tmp", _path.autosave_dir, PATHSEP); + snprintf(filename, lengthof(filename), "%s%snetwork_server.tmp", _paths.autosave_dir, PATHSEP); if (SaveOrLoad(filename, SL_SAVE) != SL_OK) error("network savedump failed"); file_pointer = fopen(filename, "rb"); diff --git a/newgrf_config.c b/newgrf_config.c index db8440c0a..aecdf4055 100644 --- a/newgrf_config.c +++ b/newgrf_config.c @@ -39,7 +39,7 @@ static bool CalcGRFMD5Sum(GRFConfig *config) size_t len; /* open the file */ - snprintf(filename, lengthof(filename), "%s%s", _path.data_dir, config->filename); + snprintf(filename, lengthof(filename), "%s%s", _paths.data_dir, config->filename); f = fopen(filename, "rb"); if (f == NULL) return false; @@ -176,7 +176,7 @@ static uint ScanPath(const char *path) } else if (sb.st_mode & S_IFREG) { /* File */ char *ext = strrchr(filename, '.'); - char *file = filename + strlen(_path.data_dir) + 1; // Crop base path + char *file = filename + strlen(_paths.data_dir) + 1; // Crop base path /* If no extension or extension isn't .grf, skip the file */ if (ext == NULL) continue; @@ -226,7 +226,7 @@ void ScanNewGRFFiles(void) _all_grfs = NULL; DEBUG(grf, 1) ("[GRF] Scanning for NewGRFs"); - num = ScanPath(_path.data_dir); + num = ScanPath(_paths.data_dir); DEBUG(grf, 1) ("[GRF] Scan complete, found %d files", num); } diff --git a/openttd.c b/openttd.c index 01e0fd8c6..fa14a0f9a 100644 --- a/openttd.c +++ b/openttd.c @@ -289,10 +289,10 @@ static void LoadIntroGame(void) SetupColorsAndInitialWindow(); // Generate a world. - snprintf(filename, lengthof(filename), "%sopntitle.dat", _path.data_dir); + snprintf(filename, lengthof(filename), "%sopntitle.dat", _paths.data_dir); #if defined SECOND_DATA_DIR if (SaveOrLoad(filename, SL_LOAD) != SL_OK) { - snprintf(filename, lengthof(filename), "%sopntitle.dat", _path.second_data_dir); + snprintf(filename, lengthof(filename), "%sopntitle.dat", _paths.second_data_dir); } #endif if (SaveOrLoad(filename, SL_LOAD) != SL_OK) { @@ -890,7 +890,7 @@ static void DoAutosave(void) const Player *p = GetPlayer(_local_player); char* s = buf; - s += snprintf(buf, lengthof(buf), "%s%s", _path.autosave_dir, PATHSEP); + s += snprintf(buf, lengthof(buf), "%s%s", _paths.autosave_dir, PATHSEP); SetDParam(0, p->name_1); SetDParam(1, p->name_2); @@ -898,7 +898,7 @@ static void DoAutosave(void) s = GetString(s, STR_4004, lastof(buf)); strecpy(s, ".sav", lastof(buf)); } else { /* generate a savegame name and number according to _patches.max_num_autosaves */ - snprintf(buf, lengthof(buf), "%s%sautosave%d.sav", _path.autosave_dir, PATHSEP, _autosave_ctr); + snprintf(buf, lengthof(buf), "%s%sautosave%d.sav", _paths.autosave_dir, PATHSEP, _autosave_ctr); _autosave_ctr++; if (_autosave_ctr >= _patches.max_num_autosaves) { diff --git a/os2.c b/os2.c index df97c4533..e01d7c0d2 100644 --- a/os2.c +++ b/os2.c @@ -134,11 +134,11 @@ void DeterminePaths(void) { char *s; - _path.game_data_dir = malloc(MAX_PATH); - ttd_strlcpy(_path.game_data_dir, GAME_DATA_DIR, MAX_PATH); + _paths.game_data_dir = malloc(MAX_PATH); + ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH); #if defined SECOND_DATA_DIR - _path.second_data_dir = malloc(MAX_PATH); - ttd_strlcpy(_path.second_data_dir, SECOND_DATA_DIR, MAX_PATH); + _paths.second_data_dir = malloc(MAX_PATH); + ttd_strlcpy(_paths.second_data_dir, SECOND_DATA_DIR, MAX_PATH); #endif #if defined(USE_HOMEDIR) @@ -150,59 +150,59 @@ void DeterminePaths(void) if (pw != NULL) homedir = pw->pw_dir; } - _path.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR); + _paths.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR); } #else /* not defined(USE_HOMEDIR) */ - _path.personal_dir = malloc(MAX_PATH); - ttd_strlcpy(_path.personal_dir, PERSONAL_DIR, MAX_PATH); + _paths.personal_dir = malloc(MAX_PATH); + ttd_strlcpy(_paths.personal_dir, PERSONAL_DIR, MAX_PATH); // check if absolute or relative path - s = strchr(_path.personal_dir, '\\'); + s = strchr(_paths.personal_dir, '\\'); // add absolute path - if (s == NULL || _path.personal_dir != s) { - getcwd(_path.personal_dir, MAX_PATH); - s = strchr(_path.personal_dir, 0); + if (s == NULL || _paths.personal_dir != s) { + getcwd(_paths.personal_dir, MAX_PATH); + s = strchr(_paths.personal_dir, 0); *s++ = '\\'; ttd_strlcpy(s, PERSONAL_DIR, MAX_PATH); } #endif /* defined(USE_HOMEDIR) */ - s = strchr(_path.personal_dir, 0); + s = strchr(_paths.personal_dir, 0); // append a / ? if (s[-1] != '\\') strcpy(s, "\\"); - _path.save_dir = str_fmt("%ssave", _path.personal_dir); - _path.autosave_dir = str_fmt("%s\\autosave", _path.save_dir); - _path.scenario_dir = str_fmt("%sscenario", _path.personal_dir); - _path.heightmap_dir = str_fmt("%sscenario\\heightmap", _path.personal_dir); - _path.gm_dir = str_fmt("%sgm\\", _path.game_data_dir); - _path.data_dir = str_fmt("%sdata\\", _path.game_data_dir); + _paths.save_dir = str_fmt("%ssave", _paths.personal_dir); + _paths.autosave_dir = str_fmt("%s\\autosave", _paths.save_dir); + _paths.scenario_dir = str_fmt("%sscenario", _paths.personal_dir); + _paths.heightmap_dir = str_fmt("%sscenario\\heightmap", _paths.personal_dir); + _paths.gm_dir = str_fmt("%sgm\\", _paths.game_data_dir); + _paths.data_dir = str_fmt("%sdata\\", _paths.game_data_dir); if (_config_file == NULL) - _config_file = str_fmt("%sopenttd.cfg", _path.personal_dir); + _config_file = str_fmt("%sopenttd.cfg", _paths.personal_dir); - _highscore_file = str_fmt("%shs.dat", _path.personal_dir); - _log_file = str_fmt("%sopenttd.log", _path.personal_dir); + _highscore_file = str_fmt("%shs.dat", _paths.personal_dir); + _log_file = str_fmt("%sopenttd.log", _paths.personal_dir); #if defined CUSTOM_LANG_DIR // sets the search path for lng files to the custom one - _path.lang_dir = malloc( MAX_PATH ); - ttd_strlcpy( _path.lang_dir, CUSTOM_LANG_DIR, MAX_PATH); + _paths.lang_dir = malloc( MAX_PATH ); + ttd_strlcpy( _paths.lang_dir, CUSTOM_LANG_DIR, MAX_PATH); #else - _path.lang_dir = str_fmt("%slang\\", _path.game_data_dir); + _paths.lang_dir = str_fmt("%slang\\", _paths.game_data_dir); #endif // create necessary folders - mkdir(_path.personal_dir); - mkdir(_path.save_dir); - mkdir(_path.autosave_dir); - mkdir(_path.scenario_dir); - mkdir(_path.heightmap_dir); + mkdir(_paths.personal_dir); + mkdir(_paths.save_dir); + mkdir(_paths.autosave_dir); + mkdir(_paths.scenario_dir); + mkdir(_paths.heightmap_dir); } /** diff --git a/saveload.c b/saveload.c index 0c51c81a5..7dc41ab5a 100644 --- a/saveload.c +++ b/saveload.c @@ -1649,7 +1649,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode) void DoExitSave(void) { char buf[200]; - snprintf(buf, sizeof(buf), "%s%sexit.sav", _path.autosave_dir, PATHSEP); + snprintf(buf, sizeof(buf), "%s%sexit.sav", _paths.autosave_dir, PATHSEP); SaveOrLoad(buf, SL_SAVE); } diff --git a/screenshot.c b/screenshot.c index d205f20a9..ac5109ced 100644 --- a/screenshot.c +++ b/screenshot.c @@ -512,7 +512,7 @@ static char *MakeScreenshotName(const char *ext) serial = 0; for (;;) { - snprintf(filename, sizeof(filename), "%s%s", _path.personal_dir, _screenshot_name); + snprintf(filename, sizeof(filename), "%s%s", _paths.personal_dir, _screenshot_name); if (!FileExists(filename)) break; sprintf(base, " #%d.%s", ++serial, ext); diff --git a/strings.c b/strings.c index eb859f600..7a6134361 100644 --- a/strings.c +++ b/strings.c @@ -1138,7 +1138,7 @@ bool ReadLanguagePack(int lang_index) char *s; { - char *lang = str_fmt("%s%s", _path.lang_dir, _dynlang.ent[lang_index].file); + char *lang = str_fmt("%s%s", _paths.lang_dir, _dynlang.ent[lang_index].file); lang_pack = ReadFileToMem(lang, &len, 200000); free(lang); } @@ -1225,7 +1225,7 @@ static int GetLanguageList(char **languages, int max) struct dirent *dirent; int num = 0; - dir = opendir(_path.lang_dir); + dir = opendir(_paths.lang_dir); if (dir != NULL) { while ((dirent = readdir(dir)) != NULL) { const char *d_name = FS2OTTD(dirent->d_name); @@ -1271,7 +1271,7 @@ void InitializeLanguagePacks(void) for (i = m = 0; i != n; i++) { size_t j; - char *s = str_fmt("%s%s", _path.lang_dir, files[i]); + char *s = str_fmt("%s%s", _paths.lang_dir, files[i]); in = fopen(s, "rb"); free(s); if (in == NULL || diff --git a/unix.c b/unix.c index a5fc71c10..c40cbafe2 100644 --- a/unix.c +++ b/unix.c @@ -169,11 +169,11 @@ void DeterminePaths(void) { char *s; - _path.game_data_dir = malloc(MAX_PATH); - ttd_strlcpy(_path.game_data_dir, GAME_DATA_DIR, MAX_PATH); + _paths.game_data_dir = malloc(MAX_PATH); + ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH); #if defined SECOND_DATA_DIR - _path.second_data_dir = malloc(MAX_PATH); - ttd_strlcpy(_path.second_data_dir, SECOND_DATA_DIR, MAX_PATH); + _paths.second_data_dir = malloc(MAX_PATH); + ttd_strlcpy(_paths.second_data_dir, SECOND_DATA_DIR, MAX_PATH); #endif #if defined(USE_HOMEDIR) @@ -185,59 +185,59 @@ void DeterminePaths(void) if (pw != NULL) homedir = pw->pw_dir; } - _path.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR); + _paths.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR); } #else /* not defined(USE_HOMEDIR) */ - _path.personal_dir = malloc(MAX_PATH); - ttd_strlcpy(_path.personal_dir, PERSONAL_DIR, MAX_PATH); + _paths.personal_dir = malloc(MAX_PATH); + ttd_strlcpy(_paths.personal_dir, PERSONAL_DIR, MAX_PATH); // check if absolute or relative path - s = strchr(_path.personal_dir, '/'); + s = strchr(_paths.personal_dir, '/'); // add absolute path - if (s == NULL || _path.personal_dir != s) { - getcwd(_path.personal_dir, MAX_PATH); - s = strchr(_path.personal_dir, 0); + if (s == NULL || _paths.personal_dir != s) { + getcwd(_paths.personal_dir, MAX_PATH); + s = strchr(_paths.personal_dir, 0); *s++ = '/'; ttd_strlcpy(s, PERSONAL_DIR, MAX_PATH); } #endif /* defined(USE_HOMEDIR) */ - s = strchr(_path.personal_dir, 0); + s = strchr(_paths.personal_dir, 0); // append a / ? if (s[-1] != '/') strcpy(s, "/"); - _path.save_dir = str_fmt("%ssave", _path.personal_dir); - _path.autosave_dir = str_fmt("%s/autosave", _path.save_dir); - _path.scenario_dir = str_fmt("%sscenario", _path.personal_dir); - _path.heightmap_dir = str_fmt("%sscenario/heightmap", _path.personal_dir); - _path.gm_dir = str_fmt("%sgm/", _path.game_data_dir); - _path.data_dir = str_fmt("%sdata/", _path.game_data_dir); + _paths.save_dir = str_fmt("%ssave", _paths.personal_dir); + _paths.autosave_dir = str_fmt("%s/autosave", _paths.save_dir); + _paths.scenario_dir = str_fmt("%sscenario", _paths.personal_dir); + _paths.heightmap_dir = str_fmt("%sscenario/heightmap", _paths.personal_dir); + _paths.gm_dir = str_fmt("%sgm/", _paths.game_data_dir); + _paths.data_dir = str_fmt("%sdata/", _paths.game_data_dir); if (_config_file == NULL) - _config_file = str_fmt("%sopenttd.cfg", _path.personal_dir); + _config_file = str_fmt("%sopenttd.cfg", _paths.personal_dir); - _highscore_file = str_fmt("%shs.dat", _path.personal_dir); - _log_file = str_fmt("%sopenttd.log", _path.personal_dir); + _highscore_file = str_fmt("%shs.dat", _paths.personal_dir); + _log_file = str_fmt("%sopenttd.log", _paths.personal_dir); #if defined CUSTOM_LANG_DIR // sets the search path for lng files to the custom one - _path.lang_dir = malloc( MAX_PATH ); - ttd_strlcpy( _path.lang_dir, CUSTOM_LANG_DIR, MAX_PATH); + _paths.lang_dir = malloc( MAX_PATH ); + ttd_strlcpy( _paths.lang_dir, CUSTOM_LANG_DIR, MAX_PATH); #else - _path.lang_dir = str_fmt("%slang/", _path.game_data_dir); + _paths.lang_dir = str_fmt("%slang/", _paths.game_data_dir); #endif // create necessary folders - mkdir(_path.personal_dir, 0755); - mkdir(_path.save_dir, 0755); - mkdir(_path.autosave_dir, 0755); - mkdir(_path.scenario_dir, 0755); - mkdir(_path.heightmap_dir, 0755); + mkdir(_paths.personal_dir, 0755); + mkdir(_paths.save_dir, 0755); + mkdir(_paths.autosave_dir, 0755); + mkdir(_paths.scenario_dir, 0755); + mkdir(_paths.heightmap_dir, 0755); } bool InsertTextBufferClipboard(Textbuf *tb) diff --git a/variables.h b/variables.h index 22f9cbcb2..02f9e8913 100644 --- a/variables.h +++ b/variables.h @@ -262,7 +262,7 @@ typedef struct Paths { char *second_data_dir; } Paths; -VARDEF Paths _path; +VARDEF Paths _paths; // NOSAVE: Used in palette animations only, not really important. VARDEF int _timer_counter; diff --git a/win32.c b/win32.c index 6ca040cbd..2f2c1fbdc 100644 --- a/win32.c +++ b/win32.c @@ -911,7 +911,7 @@ void DeterminePaths(void) char *s, *cfg; wchar_t path[MAX_PATH]; - _path.personal_dir = _path.game_data_dir = cfg = malloc(MAX_PATH); + _paths.personal_dir = _paths.game_data_dir = cfg = malloc(MAX_PATH); GetCurrentDirectoryW(MAX_PATH - 1, path); convert_from_fs(path, cfg, MAX_PATH); @@ -919,25 +919,25 @@ void DeterminePaths(void) s = strchr(cfg, '\0'); if (s[-1] != '\\') strcpy(s, "\\"); - _path.save_dir = str_fmt("%ssave", cfg); - _path.autosave_dir = str_fmt("%s\\autosave", _path.save_dir); - _path.scenario_dir = str_fmt("%sscenario", cfg); - _path.heightmap_dir = str_fmt("%sscenario\\heightmap", cfg); - _path.gm_dir = str_fmt("%sgm\\", cfg); - _path.data_dir = str_fmt("%sdata\\", cfg); - _path.lang_dir = str_fmt("%slang\\", cfg); + _paths.save_dir = str_fmt("%ssave", cfg); + _paths.autosave_dir = str_fmt("%s\\autosave", _paths.save_dir); + _paths.scenario_dir = str_fmt("%sscenario", cfg); + _paths.heightmap_dir = str_fmt("%sscenario\\heightmap", cfg); + _paths.gm_dir = str_fmt("%sgm\\", cfg); + _paths.data_dir = str_fmt("%sdata\\", cfg); + _paths.lang_dir = str_fmt("%slang\\", cfg); if (_config_file == NULL) - _config_file = str_fmt("%sopenttd.cfg", _path.personal_dir); + _config_file = str_fmt("%sopenttd.cfg", _paths.personal_dir); - _highscore_file = str_fmt("%shs.dat", _path.personal_dir); - _log_file = str_fmt("%sopenttd.log", _path.personal_dir); + _highscore_file = str_fmt("%shs.dat", _paths.personal_dir); + _log_file = str_fmt("%sopenttd.log", _paths.personal_dir); // make (auto)save and scenario folder - CreateDirectoryW(OTTD2FS(_path.save_dir), NULL); - CreateDirectoryW(OTTD2FS(_path.autosave_dir), NULL); - CreateDirectoryW(OTTD2FS(_path.scenario_dir), NULL); - CreateDirectoryW(OTTD2FS(_path.heightmap_dir), NULL); + CreateDirectoryW(OTTD2FS(_paths.save_dir), NULL); + CreateDirectoryW(OTTD2FS(_paths.autosave_dir), NULL); + CreateDirectoryW(OTTD2FS(_paths.scenario_dir), NULL); + CreateDirectoryW(OTTD2FS(_paths.heightmap_dir), NULL); } /** -- cgit v1.2.3-70-g09d2