Changeset - r22446:e215802a4b89
[Not reviewed]
master
0 15 0
alberth - 8 years ago 2016-09-04 16:06:50
alberth@openttd.org
(svn r27653) -Fix(r27647): Rename FileOperation enum and values to SaveLoadOperation to avoid nameclash with windows compiler toolkit.
15 files changed with 98 insertions and 98 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -64,13 +64,13 @@ public:
 
	 * (Re-)validate the file storage cache. Only makes a change if the storage was invalid, or if \a force_reload.
 
	 * @param Always reload the file storage cache.
 
	 */
 
	void ValidateFileList(bool force_reload = false)
 
	{
 
		if (force_reload || !this->file_list_valid) {
 
			this->BuildFileList(FT_SAVEGAME, FOP_LOAD);
 
			this->BuildFileList(FT_SAVEGAME, SLO_LOAD);
 
			this->file_list_valid = true;
 
		}
 
	}
 

	
 
	bool file_list_valid; ///< If set, the file list is valid.
 
};
 
@@ -315,13 +315,13 @@ DEF_CONSOLE_CMD(ConSave)
 
	}
 

	
 
	if (argc == 2) {
 
		char *filename = str_fmt("%s.sav", argv[1]);
 
		IConsolePrint(CC_DEFAULT, "Saving map...");
 

	
 
		if (SaveOrLoad(filename, FOP_SAVE, DFT_GAME_FILE, SAVE_DIR) != SL_OK) {
 
		if (SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, SAVE_DIR) != SL_OK) {
 
			IConsolePrint(CC_ERROR, "Saving map failed");
 
		} else {
 
			IConsolePrintF(CC_DEFAULT, "Map successfully saved to %s", filename);
 
		}
 
		free(filename);
 
		return true;
src/crashlog.cpp
Show inline comments
 
@@ -385,13 +385,13 @@ bool CrashLog::WriteSavegame(char *filen
 
	try {
 
		GamelogEmergency();
 

	
 
		seprintf(filename, filename_last, "%scrash.sav", _personal_dir);
 

	
 
		/* Don't do a threaded saveload. */
 
		return SaveOrLoad(filename, FOP_SAVE, DFT_GAME_FILE, NO_DIRECTORY, false) == SL_OK;
 
		return SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, NO_DIRECTORY, false) == SL_OK;
 
	} catch (...) {
 
		return false;
 
	}
 
}
 

	
 
/**
src/fileio_type.h
Show inline comments
 
@@ -43,18 +43,18 @@ enum DetailedFileType {
 
	DFT_FIOS_DIRECT, ///< Direct filename.
 

	
 
	DFT_INVALID = 255, ///< Unknown or invalid file.
 
};
 

	
 
/** Operation performed on the file. */
 
enum FileOperation {
 
	FOP_CHECK,   ///< Load file for checking and/or preview.
 
	FOP_LOAD,    ///< File is being loaded.
 
	FOP_SAVE,    ///< File is being saved.
 
enum SaveLoadOperation {
 
	SLO_CHECK,   ///< Load file for checking and/or preview.
 
	SLO_LOAD,    ///< File is being loaded.
 
	SLO_SAVE,    ///< File is being saved.
 

	
 
	FOP_INVALID, ///< Unknown file operation.
 
