Changeset - r15588:8aad267fa5ef
[Not reviewed]
master
0 5 0
yexo - 14 years ago 2010-07-31 12:15:12
yexo@openttd.org
(svn r20258) -Feature: more user-friendly gui to change NewGRF parameters
5 files changed with 288 insertions and 37 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -2362,48 +2362,53 @@ STR_NEWGRF_SETTINGS_MOVEUP_TOOLTIP      
 
STR_NEWGRF_SETTINGS_MOVEDOWN                                    :{BLACK}Move Down
 
STR_NEWGRF_SETTINGS_MOVEDOWN_TOOLTIP                            :{BLACK}Move the selected NewGRF file down the list
 
STR_NEWGRF_SETTINGS_FILE_TOOLTIP                                :{BLACK}A list of the NewGRF files that are installed. Click a file to change its parameters
 

	
 
STR_NEWGRF_SETTINGS_SET_PARAMETERS                              :{BLACK}Set parameters
 
STR_NEWGRF_SETTINGS_TOGGLE_PALETTE                              :{BLACK}Toggle palette
 
STR_NEWGRF_SETTINGS_TOGGLE_PALETTE_TOOLTIP                      :{BLACK}Toggle the palette of the selected NewGRF.{}Do this when the graphics from this NewGRF look pink in-game
 
STR_NEWGRF_SETTINGS_APPLY_CHANGES                               :{BLACK}Apply changes
 

	
 
STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON                 :{BLACK}Find missing content online
 
STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP                :{BLACK}Check whether the missing content can be found online
 

	
 
STR_NEWGRF_SETTINGS_FILENAME                                    :{BLACK}Filename: {SILVER}{RAW_STRING}
 
STR_NEWGRF_SETTINGS_GRF_ID                                      :{BLACK}GRF ID: {SILVER}{RAW_STRING}
 
STR_NEWGRF_SETTINGS_MD5SUM                                      :{BLACK}MD5sum: {SILVER}{RAW_STRING}
 
STR_NEWGRF_SETTINGS_PALETTE                                     :{BLACK}Palette: {SILVER}{RAW_STRING}
 
STR_NEWGRF_SETTINGS_PARAMETER                                   :{BLACK}Parameters: {SILVER}{STRING1}
 

	
 
STR_NEWGRF_SETTINGS_NO_INFO                                     :{BLACK}No information available
 
STR_NEWGRF_SETTINGS_NOT_FOUND                                   :{RED}Matching file not found
 
STR_NEWGRF_SETTINGS_DISABLED                                    :{RED}Disabled
 

	
 
STR_NEWGRF_SETTINGS_PARAMETER_QUERY                             :{BLACK}Enter NewGRF parameters
 

	
 
# NewGRF parameters window
 
STR_NEWGRF_PARAMETERS_CAPTION                                   :{WHITE}Change NewGRF parameters
 
STR_NEWGRF_PARAMETERS_CLOSE                                     :{BLACK}Close
 
STR_NEWGRF_PARAMETERS_DEFAULT_NAME                              :Parameter {NUM}
 

	
 
# NewGRF inspect window
 
STR_NEWGRF_INSPECT_CAPTION                                      :{WHITE}Inspect - {STRING5}
 
STR_NEWGRF_INSPECT_PARENT_BUTTON                                :{BLACK}Parent
 
STR_NEWGRF_INSPECT_PARENT_TOOLTIP                               :{BLACK}Inspect the object of the parent scope
 

	
 
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT                            :{STRING1} at {HEX}
 
STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE                  :Rail type
 

	
 
STR_NEWGRF_INSPECT_QUERY_CAPTION                                :{WHITE}NewGRF variable 60+x parameter (hexadecimal)
 

	
 
# Sprite aligner window
 
STR_SPRITE_ALIGNER_CAPTION                                      :{WHITE}Aligning sprite {COMMA} ({RAW_STRING})
 
STR_SPRITE_ALIGNER_NEXT_BUTTON                                  :{BLACK}Next sprite
 
STR_SPRITE_ALIGNER_NEXT_TOOLTIP                                 :{BLACK}Proceed to the next normal sprite, skipping any pseudo/recolour/font sprites and wrapping around at the end
 
STR_SPRITE_ALIGNER_GOTO_BUTTON                                  :{BLACK}Go to sprite
 
STR_SPRITE_ALIGNER_GOTO_TOOLTIP                                 :{BLACK}Go to the given sprite. If the sprite is not a normal sprite, proceed to the next normal sprite
 
STR_SPRITE_ALIGNER_PREVIOUS_BUTTON                              :{BLACK}Previous sprite
 
STR_SPRITE_ALIGNER_PREVIOUS_TOOLTIP                             :{BLACK}Proceed to the previous normal sprite, skipping any pseudo/recolour/font sprites and wrapping around at the begin
 
STR_SPRITE_ALIGNER_SPRITE_TOOLTIP                               :{BLACK}Representation of the currently selected sprite. The alignment is ignored when drawing this sprite
 
STR_SPRITE_ALIGNER_MOVE_TOOLTIP                                 :{BLACK}Move the sprite around, changing the X and Y offsets
 
STR_SPRITE_ALIGNER_OFFSETS                                      :{BLACK}X offset: {NUM}, Y offset: {NUM}
 
STR_SPRITE_ALIGNER_PICKER_BUTTON                                :{BLACK}Pick sprite
 
