summaryrefslogtreecommitdiff
path: root/fios.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-08-07 09:32:29 +0000
committerDarkvater <darkvater@openttd.org>2006-08-07 09:32:29 +0000
commita54702c43b5f7e8559c55698e75d4bf8a0938447 (patch)
treefdc1fd34c27fecbc259b6920a35aa727f2c5f0e7 /fios.c
parent864ddeca84a2df9af61f67555c0ba76e4162d2cc (diff)
downloadopenttd-a54702c43b5f7e8559c55698e75d4bf8a0938447.tar.xz
(svn r5800) - Fix: When directories were changed in 'Play Scenario', pressing 'New Game' showed scenarios from that directory, not the default one. Bug has been present for a pretty long time, weird nobody noticed this.
Diffstat (limited to 'fios.c')
-rw-r--r--fios.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fios.c b/fios.c
index 1b1c1af2a..e21192960 100644
--- a/fios.c
+++ b/fios.c
@@ -357,14 +357,15 @@ static byte FiosGetScenarioListCallback(int mode, const char *file, const char *
*/
FiosItem *FiosGetScenarioList(int mode)
{
- static char *_fios_scn_path = NULL;
+ static char *fios_scn_path = NULL;
- if (_fios_scn_path == NULL) {
- _fios_scn_path = malloc(MAX_PATH);
- ttd_strlcpy(_fios_scn_path, _path.scenario_dir, MAX_PATH);
+ /* Copy the default path on first run or on 'New Game' */
+ if (mode == SLD_NEW_GAME || fios_scn_path == NULL) {
+ if (fios_scn_path == NULL) fios_scn_path = malloc(MAX_PATH);
+ ttd_strlcpy(fios_scn_path, _path.scenario_dir, MAX_PATH);
}
- _fios_path = _fios_scn_path;
+ _fios_path = fios_scn_path;
return FiosGetFileList(mode, &FiosGetScenarioListCallback);
}