equal
deleted
inserted
replaced
12 #include "functions.h" |
12 #include "functions.h" |
13 #include "heightmap.h" |
13 #include "heightmap.h" |
14 #include "helpers.hpp" |
14 #include "helpers.hpp" |
15 #include "table/strings.h" |
15 #include "table/strings.h" |
16 #include "fios.h" |
16 #include "fios.h" |
|
17 #include "fileio.h" |
17 #include <sys/types.h> |
18 #include <sys/types.h> |
18 #include <sys/stat.h> |
19 #include <sys/stat.h> |
19 |
20 |
20 #ifdef WIN32 |
21 #ifdef WIN32 |
21 # include <tchar.h> |
22 # include <tchar.h> |
332 { |
333 { |
333 static char *_fios_save_path = NULL; |
334 static char *_fios_save_path = NULL; |
334 |
335 |
335 if (_fios_save_path == NULL) { |
336 if (_fios_save_path == NULL) { |
336 _fios_save_path = MallocT<char>(MAX_PATH); |
337 _fios_save_path = MallocT<char>(MAX_PATH); |
337 ttd_strlcpy(_fios_save_path, _paths.save_dir, MAX_PATH); |
338 FioGetDirectory(_fios_save_path, MAX_PATH, SAVE_DIR); |
338 } |
339 } |
339 |
340 |
340 _fios_path = _fios_save_path; |
341 _fios_path = _fios_save_path; |
341 |
342 |
342 return FiosGetFileList(mode, &FiosGetSavegameListCallback); |
343 return FiosGetFileList(mode, &FiosGetSavegameListCallback); |
378 */ |
379 */ |
379 FiosItem *FiosGetScenarioList(int mode) |
380 FiosItem *FiosGetScenarioList(int mode) |
380 { |
381 { |
381 static char *_fios_scn_path = NULL; |
382 static char *_fios_scn_path = NULL; |
382 |
383 |
|
384 /* Copy the default path on first run or on 'New Game' */ |
383 if (_fios_scn_path == NULL) { |
385 if (_fios_scn_path == NULL) { |
384 _fios_scn_path = MallocT<char>(MAX_PATH); |
386 _fios_scn_path = MallocT<char>(MAX_PATH); |
385 ttd_strlcpy(_fios_scn_path, _paths.scenario_dir, MAX_PATH); |
387 FioGetDirectory(_fios_scn_path, MAX_PATH, SCENARIO_DIR); |
386 } |
388 } |
387 |
389 |
388 _fios_path = _fios_scn_path; |
390 _fios_path = _fios_scn_path; |
389 |
391 |
390 return FiosGetFileList(mode, &FiosGetScenarioListCallback); |
392 return FiosGetFileList(mode, &FiosGetScenarioListCallback); |
411 { |
413 { |
412 static char *_fios_hmap_path = NULL; |
414 static char *_fios_hmap_path = NULL; |
413 |
415 |
414 if (_fios_hmap_path == NULL) { |
416 if (_fios_hmap_path == NULL) { |
415 _fios_hmap_path = MallocT<char>(MAX_PATH); |
417 _fios_hmap_path = MallocT<char>(MAX_PATH); |
416 strcpy(_fios_hmap_path, _paths.heightmap_dir); |
418 FioGetDirectory(_fios_hmap_path, MAX_PATH, HEIGHTMAP_DIR); |
417 } |
419 } |
418 |
420 |
419 _fios_path = _fios_hmap_path; |
421 _fios_path = _fios_hmap_path; |
420 |
422 |
421 return FiosGetFileList(mode, &FiosGetHeightmapListCallback); |
423 return FiosGetFileList(mode, &FiosGetHeightmapListCallback); |