	SLO_INVALID, ///< Unknown file operation.
 
};
 

	
 
/**
 
 * Construct an enum value for #FiosType as a combination of an abstract and a detailed file type.
 
 * @param abstract Abstract file type (one of #AbstractFileType).
 
 * @param detailed Detailed file type (one of #DetailedFileType).
src/fios.cpp
Show inline comments
 
@@ -68,19 +68,19 @@ FileList::~FileList()
 
	this->Clear();
 
}
 

	
 
/**
 
 * Construct a file list with the given kind of files, for the stated purpose.
 
 * @param abstract_filetype Kind of files to collect.
 
 * @param fop Purpose of the collection, either #FOP_LOAD or #FOP_SAVE.
 
 * @param fop Purpose of the collection, either #SLO_LOAD or #SLO_SAVE.
 
 */
 
void FileList::BuildFileList(AbstractFileType abstract_filetype, FileOperation fop)
 
void FileList::BuildFileList(AbstractFileType abstract_filetype, SaveLoadOperation fop)
 
{
 
	this->Clear();
 

	
 
	assert(fop == FOP_LOAD || FOP_SAVE);
 
	assert(fop == SLO_LOAD || SLO_SAVE);
 
	switch (abstract_filetype) {
 
		case FT_NONE:
 
			break;
 

	
 
		case FT_SAVEGAME:
 
			FiosGetSavegameList(fop, *this);
 
@@ -271,29 +271,29 @@ bool FiosDelete(const char *name)
 
	char filename[512];
 

	
 
	FiosMakeSavegameName(filename, name, lastof(filename));
 
	return unlink(filename) == 0;
 
}
 

	
 
typedef FiosType fios_getlist_callback_proc(FileOperation fop, const char *filename, const char *ext, char *title, const char *last);
 
typedef FiosType fios_getlist_callback_proc(SaveLoadOperation fop, const char *filename, const char *ext, char *title, const char *last);
 

	
 
/**
 
 * Scanner to scan for a particular type of FIOS file.
 
 */
 
class FiosFileScanner : public FileScanner {
 
	FileOperation fop;       ///< The kind of file we are looking for.
 
	SaveLoadOperation fop;   ///< The kind of file we are looking for.
 
	fios_getlist_callback_proc *callback_proc; ///< Callback to check whether the file may be added
 
	FileList &file_list;     ///< Destination of the found files.
 
public:
 
	/**
 
	 * Create the scanner
 
	 * @param fop Purpose of collecting the list.
 
	 * @param callback_proc The function that is called where you need to do the filtering.
 
	 * @param file_list Destination of the found files.
 
	 */
 
	FiosFileScanner(FileOperation fop, fios_getlist_callback_proc *callback_proc, FileList &file_list) :
 
	FiosFileScanner(SaveLoadOperation fop, fios_getlist_callback_proc *callback_proc, FileList &file_list) :
 
			fop(fop), callback_proc(callback_proc), file_list(file_list)
 
	{}
 

	
 
	/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename);
 
};
 

	
 
@@ -351,13 +351,13 @@ bool FiosFileScanner::AddFile(const char
 
 * Fill the list of the files in a directory, according to some arbitrary rule.
 
 * @param fop Purpose of collecting the list.
 
 * @param callback_proc The function that is called where you need to do the filtering.
 
 * @param subdir The directory from where to start (global) searching.
 
 * @param file_list Destination of the found files.
 
 */
 
static void FiosGetFileList(FileOperation fop, fios_getlist_callback_proc *callback_proc, Subdirectory subdir, FileList &file_list)
 
static void FiosGetFileList(SaveLoadOperation fop, fios_getlist_callback_proc *callback_proc, Subdirectory subdir, FileList &file_list)
 
{
 
	struct stat sb;
 
	struct dirent *dirent;
 
	DIR *dir;
 
	FiosItem *fios;
 
	int sort_start;
 
@@ -453,13 +453,13 @@ static void GetFileTitle(const char *fil
 
 * @param title Buffer if a callback wants to lookup the title of the file; NULL to skip the lookup
 
 * @param last Last available byte in buffer (to prevent buffer overflows); not used when title == NULL
 
 * @return a FIOS_TYPE_* type of the found file, FIOS_TYPE_INVALID if not a savegame
 
 * @see FiosGetFileList
 
 * @see FiosGetSavegameList
 
 */
 
FiosType FiosGetSavegameListCallback(FileOperation fop, const char *file, const char *ext, char *title, const char *last)
 
FiosType FiosGetSavegameListCallback(SaveLoadOperation fop, const char *file, const char *ext, char *title, const char *last)
 
{
 
	/* Show savegame files
 
	 * .SAV OpenTTD saved game
 
	 * .SS1 Transport Tycoon Deluxe preset game
 
	 * .SV1 Transport Tycoon Deluxe (Patch) saved game
 
	 * .SV2 Transport Tycoon Deluxe (Patch) saved 2-player game */
 
@@ -469,13 +469,13 @@ FiosType FiosGetSavegameListCallback(Fil
 

	
 
	if (strcasecmp(ext, ".sav") == 0) {
 
		GetFileTitle(file, title, last, SAVE_DIR);
 
		return FIOS_TYPE_FILE;
 
	}
 

	
 
	if (fop == FOP_LOAD) {
 
	if (fop == SLO_LOAD) {
 
		if (strcasecmp(ext, ".ss1") == 0 || strcasecmp(ext, ".sv1") == 0 ||
 
				strcasecmp(ext, ".sv2") == 0) {
 
			if (title != NULL) GetOldSaveGameName(file, title, last);
 
			return FIOS_TYPE_OLDFILE;
 
		}
 
	}
 
@@ -486,13 +486,13 @@ FiosType FiosGetSavegameListCallback(Fil
 
/**
 
 * Get a list of savegames.
 
 * @param fop Purpose of collecting the list.
 
 * @param file_list Destination of the found files.
 
 * @see FiosGetFileList
 
 */
 
void FiosGetSavegameList(FileOperation fop, FileList &file_list)
 
void FiosGetSavegameList(SaveLoadOperation fop, FileList &file_list)
 
{
 
	static char *fios_save_path = NULL;
 
	static char *fios_save_path_last = NULL;
 

	
 
	if (fios_save_path == NULL) {
 
		fios_save_path = MallocT<char>(MAX_PATH);
 
@@ -514,24 +514,24 @@ void FiosGetSavegameList(FileOperation f
 
 * @param title Buffer if a callback wants to lookup the title of the file
 
 * @param last Last available byte in buffer (to prevent buffer overflows)
 
 * @return a FIOS_TYPE_* type of the found file, FIOS_TYPE_INVALID if not a scenario
 
 * @see FiosGetFileList
 
 * @see FiosGetScenarioList
 
 */
 
static FiosType FiosGetScenarioListCallback(FileOperation fop, const char *file, const char *ext, char *title, const char *last)
 
static FiosType FiosGetScenarioListCallback(SaveLoadOperation fop, const char *file, const char *ext, char *title, const char *last)
 
{
 
	/* Show scenario files
 
	 * .SCN OpenTTD style scenario file
 
	 * .SV0 Transport Tycoon Deluxe (Patch) scenario
 
	 * .SS0 Transport Tycoon Deluxe preset scenario */
 
	if (strcasecmp(ext, ".scn") == 0) {
 
		GetFileTitle(file, title, last, SCENARIO_DIR);
 
		return FIOS_TYPE_SCENARIO;
 
	}
 

	
 
	if (fop == FOP_LOAD) {
 
	if (fop == SLO_LOAD) {
 
		if (strcasecmp(ext, ".sv0") == 0 || strcasecmp(ext, ".ss0") == 0 ) {
 
			GetOldSaveGameName(file, title, last);
 
			return FIOS_TYPE_OLD_SCENARIO;
 
		}
 
	}
 

	
 
@@ -541,13 +541,13 @@ static FiosType FiosGetScenarioListCallb
 
/**
 
 * Get a list of scenarios.
 
 * @param fop Purpose of collecting the list.
 
 * @param file_list Destination of the found files.
 
 * @see FiosGetFileList
 
 */
 
void FiosGetScenarioList(FileOperation fop, FileList &file_list)
 
void FiosGetScenarioList(SaveLoadOperation fop, FileList &file_list)
 
{
 
	static char *fios_scn_path = NULL;
 
	static char *fios_scn_path_last = NULL;
 

	
 
	/* Copy the default path on first run or on 'New Game' */
 
	if (fios_scn_path == NULL) {
 
@@ -559,17 +559,17 @@ void FiosGetScenarioList(FileOperation f
 
	_fios_path = fios_scn_path;
 
	_fios_path_last = fios_scn_path_last;
 

	
 
	char base_path[MAX_PATH];
 
	FioGetDirectory(base_path, lastof(base_path), SCENARIO_DIR);
 

	
 
	Subdirectory subdir = (fop == FOP_LOAD && strcmp(base_path, _fios_path) == 0) ? SCENARIO_DIR : NO_DIRECTORY;
 
	Subdirectory subdir = (fop == SLO_LOAD && strcmp(base_path, _fios_path) == 0) ? SCENARIO_DIR : NO_DIRECTORY;
 
	FiosGetFileList(fop, &FiosGetScenarioListCallback, subdir, file_list);
 
}
 

	
 
static FiosType FiosGetHeightmapListCallback(FileOperation fop, const char *file, const char *ext, char *title, const char *last)
 
static FiosType FiosGetHeightmapListCallback(SaveLoadOperation fop, const char *file, const char *ext, char *title, const char *last)
 
{
 
	/* Show heightmap files
 
	 * .PNG PNG Based heightmap files
 
	 * .BMP BMP Based heightmap files
 
	 */
 

	
 
@@ -612,13 +612,13 @@ static FiosType FiosGetHeightmapListCall
 

	
 
/**
 
 * Get a list of heightmaps.
 
 * @param fop Purpose of collecting the list.
 
 * @param file_list Destination of the found files.
 
 */
 
void FiosGetHeightmapList(FileOperation fop, FileList &file_list)
 
void FiosGetHeightmapList(SaveLoadOperation fop, FileList &file_list)
 
{
 
	static char *fios_hmap_path = NULL;
 
	static char *fios_hmap_path_last = NULL;
 

	
 
	if (fios_hmap_path == NULL) {
 
		fios_hmap_path = MallocT<char>(MAX_PATH);
src/fios.h
Show inline comments
 
@@ -187,13 +187,13 @@ public:
 
	/** Compact the list down to the smallest block size boundary. */
 
	inline void Compact()
 
	{
 
		this->files.Compact();
 
	}
 

	
 
	void BuildFileList(AbstractFileType abstract_filetype, FileOperation fop);
 
	void BuildFileList(AbstractFileType abstract_filetype, SaveLoadOperation fop);
 
	const FiosItem *FindItem(const char *file);
 

	
 
	SmallVector<FiosItem, 32> files; ///< The list of files.
 
};
 

	
 
enum SortingBits {
 
@@ -204,24 +204,24 @@ enum SortingBits {
 
};
 
DECLARE_ENUM_AS_BIT_SET(SortingBits)
 

	
 
/* Variables to display file lists */
 
extern SortingBits _savegame_sort_order;
 

	
 
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, FileOperation fop);
 
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop);
 

	
 
void FiosGetSavegameList(FileOperation fop, FileList &file_list);
 
void FiosGetScenarioList(FileOperation fop, FileList &file_list);
 
void FiosGetHeightmapList(FileOperation fop, FileList &file_list);
 
void FiosGetSavegameList(SaveLoadOperation fop, FileList &file_list);
 
void FiosGetScenarioList(SaveLoadOperation fop, FileList &file_list);
 
void FiosGetHeightmapList(SaveLoadOperation fop, FileList &file_list);
 

	
 
const char *FiosBrowseTo(const FiosItem *item);
 

	
 
StringID FiosGetDescText(const char **path, uint64 *total_free);
 
bool FiosDelete(const char *name);
 
void FiosMakeHeightmapName(char *buf, const char *name, const char *last);
 
void FiosMakeSavegameName(char *buf, const char *name, const char *last);
 

	
 
FiosType FiosGetSavegameListCallback(FileOperation fop, const char *file, const char *ext, char *title, const char *last);
 
FiosType FiosGetSavegameListCallback(SaveLoadOperation fop, const char *file, const char *ext, char *title, const char *last);
 

	
 
int CDECL CompareFiosItems(const FiosItem *a, const FiosItem *b);
 

	
 
#endif /* FIOS_H */
src/fios_gui.cpp
Show inline comments
 
@@ -226,13 +226,13 @@ static void SortSaveGameList(FileList &f
 
}
 

	
 
struct SaveLoadWindow : public Window {
 
private:
 
	QueryString filename_editbox; ///< Filename editbox.
 
	AbstractFileType abstract_filetype; /// Type of file to select.
 
	FileOperation fop;            ///< File operation to perform.
 
	SaveLoadOperation fop;        ///< File operation to perform.
 
	FileList fios_items;          ///< Save game list.
 
	FiosItem o_dir;
 
	const FiosItem *selected;     ///< Selected game in #fios_items, or \c NULL.
 
	Scrollbar *vscroll;
 
public:
 

	
 
@@ -240,19 +240,19 @@ public:
 
	void GenerateFileName()
 
	{
 
		GenerateDefaultSaveName(this->filename_editbox.text.buf, &this->filename_editbox.text.buf[this->filename_editbox.text.max_bytes - 1]);
 
		this->filename_editbox.text.UpdateSize();
 
	}
 

	
 
	SaveLoadWindow(WindowDesc *desc, AbstractFileType abstract_filetype, FileOperation fop)
 
	SaveLoadWindow(WindowDesc *desc, AbstractFileType abstract_filetype, SaveLoadOperation fop)
 
			: Window(desc), filename_editbox(64), abstract_filetype(abstract_filetype), fop(fop)
 
	{
 
		assert(this->fop == FOP_SAVE || this->fop == FOP_LOAD);
 
		assert(this->fop == SLO_SAVE || this->fop == SLO_LOAD);
 

	
 
		/* For saving, construct an initial file name. */
 
		if (this->fop == FOP_SAVE) {
 
		if (this->fop == SLO_SAVE) {
 
			switch (this->abstract_filetype) {
 
				case FT_SAVEGAME:
 
					this->GenerateFileName();
 
					break;
 

	
 
				case FT_SCENARIO:
 
@@ -265,29 +265,29 @@ public:
 
			}
 
		}
 
		this->querystrings[WID_SL_SAVE_OSK_TITLE] = &this->filename_editbox;
 
		this->filename_editbox.ok_button = WID_SL_SAVE_GAME;
 

	
 
		this->CreateNestedTree(true);
 
		if (this->fop == FOP_LOAD && this->abstract_filetype == FT_SAVEGAME) {
 
		if (this->fop == SLO_LOAD && this->abstract_filetype == FT_SAVEGAME) {
 
			this->GetWidget<NWidgetStacked>(WID_SL_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL);
 
		}
 

	
 
		/* Select caption string of the window. */
 
		StringID caption_string;
 
		switch (this->abstract_filetype) {
 
			case FT_SAVEGAME:
 
				caption_string = (this->fop == FOP_SAVE) ? STR_SAVELOAD_SAVE_CAPTION : STR_SAVELOAD_LOAD_CAPTION;
 
				caption_string = (this->fop == SLO_SAVE) ? STR_SAVELOAD_SAVE_CAPTION : STR_SAVELOAD_LOAD_CAPTION;
 
				break;
 

	
 
			case FT_SCENARIO:
 
				caption_string = (this->fop == FOP_SAVE) ? STR_SAVELOAD_SAVE_SCENARIO : STR_SAVELOAD_LOAD_SCENARIO;
 
				caption_string = (this->fop == SLO_SAVE) ? STR_SAVELOAD_SAVE_SCENARIO : STR_SAVELOAD_LOAD_SCENARIO;
 
				break;
 

	
 
			case FT_HEIGHTMAP:
 
				caption_string = (this->fop == FOP_SAVE) ? STR_SAVELOAD_SAVE_HEIGHTMAP : STR_SAVELOAD_LOAD_HEIGHTMAP;
 
				caption_string = (this->fop == SLO_SAVE) ? STR_SAVELOAD_SAVE_HEIGHTMAP : STR_SAVELOAD_LOAD_HEIGHTMAP;
 
				break;
 

	
 
			default:
 
				NOT_REACHED();
 
		}
 
		this->GetWidget<NWidgetCore>(WID_SL_CAPTION)->widget_data = caption_string;
 
@@ -325,13 +325,13 @@ public:
 

	
 
			default:
 
				strecpy(o_dir.name, _personal_dir, lastof(o_dir.name));
 
		}
 

	
 
		/* Focus the edit box by default in the save windows */
 
		if (this->fop == FOP_SAVE) this->SetFocusedWidget(WID_SL_SAVE_OSK_TITLE);
 
		if (this->fop == SLO_SAVE) this->SetFocusedWidget(WID_SL_SAVE_OSK_TITLE);
 
	}
 

	
 
	virtual ~SaveLoadWindow()
 
	{
 
		/* pause is only used in single-player, non-editor mode, non menu mode */
 
		if (!_networking && _game_mode != GM_EDITOR && _game_mode != GM_MENU) {
 
@@ -435,13 +435,13 @@ public:
 
						SetDParam(0, _load_check_data.current_date);
 
						DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_CURRENT_DATE);
 
						y += FONT_HEIGHT_NORMAL;
 
					}
 

	
 
					/* Hide the NewGRF stuff when saving. We also hide the button. */
 
					if (this->fop == FOP_LOAD && (this->abstract_filetype == FT_SAVEGAME || this->abstract_filetype == FT_SCENARIO)) {
 
					if (this->fop == SLO_LOAD && (this->abstract_filetype == FT_SAVEGAME || this->abstract_filetype == FT_SCENARIO)) {
 
						y += WD_PAR_VSEP_NORMAL;
 
						if (y > y_max) break;
 

	
 
						/* NewGrf compatibility */
 
						SetDParam(0, _load_check_data.grfconfig == NULL ? STR_NEWGRF_LIST_NONE :
 
								STR_NEWGRF_LIST_ALL_FOUND + _load_check_data.grf_compatibility);
 
@@ -580,25 +580,25 @@ public:
 
						if (this->selected != file) {
 
							this->selected = file;
 
							_load_check_data.Clear();
 

	
 
							if (GetDetailedFileType(file->type) == DFT_GAME_FILE) {
 
								/* Other detailed file types cannot be checked before. */
 
								SaveOrLoad(name, FOP_CHECK, DFT_GAME_FILE, NO_DIRECTORY, false);
 
								SaveOrLoad(name, SLO_CHECK, DFT_GAME_FILE, NO_DIRECTORY, false);
 
							}
 

	
 
							this->InvalidateData(1);
 
						}
 
						if (this->fop == FOP_SAVE) {
 
						if (this->fop == SLO_SAVE) {
 
							/* Copy clicked name to editbox */
 
							this->filename_editbox.text.Assign(file->title);
 
							this->SetWidgetDirty(WID_SL_SAVE_OSK_TITLE);
 
						}
 
					} else if (!_load_check_data.HasErrors()) {
 
						this->selected = file;
 
						if (this->fop == FOP_LOAD) {
 
						if (this->fop == SLO_LOAD) {
 
							if (this->abstract_filetype == FT_SAVEGAME || this->abstract_filetype == FT_SCENARIO) {
 
								this->OnClick(pt, WID_SL_LOAD_BUTTON, 1);
 
							} else {
 
								assert(this->abstract_filetype == FT_HEIGHTMAP);
 
								_file_to_saveload.SetMode(file->type);
 
								_file_to_saveload.SetName(name);
 
@@ -618,13 +618,13 @@ public:
 

	
 
			case WID_SL_CONTENT_DOWNLOAD:
 
				if (!_network_available) {
 
					ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
 
				} else {
 
#if defined(ENABLE_NETWORK)
 
					assert(this->fop == FOP_LOAD);
 
					assert(this->fop == SLO_LOAD);
 
					switch (this->abstract_filetype) {
 
						default: NOT_REACHED();
 
						case FT_SCENARIO:  ShowNetworkContentListWindow(NULL, CONTENT_TYPE_SCENARIO);  break;
 
						case FT_HEIGHTMAP: ShowNetworkContentListWindow(NULL, CONTENT_TYPE_HEIGHTMAP); break;
 
					}
 
#endif
 
@@ -651,13 +651,13 @@ public:
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	virtual void OnTimeout()
 
	{
 
		/* Widgets WID_SL_DELETE_SELECTION and WID_SL_SAVE_GAME only exist when saving to a file. */
 
		if (this->fop != FOP_SAVE) return;
 
		if (this->fop != SLO_SAVE) return;
 

	
 
		if (this->IsWidgetLowered(WID_SL_DELETE_SELECTION)) { // Delete button clicked
 
			if (!FiosDelete(this->filename_editbox.text.buf)) {
 
				ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, WL_ERROR);
 
			} else {
 
				this->InvalidateData();
 
@@ -704,13 +704,13 @@ public:
 
				_load_check_data.Clear();
 
				/* FALL THROUGH */
 
			case 1:
 
				/* Selection changes */
 
				if (!gui_scope) break;
 

	
 
				if (this->fop != FOP_LOAD) break;
 
				if (this->fop != SLO_LOAD) break;
 

	
 
				switch (this->abstract_filetype) {
 
					case FT_HEIGHTMAP:
 
						this->SetWidgetDisabledState(WID_SL_LOAD_BUTTON, this->selected == NULL || _load_check_data.HasErrors());
 
						break;
 

	
 
@@ -761,18 +761,18 @@ static WindowDesc _save_dialog_desc(
 

	
 
/**
 
 * Launch save/load dialog in the given mode.
 
 * @param abstract_filetype Kind of file to handle.
 
 * @param fop File operation to perform (load or save).
 
 */
 
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, FileOperation fop)
 
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop)
 
{
 
	DeleteWindowById(WC_SAVELOAD, 0);
 

	
 
	WindowDesc *sld;
 
	if (fop == FOP_SAVE) {
 
	if (fop == SLO_SAVE) {
 
		sld = &_save_dialog_desc;
 
	} else {
 
		/* Dialogue for loading a file. */
 
		sld = (abstract_filetype == FT_HEIGHTMAP) ? &_load_heightmap_dialog_desc : &_load_dialog_desc;
 
	}
 

	
src/genworld.cpp
Show inline comments
 
@@ -201,13 +201,13 @@ static void _GenerateWorld(void *)
 
		if (_network_dedicated) DEBUG(net, 1, "Map generated, starting game");
 
		DEBUG(desync, 1, "new_map: %08x", _settings_game.game_creation.generation_seed);
 

	
 
		if (_debug_desync_level > 0) {
 
			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);
 
		}
 
	} catch (...) {
 
		BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP, true);
 
		if (_cur_company.IsValid()) _cur_company.Restore();
 
		_generating_world = false;
 
		_modal_progress_work_mutex->EndCritical();
src/intro_gui.cpp
Show inline comments
 
@@ -108,15 +108,15 @@ struct SelectGameWindow : public Window 
 
					StartNewGameWithoutGUI(GENERATE_NEW_SEED);
 
				} else {
 
					ShowGenerateLandscape();
 
				}
 
				break;
 

	
 
			case WID_SGI_LOAD_GAME:      ShowSaveLoadDialog(FT_SAVEGAME, FOP_LOAD); break;
 
			case WID_SGI_PLAY_SCENARIO:  ShowSaveLoadDialog(FT_SCENARIO, FOP_LOAD); break;
 
			case WID_SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,FOP_LOAD); break;
 
			case WID_SGI_LOAD_GAME:      ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD); break;
 
			case WID_SGI_PLAY_SCENARIO:  ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD); break;
 
			case WID_SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD); break;
 
			case WID_SGI_EDIT_SCENARIO:  StartScenarioEditor(); break;
 

	
 
			case WID_SGI_PLAY_NETWORK:
 
				if (!_network_available) {
 
					ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
 
				} else {
src/network/network_client.cpp
Show inline comments
 
@@ -517,13 +517,13 @@ bool ClientNetworkGameSocketHandler::IsC
 

	
 
/***********
 
 * Receiving functions
 
 *   DEF_CLIENT_RECEIVE_COMMAND has parameter: Packet *p
 
 ************/
 

	
 
extern bool SafeLoad(const char *filename, FileOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL);
 
extern bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL);
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p)
 
{
 
	/* We try to join a server which is full */
 
	ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL);
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 
@@ -833,13 +833,13 @@ NetworkRecvStatus ClientNetworkGameSocke
 
	LoadFilter *lf = this->savegame;
 
	this->savegame = NULL;
 
	lf->Reset();
 

	
 
	/* The map is done downloading, load it */
 
	ClearErrorMessages();
 
	bool load_success = SafeLoad(NULL, FOP_LOAD, DFT_GAME_FILE, GM_NORMAL, NO_DIRECTORY, lf);
 
	bool load_success = SafeLoad(NULL, SLO_LOAD, DFT_GAME_FILE, GM_NORMAL, NO_DIRECTORY, lf);
 

	
 
	/* Long savegame loads shouldn't affect the lag calculation! */
 
	this->last_packet = _realtime_tick;
 

	
 
	if (!load_success) {
 
		DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
src/network/network_gui.cpp
Show inline comments
 
@@ -1184,23 +1184,23 @@ struct NetworkStartServerWindow : public
 
					ShowGenerateLandscape();
 
				}
 
				break;
 

	
 
			case WID_NSS_LOAD_GAME:
 
				_is_network_server = true;
 
				ShowSaveLoadDialog(FT_SAVEGAME, FOP_LOAD);
 
				ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD);
 
				break;
 

	
 
			case WID_NSS_PLAY_SCENARIO:
 
				_is_network_server = true;
 
				ShowSaveLoadDialog(FT_SCENARIO, FOP_LOAD);
 
				ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD);
 
				break;
 

	
 
			case WID_NSS_PLAY_HEIGHTMAP:
 
				_is_network_server = true;
 
				ShowSaveLoadDialog(FT_HEIGHTMAP,FOP_LOAD);
 
				ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
src/openttd.cpp
Show inline comments
 
@@ -325,13 +325,13 @@ static void LoadIntroGame(bool load_newg
 

	
 
	/* Setup main window */
 
	ResetWindowSystem();
 
	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);
 
	} else {
 
		SetLocalCompany(COMPANY_FIRST);
 
	}
 
@@ -618,18 +618,18 @@ int openttd_main(int argc, char *argv[])
 
		case 'e': _switch_mode = (_switch_mode == SM_LOAD_GAME || _switch_mode == SM_LOAD_SCENARIO ? SM_LOAD_SCENARIO : SM_EDITOR); break;
 
		case 'g':
 
			if (mgo.opt != NULL) {
 
				_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);
 
				}
 

	
 
				break;
 
			}
 

	
 
@@ -645,16 +645,16 @@ int openttd_main(int argc, char *argv[])
 
				ret = 1;
 
				goto exit_noshutdown;
 
			}
 

	
 
			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()) {
 
					char buf[256];
 
					SetDParamStr(0, _load_check_data.error_data);
 
					GetString(buf, _load_check_data.error, lastof(buf));
 
@@ -995,15 +995,15 @@ static void MakeNewEditorWorld()
 
 * @param mode mode of loading, either SL_LOAD or SL_OLD_LOAD
 
 * @param newgm switch to this mode of loading fails due to some unknown error
 
 * @param filename file to be loaded
 
 * @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;
 

	
 
	_game_mode = newgm;
 

	
 
	switch (lf == NULL ? SaveOrLoad(filename, fop, dft, subdir) : LoadWithFilter(lf)) {
 
@@ -1155,13 +1155,13 @@ void SwitchToMode(SwitchMode new_mode)
 
				BaseSounds::ini_set = stredup(BaseSounds::GetUsedSet()->name);
 
			}
 
			break;
 

	
 
		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 {
 
				DeleteWindowById(WC_SAVELOAD, 0);
 
			}
 
			break;
 
@@ -1366,13 +1366,13 @@ void StateGameLoop()
 
		NewsLoop();
 
	} else {
 
		if (_debug_desync_level > 2 && _date_fract == 0 && (_date & 0x1F) == 0) {
 
			/* 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();
 

	
 
		/* All these actions has to be done from OWNER_NONE
 
		 *  for multiplayer compatibility */
 
@@ -1423,13 +1423,13 @@ static void DoAutosave()
 
		seprintf(buf, lastof(buf), "autosave%d.sav", _autosave_ctr);
 

	
 
		if (++_autosave_ctr >= _settings_client.gui.max_num_autosaves) _autosave_ctr = 0;
 
	}
 

	
 
	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);
 
	}
 
}
 

	
 
void GameLoop()
 
{
src/saveload/saveload.cpp
Show inline comments
 
@@ -2775,25 +2775,25 @@ SaveOrLoadResult LoadWithFilter(LoadFilt
 
 * @param filename The name of the savegame being created/loaded
 
 * @param mode Save or load mode. Load can also be a TTD(Patch) game. Use #SL_LOAD, #SL_OLD_LOAD, #SL_LOAD_CHECK, or #SL_SAVE.
 
 * @param sb The sub directory to save the savegame in
 
 * @param threaded True when threaded saving is allowed
 
 * @return Return the result of the action. #SL_OK, #SL_ERROR, or #SL_REINIT ("unload" the game)
 
 */
 
SaveOrLoadResult SaveOrLoad(const char *filename, FileOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded)
 
SaveOrLoadResult SaveOrLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded)
 
{
 
	/* An instance of saving is already active, so don't go saving again */
 
	if (_sl.saveinprogress && fop == FOP_SAVE && dft == DFT_GAME_FILE && threaded) {
 
	if (_sl.saveinprogress && fop == SLO_SAVE && dft == DFT_GAME_FILE && threaded) {
 
		/* if not an autosave, but a user action, show error message */
 
		if (!_do_autosave) ShowErrorMessage(STR_ERROR_SAVE_STILL_IN_PROGRESS, INVALID_STRING_ID, WL_ERROR);
 
		return SL_OK;
 
	}
 
	WaitTillSaved();
 

	
 
	try {
 
		/* Load a TTDLX or TTDPatch game */
 
		if (fop == FOP_LOAD && dft == DFT_OLD_GAME_FILE) {
 
		if (fop == SLO_LOAD && dft == DFT_OLD_GAME_FILE) {
 
			InitializeGame(256, 256, true, true); // set a mapsize of 256x256 for TTDPatch games or it might get confused
 

	
 
			/* TTD/TTO savegames have no NewGRFs, TTDP savegame have them
 
			 * and if so a new NewGRF list will be made in LoadOldSaveGame.
 
			 * Note: this is done here because AfterLoadGame is also called
 
			 * for OTTD savegames which have their own NewGRF logic. */
 
@@ -2810,65 +2810,65 @@ SaveOrLoadResult SaveOrLoad(const char *
 
			GamelogStopAction();
 
			return SL_OK;
 
		}
 

	
 
		assert(dft == DFT_GAME_FILE);
 
		switch (fop) {
 
			case FOP_CHECK:
 
			case SLO_CHECK:
 
				_sl.action = SLA_LOAD_CHECK;
 
				break;
 

	
 
			case FOP_LOAD:
 
			case SLO_LOAD:
 
				_sl.action = SLA_LOAD;
 
				break;
 

	
 
			case FOP_SAVE:
 
			case SLO_SAVE:
 
				_sl.action = SLA_SAVE;
 
				break;
 

	
 
			default: NOT_REACHED();
 
		}
 

	
 
		FILE *fh = (fop == FOP_SAVE) ? FioFOpenFile(filename, "wb", sb) : FioFOpenFile(filename, "rb", sb);
 
		FILE *fh = (fop == SLO_SAVE) ? FioFOpenFile(filename, "wb", sb) : FioFOpenFile(filename, "rb", sb);
 

	
 
		/* Make it a little easier to load savegames from the console */
 
		if (fh == NULL && fop != FOP_SAVE) fh = FioFOpenFile(filename, "rb", SAVE_DIR);
 
		if (fh == NULL && fop != FOP_SAVE) fh = FioFOpenFile(filename, "rb", BASE_DIR);
 
		if (fh == NULL && fop != FOP_SAVE) fh = FioFOpenFile(filename, "rb", SCENARIO_DIR);
 
		if (fh == NULL && fop != SLO_SAVE) fh = FioFOpenFile(filename, "rb", SAVE_DIR);
 
		if (fh == NULL && fop != SLO_SAVE) fh = FioFOpenFile(filename, "rb", BASE_DIR);
 
		if (fh == NULL && fop != SLO_SAVE) fh = FioFOpenFile(filename, "rb", SCENARIO_DIR);
 

	
 
		if (fh == NULL) {
 
			SlError(fop == FOP_SAVE ? STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE : STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE);
 
			SlError(fop == SLO_SAVE ? STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE : STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE);
 
		}
 

	
 
		if (fop == FOP_SAVE) { // SAVE game
 
		if (fop == SLO_SAVE) { // SAVE game
 
			DEBUG(desync, 1, "save: %08x; %02x; %s", _date, _date_fract, filename);
 
			if (_network_server || !_settings_client.gui.threaded_saves) threaded = false;
 

	
 
			return DoSave(new FileWriter(fh), threaded);
 
		}
 

	
 
		/* LOAD game */
 
		assert(fop == FOP_LOAD || fop == FOP_CHECK);
 
		assert(fop == SLO_LOAD || fop == SLO_CHECK);
 
		DEBUG(desync, 1, "load: %s", filename);
 
		return DoLoad(new FileReader(fh), fop == FOP_CHECK);
 
		return DoLoad(new FileReader(fh), fop == SLO_CHECK);
 
	} catch (...) {
 
		/* This code may be executed both for old and new save games. */
 
		ClearSaveLoadState();
 

	
 
		/* Skip the "colour" character */
 
		if (fop != FOP_CHECK) DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
 
		if (fop != SLO_CHECK) DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
 

	
 
		/* A saver/loader exception!! reinitialize all variables to prevent crash! */
 
		return (fop == FOP_LOAD) ? SL_REINIT : SL_ERROR;
 
		return (fop == SLO_LOAD) ? SL_REINIT : SL_ERROR;
 
	}
 
}
 

	
 
/** Do a save when exiting the game (_settings_client.gui.autosave_on_exit) */
 
void DoExitSave()
 
{
 
	SaveOrLoad("exit.sav", FOP_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR);
 
	SaveOrLoad("exit.sav", SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR);
 
}
 

	
 
/**
 
 * Fill the buffer with the default name for a savegame *or* screenshot.
 
 * @param buf the buffer to write to.
 
 * @param last the last element in the buffer.
 
@@ -2906,25 +2906,25 @@ void GenerateDefaultSaveName(char *buf, 
 
/**
 
 * Set the mode and file type of the file to save or load based on the type of file entry at the file system.
 
 * @param ft Type of file entry of the file system.
 
 */
 
void FileToSaveLoad::SetMode(FiosType ft)
 
{
 
	this->SetMode(FOP_LOAD, GetAbstractFileType(ft), GetDetailedFileType(ft));
 
	this->SetMode(SLO_LOAD, GetAbstractFileType(ft), GetDetailedFileType(ft));
 
}
 

	
 
/**
 
 * Set the mode and file type of the file to save or load.
 
 * @param fop File operation being performed.
 
 * @param aft Abstract file type.
 
 * @param dft Detailed file type.
 
 */
 
void FileToSaveLoad::SetMode(FileOperation fop, AbstractFileType aft, DetailedFileType dft)
 
void FileToSaveLoad::SetMode(SaveLoadOperation fop, AbstractFileType aft, DetailedFileType dft)
 
{
 
	if (aft == FT_INVALID || aft == FT_NONE) {
 
		this->file_op = FOP_INVALID;
 
		this->file_op = SLO_INVALID;
 
		this->detail_ftype = DFT_INVALID;
 
		this->abstract_ftype = FT_INVALID;
 
		return;
 
	}
 

	
 
	this->file_op = fop;
src/saveload/saveload.h
Show inline comments
 
@@ -21,20 +21,20 @@ enum SaveOrLoadResult {
 
	SL_ERROR  = 1, ///< error that was caught before internal structures were modified
 
	SL_REINIT = 2, ///< error that was caught in the middle of updating game state, need to clear it. (can only happen during load)
 
};
 

	
 
/** Deals with the type of the savegame, independent of extension */
 
struct FileToSaveLoad {
 
	FileOperation file_op;           ///< File operation to perform.
 
	SaveLoadOperation file_op;           ///< File operation to perform.
 
	DetailedFileType detail_ftype;   ///< Concrete file type (PNG, BMP, old save, etc).
 
	AbstractFileType abstract_ftype; ///< Abstract type of file (scenario, heightmap, etc).
 
	char name[MAX_PATH];             ///< Name of the file.
 
	char title[255];                 ///< Internal name of the game.
 

	
 
	void SetMode(FiosType ft);
 
	void SetMode(FileOperation fop, AbstractFileType aft, DetailedFileType dft);
 
	void SetMode(SaveLoadOperation fop, AbstractFileType aft, DetailedFileType dft);
 
	void SetName(const char *name);
 
	void SetTitle(const char *title);
 
};
 

	
 
/** Types of save games. */
 
enum SavegameType {
 
@@ -48,13 +48,13 @@ enum SavegameType {
 

	
 
extern FileToSaveLoad _file_to_saveload;
 

	
 
void GenerateDefaultSaveName(char *buf, const char *last);
 
void SetSaveLoadError(uint16 str);
 
const char *GetSaveLoadErrorString();
 
SaveOrLoadResult SaveOrLoad(const char *filename, FileOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded = true);
 
SaveOrLoadResult SaveOrLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded = true);
 
void WaitTillSaved();
 
void ProcessAsyncSaveFinish();
 
void DoExitSave();
 

	
 
SaveOrLoadResult SaveWithFilter(struct SaveFilter *writer, bool threaded);
 
SaveOrLoadResult LoadWithFilter(struct LoadFilter *reader);
src/toolbar_gui.cpp
Show inline comments
 
@@ -424,23 +424,23 @@ static CallBackFunction ToolbarScenSaveO
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction MenuClickSaveLoad(int index = 0)
 
{
 
	if (_game_mode == GM_EDITOR) {
 
		switch (index) {
 
			case SLEME_SAVE_SCENARIO:  ShowSaveLoadDialog(FT_SCENARIO, FOP_SAVE);  break;
 
			case SLEME_LOAD_SCENARIO:  ShowSaveLoadDialog(FT_SCENARIO, FOP_LOAD);  break;
 
			case SLEME_SAVE_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,FOP_SAVE); break;
 
			case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,FOP_LOAD); break;
 
			case SLEME_SAVE_SCENARIO:  ShowSaveLoadDialog(FT_SCENARIO, SLO_SAVE);  break;
 
			case SLEME_LOAD_SCENARIO:  ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD);  break;
 
			case SLEME_SAVE_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_SAVE); break;
 
			case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD); break;
 
			case SLEME_EXIT_TOINTRO:   AskExitToGameMenu();                    break;
 
			case SLEME_EXIT_GAME:      HandleExitGameRequest();                break;
 
		}
 
	} else {
 
		switch (index) {
 
			case SLNME_SAVE_GAME:      ShowSaveLoadDialog(FT_SAVEGAME, FOP_SAVE); break;
 
			case SLNME_LOAD_GAME:      ShowSaveLoadDialog(FT_SAVEGAME, FOP_LOAD); break;
 
			case SLNME_SAVE_GAME:      ShowSaveLoadDialog(FT_SAVEGAME, SLO_SAVE); break;
 
			case SLNME_LOAD_GAME:      ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD); break;
 
			case SLNME_EXIT_TOINTRO:   AskExitToGameMenu();               break;
 
			case SLNME_EXIT_GAME:      HandleExitGameRequest();           break;
 
		}
 
	}
 
	return CBF_NONE;
 
}
 
@@ -1709,13 +1709,13 @@ struct MainToolbarWindow : Window {
 
	{
 
		switch (hotkey) {
 
			case MTHK_PAUSE: ToolbarPauseClick(this); break;
 
			case MTHK_FASTFORWARD: ToolbarFastForwardClick(this); break;
 
			case MTHK_SETTINGS: ShowGameOptions(); break;
 
			case MTHK_SAVEGAME: MenuClickSaveLoad(); break;
 
			case MTHK_LOADGAME: ShowSaveLoadDialog(FT_SAVEGAME, FOP_LOAD); break;
 
			case MTHK_LOADGAME: ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD); break;
 
			case MTHK_SMALLMAP: ShowSmallMap(); break;
 
			case MTHK_TOWNDIRECTORY: ShowTownDirectory(); break;
 
			case MTHK_SUBSIDIES: ShowSubsidiesList(); break;
 
			case MTHK_STATIONS: ShowCompanyStations(_local_company); break;
 
			case MTHK_FINANCES: ShowCompanyFinances(_local_company); break;
 
			case MTHK_COMPANIES: ShowCompany(_local_company); break;
src/video/dedicated_v.cpp
Show inline comments
 
@@ -139,13 +139,13 @@ static void CloseWindowsConsoleThread()
 

	
 
static void *_dedicated_video_mem;
 

	
 
/* Whether a fork has been done. */
 
bool _dedicated_forks;
 

	
 
extern bool SafeLoad(const char *filename, FileOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL);
 
extern bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL);
 

	
 
static FVideoDriver_Dedicated iFVideoDriver_Dedicated;
 

	
 

	
 
const char *VideoDriver_Dedicated::Start(const char * const *parm)
 
{
0 comments (0 inline, 0 general)