Changeset - r10066:d73a08a8dd72
[Not reviewed]
master
0 7 0
rubidium - 16 years ago 2008-09-03 07:51:07
rubidium@openttd.org
(svn r14233) -Feature/Fix [FS#2172]: save the palette of the loaded NewGRFs in the savegame, so joining with a server using Windows palette will make a client with the DOS palette do palette conversion and (thus) not cause a desync due to the different palettes disabling different NewGRFs.
7 files changed with 39 insertions and 18 deletions:
0 comments (0 inline, 0 general)
src/gfxinit.cpp
Show inline comments
 
@@ -290,29 +290,29 @@ static void LoadSpriteTables()
 
	/* Initialize the unicode to sprite mapping table */
 
	InitializeUnicodeGlyphMap();
 

	
 
	/*
 
	 * Load the base NewGRF with OTTD required graphics as first NewGRF.
 
	 * However, we do not want it to show up in the list of used NewGRFs,
 
	 * so we have to manually add it, and then remove it later.
 
	 */
 
	GRFConfig *top = _grfconfig;
 
	GRFConfig *master = CallocT<GRFConfig>(1);
 
	master->filename = strdup(_used_graphics_set->files[GFT_EXTRA].filename);
 
	FillGRFDetails(master, false);
 
	master->windows_paletted = (_used_graphics_set->palette == PAL_WINDOWS);
 
	ClrBit(master->flags, GCF_INIT_ONLY);
 
	master->next = top;
 
	_grfconfig = master;
 

	
 
	_palette_remap_grf[i] = (_use_palette != _used_graphics_set->palette);
 
	LoadNewGRF(SPR_NEWGRFS_BASE, i);
 

	
 
	/* Free and remove the top element. */
 
	ClearGRFConfig(&master);
 
	_grfconfig = top;
 
}
 

	
 

	
 
void GfxLoadSprites()
 
