equal
deleted
inserted
replaced
9 #include "hal.h" |
9 #include "hal.h" |
10 #include "string.h" |
10 #include "string.h" |
11 #include "variables.h" |
11 #include "variables.h" |
12 #include "functions.h" |
12 #include "functions.h" |
13 #include "heightmap.h" |
13 #include "heightmap.h" |
|
14 #include "helpers.hpp" |
14 #include "table/strings.h" |
15 #include "table/strings.h" |
15 #include "fios.h" |
16 #include "fios.h" |
16 #include <sys/types.h> |
17 #include <sys/types.h> |
17 #include <sys/stat.h> |
18 #include <sys/stat.h> |
18 |
19 |
45 */ |
46 */ |
46 FiosItem *FiosAlloc(void) |
47 FiosItem *FiosAlloc(void) |
47 { |
48 { |
48 if (_fios_count == _fios_alloc) { |
49 if (_fios_count == _fios_alloc) { |
49 _fios_alloc += 256; |
50 _fios_alloc += 256; |
50 _fios_items = realloc(_fios_items, _fios_alloc * sizeof(FiosItem)); |
51 ReallocT(&_fios_items, _fios_alloc); |
51 } |
52 } |
52 return &_fios_items[_fios_count++]; |
53 return &_fios_items[_fios_count++]; |
53 } |
54 } |
54 |
55 |
55 /** |
56 /** |
321 FiosItem *FiosGetSavegameList(int mode) |
322 FiosItem *FiosGetSavegameList(int mode) |
322 { |
323 { |
323 static char *_fios_save_path = NULL; |
324 static char *_fios_save_path = NULL; |
324 |
325 |
325 if (_fios_save_path == NULL) { |
326 if (_fios_save_path == NULL) { |
326 _fios_save_path = malloc(MAX_PATH); |
327 MallocT(&_fios_save_path, MAX_PATH); |
327 ttd_strlcpy(_fios_save_path, _paths.save_dir, MAX_PATH); |
328 ttd_strlcpy(_fios_save_path, _paths.save_dir, MAX_PATH); |
328 } |
329 } |
329 |
330 |
330 _fios_path = _fios_save_path; |
331 _fios_path = _fios_save_path; |
331 |
332 |
369 FiosItem *FiosGetScenarioList(int mode) |
370 FiosItem *FiosGetScenarioList(int mode) |
370 { |
371 { |
371 static char *_fios_scn_path = NULL; |
372 static char *_fios_scn_path = NULL; |
372 |
373 |
373 if (_fios_scn_path == NULL) { |
374 if (_fios_scn_path == NULL) { |
374 _fios_scn_path = malloc(MAX_PATH); |
375 MallocT(&_fios_scn_path, MAX_PATH); |
375 ttd_strlcpy(_fios_scn_path, _paths.scenario_dir, MAX_PATH); |
376 ttd_strlcpy(_fios_scn_path, _paths.scenario_dir, MAX_PATH); |
376 } |
377 } |
377 |
378 |
378 _fios_path = _fios_scn_path; |
379 _fios_path = _fios_scn_path; |
379 |
380 |
400 FiosItem *FiosGetHeightmapList(int mode) |
401 FiosItem *FiosGetHeightmapList(int mode) |
401 { |
402 { |
402 static char *_fios_hmap_path = NULL; |
403 static char *_fios_hmap_path = NULL; |
403 |
404 |
404 if (_fios_hmap_path == NULL) { |
405 if (_fios_hmap_path == NULL) { |
405 _fios_hmap_path = malloc(MAX_PATH); |
406 MallocT(&_fios_hmap_path, MAX_PATH); |
406 strcpy(_fios_hmap_path, _paths.heightmap_dir); |
407 strcpy(_fios_hmap_path, _paths.heightmap_dir); |
407 } |
408 } |
408 |
409 |
409 _fios_path = _fios_hmap_path; |
410 _fios_path = _fios_hmap_path; |
410 |
411 |