STR_SPRITE_ALIGNER_PICKER_TOOLTIP                               :{BLACK}Pick a sprite from anywhere on the screen
 

	
src/newgrf_config.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/*
 
 * This file is part of OpenTTD.
 
 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
/** @file newgrf_config.cpp Finding NewGRFs and configuring them. */
 

	
 
#include "stdafx.h"
 
#include "debug.h"
 
#include "3rdparty/md5/md5.h"
 
#include "newgrf.h"
 
#include "gamelog.h"
 
#include "network/network_func.h"
 
#include "gfx_func.h"
 
#include "newgrf_text.h"
 
#include "window_func.h"
 

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

	
 
/**
 
 * Create a new GRFConfig.
 
 * @param filename Set the filename of this GRFConfig to filename. The argument
 
 *   is copied so the original string isn't needed after the constructor.
 
 */
 
GRFConfig::GRFConfig(const char *filename) :
 
	num_valid_params(lengthof(param))
 
{
 
	if (filename != NULL) this->filename = strdup(filename);
 
}
 

	
 
/**
 
 * Create a new GRFConfig that is a deep copy of an existing config.
 
 * @param config The GRFConfig object to make a copy of.
 
 */
 
GRFConfig::GRFConfig(const GRFConfig &config) :
 
	ident(config.ident),
 
	flags(config.flags & ~GCF_COPY),
 
	status(config.status),
 
	grf_bugs(config.grf_bugs),
 