{
 
	DEBUG(sprite, 2, "Loading sprite set %d", _settings_game.game_creation.landscape);
 

	
src/lang/english.txt
Show inline comments
 
@@ -3185,28 +3185,31 @@ STR_PERFORMANCE_DETAIL_STATIONS_TIP     
 
STR_PERFORMANCE_DETAIL_MIN_PROFIT_TIP                           :{BLACK}The profit of the vehicle with the lowest income (of all vehicles older than 2 years)
 
STR_PERFORMANCE_DETAIL_MIN_INCOME_TIP                           :{BLACK}Amount of cash made in the month with the lowest profit of the last 12 quarters
 
STR_PERFORMANCE_DETAIL_MAX_INCOME_TIP                           :{BLACK}Amount of cash made in the month with the highest profit of the last 12 quarters
 
STR_PERFORMANCE_DETAIL_DELIVERED_TIP                            :{BLACK}Units of cargo delivered in the last four quarters
 
STR_PERFORMANCE_DETAIL_CARGO_TIP                                :{BLACK}Number of types of cargo delivered in the last quarter
 
STR_PERFORMANCE_DETAIL_MONEY_TIP                                :{BLACK}Amount of money this company has in the bank
 
STR_PERFORMANCE_DETAIL_LOAN_TIP                                 :{BLACK}The amount of money this company has taken on loan
 
STR_PERFORMANCE_DETAIL_TOTAL_TIP                                :{BLACK}Total points out of possible points
 

	
 
STR_NEWGRF_SETTINGS_BUTTON                                      :{BLACK}NewGRF Settings
 
STR_NEWGRF_SETTINGS_CAPTION                                     :{WHITE}NewGRF settings
 
STR_NEWGRF_APPLY_CHANGES                                        :{BLACK}Apply changes
 
STR_NEWGRF_TOGGLE_PALETTE                                       :{BLACK}Toggle palette
 
STR_NEWGRF_TOGGLE_PALETTE_TIP                                   :{BLACK}Toggle the palette of the selected NewGRF.{}Do this when the graphics from this NewGRF look pink in-game
 
STR_NEWGRF_SET_PARAMETERS                                       :{BLACK}Set parameters
 
STR_NEWGRF_TIP                                                  :{BLACK}A list of all the Newgrf sets that you have installed. Click a set to change the settings
 
STR_NEWGRF_NO_FILES_INSTALLED                                   :{BLACK}There are currently no newgrf files installed! Please refer to the manual for instructions on installing new graphics
 
STR_NEWGRF_FILENAME                                             :{BLACK}Filename: {SILVER}{RAW_STRING}
 
STR_NEWGRF_PALETTE                                              :{BLACK}Palette: {SILVER}{RAW_STRING}
 
STR_NEWGRF_GRF_ID                                               :{BLACK}GRF ID: {SILVER}{RAW_STRING}
 
STR_NEWGRF_MD5SUM                                               :{BLACK}MD5sum: {SILVER}{RAW_STRING}
 
STR_NEWGRF_CONFIRMATION_TEXT                                    :{YELLOW}You are about to make changes to a running game; this can crash OpenTTD.{}Are you absolutely sure about this?
 

	
 
STR_NEWGRF_ERROR_MSG_INFO                                       :{SILVER}{RAW_STRING}
 
STR_NEWGRF_ERROR_MSG_WARNING                                    :{RED}Warning: {SILVER}{RAW_STRING}
 
STR_NEWGRF_ERROR_MSG_ERROR                                      :{RED}Error: {SILVER}{RAW_STRING}
 
STR_NEWGRF_ERROR_MSG_FATAL                                      :{RED}Fatal: {SILVER}{RAW_STRING}
 
STR_NEWGRF_ERROR_VERSION_NUMBER                                 :{SKIP}{STRING1} will not work with the TTDPatch version reported by OpenTTD.
 
STR_NEWGRF_ERROR_DOS_OR_WINDOWS                                 :{SKIP}{STRING1} is for the {STRING1} version of TTD.
 
STR_NEWGRF_ERROR_UNSET_SWITCH                                   :{SKIP}{STRING1} is designed to be used with {STRING1}
 
STR_NEWGRF_ERROR_INVALID_PARAMETER                              :{SKIP}Invalid parameter for {STRING1}: parameter {STRING1} ({NUM})
src/newgrf.cpp
Show inline comments
 
@@ -3635,29 +3635,25 @@ bool GetGlobalVariable(byte param, uint3
 
			return true;
 

	
 
		case 0x0B: { // TTDPatch version
 
			uint major    = 2;
 
			uint minor    = 6;
 
			uint revision = 1; // special case: 2.0.1 is 2.0.10
 
			uint build    = 1382;
 
			*value = (major << 24) | (minor << 20) | (revision << 16) | build;
 
			return true;
 
		}
 

	
 
		case 0x0D: // TTD Version, 00=DOS, 01=Windows
 
			if (_palette_remap_grf[_file_index]) {
 
				*value = !_use_palette;
 
			} else {
 
				*value = _use_palette;
 
			}
 
			*value = _cur_grfconfig->windows_paletted;
 
			return true;
 

	
 
		case 0x0E: // Y-offset for train sprites
 
			*value = _traininfo_vehicle_pitch;
 
			return true;
 

	
 
		case 0x0F: // Rail track type cost factors
 
			*value = 0;
 
			SB(*value, 0, 8, GetRailTypeInfo(RAILTYPE_RAIL)->cost_multiplier); // normal rail
 
			if (_settings_game.vehicle.disable_elrails) {
 
				/* skip elrail multiplier - disabled */
 
				SB(*value, 8, 8, GetRailTypeInfo(RAILTYPE_MONO)->cost_multiplier); // monorail
 
@@ -4091,25 +4087,25 @@ static void GRFInfo(byte *buf, size_t le
 

	
 
	if (!check_length(len, 8, "GRFInfo")) return;
 
	buf++;
 
	uint8 version    = grf_load_byte(&buf);
 
	uint32 grfid     = grf_load_dword(&buf);
 
	const char *name = grf_load_string(&buf, len - 6);
 

	
 
	_cur_grffile->grfid = grfid;
 
	_cur_grffile->grf_version = version;
 
	_cur_grfconfig->status = _cur_stage < GLS_RESERVE ? GCS_INITIALISED : GCS_ACTIVATED;
 

	
 
	/* Do swap the GRFID for displaying purposes since people expect that */
 
	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08lX - %s", version, BSWAP32(grfid), name);
 
	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08lX - %s (palette: %s)", version, BSWAP32(grfid), name, _cur_grfconfig->windows_paletted ? "Windows" : "DOS");
 
}
 

	
 
/* Action 0x0A */
 
static void SpriteReplace(byte *buf, size_t len)
 
{
 
	/* <0A> <num-sets> <set1> [<set2> ...]
 
	 * <set>: <num-sprites> <first-sprite>
 
	 *
 
	 * B num-sets      How many sets of sprites to replace.
 
	 * Each set:
 
	 * B num-sprites   How many sprites are in this set
 
	 * W first-sprite  First sprite number to replace */
 
@@ -5885,24 +5881,25 @@ void LoadNewGRFFile(GRFConfig *config, u
 

	
 
	if (file_index > LAST_GRF_SLOT) {
 
		DEBUG(grf, 0, "'%s' is not loaded as the maximum number of GRFs has been reached", filename);
 
		config->status = GCS_DISABLED;
 
		config->error  = CallocT<GRFError>(1);
 
		config->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
 
		config->error->message  = STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED;
 
		return;
 
	}
 

	
 
	FioOpenFile(file_index, filename);
 
	_file_index = file_index; // XXX
 
	_palette_remap_grf[_file_index] = (config->windows_paletted != (_use_palette == PAL_WINDOWS));
 

	
 
	_cur_grfconfig = config;
 

	
 
	DEBUG(grf, 2, "LoadNewGRFFile: Reading NewGRF-file '%s'", filename);
 

	
 
	/* Skip the first sprite; we don't care about how many sprites this
 
	 * does contain; newest TTDPatches and George's longvehicles don't
 
	 * neither, apparently. */
 
	if (FioReadWord() == 4 && FioReadByte() == 0xFF) {
 
		FioReadDword();
 
	} else {
 
		DEBUG(grf, 7, "LoadNewGRFFile: Custom .grf has invalid format");
src/newgrf_config.cpp
Show inline comments
 
@@ -5,24 +5,25 @@
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "variables.h"
 
#include "saveload.h"
 
#include "md5.h"
 
#include "newgrf.h"
 
#include "newgrf_config.h"
 
#include "core/alloc_func.hpp"
 
#include "string_func.h"
 
#include "gamelog.h"
 
#include "network/network_type.h"
 
#include "gfx_func.h"
 

	
 
#include "fileio_func.h"
 
#include "fios.h"
 

	
 

	
 
GRFConfig *_all_grfs;
 
GRFConfig *_grfconfig;
 
GRFConfig *_grfconfig_newgame;
 
GRFConfig *_grfconfig_static;
 

	
 

	
 
/* Calculate the MD5 Sum for a GRF */
 
@@ -63,24 +64,26 @@ bool FillGRFDetails(GRFConfig *config, b
 

	
 
	/* Skip if the grfid is 0 (not read) or 0xFFFFFFFF (ttdp system grf) */
 
	if (config->grfid == 0 || config->grfid == 0xFFFFFFFF || config->IsOpenTTDBaseGRF()) return false;
 

	
 
	if (is_static) {
 
		/* Perform a 'safety scan' for static GRFs */
 
		LoadNewGRFFile(config, 62, GLS_SAFETYSCAN);
 

	
 
		/* GCF_UNSAFE is set if GLS_SAFETYSCAN finds unsafe actions */
 
		if (HasBit(config->flags, GCF_UNSAFE)) return false;
 
	}
 

	
 
	config->windows_paletted = (_use_palette == PAL_WINDOWS);
 

	
 
	return CalcGRFMD5Sum(config);
 
}
 

	
 

	
 
void ClearGRFConfig(GRFConfig **config)
 
{
 
	/* GCF_COPY as in NOT strdupped/alloced the filename, name and info */
 
	if (!HasBit((*config)->flags, GCF_COPY)) {
 
		free((*config)->filename);
 
		free((*config)->name);
 
		free((*config)->info);
 

	
 
@@ -472,51 +475,53 @@ static const uint32 OPENTTD_GRAPHICS_BAS
 

	
 
/**
 
 * Checks whether this GRF is a OpenTTD base graphic GRF.
 
 * @return true if and only if it is a base GRF.
 
 */
 
bool GRFConfig::IsOpenTTDBaseGRF() const
 
{
 
	return (this->grfid & 0x00FFFFFF) == OPENTTD_GRAPHICS_BASE_GRF_ID;
 
}
 

	
 

	
 
static const SaveLoad _grfconfig_desc[] = {
 
	SLE_STR(GRFConfig, filename,   SLE_STR, 0x40),
 
	SLE_VAR(GRFConfig, grfid,      SLE_UINT32),
 
	SLE_ARR(GRFConfig, md5sum,     SLE_UINT8, 16),
 
	SLE_ARR(GRFConfig, param,      SLE_UINT32, 0x80),
 
	SLE_VAR(GRFConfig, num_params, SLE_UINT8),
 
	    SLE_STR(GRFConfig, filename,         SLE_STR,    0x40),
 
	    SLE_VAR(GRFConfig, grfid,            SLE_UINT32),
 
	    SLE_ARR(GRFConfig, md5sum,           SLE_UINT8,  16),
 
	    SLE_ARR(GRFConfig, param,            SLE_UINT32, 0x80),
 
	    SLE_VAR(GRFConfig, num_params,       SLE_UINT8),
 
	SLE_CONDVAR(GRFConfig, windows_paletted, SLE_BOOL,   101, SL_MAX_VERSION),
 
	SLE_END()
 
};
 

	
 

	
 
static void Save_NGRF()
 
{
 
	int index = 0;
 

	
 
	for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
 
		if (HasBit(c->flags, GCF_STATIC)) continue;
 
		SlSetArrayIndex(index++);
 
		SlObject(c, _grfconfig_desc);
 
	}
 
}
 

	
 

	
 
static void Load_NGRF()
 
{
 
	ClearGRFConfigList(&_grfconfig);
 
	while (SlIterateArray() != -1) {
 
		GRFConfig *c = CallocT<GRFConfig>(1);
 
		SlObject(c, _grfconfig_desc);
 
		if (CheckSavegameVersion(101)) c->windows_paletted = (_use_palette == PAL_WINDOWS);
 
		AppendToGRFConfigList(&_grfconfig, c);
 
	}
 

	
 
	/* Append static NewGRF configuration */
 
	AppendStaticGRFConfigs(&_grfconfig);
 
}
 

	
 
extern const ChunkHandler _newgrf_chunk_handlers[] = {
 
	{ 'NGRF', Save_NGRF, Load_NGRF, CH_ARRAY | CH_LAST }
 
};
 

	
 

	
src/newgrf_config.h
Show inline comments
 
@@ -59,24 +59,25 @@ struct GRFError {
 
/** Information about GRF, used in the game and (part of it) in savegames */
 
struct GRFConfig : public GRFIdentifier {
 
	char *filename;     ///< Filename - either with or without full path
 
	char *name;         ///< NOSAVE: GRF name (Action 0x08)
 
	char *info;         ///< NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
 
	GRFError *error;    ///< NOSAVE: Error/Warning during GRF loading (Action 0x0B)
 

	
 
	uint8 flags;        ///< NOSAVE: GCF_Flags, bitset
 
	GRFStatus status;   ///< NOSAVE: GRFStatus, enum
 
	uint32 grf_bugs;    ///< NOSAVE: bugs in this GRF in this run, @see enum GRFBugs
 
	uint32 param[0x80]; ///< GRF parameters
 
	uint8 num_params;   ///< Number of used parameters
 
	bool windows_paletted;  ///< Whether the NewGRF is Windows paletted or not
 

	
 
	struct GRFConfig *next; ///< NOSAVE: Next item in the linked list
 

	
 
	bool IsOpenTTDBaseGRF() const;
 
};
 

	
 
extern GRFConfig *_all_grfs;          ///< First item in list of all scanned NewGRFs
 
extern GRFConfig *_grfconfig;         ///< First item in list of current GRF set up
 
extern GRFConfig *_grfconfig_newgame; ///< First item in list of default GRF set up
 
extern GRFConfig *_grfconfig_static;  ///< First item in list of static GRF set up
 

	
 
void ScanNewGRFFiles();
src/newgrf_gui.cpp
Show inline comments
 
@@ -91,24 +91,28 @@ static void ShowNewGRFInfo(const GRFConf
 
	/* Show GRF parameter list */
 
	if (show_params) {
 
		if (c->num_params > 0) {
 
			GRFBuildParamList(buff, c, lastof(buff));
 
			SetDParam(0, STR_JUST_RAW_STRING);
 
			SetDParamStr(1, buff);
 
		} else {
 
			SetDParam(0, STR_01A9_NONE);
 
		}
 
		y += DrawStringMultiLine(x, y, STR_NEWGRF_PARAMETER, w, bottom - y);
 
	}
 

	
 
	/* Draw the palette of the NewGRF */
 
	SetDParamStr(0, c->windows_paletted ? "Windows" : "DOS");
 
	y += DrawStringMultiLine(x, y, STR_NEWGRF_PALETTE, w, bottom - y);
 

	
 
	/* Show flags */
 
	if (c->status == GCS_NOT_FOUND)        y += DrawStringMultiLine(x, y, STR_NEWGRF_NOT_FOUND, w, bottom - y);
 
	if (c->status == GCS_DISABLED)         y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w, bottom - y);
 
	if (HasBit(c->flags, GCF_COMPATIBLE)) y += DrawStringMultiLine(x, y, STR_NEWGRF_COMPATIBLE_LOADED, w, bottom - y);
 

	
 
	/* Draw GRF info if it exists */
 
	if (c->info != NULL && !StrEmpty(c->info)) {
 
		SetDParam(0, STR_JUST_RAW_STRING);
 
		SetDParamStr(1, c->info);
 
		y += DrawStringMultiLine(x, y, STR_02BD, w, bottom - y);
 
	} else {
 
		y += DrawStringMultiLine(x, y, STR_NEWGRF_NO_INFO, w, bottom - y);
 
@@ -292,24 +296,25 @@ struct NewGRFWindow : public Window {
 
		SNGRFS_PRESET_LIST,
 
		SNGRFS_PRESET_SAVE,
 
		SNGRFS_PRESET_DELETE,
 
		SNGRFS_BACKGROUND2,
 
		SNGRFS_ADD,
 
		SNGRFS_REMOVE,
 
		SNGRFS_MOVE_UP,
 
		SNGRFS_MOVE_DOWN,
 
		SNGRFS_FILE_LIST,
 
		SNGRFS_SCROLLBAR,
 
		SNGRFS_NEWGRF_INFO,
 
		SNGRFS_SET_PARAMETERS,
 
		SNGRFS_TOGGLE_PALETTE,
 
		SNGRFS_APPLY_CHANGES,
 
		SNGRFS_RESIZE,
 
	};
 

	
 
	GRFConfig **orig_list; ///< grf list the window is shown with
 
	GRFConfig *list;       ///< temporary grf list to which changes are made
 
	GRFConfig *sel;        ///< selected grf item
 
	bool editable;         ///< is the window editable
 
	bool show_params;      ///< are the grf-parameters shown in the info-panel
 
	bool execute;          ///< on pressing 'apply changes' are grf changes applied immediately, or only list is updated
 
	int query_widget;      ///< widget that opened a query
 
	int preset;            ///< selected preset
 
@@ -350,24 +355,25 @@ struct NewGRFWindow : public Window {
 
		const GRFConfig *c;
 
		int i;
 

	
 
		for (c = this->list, i = 0; c != NULL; c = c->next, i++) {}
 

	
 
		this->vscroll.cap = (this->widget[SNGRFS_FILE_LIST].bottom - this->widget[SNGRFS_FILE_LIST].top) / 14 + 1;
 
		SetVScrollCount(this, i);
 

	
 
		this->SetWidgetsDisabledState(!this->editable,
 
			SNGRFS_PRESET_LIST,
 
			SNGRFS_ADD,
 
			SNGRFS_APPLY_CHANGES,
 
			SNGRFS_TOGGLE_PALETTE,
 
			WIDGET_LIST_END
 
		);
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		bool disable_all = this->sel == NULL || !this->editable;
 

	
 
		this->SetWidgetsDisabledState(disable_all,
 
			SNGRFS_REMOVE,
 
			SNGRFS_MOVE_UP,
 
			SNGRFS_MOVE_DOWN,
 
@@ -562,24 +568,32 @@ struct NewGRFWindow : public Window {
 
				break;
 

	
 
			case SNGRFS_SET_PARAMETERS: { // Edit parameters
 
				if (this->sel == NULL) break;
 

	
 
				this->query_widget = widget;
 
				static char buff[512];
 
				GRFBuildParamList(buff, this->sel, lastof(buff));
 
				SetDParamStr(0, buff);
 
				ShowQueryString(STR_JUST_RAW_STRING, STR_NEWGRF_PARAMETER_QUERY, 63, 250, this, CS_ALPHANUMERAL);
 
				break;
 
			}
 

	
 
			case SNGRFS_TOGGLE_PALETTE: {
 
				if (this->sel != NULL) {
 
					this->sel->windows_paletted ^= true;
 
					this->SetDirty();
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		if (index == -1) {
 
			ClearGRFConfigList(&this->list);
 
			this->preset = -1;
 
		} else {
 
			GRFConfig *c = LoadGRFPresetFromConfig(_grf_preset_list[index]);
 

	
 
			if (c != NULL) {
 
@@ -656,34 +670,35 @@ static const Widget _newgrf_widgets[] = 
 
{    WWT_CAPTION, RESIZE_RIGHT,  COLOUR_MAUVE,   11, 299,   0,  13, STR_NEWGRF_SETTINGS_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS },  // SNGRFS_CAPTION
 
{      WWT_PANEL, RESIZE_RIGHT,  COLOUR_MAUVE,    0, 299,  14,  41, STR_NULL,                    STR_NULL },                         // SNGRFS_BACKGROUND1
 
{   WWT_DROPDOWN, RESIZE_RIGHT,  COLOUR_YELLOW,  10, 103,  16,  27, STR_EMPTY,                   STR_NEWGRF_PRESET_LIST_TIP },       // SNGRFS_PRESET_LIST
 
{ WWT_PUSHTXTBTN,    RESIZE_LR,  COLOUR_YELLOW, 104, 196,  16,  27, STR_NEWGRF_PRESET_SAVE,      STR_NEWGRF_PRESET_SAVE_TIP },       // SNGRFS_PRESET_SAVE
 
{ WWT_PUSHTXTBTN,    RESIZE_LR,  COLOUR_YELLOW, 197, 289,  16,  27, STR_NEWGRF_PRESET_DELETE,    STR_NEWGRF_PRESET_DELETE_TIP },     // SNGRFS_PRESET_DELETE
 
{      WWT_PANEL, RESIZE_RIGHT,  COLOUR_MAUVE,    0, 299,  30,  45, STR_NULL,                    STR_NULL },                         // SNGRFS_BACKGROUND
 
{ WWT_PUSHTXTBTN,  RESIZE_NONE,  COLOUR_YELLOW,  10,  79,  32,  43, STR_NEWGRF_ADD,              STR_NEWGRF_ADD_TIP },               // SNGRFS_ADD
 
{ WWT_PUSHTXTBTN,  RESIZE_NONE,  COLOUR_YELLOW,  80, 149,  32,  43, STR_NEWGRF_REMOVE,           STR_NEWGRF_REMOVE_TIP },            // SNGRFS_REMOVE
 
{ WWT_PUSHTXTBTN,  RESIZE_NONE,  COLOUR_YELLOW, 150, 219,  32,  43, STR_NEWGRF_MOVEUP,           STR_NEWGRF_MOVEUP_TIP },            // SNGRFS_MOVE_UP
 
{ WWT_PUSHTXTBTN, RESIZE_RIGHT,  COLOUR_YELLOW, 220, 289,  32,  43, STR_NEWGRF_MOVEDOWN,         STR_NEWGRF_MOVEDOWN_TIP },          // SNGRFS_MOVE_DOWN
 
{     WWT_MATRIX,    RESIZE_RB,  COLOUR_MAUVE,    0, 287,  46, 115, 0x501,                       STR_NEWGRF_FILE_TIP },              // SNGRFS_FILE_LIST
 
{  WWT_SCROLLBAR,   RESIZE_LRB,  COLOUR_MAUVE,  288, 299,  46, 115, 0x0,                         STR_0190_SCROLL_BAR_SCROLLS_LIST }, // SNGRFS_SCROLLBAR
 
{      WWT_PANEL,   RESIZE_RTB,  COLOUR_MAUVE,    0, 299, 116, 228, STR_NULL,                    STR_NULL },                         // SNGRFS_NEWGRF_INFO
 
{ WWT_PUSHTXTBTN,    RESIZE_TB,  COLOUR_MAUVE,    0, 143, 229, 240, STR_NEWGRF_SET_PARAMETERS,   STR_NULL },                         // SNGRFS_SET_PARAMETERS
 
{ WWT_PUSHTXTBTN,   RESIZE_RTB,  COLOUR_MAUVE,  144, 287, 229, 240, STR_NEWGRF_APPLY_CHANGES,    STR_NULL },                         // SNGRFS_APPLY_CHANGES
 
{  WWT_RESIZEBOX,  RESIZE_LRTB,  COLOUR_MAUVE,  288, 299, 229, 240, 0x0,                         STR_RESIZE_BUTTON },                // SNGRFS_RESIZE
 
{      WWT_PANEL,   RESIZE_RTB,  COLOUR_MAUVE,    0, 299, 116, 238, STR_NULL,                    STR_NULL },                         // SNGRFS_NEWGRF_INFO
 
{ WWT_PUSHTXTBTN,    RESIZE_TB,  COLOUR_MAUVE,    0,  95, 239, 250, STR_NEWGRF_SET_PARAMETERS,   STR_NULL },                         // SNGRFS_SET_PARAMETERS
 
{ WWT_PUSHTXTBTN,   RESIZE_RTB,  COLOUR_MAUVE,   96, 191, 239, 250, STR_NEWGRF_TOGGLE_PALETTE,   STR_NEWGRF_TOGGLE_PALETTE_TIP },    // SNGRFS_TOGGLE_PALETTE
 
{ WWT_PUSHTXTBTN,   RESIZE_RTB,  COLOUR_MAUVE,  192, 287, 239, 250, STR_NEWGRF_APPLY_CHANGES,    STR_NULL },                         // SNGRFS_APPLY_CHANGES
 
{  WWT_RESIZEBOX,  RESIZE_LRTB,  COLOUR_MAUVE,  288, 299, 239, 250, 0x0,                         STR_RESIZE_BUTTON },                // SNGRFS_RESIZE
 
{ WIDGETS_END },
 
};
 

	
 
/* Window definition of the manage newgrfs window */
 
static const WindowDesc _newgrf_desc = {
 
	WDP_CENTER, WDP_CENTER, 300, 241, 300, 241,
 
	WDP_CENTER, WDP_CENTER, 300, 251, 300, 251,
 
	WC_GAME_OPTIONS, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
 
	_newgrf_widgets,
 
};
 

	
 
/** Callback function for the newgrf 'apply changes' confirmation window
 
 * @param w Window which is calling this callback
 
 * @param confirmed boolean value, true when yes was clicked, false otherwise
 
 */
 
static void NewGRFConfirmationCallback(Window *w, bool confirmed)
 
{
 
	if (confirmed) {
src/saveload.cpp
Show inline comments
 
@@ -28,25 +28,25 @@
 
#include "core/alloc_func.hpp"
 
#include "functions.h"
 
#include "core/endian_func.hpp"
 
#include "vehicle_base.h"
 
#include "autoreplace_base.h"
 
#include "statusbar_gui.h"
 
#include "fileio_func.h"
 
#include <list>
 
#include "gamelog.h"
 

	
 
#include "table/strings.h"
 

	
 
extern const uint16 SAVEGAME_VERSION = 100;
 
extern const uint16 SAVEGAME_VERSION = 101;
 

	
 
SavegameType _savegame_type; ///< type of savegame we are loading
 

	
 
uint32 _ttdp_version;     ///< version of TTDP savegame (if applicable)
 
uint16 _sl_version;       ///< the major savegame version identifier
 
byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
 

	
 
typedef void WriterProc(size_t len);
 
typedef size_t ReaderProc();
 

	
 
/** The saveload struct, containing reader-writer functions, bufffer, version, etc. */
 
static struct {
0 comments (0 inline, 0 general)