forked from mirror/OpenTTD
(svn r27653) -Fix(r27647): Rename FileOperation enum and values to SaveLoadOperation to avoid nameclash with windows compiler toolkit.
This commit is contained in:
@@ -328,7 +328,7 @@ static void LoadIntroGame(bool load_newgrfs = true)
|
||||
SetupColoursAndInitialWindow();
|
||||
|
||||
/* Load the default opening screen savegame */
|
||||
if (SaveOrLoad("opntitle.dat", FOP_LOAD, DFT_GAME_FILE, BASESET_DIR) != SL_OK) {
|
||||
if (SaveOrLoad("opntitle.dat", SLO_LOAD, DFT_GAME_FILE, BASESET_DIR) != SL_OK) {
|
||||
GenerateWorld(GWM_EMPTY, 64, 64); // if failed loading, make empty world.
|
||||
WaitTillGeneratedWorld();
|
||||
SetLocalCompany(COMPANY_SPECTATOR);
|
||||
@@ -621,12 +621,12 @@ int openttd_main(int argc, char *argv[])
|
||||
_file_to_saveload.SetName(mgo.opt);
|
||||
bool is_scenario = _switch_mode == SM_EDITOR || _switch_mode == SM_LOAD_SCENARIO;
|
||||
_switch_mode = is_scenario ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
|
||||
_file_to_saveload.SetMode(FOP_LOAD, is_scenario ? FT_SCENARIO : FT_SAVEGAME, DFT_GAME_FILE);
|
||||
_file_to_saveload.SetMode(SLO_LOAD, is_scenario ? FT_SCENARIO : FT_SAVEGAME, DFT_GAME_FILE);
|
||||
|
||||
/* if the file doesn't exist or it is not a valid savegame, let the saveload code show an error */
|
||||
const char *t = strrchr(_file_to_saveload.name, '.');
|
||||
if (t != NULL) {
|
||||
FiosType ft = FiosGetSavegameListCallback(FOP_LOAD, _file_to_saveload.name, t, NULL, NULL);
|
||||
FiosType ft = FiosGetSavegameListCallback(SLO_LOAD, _file_to_saveload.name, t, NULL, NULL);
|
||||
if (ft != FIOS_TYPE_INVALID) _file_to_saveload.SetMode(ft);
|
||||
}
|
||||
|
||||
@@ -648,10 +648,10 @@ int openttd_main(int argc, char *argv[])
|
||||
|
||||
char title[80];
|
||||
title[0] = '\0';
|
||||
FiosGetSavegameListCallback(FOP_LOAD, mgo.opt, strrchr(mgo.opt, '.'), title, lastof(title));
|
||||
FiosGetSavegameListCallback(SLO_LOAD, mgo.opt, strrchr(mgo.opt, '.'), title, lastof(title));
|
||||
|
||||
_load_check_data.Clear();
|
||||
SaveOrLoadResult res = SaveOrLoad(mgo.opt, FOP_CHECK, DFT_GAME_FILE, SAVE_DIR, false);
|
||||
SaveOrLoadResult res = SaveOrLoad(mgo.opt, SLO_CHECK, DFT_GAME_FILE, SAVE_DIR, false);
|
||||
if (res != SL_OK || _load_check_data.HasErrors()) {
|
||||
fprintf(stderr, "Failed to open savegame\n");
|
||||
if (_load_check_data.HasErrors()) {
|
||||
@@ -998,9 +998,9 @@ static void MakeNewEditorWorld()
|
||||
* @param subdir default directory to look for filename, set to 0 if not needed
|
||||
* @param lf Load filter to use, if NULL: use filename + subdir.
|
||||
*/
|
||||
bool SafeLoad(const char *filename, FileOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL)
|
||||
bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL)
|
||||
{
|
||||
assert(fop == FOP_LOAD);
|
||||
assert(fop == SLO_LOAD);
|
||||
assert(dft == DFT_GAME_FILE || (lf == NULL && dft == DFT_OLD_GAME_FILE));
|
||||
GameMode ogm = _game_mode;
|
||||
|
||||
@@ -1158,7 +1158,7 @@ void SwitchToMode(SwitchMode new_mode)
|
||||
|
||||
case SM_SAVE_GAME: // Save game.
|
||||
/* Make network saved games on pause compatible to singleplayer */
|
||||
if (SaveOrLoad(_file_to_saveload.name, FOP_SAVE, DFT_GAME_FILE, NO_DIRECTORY) != SL_OK) {
|
||||
if (SaveOrLoad(_file_to_saveload.name, SLO_SAVE, DFT_GAME_FILE, NO_DIRECTORY) != SL_OK) {
|
||||
SetDParamStr(0, GetSaveLoadErrorString());
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
|
||||
} else {
|
||||
@@ -1369,7 +1369,7 @@ void StateGameLoop()
|
||||
/* Save the desync savegame if needed. */
|
||||
char name[MAX_PATH];
|
||||
seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date);
|
||||
SaveOrLoad(name, FOP_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false);
|
||||
SaveOrLoad(name, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false);
|
||||
}
|
||||
|
||||
CheckCaches();
|
||||
@@ -1426,7 +1426,7 @@ static void DoAutosave()
|
||||
}
|
||||
|
||||
DEBUG(sl, 2, "Autosaving to '%s'", buf);
|
||||
if (SaveOrLoad(buf, FOP_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR) != SL_OK) {
|
||||
if (SaveOrLoad(buf, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR) != SL_OK) {
|
||||
ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, WL_ERROR);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user