|
@@ -8,12 +8,13 @@
|
|
|
#include "openttd.h"
|
|
|
#include "hal.h"
|
|
|
#include "string.h"
|
|
|
#include "variables.h"
|
|
|
#include "functions.h"
|
|
|
#include "heightmap.h"
|
|
|
#include "helpers.hpp"
|
|
|
#include "table/strings.h"
|
|
|
#include "fios.h"
|
|
|
#include <sys/types.h>
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
#ifdef WIN32
|
|
@@ -44,13 +45,13 @@ extern void GetOldSaveGameName(char *tit
|
|
|
* @return A pointer to the newly allocated FiosItem.
|
|
|
*/
|
|
|
FiosItem *FiosAlloc(void)
|
|
|
{
|
|
|
if (_fios_count == _fios_alloc) {
|
|
|
_fios_alloc += 256;
|
|
|
_fios_items = realloc(_fios_items, _fios_alloc * sizeof(FiosItem));
|
|
|
ReallocT(&_fios_items, _fios_alloc);
|
|
|
}
|
|
|
return &_fios_items[_fios_count++];
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Compare two FiosItem's. Used with qsort when sorting the file list.
|
|
@@ -320,13 +321,13 @@ static byte FiosGetSavegameListCallback(
|
|
|
*/
|
|
|
FiosItem *FiosGetSavegameList(int mode)
|
|
|
{
|
|
|
static char *_fios_save_path = NULL;
|
|
|
|
|
|
if (_fios_save_path == NULL) {
|
|
|
_fios_save_path = malloc(MAX_PATH);
|
|
|
MallocT(&_fios_save_path, MAX_PATH);
|
|
|
ttd_strlcpy(_fios_save_path, _paths.save_dir, MAX_PATH);
|
|
|
}
|
|
|
|
|
|
_fios_path = _fios_save_path;
|
|
|
|
|
|
return FiosGetFileList(mode, &FiosGetSavegameListCallback);
|
|
@@ -368,13 +369,13 @@ static byte FiosGetScenarioListCallback(
|
|
|
*/
|
|
|
FiosItem *FiosGetScenarioList(int mode)
|
|
|
{
|
|
|
static char *_fios_scn_path = NULL;
|
|
|
|
|
|
if (_fios_scn_path == NULL) {
|
|
|
_fios_scn_path = malloc(MAX_PATH);
|
|
|
MallocT(&_fios_scn_path, MAX_PATH);
|
|
|
ttd_strlcpy(_fios_scn_path, _paths.scenario_dir, MAX_PATH);
|
|
|
}
|
|
|
|
|
|
_fios_path = _fios_scn_path;
|
|
|
|
|
|
return FiosGetFileList(mode, &FiosGetScenarioListCallback);
|
|
@@ -399,13 +400,13 @@ static byte FiosGetHeightmapListCallback
|
|
|
// Get a list of Heightmaps
|
|
|
FiosItem *FiosGetHeightmapList(int mode)
|
|
|
{
|
|
|
static char *_fios_hmap_path = NULL;
|
|
|
|
|
|
if (_fios_hmap_path == NULL) {
|
|
|
_fios_hmap_path = malloc(MAX_PATH);
|
|
|
MallocT(&_fios_hmap_path, MAX_PATH);
|
|
|
strcpy(_fios_hmap_path, _paths.heightmap_dir);
|
|
|
}
|
|
|
|
|
|
_fios_path = _fios_hmap_path;
|
|
|
|
|
|
return FiosGetFileList(mode, &FiosGetHeightmapListCallback);
|