Changeset - r8152:85dbf9d0e190
[Not reviewed]
master
0 4 0
belugas - 16 years ago 2007-12-28 04:20:56
belugas@openttd.org
(svn r11714) -Fix[FS#1569]: Do not allow player inauguration date on scenarios to be bigger than current year.
This will not (yet) be true if you are loading a scenario with the "-g" command line option.
4 files changed with 33 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/fios.h
Show inline comments
 
@@ -32,6 +32,14 @@ enum SaveLoadDialogMode{
 
	SLD_NEW_GAME,
 
};
 

	
 
/* The different types of files been handled by the system */
 
enum FileType {
 
	FT_NONE,      ///< nothing to do
 
	FT_SAVEGAME,  ///< old or new savegame
 
	FT_SCENARIO,  ///< old or new scenario
 
	FT_HEIGHTMAP, ///< heightmap file
 
};
 

	
 
enum {
 
	FIOS_TYPE_DRIVE        =   0,
 
	FIOS_TYPE_PARENT       =   1,
 
@@ -57,6 +65,7 @@ struct FiosItem {
 
/* Deals with the type of the savegame, independent of extension */
 
struct SmallFiosItem {
 
	int mode;             ///< savegame/scenario type (old, new)
 
	FileType filetype;    ///< what type of file are we dealing with
 
	char name[MAX_PATH];  ///< name
 
	char title[255];      ///< internal name of the game
 
};
src/misc_gui.cpp
Show inline comments
 
@@ -1671,6 +1671,17 @@ static const WindowDesc _save_dialog_des
 
	SaveLoadDlgWndProc,
 
};
 

	
 
/** These values are used to convert the file/operations mode into a corresponding file type.
 
 * So each entry, as expressed by the related comment, is based on the enum   */
 
static const FileType _file_modetotype[] = {
 
	FT_SAVEGAME,  ///< used for SLD_LOAD_GAME
 
	FT_SCENARIO,  ///< used for SLD_LOAD_SCENARIO
 
	FT_SAVEGAME,  ///< used for SLD_SAVE_GAME
 
	FT_SCENARIO,  ///< used for SLD_SAVE_SCENARIO
 
	FT_HEIGHTMAP, ///< used for SLD_LOAD_HEIGHTMAP
 
	FT_SAVEGAME,  ///< SLD_NEW_GAME
 
};
 

	
 
void ShowSaveLoadDialog(SaveLoadDialogMode mode)
 
{
 
	static const StringID saveload_captions[] = {
 
@@ -1692,6 +1703,9 @@ void ShowSaveLoadDialog(SaveLoadDialogMo
 
	_saveload_mode = mode;
 
	SetBit(_no_scroll, SCROLL_SAVE);
 

	
 
	/* Use an array to define what will be the current file type being handled
 
	 * by current file mode */
 
	_file_to_saveload.filetype = _file_modetotype[mode];
 
	switch (mode) {
 
		case SLD_SAVE_GAME:     GenerateFileName(); break;
 
		case SLD_SAVE_SCENARIO: strcpy(_edit_str_buf, "UNNAMED"); break;
src/network/network_gui.cpp
Show inline comments
 
@@ -810,6 +810,7 @@ static void NetworkStartServerWindowWndP
 
				char *name = FiosBrowseTo(nd->map);
 
				if (name != NULL) {
 
					SetFiosType(nd->map->type);
 
					_file_to_saveload.filetype = FT_SCENARIO;
 
					ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
 
					ttd_strlcpy(_file_to_saveload.title, nd->map->title, sizeof(_file_to_saveload.title));
 

	
src/openttd.cpp
Show inline comments
 
@@ -1289,7 +1289,15 @@ static bool InitializeWindowsAndCaches()
 
	Player *players[MAX_PLAYERS];
 
	const Vehicle *v;
 

	
 
	for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) players[i] = GetPlayer(i);
 
	for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
 
		players[i] = GetPlayer(i);
 

	
 
		/* For each player, verify (while loading a scenario) that the inauguration date is the current year and set it
 
		 * accordingly if it is not the case.  No need to set it on players that are not been used already,
 
		 * thus the MIN_YEAR (which is really nothing more than Zero, initialized value) test */
 
		if (_file_to_saveload.filetype == FT_SCENARIO && players[i]->inaugurated_year != MIN_YEAR)
 
			players[i]->inaugurated_year = _cur_year;
 
	}
 

	
 
	FOR_ALL_VEHICLES(v) {
 
		if (!IsEngineCountable(v)) continue;
0 comments (0 inline, 0 general)