--- a/os2.c Sat Aug 12 12:01:20 2006 +0000
+++ b/os2.c Sat Aug 12 12:11:54 2006 +0000
@@ -210,9 +210,10 @@
int sort_start;
char filename[MAX_PATH];
- if (_fios_scn_path == NULL) {
- _fios_scn_path = malloc(MAX_PATH);
- strcpy(_fios_scn_path, _path.scenario_dir);
+ /* 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;
--- a/unix.c Sat Aug 12 12:01:20 2006 +0000
+++ b/unix.c Sat Aug 12 12:11:54 2006 +0000
@@ -208,9 +208,10 @@
int sort_start;
char filename[MAX_PATH];
- if (_fios_scn_path == NULL) {
- _fios_scn_path = malloc(MAX_PATH);
- strcpy(_fios_scn_path, _path.scenario_dir);
+ /* 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;
--- a/win32.c Sat Aug 12 12:01:20 2006 +0000
+++ b/win32.c Sat Aug 12 12:11:54 2006 +0000
@@ -779,9 +779,10 @@
HANDLE h;
int sort_start;
- if (_fios_scn_path == NULL) {
- _fios_scn_path = malloc(MAX_PATH);
- strcpy(_fios_scn_path, _path.scenario_dir);
+ /* 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;