@@ -175,48 +176,77 @@ GRFParameterInfo::GRFParameterInfo(GRFPa
 
	min_value(info.min_value),
 
	max_value(info.max_value),
 
	param_nr(info.param_nr),
 
	first_bit(info.first_bit),
 
	num_bit(info.num_bit)
 
{
 
	for (uint i = 0; i < info.value_names.Length(); i++) {
 
		SmallPair<uint32, GRFText *> *data = info.value_names.Get(i);
 
		this->value_names.Insert(data->first, DuplicateGRFText(data->second));
 
	}
 
}
 

	
 
/** Cleanup all parameter info. */
 
GRFParameterInfo::~GRFParameterInfo()
 
{
 
	CleanUpGRFText(this->name);
 
	CleanUpGRFText(this->desc);
 
	for (uint i = 0; i < this->value_names.Length(); i++) {
 
		SmallPair<uint32, GRFText *> *data = this->value_names.Get(i);
 
		CleanUpGRFText(data->second);
 
	}
 
}
 

	
 
/**
 
 * Get the value of this user-changeable parameter from the given config.
 
 * @param config The GRFConfig to get the value from.
 
 * @return The value of this parameter.
 
 */
 
uint32 GRFParameterInfo::GetValue(struct GRFConfig *config) const
 
{
 
	/* GB doesn't work correctly with nbits == 32, so handle that case here. */
 
	if (this->num_bit == 32) return config->param[this->param_nr];
 
	return GB(config->param[this->param_nr], this->first_bit, this->num_bit);
 
}
 

	
 
/**
 
 * Set the value of this user-changeable parameter in the given config.
 
 * @param config The GRFConfig to set the value in.
 
 * @param value The new value.
 
 */
 
void GRFParameterInfo::SetValue(struct GRFConfig *config, uint32 value)
 
{
 
	/* SB doesn't work correctly with nbits == 32, so handle that case here. */
 
	if (this->num_bit == 32) {
 
		config->param[this->param_nr] = value;
 
	} else {
 
		SB(config->param[this->param_nr], this->first_bit, this->num_bit, value);
 
	}
 
	config->num_params = max<uint>(config->num_params, this->param_nr + 1);
 
	SetWindowClassesDirty(WC_GAME_OPTIONS); // Is always the newgrf window
 
}
 

	
 
/**
 
 * Update the palettes of the graphics from the config file.
 
 * This is needed because the config file gets read and parsed
 
 * before the palette is chosen (one can configure the base
 
 * graphics set governing the palette in the config after all).
 
 * As a result of this we update the settings from the config
 
 * once we have determined the palette.
 
 */
 
void UpdateNewGRFConfigPalette()
 
{
 
	for (GRFConfig *c = _grfconfig_newgame; c != NULL; c = c->next) c->SetSuitablePalette();
 
	for (GRFConfig *c = _grfconfig_static;  c != NULL; c = c->next) c->SetSuitablePalette();
 
}
 

	
 
/** Calculate the MD5 sum for a GRF, and store it in the config.
 
 * @param config GRF to compute.
 
 * @return MD5 sum was successfully computed
 
 */
 
static bool CalcGRFMD5Sum(GRFConfig *config)
 
{
 
	FILE *f;
 
	Md5 checksum;
 
	uint8 buffer[1024];
 
	size_t len, size;
 

	
src/newgrf_config.h
Show inline comments
 
@@ -100,48 +100,51 @@ struct GRFError : ZeroedMemoryAllocator 
 
	uint32 param_value[2]; ///< Values of GRF parameters to show for message and custom_message
 
};
 

	
 
/** The possible types of a newgrf parameter. */
 
enum GRFParameterType {
 
	PTYPE_UINT_ENUM, ///< The parameter allows a range of numbers, each of which can have a special name
 
	PTYPE_BOOL,      ///< The parameter is either 0 or 1
 
	PTYPE_END,       ///< Invalid parameter type
 
};
 

	
 
/** Information about one grf parameter. */
 
struct GRFParameterInfo {
 
	GRFParameterInfo(uint nr);
 
	GRFParameterInfo(GRFParameterInfo &info);
 
	~GRFParameterInfo();
 
	struct GRFText *name;  ///< The name of this parameter
 
	struct GRFText *desc;  ///< The description of this parameter
 
	GRFParameterType type; ///< The type of this parameter
 
	uint32 min_value;      ///< The minimal value this parameter can have
 
	uint32 max_value;      ///< The maximal value of this parameter
 
	byte param_nr;         ///< GRF parameter to store content in
 
	byte first_bit;        ///< First bit to use in the GRF parameter
 
	byte num_bit;          ///< Number of bits to use for this parameter
 
	SmallMap<uint32, struct GRFText *, 8> value_names; ///< Names for each value.
 

	
 
	uint32 GetValue(struct GRFConfig *config) const;
 
	void SetValue(struct GRFConfig *config, uint32 value);
 
};
 

	
 
/** Information about GRF, used in the game and (part of it) in savegames */
 
struct GRFConfig : ZeroedMemoryAllocator {
 
	GRFConfig(const char *filename = NULL);
 
	GRFConfig(const GRFConfig &config);
 
	~GRFConfig();
 

	
 
	GRFIdentifier ident;       ///< grfid and md5sum to uniquely identify newgrfs
 
	uint8 original_md5sum[16]; ///< MD5 checksum of original file if only a 'compatible' file was loaded
 
	char *filename;            ///< Filename - either with or without full path
 
	struct GRFText *name;      ///< NOSAVE: GRF name (Action 0x08)
 
	struct GRFText *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
 
	uint8 num_valid_params;    ///< NOSAVE: Number of valid parameters (action 0x14)
 
	uint8 palette;             ///< GRFPalette, bitset
 
	SmallVector<GRFParameterInfo *, 4> param_info; ///< NOSAVE: extra information about the parameters
 

	
src/newgrf_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/*
 
 * This file is part of OpenTTD.
 
 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
/** @file newgrf_gui.cpp GUI to change NewGRF settings. */
 

	
 
#include "stdafx.h"
 
#include "gui.h"
 
#include "newgrf.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "gamelog.h"
 
#include "settings_func.h"
 
#include "widgets/dropdown_type.h"
 
#include "network/network.h"
 
#include "network/network_content.h"
 
#include "sortlist_type.h"
 
#include "querystring_gui.h"
 
#include "core/geometry_func.hpp"
 
#include "newgrf_text.h"
 

	
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
/**
 
 * Show the first NewGRF error we can find.
 
 */
 
void ShowNewGRFError()
 
{
 
	for (const GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
 
		/* We only want to show fatal errors */
 
		if (c->error == NULL || c->error->severity != STR_NEWGRF_ERROR_MSG_FATAL) continue;
 

	
 
		SetDParam   (0, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING);
 
		SetDParamStr(1, c->error->custom_message);
 
		SetDParam   (2, STR_JUST_RAW_STRING);
 
		SetDParamStr(3, c->filename);
 
		SetDParam   (4, STR_JUST_RAW_STRING);
 
		SetDParamStr(5, c->error->data);
 
		for (uint i = 0; i < c->error->num_params; i++) {
 
			SetDParam(6 + i, c->error->param_value[i]);
 
		}
 
		ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, WL_CRITICAL);
 
		break;
 
@@ -94,48 +95,285 @@ static void ShowNewGRFInfo(const GRFConf
 
			SetDParam(0, STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE);
 
		}
 
		y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_PARAMETER);
 

	
 
		/* Draw the palette of the NewGRF */
 
		SetDParamStr(0, (c->palette & GRFP_USE_WINDOWS) ? "Windows" : "DOS");
 
		y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_PALETTE);
 
	}
 

	
 
	/* Show flags */
 
	if (c->status == GCS_NOT_FOUND)       y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_NOT_FOUND);
 
	if (c->status == GCS_DISABLED)        y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_DISABLED);
 
	if (HasBit(c->flags, GCF_COMPATIBLE)) y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_COMPATIBLE_LOADED);
 

	
 
	/* Draw GRF info if it exists */
 
	if (!StrEmpty(c->GetDescription())) {
 
		SetDParam(0, STR_JUST_RAW_STRING);
 
		SetDParamStr(1, c->GetDescription());
 
		y = DrawStringMultiLine(x, right, y, bottom, STR_BLACK_STRING);
 
	} else {
 
		y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_NO_INFO);
 
	}
 
}
 

	
 

	
 
/** Enum referring to the widgets of the NewGRF parameters window */
 
enum ShowNewGRFParametersWidgets {
 
	GRFPAR_WIDGET_BACKGROUND,  ///< Panel to draw the settings on
 
	GRFPAR_WIDGET_SCROLLBAR,   ///< Scrollbar to scroll through all settings
 
	GRFPAR_WIDGET_ACCEPT,      ///< Accept button
 
	GRFPAR_WIDGET_DESCRIPTION, ///< Multi-line description of a parameter
 
};
 

	
 
/**
 
 * Window for setting the parameters of a NewGRF.
 
 */
 
struct NewGRFParametersWindow : public Window {
 
	static GRFParameterInfo dummy_parameter_info; ///< Dummy info in case a newgrf didn't provide info about some parameter.
 
	GRFConfig *grf_config; ///< Set the parameters of this GRFConfig.
 
	uint clicked_button;   ///< The row in which a button was clicked or UINT_MAX.
 
