fios.c
changeset 4235 f5ad8ebce258
parent 4223 d4c9ef555f43
child 4300 c7e43c47a2b9
equal deleted inserted replaced
4234:2eff57fbe7d6 4235:f5ad8ebce258
   355  * @return A pointer to an array of FiosItem representing all the files to be shown in the save/load dialog.
   355  * @return A pointer to an array of FiosItem representing all the files to be shown in the save/load dialog.
   356  * @see FiosGetFileList
   356  * @see FiosGetFileList
   357  */
   357  */
   358 FiosItem *FiosGetScenarioList(int mode)
   358 FiosItem *FiosGetScenarioList(int mode)
   359 {
   359 {
   360 	static char *_fios_scn_path = NULL;
   360 	static char *fios_scn_path = NULL;
   361 
   361 
   362 	if (_fios_scn_path == NULL) {
   362 	/* Copy the default path on first run or on 'New Game' */
   363 		_fios_scn_path = malloc(MAX_PATH);
   363 	if (mode == SLD_NEW_GAME || fios_scn_path == NULL) {
   364 		ttd_strlcpy(_fios_scn_path, _path.scenario_dir, MAX_PATH);
   364 		if (fios_scn_path == NULL) fios_scn_path = malloc(MAX_PATH);
   365 	}
   365 		ttd_strlcpy(fios_scn_path, _path.scenario_dir, MAX_PATH);
   366 
   366 	}
   367 	_fios_path = _fios_scn_path;
   367 
       
   368 	_fios_path = fios_scn_path;
   368 
   369 
   369 	return FiosGetFileList(mode, &FiosGetScenarioListCallback);
   370 	return FiosGetFileList(mode, &FiosGetScenarioListCallback);
   370 }
   371 }