src/fios.cpp
branchNewGRF_ports
changeset 6720 35756db7e577
parent 6719 4cc327ad39d5
child 6800 6c09e1e86fcb
equal deleted inserted replaced
6719:4cc327ad39d5 6720:35756db7e577
     4  * This file contains functions for building file lists for the save/load dialogs.
     4  * This file contains functions for building file lists for the save/load dialogs.
     5  */
     5  */
     6 
     6 
     7 #include "stdafx.h"
     7 #include "stdafx.h"
     8 #include "openttd.h"
     8 #include "openttd.h"
     9 #include "hal.h"
       
    10 #include "string.h"
     9 #include "string.h"
    11 #include "variables.h"
    10 #include "variables.h"
    12 #include "functions.h"
    11 #include "functions.h"
    13 #include "heightmap.h"
    12 #include "heightmap.h"
    14 #include "helpers.hpp"
    13 #include "helpers.hpp"
    15 #include "table/strings.h"
    14 #include "table/strings.h"
    16 #include "fios.h"
    15 #include "fios.h"
       
    16 #include "fileio.h"
    17 #include <sys/types.h>
    17 #include <sys/types.h>
    18 #include <sys/stat.h>
    18 #include <sys/stat.h>
    19 
    19 
    20 #ifdef WIN32
    20 #ifdef WIN32
    21 # include <tchar.h>
    21 # include <tchar.h>
   332 {
   332 {
   333 	static char *_fios_save_path = NULL;
   333 	static char *_fios_save_path = NULL;
   334 
   334 
   335 	if (_fios_save_path == NULL) {
   335 	if (_fios_save_path == NULL) {
   336 		_fios_save_path = MallocT<char>(MAX_PATH);
   336 		_fios_save_path = MallocT<char>(MAX_PATH);
   337 		ttd_strlcpy(_fios_save_path, _paths.save_dir, MAX_PATH);
   337 		FioGetDirectory(_fios_save_path, MAX_PATH, SAVE_DIR);
   338 	}
   338 	}
   339 
   339 
   340 	_fios_path = _fios_save_path;
   340 	_fios_path = _fios_save_path;
   341 
   341 
   342 	return FiosGetFileList(mode, &FiosGetSavegameListCallback);
   342 	return FiosGetFileList(mode, &FiosGetSavegameListCallback);
   378  */
   378  */
   379 FiosItem *FiosGetScenarioList(int mode)
   379 FiosItem *FiosGetScenarioList(int mode)
   380 {
   380 {
   381 	static char *_fios_scn_path = NULL;
   381 	static char *_fios_scn_path = NULL;
   382 
   382 
       
   383 	/* Copy the default path on first run or on 'New Game' */
   383 	if (_fios_scn_path == NULL) {
   384 	if (_fios_scn_path == NULL) {
   384 		_fios_scn_path = MallocT<char>(MAX_PATH);
   385 		_fios_scn_path = MallocT<char>(MAX_PATH);
   385 		ttd_strlcpy(_fios_scn_path, _paths.scenario_dir, MAX_PATH);
   386 		FioGetDirectory(_fios_scn_path, MAX_PATH, SCENARIO_DIR);
   386 	}
   387 	}
   387 
   388 
   388 	_fios_path = _fios_scn_path;
   389 	_fios_path = _fios_scn_path;
   389 
   390 
   390 	return FiosGetFileList(mode, &FiosGetScenarioListCallback);
   391 	return FiosGetFileList(mode, &FiosGetScenarioListCallback);
   411 {
   412 {
   412 	static char *_fios_hmap_path = NULL;
   413 	static char *_fios_hmap_path = NULL;
   413 
   414 
   414 	if (_fios_hmap_path == NULL) {
   415 	if (_fios_hmap_path == NULL) {
   415 		_fios_hmap_path = MallocT<char>(MAX_PATH);
   416 		_fios_hmap_path = MallocT<char>(MAX_PATH);
   416 		strcpy(_fios_hmap_path, _paths.heightmap_dir);
   417 		FioGetDirectory(_fios_hmap_path, MAX_PATH, HEIGHTMAP_DIR);
   417 	}
   418 	}
   418 
   419 
   419 	_fios_path = _fios_hmap_path;
   420 	_fios_path = _fios_hmap_path;
   420 
   421 
   421 	return FiosGetFileList(mode, &FiosGetHeightmapListCallback);
   422 	return FiosGetFileList(mode, &FiosGetHeightmapListCallback);