	bool clicked_increase; ///< True if the increase button was clicked, false for the decrease button.
 
	int timeout;           ///< How long before we unpress the last-pressed button?
 
	uint clicked_row;      ///< The selected parameter
 
	int line_height;       ///< Height of a row in the matrix widget.
 

	
 
	NewGRFParametersWindow(const WindowDesc *desc, GRFConfig *c) : Window(),
 
		grf_config(c),
 
		clicked_button(UINT_MAX),
 
		timeout(0),
 
		clicked_row(UINT_MAX)
 
	{
 
		this->InitNested(desc);  // Initializes 'this->line_height' as side effect.
 

	
 
		this->vscroll.SetCount(c->num_valid_params);
 
	}
 

	
 
	/**
 
	 * Get a dummy parameter-info object with default information.
 
	 * @param nr The param number that should be changed.
 
	 * @return GRFParameterInfo with dummy information about the given parameter.
 
	 */
 
	static GRFParameterInfo *GetDummyParameterInfo(uint nr)
 
	{
 
		dummy_parameter_info.param_nr = nr;
 
		return &dummy_parameter_info;
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case GRFPAR_WIDGET_BACKGROUND:
 
				this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 

	
 
				resize->width = 1;
 
				resize->height = this->line_height;
 
				size->height = GB(this->GetWidget<NWidgetCore>(widget)->widget_data, MAT_ROW_START, MAT_ROW_BITS) * this->line_height;
 
				break;
 

	
 
			case GRFPAR_WIDGET_DESCRIPTION:
 
				size->height = max<uint>(size->height, FONT_HEIGHT_NORMAL * 4 + WD_TEXTPANEL_TOP + WD_TEXTPANEL_BOTTOM);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget == GRFPAR_WIDGET_DESCRIPTION) {
 
			const GRFParameterInfo *par_info = (this->clicked_row < this->grf_config->param_info.Length()) ? this->grf_config->param_info[this->clicked_row] : NULL;
 
			if (par_info == NULL) return;
 
			const char *desc = GetGRFStringFromGRFText(par_info->desc);
 
			if (desc == NULL) return;
 
			DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_TEXTPANEL_TOP, r.bottom - WD_TEXTPANEL_BOTTOM, desc, TC_BLACK);
 
			return;
 
		} else if (widget != GRFPAR_WIDGET_BACKGROUND) {
 
			return;
 
		}
 

	
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		uint buttons_left = rtl ? r.right - 23 : r.left + 4;
 
		uint value_left   = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
 
		uint value_right  = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
 
		uint text_left    = r.left + (rtl ? WD_FRAMERECT_LEFT : 54);
 
		uint text_right   = r.right - (rtl ? 54 : WD_FRAMERECT_RIGHT);
 

	
 
		int y = r.top;
 
		for (uint i = this->vscroll.GetPosition(); this->vscroll.IsVisible(i) && i < this->grf_config->num_valid_params; i++) {
 
			GRFParameterInfo *par_info = (i < this->grf_config->param_info.Length()) ? this->grf_config->param_info[i] : NULL;
 
			if (par_info == NULL) par_info = GetDummyParameterInfo(i);
 
			uint32 current_value = par_info->GetValue(this->grf_config);
 
			bool selected = (i == this->clicked_row);
 

	
 
			uint x = rtl ? r.right : r.left;
 
			if (par_info->type == PTYPE_BOOL) {
 
				DrawFrameRect(buttons_left, y  + 2, buttons_left + 19, y + 10, (current_value != 0) ? COLOUR_GREEN : COLOUR_RED, (current_value != 0) ? FR_LOWERED : FR_NONE);
 
			} else if (par_info->type == PTYPE_UINT_ENUM) {
 
				DrawArrowButtons(buttons_left, y + 2, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + (this->clicked_increase != rtl) : 0, current_value > par_info->min_value, current_value < par_info->max_value);
 
				bool draw_numeric = true;
 
				if (par_info->value_names.Find(current_value) != par_info->value_names.End()) {
 
					const char *label = GetGRFStringFromGRFText(par_info->value_names.Find(current_value)->second);
 
					if (label != NULL) {
 
						x = DrawString(value_left, value_right, y + WD_MATRIX_TOP, label, TC_ORANGE);
 
						draw_numeric = false;
 
					}
 
				}
 
				if (draw_numeric) {
 
					SetDParam(0, current_value);
 
					x = DrawString(value_left, value_right, y + WD_MATRIX_TOP, STR_JUST_INT, TC_ORANGE);
 
				}
 
			}
 

	
 
			const char *name = GetGRFStringFromGRFText(par_info->name);
 
			if (name != NULL) {
 
				DrawString(max(rtl ? 0U : x + 3, text_left), min(rtl ? x - 3 : r.right, text_right), y + WD_MATRIX_TOP, name, selected ? TC_WHITE : TC_LIGHT_BLUE);
 
			} else {
 
				SetDParam(0, i + 1);
 
				DrawString(max(rtl ? 0U : x + 3, text_left), min(rtl ? x - 3 : r.right, text_right), y + WD_MATRIX_TOP, STR_NEWGRF_PARAMETERS_DEFAULT_NAME, selected ? TC_WHITE : TC_LIGHT_BLUE);
 
			}
 
			y += this->line_height;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GRFPAR_WIDGET_BACKGROUND: {
 
				uint num = this->vscroll.GetScrolledRowFromWidget(pt.y, this, GRFPAR_WIDGET_BACKGROUND);
 
				if (num >= this->grf_config->num_valid_params) break;
 
				if (this->clicked_row != num) {
 
					DeleteChildWindows(WC_QUERY_STRING);
 
					this->clicked_row = num;
 
				}
 

	
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(GRFPAR_WIDGET_BACKGROUND);
 
				int x = pt.x - wid->pos_x;
 
				if (_dynlang.text_dir == TD_RTL) x = wid->current_x - x;
 
				x -= 4;
 

	
 
				GRFParameterInfo *par_info = (num < this->grf_config->param_info.Length()) ? this->grf_config->param_info[num] : NULL;
 
				if (par_info == NULL) par_info = GetDummyParameterInfo(num);
 

	
 
				/* One of the arrows is clicked */
 
				if (IsInsideMM(x, 0, 21)) {
 
					uint32 val = par_info->GetValue(this->grf_config);
 
					if (par_info->type == PTYPE_BOOL) {
 
						val = !val;
 
					} else {
 
						if (x >= 10) {
 
							/* Increase button clicked */
 
							if (val < par_info->max_value) val++;
 
							this->clicked_increase = true;
 
						} else {
 
							/* Decrease button clicked */
 
							if (val > par_info->min_value) val--;
 
							this->clicked_increase = false;
 
						}
 
					}
 
					par_info->SetValue(this->grf_config, val);
 

	
 
					this->clicked_button = num;
 
					this->timeout = 5;
 
				} else if (par_info->type == PTYPE_UINT_ENUM && click_count >= 2) {
 
					/* Display a query box so users can enter a custom value. */
 
					SetDParam(0, this->grf_config->param[num]);
 
					ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, 100, this, CS_NUMERAL, QSF_NONE);
 
				}
 

	
 
				this->SetDirty();
 
				break;
 
			}
 

	
 
			case GRFPAR_WIDGET_ACCEPT:
 
				delete this;
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (StrEmpty(str)) return;
 
		int32 value = atoi(str);
 
		GRFParameterInfo *par_info = ((uint)this->clicked_row < this->grf_config->param_info.Length()) ? this->grf_config->param_info[this->clicked_row] : NULL;
 
		if (par_info == NULL) par_info = GetDummyParameterInfo(this->clicked_row);
 
		uint32 val = Clamp<uint32>(value, par_info->min_value, par_info->max_value);
 
		par_info->SetValue(this->grf_config, val);
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(GRFPAR_WIDGET_BACKGROUND);
 
		this->vscroll.SetCapacity(nwi->current_y / this->line_height);
 
		nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void OnTick()
 
	{
 
		if (--this->timeout == 0) {
 
			this->clicked_button = UINT_MAX;
 
			this->SetDirty();
 
		}
 
	}
 
};
 
GRFParameterInfo NewGRFParametersWindow::dummy_parameter_info(0);
 

	
 

	
 
static const NWidgetPart _nested_newgrf_parameter_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
 
		NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_PARAMETERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_MATRIX, COLOUR_MAUVE, GRFPAR_WIDGET_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL),
 
		NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, GRFPAR_WIDGET_SCROLLBAR),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_MAUVE, GRFPAR_WIDGET_DESCRIPTION), SetResize(1, 0), SetFill(1, 0),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, GRFPAR_WIDGET_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NEWGRF_PARAMETERS_CLOSE, STR_NULL),
 
		NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
 
	EndContainer(),
 
};
 

	
 
/* Window definition for the change grf parameters window */
 
static const WindowDesc _newgrf_parameters_desc(
 
	WDP_CENTER, 500, 208,
 
	WC_GRF_PARAMETERS, WC_NONE,
 
	WDF_UNCLICK_BUTTONS,
 
	_nested_newgrf_parameter_widgets, lengthof(_nested_newgrf_parameter_widgets)
 
);
 

	
 
void OpenGRFParameterWindow(GRFConfig *c)
 
{
 
	DeleteWindowByClass(WC_GRF_PARAMETERS);
 
	new NewGRFParametersWindow(&_newgrf_parameters_desc, c);
 
}
 

	
 
static GRFPresetList _grf_preset_list;
 

	
 
class DropDownListPresetItem : public DropDownListItem {
 
public:
 
	DropDownListPresetItem(int result) : DropDownListItem(result, false) {}
 

	
 
	virtual ~DropDownListPresetItem() {}
 

	
 
	bool Selectable() const
 
	{
 
		return true;
 
	}
 

	
 
	void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
	{
 
		DrawString(left + 2, right + 2, top, _grf_preset_list[this->result], sel ? TC_WHITE : TC_BLACK);
 
	}
 
};
 

	
 
static void NewGRFConfirmationCallback(Window *w, bool confirmed);
 

	
 
/** Names of the manage newgrfs window widgets. */
 
enum ShowNewGRFStateWidgets {
 
	SNGRFS_PRESET_LIST,
 
@@ -163,81 +401,82 @@ enum ShowNewGRFStateWidgets {
 
 * Window for showing NewGRF files
 
 */
 
struct NewGRFWindow : public QueryStringBaseWindow {
 
	typedef GUIList<const GRFConfig *> GUIGRFConfigList;
 

	
 
	static const uint EDITBOX_MAX_SIZE   =  50;
 
	static const uint EDITBOX_MAX_LENGTH = 300;
 

	
 
	static Listing   last_sorting;   ///< Default sorting of #GUIGRFConfigList.
 
	static Filtering last_filtering; ///< Default filtering of #GUIGRFConfigList.
 
	static GUIGRFConfigList::SortFunction   * const sorter_funcs[]; ///< Sort functions of the #GUIGRFConfigList.
 
	static GUIGRFConfigList::FilterFunction * const filter_funcs[]; ///< Filter functions of the #GUIGRFConfigList.
 

	
 
	GUIGRFConfigList avails;    ///< Available (non-active) grfs.
 
	const GRFConfig *avail_sel; ///< Currently selected available grf. \c NULL is none is selected.
 
	int avail_pos;              ///< Index of #avail_sel if existing, else \c -1.
 

	
 
	GRFConfig *actives;         ///< Temporary active grf list to which changes are made.
 
	GRFConfig *active_sel;      ///< Selected active grf item.
 

	
 
	GRFConfig **orig_list;      ///< List active grfs in the game. Used as initial value, may be updated by the window.
 
	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 the last query.
 
	int preset;                 ///< Selected preset.
 

	
 
	NewGRFWindow(const WindowDesc *desc, bool editable, bool show_params, bool execute, GRFConfig **orig_list) : QueryStringBaseWindow(EDITBOX_MAX_SIZE)
 
	{
 
		this->avail_sel   = NULL;
 
		this->avail_pos   = -1;
 
		this->active_sel  = NULL;
 
		this->actives     = NULL;
 
		this->orig_list   = orig_list;
 
		this->editable    = editable;
 
		this->execute     = execute;
 
		this->show_params = show_params;
 
		this->preset      = -1;
 

	
 
		CopyGRFConfigList(&this->actives, *orig_list, false);
 
		GetGRFPresetList(&_grf_preset_list);
 

	
 
		this->InitNested(desc);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, EDITBOX_MAX_LENGTH);
 
		this->SetFocusedWidget(SNGRFS_FILTER);
 

	
 
		this->avails.SetListing(this->last_sorting);
 
		this->avails.SetFiltering(this->last_filtering);
 
		this->avails.SetSortFuncs(this->sorter_funcs);
 
		this->avails.SetFilterFuncs(this->filter_funcs);
 
		this->avails.ForceRebuild();
 

	
 
		this->OnInvalidateData(2);
 
	}
 

	
 
	~NewGRFWindow()
 
	{
 
		DeleteWindowByClass(WC_GRF_PARAMETERS);
 

	
 
		if (this->editable && !this->execute) {
 
			CopyGRFConfigList(this->orig_list, this->actives, true);
 
			ResetGRFConfig(false);
 
			ReloadNewGRFData();
 
		}
 

	
 
		/* Remove the temporary copy of grf-list used in window */
 
		ClearGRFConfigList(&this->actives);
 
		_grf_preset_list.Clear();
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case SNGRFS_FILE_LIST:
 
				resize->height = max(12, FONT_HEIGHT_NORMAL + 2);
 
				size->height = max(size->height, WD_FRAMERECT_TOP + 6 * resize->height + WD_FRAMERECT_BOTTOM);
 
				break;
 

	
 
			case SNGRFS_AVAIL_LIST:
 
				resize->height = max(12, FONT_HEIGHT_NORMAL + 2);
 
				size->height = max(size->height, WD_FRAMERECT_TOP + 8 * resize->height + WD_FRAMERECT_BOTTOM);
 
				break;
 

	
 
@@ -408,49 +647,48 @@ struct NewGRFWindow : public QueryString
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SNGRFS_PRESET_LIST: {
 
				DropDownList *list = new DropDownList();
 

	
 
				/* Add 'None' option for clearing list */
 
				list->push_back(new DropDownListStringItem(STR_NONE, -1, false));
 

	
 
				for (uint i = 0; i < _grf_preset_list.Length(); i++) {
 
					if (_grf_preset_list[i] != NULL) {
 
						list->push_back(new DropDownListPresetItem(i));
 
					}
 
				}
 

	
 
				this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 
				ShowDropDownList(this, list, this->preset, SNGRFS_PRESET_LIST);
 
				break;
 
			}
 

	
 
			case SNGRFS_PRESET_SAVE:
 
				this->query_widget = widget;
 
				ShowQueryString(STR_EMPTY, STR_NEWGRF_SETTINGS_PRESET_SAVE_QUERY, 32, 100, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 

	
 
			case SNGRFS_PRESET_DELETE:
 
				if (this->preset == -1) return;
 

	
 
				DeleteGRFPresetFromConfig(_grf_preset_list[this->preset]);
 
				GetGRFPresetList(&_grf_preset_list);
 
				this->preset = -1;
 
				this->InvalidateData();
 
				this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 
				break;
 

	
 
			case SNGRFS_MOVE_UP: { // Move GRF up
 
				if (this->active_sel == NULL || !this->editable) break;
 

	
 
				int pos = 0;
 
				for (GRFConfig **pc = &this->actives; *pc != NULL; pc = &(*pc)->next, pos++) {
 
					GRFConfig *c = *pc;
 
					if (c->next == this->active_sel) {
 
						c->next = this->active_sel->next;
 
						this->active_sel->next = c;
 
						*pc = this->active_sel;
 
						break;
 
@@ -466,94 +704,94 @@ struct NewGRFWindow : public QueryString
 
				if (this->active_sel == NULL || !this->editable) break;
 

	
 
				int pos = 1; // Start at 1 as we swap the selected newgrf with the next one
 
				for (GRFConfig **pc = &this->actives; *pc != NULL; pc = &(*pc)->next, pos++) {
 
					GRFConfig *c = *pc;
 
					if (c == this->active_sel) {
 
						*pc = c->next;
 
						c->next = c->next->next;
 
						(*pc)->next = c;
 
						break;
 
					}
 
				}
 
				this->vscroll.ScrollTowards(pos);
 
				this->preset = -1;
 
				this->InvalidateData();
 
				break;
 
			}
 

	
 
			case SNGRFS_FILE_LIST: { // Select an active GRF.
 
				uint i = this->vscroll.GetScrolledRowFromWidget(pt.y, this, SNGRFS_FILE_LIST);
 

	
 
				GRFConfig *c;
 
				for (c = this->actives; c != NULL && i > 0; c = c->next, i--) {}
 

	
 
				if (this->active_sel != c) this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 
				if (this->active_sel != c) DeleteWindowByClass(WC_GRF_PARAMETERS);
 
				this->active_sel = c;
 
				this->avail_sel = NULL;
 
				this->avail_pos = -1;
 

	
 
				this->InvalidateData();
 
				if (click_count == 1) break;
 
			}
 
			/* FALL THROUGH, with double click. */
 
			case SNGRFS_REMOVE: { // Remove GRF
 
				if (this->active_sel == NULL || !this->editable) break;
 
				DeleteWindowByClass(WC_GRF_PARAMETERS);
 

	
 
				/* Choose the next GRF file to be the selected file. */
 
				GRFConfig *newsel = this->active_sel->next;
 
				for (GRFConfig **pc = &this->actives; *pc != NULL; pc = &(*pc)->next) {
 
					GRFConfig *c = *pc;
 
					/* If the new selection is empty (i.e. we're deleting the last item
 
					 * in the list, pick the file just before the selected file */
 
					if (newsel == NULL && c->next == this->active_sel) newsel = c;
 

	
 
					if (c == this->active_sel) {
 
						*pc = c->next;
 
						delete c;
 
						break;
 
					}
 
				}
 

	
 
				this->active_sel = newsel;
 
				this->preset = -1;
 
				this->avail_pos = -1;
 
				this->avail_sel = NULL;
 
				this->avails.ForceRebuild();
 
				this->InvalidateData(2);
 
				this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 
				break;
 
			}
 

	
 
			case SNGRFS_AVAIL_LIST: { // Select a non-active GRF.
 
				uint i = this->vscroll2.GetScrolledRowFromWidget(pt.y, this, SNGRFS_AVAIL_LIST);
 
				this->active_sel = NULL;
 
				DeleteWindowByClass(WC_GRF_PARAMETERS);
 
				if (i < this->avails.Length()) {
 
					this->avail_sel = this->avails[i];
 
					this->avail_pos = i;
 
				}
 
				this->InvalidateData();
 
				this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 
				if (click_count == 1) break;
 
			}
 
			/* FALL THROUGH, with double click. */
 
			case SNGRFS_ADD: {
 
				if (this->avail_sel == NULL || !this->editable) break;
 

	
 
				GRFConfig **list;
 
				/* Find last entry in the list, checking for duplicate grfid on the way */
 
				for (list = &this->actives; *list != NULL; list = &(*list)->next) {
 
					if ((*list)->ident.grfid == this->avail_sel->ident.grfid) {
 
						ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, WL_INFO);
 
						return;
 
					}
 
				}
 

	
 
				GRFConfig *c = new GRFConfig(*this->avail_sel); // Copy GRF details from scanned list.
 
				*list = c; // Append GRF config to configuration list.
 

	
 
				/* Select next (or previous, if last one) item in the list. */
 
				int new_pos = this->avail_pos + 1;
 
				if (new_pos >= (int)this->avails.Length()) new_pos = this->avail_pos - 1;
 
				this->avail_pos = new_pos;
 
				if (new_pos >= 0) this->avail_sel = this->avails[new_pos];
 

	
 
@@ -561,53 +799,49 @@ struct NewGRFWindow : public QueryString
 
				this->InvalidateData(2);
 
				break;
 
			}
 

	
 
			case SNGRFS_APPLY_CHANGES: // Apply changes made to GRF list
 
				if (!this->editable) break;
 
				if (this->execute) {
 
					ShowQuery(
 
						STR_NEWGRF_POPUP_CAUTION_CAPTION,
 
						STR_NEWGRF_CONFIRMATION_TEXT,
 
						this,
 
						NewGRFConfirmationCallback
 
					);
 
				} else {
 
					CopyGRFConfigList(this->orig_list, this->actives, true);
 
					ResetGRFConfig(false);
 
					ReloadNewGRFData();
 
				}
 
				this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 
				break;
 

	
 
			case SNGRFS_SET_PARAMETERS: { // Edit parameters
 
				if (this->active_sel == NULL || !this->editable || !this->show_params) break;
 

	
 
				this->query_widget = widget;
 
				static char buff[512];
 
				GRFBuildParamList(buff, this->active_sel, lastof(buff));
 
				SetDParamStr(0, buff);
 
				ShowQueryString(STR_JUST_RAW_STRING, STR_NEWGRF_SETTINGS_PARAMETER_QUERY, 63, 250, this, CS_NUMERAL_SPACE, QSF_NONE);
 
				OpenGRFParameterWindow(this->active_sel);
 
				break;
 
			}
 

	
 
			case SNGRFS_TOGGLE_PALETTE:
 
				if (this->active_sel != NULL || !this->editable) {
 
					this->active_sel->palette ^= GRFP_USE_MASK;
 
					this->SetDirty();
 
				}
 
				break;
 

	
 
			case SNGRFS_CONTENT_DOWNLOAD:
 
				if (!_network_available) {
 
					ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
 
				} else {
 
#if defined(ENABLE_NETWORK)
 
					this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 

	
 
					/* Only show the things in the current list, or everything when nothing's selected */
 
					ContentVector cv;
 
					for (const GRFConfig *c = this->actives; c != NULL; c = c->next) {
 
						if (c->status != GCS_NOT_FOUND && !HasBit(c->flags, GCF_COMPATIBLE)) continue;
 

	
 
						ContentInfo *ci = new ContentInfo();
 
						ci->type = CONTENT_TYPE_NEWGRF;
 
@@ -631,83 +865,61 @@ struct NewGRFWindow : public QueryString
 
				this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 
				InvalidateWindowClassesData(WC_SAVELOAD);
 
				break;
 
		}
 
	}
 

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

	
 
			if (c != NULL) {
 
				this->active_sel = NULL;
 
				ClearGRFConfigList(&this->actives);
 
				this->actives = c;
 
				this->preset = index;
 
				this->avails.ForceRebuild();
 
			}
 
		}
 

	
 
		DeleteWindowByClass(WC_GRF_PARAMETERS);
 
		this->active_sel = NULL;
 
		this->InvalidateData(3);
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (str == NULL) return;
 

	
 
		switch (this->query_widget) {
 
			default: NOT_REACHED();
 

	
 
			case SNGRFS_PRESET_SAVE:
 
				SaveGRFPresetToConfig(str, this->actives);
 
				GetGRFPresetList(&_grf_preset_list);
 

	
 
				/* Switch to this preset */
 
				for (uint i = 0; i < _grf_preset_list.Length(); i++) {
 
					if (_grf_preset_list[i] != NULL && strcmp(_grf_preset_list[i], str) == 0) {
 
						this->preset = i;
 
						break;
 
					}
 
				}
 
				break;
 

	
 
			case SNGRFS_SET_PARAMETERS: {
 
				if (this->active_sel == NULL || !this->editable || !this->show_params) return;
 

	
 
				/* Parse our new "int list" */
 
				GRFConfig *c = this->active_sel;
 
				c->num_params = ParseIntList(str, (int*)c->param, lengthof(c->param));
 

	
 
				/* ParseIntList() returns -1 on error */
 
				if (c->num_params == (byte)-1) c->num_params = 0;
 

	
 
				this->preset = -1;
 
		/* Switch to this preset */
 
		for (uint i = 0; i < _grf_preset_list.Length(); i++) {
 
			if (_grf_preset_list[i] != NULL && strcmp(_grf_preset_list[i], str) == 0) {
 
				this->preset = i;
 
				break;
 
			}
 
		}
 

	
 
		this->InvalidateData();
 
	}
 

	
 
	/** Calback to update internal data.
 
	 *  - 0: (optionally) build availables, update button status.
 
	 *  - 1: build availables, Add newly found grfs, update button status.
 
	 *  - 2: (optionally) build availables, Reset preset, + 3
 
	 *  - 3: (optionally) build availables, Update active scrollbar, update button status.
 
	 *  - 4: Force a rebuild of the availables, + 2
 
	 */
 
	virtual void OnInvalidateData(int data = 0)
 
	{
 
		switch (data) {
 
			default: NOT_REACHED();
 
			case 0:
 
				/* Nothing important to do */
 
				break;
 

	
 
			case 1:
 
				/* Search the list for items that are now found and mark them as such. */
src/window_type.h
Show inline comments
 
@@ -88,34 +88,35 @@ enum WindowClass {
 
	WC_CLIENT_LIST,
 
	WC_NETWORK_STATUS_WINDOW,
 
	WC_CUSTOM_CURRENCY,
 
	WC_REPLACE_VEHICLE,
 
	WC_HIGHSCORE,
 
	WC_ENDSCREEN,
 
	WC_SIGN_LIST,
 
	WC_GENERATE_LANDSCAPE,
 
	WC_GENERATE_PROGRESS_WINDOW,
 
	WC_CONFIRM_POPUP_QUERY,
 
	WC_TRANSPARENCY_TOOLBAR,
 
	WC_VEHICLE_TIMETABLE,
 
	WC_BUILD_SIGNAL,
 
	WC_COMPANY_PASSWORD_WINDOW,
 
	WC_OSK,
 
	WC_WAYPOINT_VIEW,
 
	WC_SELECT_STATION,
 
	WC_SET_DATE,
 
	WC_AI_DEBUG,
 
	WC_AI_LIST,
 
	WC_AI_SETTINGS,
 
	WC_NEWGRF_INSPECT,
 
	WC_SPRITE_ALIGNER,
 
	WC_INDUSTRY_CARGOES,
 
	WC_GRF_PARAMETERS,
 

	
 
	WC_INVALID = 0xFFFF
 
};
 

	
 
struct Window;
 

	
 
/** Number to differentiate different windows of the same class */
 
typedef int32 WindowNumber;
 

	
 
#endif /* WINDOW_TYPE_H */
0 comments (0 inline, 0 general)