Changeset - r18673:e5a4490b411b
[Not reviewed]
master
0 36 0
truebrain - 13 years ago 2011-12-16 16:27:45
truebrain@openttd.org
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
15 files changed:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -59,7 +59,7 @@ struct AIListWindow : public Window {
 
		this->ai_info_list = AI::GetUniqueInfoList();
 

	
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(AIL_WIDGET_SCROLLBAR);
 
		this->vscroll = this->GetScrollbar(WID_AIL_SCROLLBAR);
 
		this->FinishInitNested(desc); // Initializes 'this->line_height' as side effect.
 

	
 
		this->vscroll->SetCount((int)this->ai_info_list->size() + 1);
 
@@ -80,7 +80,7 @@ struct AIListWindow : public Window {
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget == AIL_WIDGET_LIST) {
 
		if (widget == WID_AIL_LIST) {
 
			this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 

	
 
			resize->width = 1;
 
@@ -92,9 +92,9 @@ struct AIListWindow : public Window {
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case AIL_WIDGET_LIST: {
 
			case WID_AIL_LIST: {
 
				/* Draw a list of all available AIs. */
 
				int y = this->GetWidget<NWidgetBase>(AIL_WIDGET_LIST)->pos_y;
 
				int y = this->GetWidget<NWidgetBase>(WID_AIL_LIST)->pos_y;
 
				/* First AI in the list is hardcoded to random */
 
				if (this->vscroll->IsVisible(0)) {
 
					DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_LEFT, y + WD_MATRIX_TOP, STR_AI_CONFIG_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_BLACK);
 
@@ -109,7 +109,7 @@ struct AIListWindow : public Window {
 
				}
 
				break;
 
			}
 
			case AIL_WIDGET_INFO_BG: {
 
			case WID_AIL_INFO_BG: {
 
				AIInfo *selected_info = NULL;
 
				ScriptInfoList::const_iterator it = this->ai_info_list->begin();
 
				for (int i = 1; selected_info == NULL && it != this->ai_info_list->end(); i++, it++) {
 
@@ -155,8 +155,8 @@ struct AIListWindow : public Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIL_WIDGET_LIST: { // Select one of the AIs
 
				int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, AIL_WIDGET_LIST, 0, this->line_height) - 1;
 
			case WID_AIL_LIST: { // Select one of the AIs
 
				int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_AIL_LIST, 0, this->line_height) - 1;
 
				if (sel < (int)this->ai_info_list->size()) {
 
					this->selected = sel;
 
					this->SetDirty();
 
@@ -168,13 +168,13 @@ struct AIListWindow : public Window {
 
				break;
 
			}
 

	
 
			case AIL_WIDGET_ACCEPT: {
 
			case WID_AIL_ACCEPT: {
 
				this->ChangeAI();
 
				delete this;
 
				break;
 
			}
 

	
 
			case AIL_WIDGET_CANCEL:
 
			case WID_AIL_CANCEL:
 
				delete this;
 
				break;
 
		}
 
@@ -182,7 +182,7 @@ struct AIListWindow : public Window {
 

	
 
	virtual void OnResize()
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST);
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIL_LIST);
 
		this->vscroll->SetCapacity(nwi->current_y / this->line_height);
 
		nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 
@@ -215,15 +215,15 @@ static const NWidgetPart _nested_ai_list
 
		NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_MATRIX, COLOUR_MAUVE, AIL_WIDGET_LIST), SetMinimalSize(188, 112), SetFill(1, 1), SetResize(1, 1), SetDataTip(0x501, STR_AI_LIST_TOOLTIP), SetScrollbar(AIL_WIDGET_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, AIL_WIDGET_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIL_LIST), SetMinimalSize(188, 112), SetFill(1, 1), SetResize(1, 1), SetDataTip(0x501, STR_AI_LIST_TOOLTIP), SetScrollbar(WID_AIL_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIL_SCROLLBAR),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_MAUVE, AIL_WIDGET_INFO_BG), SetMinimalTextLines(8, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 0),
 
	NWidget(WWT_PANEL, COLOUR_MAUVE, WID_AIL_INFO_BG), SetMinimalTextLines(8, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 0),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, AIL_WIDGET_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_LIST_ACCEPT, STR_AI_LIST_ACCEPT_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, AIL_WIDGET_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_LIST_CANCEL, STR_AI_LIST_CANCEL_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_AIL_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_LIST_ACCEPT, STR_AI_LIST_ACCEPT_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_AIL_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_LIST_CANCEL, STR_AI_LIST_CANCEL_TOOLTIP),
 
		EndContainer(),
 
		NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
 
	EndContainer(),
 
@@ -276,10 +276,10 @@ struct AISettingsWindow : public Window 
 
		this->RebuildVisibleSettings();
 

	
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(AIS_WIDGET_SCROLLBAR);
 
		this->vscroll = this->GetScrollbar(WID_AIS_SCROLLBAR);
 
		this->FinishInitNested(desc, slot);  // Initializes 'this->line_height' as side effect.
 

	
 
		this->SetWidgetDisabledState(AIS_WIDGET_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot));
 
		this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot));
 

	
 
		this->vscroll->SetCount((int)this->visible_settings.size());
 
	}
 
@@ -304,7 +304,7 @@ struct AISettingsWindow : public Window 
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget == AIS_WIDGET_BACKGROUND) {
 
		if (widget == WID_AIS_BACKGROUND) {
 
			this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 

	
 
			resize->width = 1;
 
@@ -315,7 +315,7 @@ struct AISettingsWindow : public Window 
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget != AIS_WIDGET_BACKGROUND) return;
 
		if (widget != WID_AIS_BACKGROUND) return;
 

	
 
		AIConfig *config = this->ai_config;
 
		VisibleSettingsList::const_iterator it = this->visible_settings.begin();
 
@@ -383,8 +383,8 @@ struct AISettingsWindow : public Window 
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIS_WIDGET_BACKGROUND: {
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(AIS_WIDGET_BACKGROUND);
 
			case WID_AIS_BACKGROUND: {
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_AIS_BACKGROUND);
 
				int num = (pt.y - wid->pos_y) / this->line_height + this->vscroll->GetPosition();
 
				if (num >= (int)this->visible_settings.size()) break;
 

	
 
@@ -433,11 +433,11 @@ struct AISettingsWindow : public Window 
 
				break;
 
			}
 

	
 
			case AIS_WIDGET_ACCEPT:
 
			case WID_AIS_ACCEPT:
 
				delete this;
 
				break;
 

	
 
			case AIS_WIDGET_RESET:
 
			case WID_AIS_RESET:
 
				if (_game_mode == GM_MENU || !Company::IsValidID(this->slot)) {
 
					this->ai_config->ResetSettings();
 
					this->SetDirty();
 
@@ -460,7 +460,7 @@ struct AISettingsWindow : public Window 
 

	
 
	virtual void OnResize()
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND);
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIS_BACKGROUND);
 
		this->vscroll->SetCapacity(nwi->current_y / this->line_height);
 
		nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 
@@ -495,13 +495,13 @@ static const NWidgetPart _nested_ai_sett
 
		NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_SETTINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_MATRIX, COLOUR_MAUVE, AIS_WIDGET_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(AIS_WIDGET_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, AIS_WIDGET_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIS_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(WID_AIS_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIS_SCROLLBAR),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, AIS_WIDGET_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, AIS_WIDGET_RESET), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_SETTINGS_RESET, STR_NULL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_AIS_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_AIS_RESET), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_SETTINGS_RESET, STR_NULL),
 
		EndContainer(),
 
		NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
 
	EndContainer(),
 
@@ -532,30 +532,30 @@ static const NWidgetPart _nested_ai_conf
 
		NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
 
		NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_MAUVE, AIC_WIDGET_BACKGROUND),
 
	NWidget(WWT_PANEL, COLOUR_MAUVE, WID_AIC_BACKGROUND),
 
		NWidget(NWID_VERTICAL), SetPIP(4, 4, 4),
 
			NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
 
				NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, AIC_WIDGET_DECREASE), SetFill(0, 1), SetDataTip(AWV_DECREASE, STR_NULL),
 
				NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, AIC_WIDGET_INCREASE), SetFill(0, 1), SetDataTip(AWV_INCREASE, STR_NULL),
 
				NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_DECREASE), SetFill(0, 1), SetDataTip(AWV_DECREASE, STR_NULL),
 
				NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_INCREASE), SetFill(0, 1), SetDataTip(AWV_INCREASE, STR_NULL),
 
				NWidget(NWID_SPACER), SetMinimalSize(6, 0),
 
				NWidget(WWT_TEXT, COLOUR_MAUVE, AIC_WIDGET_NUMBER), SetDataTip(STR_DIFFICULTY_LEVEL_SETTING_MAXIMUM_NO_COMPETITORS, STR_NULL), SetFill(1, 0), SetPadding(1, 0, 0, 0),
 
				NWidget(WWT_TEXT, COLOUR_MAUVE, WID_AIC_NUMBER), SetDataTip(STR_DIFFICULTY_LEVEL_SETTING_MAXIMUM_NO_COMPETITORS, STR_NULL), SetFill(1, 0), SetPadding(1, 0, 0, 0),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_MOVE_UP), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_UP, STR_AI_CONFIG_MOVE_UP_TOOLTIP),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_MOVE_DOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_DOWN, STR_AI_CONFIG_MOVE_DOWN_TOOLTIP),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_MOVE_UP), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_UP, STR_AI_CONFIG_MOVE_UP_TOOLTIP),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_MOVE_DOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_DOWN, STR_AI_CONFIG_MOVE_DOWN_TOOLTIP),
 
			EndContainer(),
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(WWT_MATRIX, COLOUR_MAUVE, AIC_WIDGET_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetDataTip(0x801, STR_AI_CONFIG_LIST_TOOLTIP), SetScrollbar(AIC_WIDGET_SCROLLBAR),
 
			NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, AIC_WIDGET_SCROLLBAR),
 
			NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetDataTip(0x801, STR_AI_CONFIG_LIST_TOOLTIP), SetScrollbar(WID_AIC_SCROLLBAR),
 
			NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIC_SCROLLBAR),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 9),
 
		NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 0, 5),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_CLOSE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CLOSE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL),
 
		EndContainer(),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_CONTENT_DOWNLOAD), SetFill(1, 0), SetMinimalSize(279, 12), SetPadding(0, 5, 9, 5), SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONTENT_DOWNLOAD), SetFill(1, 0), SetMinimalSize(279, 12), SetPadding(0, 5, 9, 5), SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
 
	EndContainer(),
 
};
 

	
 
@@ -578,9 +578,9 @@ struct AIConfigWindow : public Window {
 
	AIConfigWindow() : Window()
 
	{
 
		this->InitNested(&_ai_config_desc); // Initializes 'this->line_height' as a side effect.
 
		this->vscroll = this->GetScrollbar(AIC_WIDGET_SCROLLBAR);
 
		this->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR);
 
		this->selected_slot = INVALID_COMPANY;
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIC_WIDGET_LIST);
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIC_LIST);
 
		this->vscroll->SetCapacity(nwi->current_y / this->line_height);
 
		this->vscroll->SetCount(MAX_COMPANIES);
 
		nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
@@ -596,7 +596,7 @@ struct AIConfigWindow : public Window {
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case AIC_WIDGET_NUMBER:
 
			case WID_AIC_NUMBER:
 
				SetDParam(0, GetGameSettings().difficulty.max_no_competitors);
 
				break;
 
		}
 
@@ -605,7 +605,7 @@ struct AIConfigWindow : public Window {
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case AIC_WIDGET_LIST:
 
			case WID_AIC_LIST:
 
				this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				size->height = GB(this->GetWidget<NWidgetCore>(widget)->widget_data, MAT_ROW_START, MAT_ROW_BITS) * this->line_height;
 
				break;
 
@@ -634,7 +634,7 @@ struct AIConfigWindow : public Window {
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case AIC_WIDGET_LIST: {
 
			case WID_AIC_LIST: {
 
				int y = r.top;
 
				for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) {
 
					StringID text;
 
@@ -659,10 +659,10 @@ struct AIConfigWindow : public Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIC_WIDGET_DECREASE:
 
			case AIC_WIDGET_INCREASE: {
 
			case WID_AIC_DECREASE:
 
			case WID_AIC_INCREASE: {
 
				int new_value;
 
				if (widget == AIC_WIDGET_DECREASE) {
 
				if (widget == WID_AIC_DECREASE) {
 
					new_value = max(0, GetGameSettings().difficulty.max_no_competitors - 1);
 
				} else {
 
					new_value = min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1);
 
@@ -672,14 +672,14 @@ struct AIConfigWindow : public Window {
 
				break;
 
			}
 

	
 
			case AIC_WIDGET_LIST: { // Select a slot
 
			case WID_AIC_LIST: { // Select a slot
 
				this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height);
 
				this->InvalidateData();
 
				if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
 
				break;
 
			}
 

	
 
			case AIC_WIDGET_MOVE_UP:
 
			case WID_AIC_MOVE_UP:
 
				if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot - 1))) {
 
					Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot - 1]);
 
					this->selected_slot--;
 
@@ -688,7 +688,7 @@ struct AIConfigWindow : public Window {
 
				}
 
				break;
 

	
 
			case AIC_WIDGET_MOVE_DOWN:
 
			case WID_AIC_MOVE_DOWN:
 
				if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot + 1))) {
 
					Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot + 1]);
 
					this->selected_slot++;
 
@@ -697,19 +697,19 @@ struct AIConfigWindow : public Window {
 
				}
 
				break;
 

	
 
			case AIC_WIDGET_CHANGE:  // choose other AI
 
			case WID_AIC_CHANGE:  // choose other AI
 
				ShowAIListWindow((CompanyID)this->selected_slot);
 
				break;
 

	
 
			case AIC_WIDGET_CONFIGURE: // change the settings for an AI
 
			case WID_AIC_CONFIGURE: // change the settings for an AI
 
				ShowAISettingsWindow((CompanyID)this->selected_slot);
 
				break;
 

	
 
			case AIC_WIDGET_CLOSE:
 
			case WID_AIC_CLOSE:
 
				delete this;
 
				break;
 

	
 
			case AIC_WIDGET_CONTENT_DOWNLOAD:
 
			case WID_AIC_CONTENT_DOWNLOAD:
 
				if (!_network_available) {
 
					ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
 
				} else {
 
@@ -734,12 +734,12 @@ struct AIConfigWindow : public Window {
 

	
 
		if (!gui_scope) return;
 

	
 
		this->SetWidgetDisabledState(AIC_WIDGET_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
 
		this->SetWidgetDisabledState(AIC_WIDGET_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
 
		this->SetWidgetDisabledState(AIC_WIDGET_CHANGE, this->selected_slot == INVALID_COMPANY);
 
		this->SetWidgetDisabledState(AIC_WIDGET_CONFIGURE, this->selected_slot == INVALID_COMPANY);
 
		this->SetWidgetDisabledState(AIC_WIDGET_MOVE_UP, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
 
		this->SetWidgetDisabledState(AIC_WIDGET_MOVE_DOWN, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));
 
		this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
 
		this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
 
		this->SetWidgetDisabledState(WID_AIC_CHANGE, this->selected_slot == INVALID_COMPANY);
 
		this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY);
 
		this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
 
		this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));
 
	}
 
};
 

	
 
@@ -754,8 +754,8 @@ void ShowAIConfigWindow()
 
 * Window with everything an AI prints via ScriptLog.
 
 */
 
struct AIDebugWindow : public QueryStringBaseWindow {
 
	static const int top_offset;    ///< Offset of the text at the top of the AID_WIDGET_LOG_PANEL.
 
	static const int bottom_offset; ///< Offset of the text at the bottom of the AID_WIDGET_LOG_PANEL.
 
	static const int top_offset;    ///< Offset of the text at the top of the WID_AID_LOG_PANEL.
 
	static const int bottom_offset; ///< Offset of the text at the bottom of the WID_AID_LOG_PANEL.
 

	
 
	static const unsigned int MAX_BREAK_STR_STRING_LENGTH = 256; ///< Maximum length of the break string.
 

	
 
@@ -778,19 +778,19 @@ struct AIDebugWindow : public QueryStrin
 
	AIDebugWindow(const WindowDesc *desc, WindowNumber number) : QueryStringBaseWindow(MAX_BREAK_STR_STRING_LENGTH)
 
	{
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(AID_WIDGET_SCROLLBAR);
 
		this->vscroll = this->GetScrollbar(WID_AID_SCROLLBAR);
 
		this->show_break_box = _settings_client.gui.ai_developer_tools;
 
		this->GetWidget<NWidgetStacked>(AID_BREAK_STRING_WIDGETS)->SetDisplayedPlane(this->show_break_box ? 0 : SZSP_HORIZONTAL);
 
		this->GetWidget<NWidgetStacked>(WID_AID_BREAK_STRING_WIDGETS)->SetDisplayedPlane(this->show_break_box ? 0 : SZSP_HORIZONTAL);
 
		this->FinishInitNested(desc, number);
 

	
 
		if (!this->show_break_box) break_check_enabled = false;
 
		/* Disable the companies who are not active or not an AI */
 
		for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
 
			this->SetWidgetDisabledState(i + AID_WIDGET_COMPANY_BUTTON_START, !Company::IsValidAiID(i));
 
			this->SetWidgetDisabledState(i + WID_AID_COMPANY_BUTTON_START, !Company::IsValidAiID(i));
 
		}
 
		this->DisableWidget(AID_WIDGET_RELOAD_TOGGLE);
 
		this->DisableWidget(AID_WIDGET_SETTINGS);
 
		this->DisableWidget(AID_WIDGET_CONTINUE_BTN);
 
		this->DisableWidget(WID_AID_RELOAD_TOGGLE);
 
		this->DisableWidget(WID_AID_SETTINGS);
 
		this->DisableWidget(WID_AID_CONTINUE_BTN);
 

	
 
		this->last_vscroll_pos = 0;
 
		this->autoscroll = true;
 
@@ -802,15 +802,15 @@ struct AIDebugWindow : public QueryStrin
 
		UpdateTextBufferSize(&this->text);
 

	
 
		/* Restore button state from static class variables */
 
		if (ai_debug_company != INVALID_COMPANY) this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
 
		this->SetWidgetLoweredState(AID_WIDGET_BREAK_STR_ON_OFF_BTN, this->break_check_enabled);
 
		this->SetWidgetLoweredState(AID_WIDGET_MATCH_CASE_BTN, this->case_sensitive_break_check);
 
		if (ai_debug_company != INVALID_COMPANY) this->LowerWidget(ai_debug_company + WID_AID_COMPANY_BUTTON_START);
 
		this->SetWidgetLoweredState(WID_AID_BREAK_STR_ON_OFF_BTN, this->break_check_enabled);
 
		this->SetWidgetLoweredState(WID_AID_MATCH_CASE_BTN, this->case_sensitive_break_check);
 

	
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget == AID_WIDGET_LOG_PANEL) {
 
		if (widget == WID_AID_LOG_PANEL) {
 
			resize->height = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
 
			size->height = 14 * resize->height + this->top_offset + this->bottom_offset;
 
		}
 
@@ -822,7 +822,7 @@ struct AIDebugWindow : public QueryStrin
 
		if (ai_debug_company == INVALID_COMPANY || !Company::IsValidAiID(ai_debug_company)) {
 
			if (ai_debug_company != INVALID_COMPANY) {
 
				/* Raise the widget for the previous selection. */
 
				this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
 
				this->RaiseWidget(ai_debug_company + WID_AID_COMPANY_BUTTON_START);
 

	
 
				ai_debug_company = INVALID_COMPANY;
 
			}
 
@@ -831,7 +831,7 @@ struct AIDebugWindow : public QueryStrin
 
			FOR_ALL_COMPANIES(c) {
 
				if (c->is_ai) {
 
					/* Lower the widget corresponding to this company. */
 
					this->LowerWidget(c->index + AID_WIDGET_COMPANY_BUTTON_START);
 
					this->LowerWidget(c->index + WID_AID_COMPANY_BUTTON_START);
 

	
 
					ai_debug_company = c->index;
 
					break;
 
@@ -841,8 +841,8 @@ struct AIDebugWindow : public QueryStrin
 

	
 
		/* Update "Reload AI" and "AI settings" buttons */
 
		this->SetWidgetsDisabledState(ai_debug_company == INVALID_COMPANY,
 
			AID_WIDGET_RELOAD_TOGGLE,
 
			AID_WIDGET_SETTINGS,
 
			WID_AID_RELOAD_TOGGLE,
 
			WID_AID_SETTINGS,
 
			WIDGET_LIST_END);
 

	
 
		/* Draw standard stuff */
 
@@ -850,11 +850,11 @@ struct AIDebugWindow : public QueryStrin
 

	
 
		if (this->IsShaded()) return; // Don't draw anything when the window is shaded.
 

	
 
		if (this->show_break_box) this->DrawEditBox(AID_WIDGET_BREAK_STR_EDIT_BOX);
 
		if (this->show_break_box) this->DrawEditBox(WID_AID_BREAK_STR_EDIT_BOX);
 

	
 
		/* Paint the company icons */
 
		for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
 
			NWidgetCore *button = this->GetWidget<NWidgetCore>(i + AID_WIDGET_COMPANY_BUTTON_START);
 
			NWidgetCore *button = this->GetWidget<NWidgetCore>(i + WID_AID_COMPANY_BUTTON_START);
 
			bool dirty = false;
 

	
 
			bool valid = Company::IsValidAiID(i);
 
@@ -879,7 +879,7 @@ struct AIDebugWindow : public QueryStrin
 
			if (!valid) continue;
 

	
 
			byte offset = (i == ai_debug_company) ? 1 : 0;
 
			DrawCompanyIcon(i, button->pos_x + button->current_x / 2 - 7 + offset, this->GetWidget<NWidgetBase>(AID_WIDGET_COMPANY_BUTTON_START + i)->pos_y + 2 + offset);
 
			DrawCompanyIcon(i, button->pos_x + button->current_x / 2 - 7 + offset, this->GetWidget<NWidgetBase>(WID_AID_COMPANY_BUTTON_START + i)->pos_y + 2 + offset);
 
		}
 

	
 
		/* If there are no active companies, don't display anything else. */
 
@@ -892,7 +892,7 @@ struct AIDebugWindow : public QueryStrin
 
			this->vscroll->SetCount(scroll_count);
 

	
 
			/* We need a repaint */
 
			this->SetWidgetDirty(AID_WIDGET_SCROLLBAR);
 
			this->SetWidgetDirty(WID_AID_SCROLLBAR);
 
		}
 

	
 
		if (log == NULL) return;
 
@@ -908,8 +908,8 @@ struct AIDebugWindow : public QueryStrin
 
				this->vscroll->SetPosition(scroll_pos);
 

	
 
				/* We need a repaint */
 
				this->SetWidgetDirty(AID_WIDGET_SCROLLBAR);
 
				this->SetWidgetDirty(AID_WIDGET_LOG_PANEL);
 
				this->SetWidgetDirty(WID_AID_SCROLLBAR);
 
				this->SetWidgetDirty(WID_AID_LOG_PANEL);
 
			}
 
		}
 
		this->last_vscroll_pos = this->vscroll->GetPosition();
 
@@ -918,7 +918,7 @@ struct AIDebugWindow : public QueryStrin
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case AID_WIDGET_NAME_TEXT:
 
			case WID_AID_NAME_TEXT:
 
				if (ai_debug_company == INVALID_COMPANY || !Company::IsValidAiID(ai_debug_company)) {
 
					SetDParam(0, STR_EMPTY);
 
				} else {
 
@@ -937,7 +937,7 @@ struct AIDebugWindow : public QueryStrin
 
		if (ai_debug_company == INVALID_COMPANY) return;
 

	
 
		switch (widget) {
 
			case AID_WIDGET_LOG_PANEL: {
 
			case WID_AID_LOG_PANEL: {
 
				ScriptLog::LogData *log = (ScriptLog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
 
				if (log == NULL) return;
 

	
 
@@ -976,13 +976,13 @@ struct AIDebugWindow : public QueryStrin
 
	 */
 
	void ChangeToAI(CompanyID show_ai)
 
	{
 
		this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
 
		this->RaiseWidget(ai_debug_company + WID_AID_COMPANY_BUTTON_START);
 
		ai_debug_company = show_ai;
 

	
 
		ScriptLog::LogData *log = (ScriptLog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer();
 
		this->vscroll->SetCount((log == NULL) ? 0 : log->used);
 

	
 
		this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
 
		this->LowerWidget(ai_debug_company + WID_AID_COMPANY_BUTTON_START);
 
		this->autoscroll = true;
 
		this->last_vscroll_pos = this->vscroll->GetPosition();
 
		this->SetDirty();
 
@@ -993,60 +993,60 @@ struct AIDebugWindow : public QueryStrin
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Check which button is clicked */
 
		if (IsInsideMM(widget, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END + 1)) {
 
		if (IsInsideMM(widget, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END + 1)) {
 
			/* Is it no on disable? */
 
			if (!this->IsWidgetDisabled(widget)) {
 
				ChangeToAI((CompanyID)(widget - AID_WIDGET_COMPANY_BUTTON_START));
 
				ChangeToAI((CompanyID)(widget - WID_AID_COMPANY_BUTTON_START));
 
			}
 
		}
 

	
 
		switch (widget) {
 
			case AID_WIDGET_RELOAD_TOGGLE:
 
			case WID_AID_RELOAD_TOGGLE:
 
				/* First kill the company of the AI, then start a new one. This should start the current AI again */
 
				DoCommandP(0, 2 | ai_debug_company << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
 
				DoCommandP(0, 1 | ai_debug_company << 16, 0, CMD_COMPANY_CTRL);
 
				break;
 

	
 
			case AID_WIDGET_SETTINGS:
 
			case WID_AID_SETTINGS:
 
				ShowAISettingsWindow(ai_debug_company);
 
				break;
 

	
 
			case AID_WIDGET_BREAK_STR_ON_OFF_BTN:
 
			case WID_AID_BREAK_STR_ON_OFF_BTN:
 
				this->break_check_enabled = !this->break_check_enabled;
 
				this->SetWidgetLoweredState(AID_WIDGET_BREAK_STR_ON_OFF_BTN, this->break_check_enabled);
 
				this->SetWidgetDirty(AID_WIDGET_BREAK_STR_ON_OFF_BTN);
 
				this->SetWidgetLoweredState(WID_AID_BREAK_STR_ON_OFF_BTN, this->break_check_enabled);
 
				this->SetWidgetDirty(WID_AID_BREAK_STR_ON_OFF_BTN);
 
				break;
 

	
 
			case AID_WIDGET_MATCH_CASE_BTN:
 
			case WID_AID_MATCH_CASE_BTN:
 
				this->case_sensitive_break_check = !this->case_sensitive_break_check;
 
				this->SetWidgetLoweredState(AID_WIDGET_MATCH_CASE_BTN, this->case_sensitive_break_check);
 
				this->SetWidgetLoweredState(WID_AID_MATCH_CASE_BTN, this->case_sensitive_break_check);
 
				break;
 

	
 
			case AID_WIDGET_CONTINUE_BTN:
 
			case WID_AID_CONTINUE_BTN:
 
				/* Unpause */
 
				DoCommandP(0, PM_PAUSED_NORMAL, 0, CMD_PAUSE);
 
				this->DisableWidget(AID_WIDGET_CONTINUE_BTN);
 
				this->RaiseWidget(AID_WIDGET_CONTINUE_BTN); // Disabled widgets don't raise themself
 
				this->DisableWidget(WID_AID_CONTINUE_BTN);
 
				this->RaiseWidget(WID_AID_CONTINUE_BTN); // Disabled widgets don't raise themself
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnTimeout()
 
	{
 
		this->RaiseWidget(AID_WIDGET_RELOAD_TOGGLE);
 
		this->RaiseWidget(AID_WIDGET_SETTINGS);
 
		this->RaiseWidget(WID_AID_RELOAD_TOGGLE);
 
		this->RaiseWidget(WID_AID_SETTINGS);
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnMouseLoop()
 
	{
 
		this->HandleEditBox(AID_WIDGET_BREAK_STR_EDIT_BOX);
 
		this->HandleEditBox(WID_AID_BREAK_STR_EDIT_BOX);
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		if (this->HandleEditBoxKey(AID_WIDGET_BREAK_STR_EDIT_BOX, key, keycode, state) != HEBR_NOT_FOCUSED) {
 
		if (this->HandleEditBoxKey(WID_AID_BREAK_STR_EDIT_BOX, key, keycode, state) != HEBR_NOT_FOCUSED) {
 
			/* Save the current string to static member so it can be restored next time the window is opened */
 
			strecpy(this->break_string, this->edit_str_buf, lastof(this->break_string));
 
		}
 
@@ -1067,9 +1067,9 @@ struct AIDebugWindow : public QueryStrin
 
			 * it was previously paused by the break string ( = a line in the log
 
			 * was highlighted )*/
 
			if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED && this->highlight_row != -1) {
 
				this->DisableWidget(AID_WIDGET_CONTINUE_BTN);
 
				this->SetWidgetDirty(AID_WIDGET_CONTINUE_BTN);
 
				this->SetWidgetDirty(AID_WIDGET_LOG_PANEL);
 
				this->DisableWidget(WID_AID_CONTINUE_BTN);
 
				this->SetWidgetDirty(WID_AID_CONTINUE_BTN);
 
				this->SetWidgetDirty(WID_AID_LOG_PANEL);
 
				this->highlight_row = -1;
 
			}
 
		}
 
@@ -1090,8 +1090,8 @@ struct AIDebugWindow : public QueryStrin
 
				}
 

	
 
				/* Make it possible to click on the continue button */
 
				this->EnableWidget(AID_WIDGET_CONTINUE_BTN);
 
				this->SetWidgetDirty(AID_WIDGET_CONTINUE_BTN);
 
				this->EnableWidget(WID_AID_CONTINUE_BTN);
 
				this->SetWidgetDirty(WID_AID_CONTINUE_BTN);
 

	
 
				/* Highlight row that matched */
 
				this->highlight_row = log->pos;
 
@@ -1101,7 +1101,7 @@ struct AIDebugWindow : public QueryStrin
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, AID_WIDGET_LOG_PANEL);
 
		this->vscroll->SetCapacityFromWidget(this, WID_AID_LOG_PANEL);
 
	}
 
};
 

	
 
@@ -1115,7 +1115,7 @@ bool AIDebugWindow::case_sensitive_break
 
/** Make a number of rows with buttons for each company for the AI debug window. */
 
NWidgetBase *MakeCompanyButtonRowsAIDebug(int *biggest_index)
 
{
 
	return MakeCompanyButtonRows(biggest_index, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
 
	return MakeCompanyButtonRows(biggest_index, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
 
}
 

	
 
/** Widgets for the AI debug window. */
 
@@ -1126,36 +1126,36 @@ static const NWidgetPart _nested_ai_debu
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_VIEW),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_AID_VIEW),
 
		NWidgetFunction(MakeCompanyButtonRowsAIDebug), SetPadding(0, 2, 1, 2),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_TEXTBTN, COLOUR_GREY, AID_WIDGET_NAME_TEXT), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_JUST_STRING, STR_AI_DEBUG_NAME_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_SETTINGS), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_RELOAD_TOGGLE), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_RELOAD, STR_AI_DEBUG_RELOAD_TOOLTIP),
 
		NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AID_NAME_TEXT), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_JUST_STRING, STR_AI_DEBUG_NAME_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_AID_SETTINGS), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_AID_RELOAD_TOGGLE), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_RELOAD, STR_AI_DEBUG_RELOAD_TOOLTIP),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_VERTICAL),
 
			/* Log panel */
 
			NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_LOG_PANEL), SetMinimalSize(287, 180), SetResize(1, 1), SetScrollbar(AID_WIDGET_SCROLLBAR),
 
			NWidget(WWT_PANEL, COLOUR_GREY, WID_AID_LOG_PANEL), SetMinimalSize(287, 180), SetResize(1, 1), SetScrollbar(WID_AID_SCROLLBAR),
 
			EndContainer(),
 
			/* Break string widgets */
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, AID_BREAK_STRING_WIDGETS),
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, WID_AID_BREAK_STRING_WIDGETS),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(WWT_IMGBTN_2, COLOUR_GREY, AID_WIDGET_BREAK_STR_ON_OFF_BTN), SetFill(0, 1), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_AI_DEBUG_BREAK_STR_ON_OFF_TOOLTIP),
 
					NWidget(WWT_IMGBTN_2, COLOUR_GREY, WID_AID_BREAK_STR_ON_OFF_BTN), SetFill(0, 1), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_AI_DEBUG_BREAK_STR_ON_OFF_TOOLTIP),
 
					NWidget(WWT_PANEL, COLOUR_GREY),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_LABEL, COLOUR_GREY), SetPadding(2, 2, 2, 4), SetDataTip(STR_AI_DEBUG_BREAK_ON_LABEL, 0x0),
 
							NWidget(WWT_EDITBOX, COLOUR_WHITE, AID_WIDGET_BREAK_STR_EDIT_BOX), SetFill(1, 1), SetResize(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_AI_DEBUG_BREAK_STR_OSKTITLE, STR_AI_DEBUG_BREAK_STR_TOOLTIP),
 
							NWidget(WWT_EDITBOX, COLOUR_WHITE, WID_AID_BREAK_STR_EDIT_BOX), SetFill(1, 1), SetResize(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_AI_DEBUG_BREAK_STR_OSKTITLE, STR_AI_DEBUG_BREAK_STR_TOOLTIP),
 
						EndContainer(),
 
					EndContainer(),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_MATCH_CASE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_MATCH_CASE, STR_AI_DEBUG_MATCH_CASE_TOOLTIP),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_CONTINUE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_CONTINUE, STR_AI_DEBUG_CONTINUE_TOOLTIP),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_AID_MATCH_CASE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_MATCH_CASE, STR_AI_DEBUG_MATCH_CASE_TOOLTIP),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_AID_CONTINUE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_CONTINUE, STR_AI_DEBUG_CONTINUE_TOOLTIP),
 
				EndContainer(),
 
			EndContainer(),
 
		EndContainer(),
 
		NWidget(NWID_VERTICAL),
 
			NWidget(NWID_VSCROLLBAR, COLOUR_GREY, AID_WIDGET_SCROLLBAR),
 
			NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AID_SCROLLBAR),
 
			NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
		EndContainer(),
 
	EndContainer(),
src/airport_gui.cpp
Show inline comments
 
@@ -84,15 +84,15 @@ struct BuildAirToolbarWindow : Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case ATW_AIRPORT:
 
				if (HandlePlacePushButton(this, ATW_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
 
			case WID_AT_AIRPORT:
 
				if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
 
					ShowBuildAirportPicker(this);
 
					this->last_user_action = widget;
 
				}
 
				break;
 

	
 
			case ATW_DEMOLISH:
 
				HandlePlacePushButton(this, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
			case WID_AT_DEMOLISH:
 
				HandlePlacePushButton(this, WID_AT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
@@ -112,11 +112,11 @@ struct BuildAirToolbarWindow : Window {
 
	virtual void OnPlaceObject(Point pt, TileIndex tile)
 
	{
 
		switch (this->last_user_action) {
 
			case ATW_AIRPORT:
 
			case WID_AT_AIRPORT:
 
				PlaceAirport(tile);
 
				break;
 

	
 
			case ATW_DEMOLISH:
 
			case WID_AT_DEMOLISH:
 
				PlaceProc_DemolishArea(tile);
 
				break;
 

	
 
@@ -148,8 +148,8 @@ struct BuildAirToolbarWindow : Window {
 
};
 

	
 
Hotkey<BuildAirToolbarWindow> BuildAirToolbarWindow::airtoolbar_hotkeys[] = {
 
	Hotkey<BuildAirToolbarWindow>('1', "airport", ATW_AIRPORT),
 
	Hotkey<BuildAirToolbarWindow>('2', "demolish", ATW_DEMOLISH),
 
	Hotkey<BuildAirToolbarWindow>('1', "airport", WID_AT_AIRPORT),
 
	Hotkey<BuildAirToolbarWindow>('2', "demolish", WID_AT_DEMOLISH),
 
	HOTKEY_LIST_END(BuildAirToolbarWindow)
 
};
 
Hotkey<BuildAirToolbarWindow> *_airtoolbar_hotkeys = BuildAirToolbarWindow::airtoolbar_hotkeys;
 
@@ -161,9 +161,9 @@ static const NWidgetPart _nested_air_too
 
		NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ATW_AIRPORT), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_AIRPORT), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP),
 
		NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ATW_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
 
	EndContainer(),
 
};
 

	
 
@@ -221,14 +221,14 @@ public:
 
	{
 
		this->CreateNestedTree(desc);
 

	
 
		this->vscroll = this->GetScrollbar(BAIRW_SCROLLBAR);
 
		this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR);
 
		this->vscroll->SetCapacity(5);
 
		this->vscroll->SetPosition(0);
 

	
 
		this->FinishInitNested(desc, TRANSPORT_AIR);
 

	
 
		this->SetWidgetLoweredState(BAIRW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
 
		this->SetWidgetLoweredState(BAIRW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
 
		this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
 
		this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
 
		this->OnInvalidateData();
 

	
 
		this->vscroll->SetCount(AirportClass::GetCount(_selected_airport_class));
 
@@ -243,11 +243,11 @@ public:
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case BAIRW_CLASS_DROPDOWN:
 
			case WID_AP_CLASS_DROPDOWN:
 
				SetDParam(0, AirportClass::GetName(_selected_airport_class));
 
				break;
 

	
 
			case BAIRW_LAYOUT_NUM:
 
			case WID_AP_LAYOUT_NUM:
 
				SetDParam(0, STR_EMPTY);
 
				if (_selected_airport_index != -1) {
 
					const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index);
 
@@ -268,7 +268,7 @@ public:
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case BAIRW_CLASS_DROPDOWN: {
 
			case WID_AP_CLASS_DROPDOWN: {
 
				Dimension d = {0, 0};
 
				for (uint i = 0; i < AirportClass::GetCount(); i++) {
 
					SetDParam(0, AirportClass::GetName((AirportClassID)i));
 
@@ -280,7 +280,7 @@ public:
 
				break;
 
			}
 

	
 
			case BAIRW_AIRPORT_LIST: {
 
			case WID_AP_AIRPORT_LIST: {
 
				for (int i = 0; i < NUM_AIRPORTS; i++) {
 
					const AirportSpec *as = AirportSpec::Get(i);
 
					if (!as->enabled) continue;
 
@@ -293,7 +293,7 @@ public:
 
				break;
 
			}
 

	
 
			case BAIRW_AIRPORT_SPRITE:
 
			case WID_AP_AIRPORT_SPRITE:
 
				for (int i = 0; i < NUM_AIRPORTS; i++) {
 
					const AirportSpec *as = AirportSpec::Get(i);
 
					if (!as->enabled) continue;
 
@@ -309,7 +309,7 @@ public:
 
				}
 
				break;
 

	
 
			case BAIRW_EXTRA_TEXT:
 
			case WID_AP_EXTRA_TEXT:
 
				for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
 
					const AirportSpec *as = AirportSpec::Get(i);
 
					if (!as->enabled) continue;
 
@@ -332,7 +332,7 @@ public:
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case BAIRW_AIRPORT_LIST: {
 
			case WID_AP_AIRPORT_LIST: {
 
				int y = r.top;
 
				for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < AirportClass::GetCount(_selected_airport_class); i++) {
 
					const AirportSpec *as = AirportClass::Get(_selected_airport_class, i);
 
@@ -345,14 +345,14 @@ public:
 
				break;
 
			}
 

	
 
			case BAIRW_AIRPORT_SPRITE:
 
			case WID_AP_AIRPORT_SPRITE:
 
				if (this->preview_sprite != 0) {
 
					Dimension d = GetSpriteSize(this->preview_sprite);
 
					DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), (r.left + r.right - d.width) / 2, (r.top + r.bottom - d.height) / 2);
 
				}
 
				break;
 

	
 
			case BAIRW_EXTRA_TEXT:
 
			case WID_AP_EXTRA_TEXT:
 
				if (_selected_airport_index != -1) {
 
					const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index);
 
					StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_ADDITIONAL_TEXT);
 
@@ -369,8 +369,8 @@ public:
 
	{
 
		this->DrawWidgets();
 

	
 
		uint16 top = this->GetWidget<NWidgetBase>(BAIRW_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(BAIRW_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL;
 
		NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(BAIRW_BOTTOMPANEL);
 
		uint16 top = this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL;
 
		NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(WID_AP_BOTTOMPANEL);
 

	
 
		int right = panel_nwi->pos_x +  panel_nwi->current_x;
 
		int bottom = panel_nwi->pos_y +  panel_nwi->current_y;
 
@@ -411,8 +411,8 @@ public:
 
	{
 
		if (_selected_airport_index == -1) {
 
			SetTileSelectSize(1, 1);
 
			this->DisableWidget(BAIRW_LAYOUT_DECREASE);
 
			this->DisableWidget(BAIRW_LAYOUT_INCREASE);
 
			this->DisableWidget(WID_AP_LAYOUT_DECREASE);
 
			this->DisableWidget(WID_AP_LAYOUT_INCREASE);
 
		} else {
 
			const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index);
 
			int w = as->size_x;
 
@@ -423,8 +423,8 @@ public:
 

	
 
			this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout);
 

	
 
			this->SetWidgetDisabledState(BAIRW_LAYOUT_DECREASE, _selected_airport_layout == 0);
 
			this->SetWidgetDisabledState(BAIRW_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table);
 
			this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE, _selected_airport_layout == 0);
 
			this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table);
 

	
 
			int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
 
			if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 
@@ -434,11 +434,11 @@ public:
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BAIRW_CLASS_DROPDOWN:
 
				ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class, BAIRW_CLASS_DROPDOWN);
 
			case WID_AP_CLASS_DROPDOWN:
 
				ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class, WID_AP_CLASS_DROPDOWN);
 
				break;
 

	
 
			case BAIRW_AIRPORT_LIST: {
 
			case WID_AP_AIRPORT_LIST: {
 
				int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
 
				if (num_clicked >= this->vscroll->GetCount()) break;
 
				const AirportSpec *as = AirportClass::Get(_selected_airport_class, num_clicked);
 
@@ -446,22 +446,22 @@ public:
 
				break;
 
			}
 

	
 
			case BAIRW_BTN_DONTHILIGHT: case BAIRW_BTN_DOHILIGHT:
 
				_settings_client.gui.station_show_coverage = (widget != BAIRW_BTN_DONTHILIGHT);
 
				this->SetWidgetLoweredState(BAIRW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
 
				this->SetWidgetLoweredState(BAIRW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
 
			case WID_AP_BTN_DONTHILIGHT: case WID_AP_BTN_DOHILIGHT:
 
				_settings_client.gui.station_show_coverage = (widget != WID_AP_BTN_DONTHILIGHT);
 
				this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
 
				this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
 
				this->SetDirty();
 
				SndPlayFx(SND_15_BEEP);
 
				this->UpdateSelectSize();
 
				break;
 

	
 
			case BAIRW_LAYOUT_DECREASE:
 
			case WID_AP_LAYOUT_DECREASE:
 
				_selected_airport_layout--;
 
				this->UpdateSelectSize();
 
				this->SetDirty();
 
				break;
 

	
 
			case BAIRW_LAYOUT_INCREASE:
 
			case WID_AP_LAYOUT_INCREASE:
 
				_selected_airport_layout++;
 
				this->UpdateSelectSize();
 
				this->SetDirty();
 
@@ -504,7 +504,7 @@ public:
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		assert(widget == BAIRW_CLASS_DROPDOWN);
 
		assert(widget == WID_AP_CLASS_DROPDOWN);
 
		_selected_airport_class = (AirportClassID)index;
 
		this->vscroll->SetCount(AirportClass::GetCount(_selected_airport_class));
 
		this->SelectFirstAvailableAirport(false);
 
@@ -523,28 +523,28 @@ static const NWidgetPart _nested_build_a
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2),
 
		NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
 
		NWidget(WWT_DROPDOWN, COLOUR_GREY, BAIRW_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
 
		NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(WWT_MATRIX, COLOUR_GREY, BAIRW_AIRPORT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(BAIRW_SCROLLBAR),
 
			NWidget(NWID_VSCROLLBAR, COLOUR_GREY, BAIRW_SCROLLBAR),
 
			NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
 
			NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR),
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, BAIRW_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL),
 
			NWidget(WWT_LABEL, COLOUR_GREY, BAIRW_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
 
			NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, BAIRW_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL),
 
			NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL),
 
			NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
 
			NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL),
 
		EndContainer(),
 
		NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, BAIRW_AIRPORT_SPRITE), SetFill(1, 0),
 
		NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, BAIRW_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
 
		NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
 
		NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
 
	EndContainer(),
 
	/* Bottom panel. */
 
	NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAIRW_BOTTOMPANEL), SetPIP(2, 2, 2),
 
	NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL), SetPIP(2, 2, 2),
 
		NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
 
			NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
				NWidget(WWT_TEXTBTN, COLOUR_GREY, BAIRW_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
 
				NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
 
											SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
 
				NWidget(WWT_TEXTBTN, COLOUR_GREY, BAIRW_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
 
				NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
 
											SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
 
			EndContainer(),
 
			NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
src/autoreplace_gui.cpp
Show inline comments
 
@@ -202,8 +202,8 @@ public:
 
		this->sel_engine[1] = INVALID_ENGINE;
 

	
 
		this->CreateNestedTree(desc);
 
		this->vscroll[0] = this->GetScrollbar(RVW_WIDGET_LEFT_SCROLLBAR);
 
		this->vscroll[1] = this->GetScrollbar(RVW_WIDGET_RIGHT_SCROLLBAR);
 
		this->vscroll[0] = this->GetScrollbar(WID_RV_LEFT_SCROLLBAR);
 
		this->vscroll[1] = this->GetScrollbar(WID_RV_RIGHT_SCROLLBAR);
 
		this->FinishInitNested(desc, vehicletype);
 

	
 
		this->owner = _local_company;
 
@@ -213,18 +213,18 @@ public:
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case RVW_WIDGET_LEFT_MATRIX:
 
			case RVW_WIDGET_RIGHT_MATRIX:
 
			case WID_RV_LEFT_MATRIX:
 
			case WID_RV_RIGHT_MATRIX:
 
				resize->height = GetEngineListHeight((VehicleType)this->window_number);
 
				size->height = (this->window_number <= VEH_ROAD ? 8 : 4) * resize->height;
 
				break;
 

	
 
			case RVW_WIDGET_LEFT_DETAILS:
 
			case RVW_WIDGET_RIGHT_DETAILS:
 
			case WID_RV_LEFT_DETAILS:
 
			case WID_RV_RIGHT_DETAILS:
 
				size->height = this->details_height;
 
				break;
 

	
 
			case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: {
 
			case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
 
				StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
 
				SetDParam(0, STR_CONFIG_SETTING_ON);
 
				Dimension d = GetStringBoundingBox(str);
 
@@ -236,7 +236,7 @@ public:
 
				break;
 
			}
 

	
 
			case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE: {
 
			case WID_RV_TRAIN_ENGINEWAGON_TOGGLE: {
 
				StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
 
				SetDParam(0, STR_REPLACE_ENGINES);
 
				Dimension d = GetStringBoundingBox(str);
 
@@ -248,7 +248,7 @@ public:
 
				break;
 
			}
 

	
 
			case RVW_WIDGET_INFO_TAB: {
 
			case WID_RV_INFO_TAB: {
 
				SetDParam(0, STR_REPLACE_NOT_REPLACING);
 
				Dimension d = GetStringBoundingBox(STR_BLACK_STRING);
 
				SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED);
 
@@ -259,7 +259,7 @@ public:
 
				break;
 
			}
 

	
 
			case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: {
 
			case WID_RV_TRAIN_RAILTYPE_DROPDOWN: {
 
				Dimension d = {0, 0};
 
				for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
 
					const RailtypeInfo *rti = GetRailTypeInfo(rt);
 
@@ -278,17 +278,17 @@ public:
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case RVW_WIDGET_CAPTION:
 
			case WID_RV_CAPTION:
 
				SetDParam(0, STR_REPLACE_VEHICLE_TRAIN + this->window_number);
 
				break;
 

	
 
			case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: {
 
			case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
 
				const Company *c = Company::Get(_local_company);
 
				SetDParam(0, c->settings.renew_keep_length ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
 
				break;
 
			}
 

	
 
			case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE:
 
			case WID_RV_TRAIN_ENGINEWAGON_TOGGLE:
 
				SetDParam(0, this->replace_engines ? STR_REPLACE_ENGINES : STR_REPLACE_WAGONS);
 
				break;
 
		}
 
@@ -297,7 +297,7 @@ public:
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case RVW_WIDGET_INFO_TAB: {
 
			case WID_RV_INFO_TAB: {
 
				const Company *c = Company::Get(_local_company);
 
				if (this->sel_engine[0] != INVALID_ENGINE) {
 
					if (!EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group)) {
 
@@ -314,9 +314,9 @@ public:
 
				break;
 
			}
 

	
 
			case RVW_WIDGET_LEFT_MATRIX:
 
			case RVW_WIDGET_RIGHT_MATRIX: {
 
				int side = (widget == RVW_WIDGET_LEFT_MATRIX) ? 0 : 1;
 
			case WID_RV_LEFT_MATRIX:
 
			case WID_RV_RIGHT_MATRIX: {
 
				int side = (widget == WID_RV_LEFT_MATRIX) ? 0 : 1;
 
				EngineID start  = this->vscroll[side]->GetPosition(); // what is the offset for the start (scrolling)
 
				EngineID end    = min(this->vscroll[side]->GetCapacity() + start, this->engines[side].Length());
 

	
 
@@ -338,7 +338,7 @@ public:
 
		 *    Either engines list is empty
 
		 * or The selected replacement engine has a replacement (to prevent loops)
 
		 * or The right engines list (new replacement) has the existing replacement vehicle selected */
 
		this->SetWidgetDisabledState(RVW_WIDGET_START_REPLACE,
 
		this->SetWidgetDisabledState(WID_RV_START_REPLACE,
 
										this->sel_engine[0] == INVALID_ENGINE ||
 
										this->sel_engine[1] == INVALID_ENGINE ||
 
										EngineReplacementForCompany(c, this->sel_engine[1], this->sel_group) != INVALID_ENGINE ||
 
@@ -347,7 +347,7 @@ public:
 
		/* Disable the "Stop Replacing" button if:
 
		 *   The left engines list (existing vehicle) is empty
 
		 *   or The selected vehicle has no replacement set up */
 
		this->SetWidgetDisabledState(RVW_WIDGET_STOP_REPLACE,
 
		this->SetWidgetDisabledState(WID_RV_STOP_REPLACE,
 
										this->sel_engine[0] == INVALID_ENGINE ||
 
										!EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group));
 

	
 
@@ -356,11 +356,11 @@ public:
 

	
 
		if (this->window_number == VEH_TRAIN) {
 
			/* sets the colour of that art thing */
 
			this->GetWidget<NWidgetCore>(RVW_WIDGET_TRAIN_FLUFF_LEFT)->colour  = _company_colours[_local_company];
 
			this->GetWidget<NWidgetCore>(RVW_WIDGET_TRAIN_FLUFF_RIGHT)->colour = _company_colours[_local_company];
 
			this->GetWidget<NWidgetCore>(WID_RV_TRAIN_FLUFF_LEFT)->colour  = _company_colours[_local_company];
 
			this->GetWidget<NWidgetCore>(WID_RV_TRAIN_FLUFF_RIGHT)->colour = _company_colours[_local_company];
 

	
 
			/* Show the selected railtype in the pulldown menu */
 
			this->GetWidget<NWidgetCore>(RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN)->widget_data = GetRailTypeInfo(sel_railtype)->strings.replace_text;
 
			this->GetWidget<NWidgetCore>(WID_RV_TRAIN_RAILTYPE_DROPDOWN)->widget_data = GetRailTypeInfo(sel_railtype)->strings.replace_text;
 
		}
 

	
 
		this->DrawWidgets();
 
@@ -370,7 +370,7 @@ public:
 
			/* Draw details panels. */
 
			for (int side = 0; side < 2; side++) {
 
				if (this->sel_engine[side] != INVALID_ENGINE) {
 
					NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS);
 
					NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? WID_RV_LEFT_DETAILS : WID_RV_RIGHT_DETAILS);
 
					int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT,
 
							nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side]);
 
					needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM);
 
@@ -387,22 +387,22 @@ public:
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE:
 
			case WID_RV_TRAIN_ENGINEWAGON_TOGGLE:
 
				this->replace_engines  = !(this->replace_engines);
 
				this->engines[0].ForceRebuild();
 
				this->reset_sel_engine = true;
 
				this->SetDirty();
 
				break;
 

	
 
			case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: // Railtype selection dropdown menu
 
				ShowDropDownList(this, GetRailTypeDropDownList(true), sel_railtype, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN);
 
			case WID_RV_TRAIN_RAILTYPE_DROPDOWN: // Railtype selection dropdown menu
 
				ShowDropDownList(this, GetRailTypeDropDownList(true), sel_railtype, WID_RV_TRAIN_RAILTYPE_DROPDOWN);
 
				break;
 

	
 
			case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length
 
			case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length
 
				DoCommandP(0, GetCompanySettingIndex("company.renew_keep_length"), Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1, CMD_CHANGE_COMPANY_SETTING);
 
				break;
 

	
 
			case RVW_WIDGET_START_REPLACE: { // Start replacing
 
			case WID_RV_START_REPLACE: { // Start replacing
 
				EngineID veh_from = this->sel_engine[0];
 
				EngineID veh_to = this->sel_engine[1];
 
				DoCommandP(0, this->sel_group << 16, veh_from + (veh_to << 16), CMD_SET_AUTOREPLACE);
 
@@ -410,17 +410,17 @@ public:
 
				break;
 
			}
 

	
 
			case RVW_WIDGET_STOP_REPLACE: { // Stop replacing
 
			case WID_RV_STOP_REPLACE: { // Stop replacing
 
				EngineID veh_from = this->sel_engine[0];
 
				DoCommandP(0, this->sel_group << 16, veh_from + (INVALID_ENGINE << 16), CMD_SET_AUTOREPLACE);
 
				this->SetDirty();
 
				break;
 
			}
 

	
 
			case RVW_WIDGET_LEFT_MATRIX:
 
			case RVW_WIDGET_RIGHT_MATRIX: {
 
			case WID_RV_LEFT_MATRIX:
 
			case WID_RV_RIGHT_MATRIX: {
 
				byte click_side;
 
				if (widget == RVW_WIDGET_LEFT_MATRIX) {
 
				if (widget == WID_RV_LEFT_MATRIX) {
 
					click_side = 0;
 
				} else {
 
					click_side = 1;
 
@@ -458,11 +458,11 @@ public:
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll[0]->SetCapacityFromWidget(this, RVW_WIDGET_LEFT_MATRIX);
 
		this->vscroll[1]->SetCapacityFromWidget(this, RVW_WIDGET_RIGHT_MATRIX);
 
		this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX);
 
		this->vscroll[1]->SetCapacityFromWidget(this, WID_RV_RIGHT_MATRIX);
 

	
 
		this->GetWidget<NWidgetCore>(RVW_WIDGET_LEFT_MATRIX)->widget_data =
 
				this->GetWidget<NWidgetCore>(RVW_WIDGET_RIGHT_MATRIX)->widget_data = (this->vscroll[0]->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
		this->GetWidget<NWidgetCore>(WID_RV_LEFT_MATRIX)->widget_data =
 
				this->GetWidget<NWidgetCore>(WID_RV_RIGHT_MATRIX)->widget_data = (this->vscroll[0]->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	/**
 
@@ -484,32 +484,32 @@ public:
 
static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, RVW_WIDGET_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_LEFT_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, RVW_WIDGET_LEFT_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_RIGHT_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, RVW_WIDGET_RIGHT_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_LEFT_DETAILS), SetMinimalSize(228, 102), SetResize(1, 0), EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_RIGHT_DETAILS), SetMinimalSize(228, 102), SetResize(1, 0), EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(228, 102), SetResize(1, 0), EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(228, 102), SetResize(1, 0), EndContainer(),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
 
		NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0),
 
		EndContainer(),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_STOP_REPLACE), SetMinimalSize(150, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(150, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_ENGINE_WAGON_SELECT, STR_REPLACE_ENGINE_WAGON_SELECT_HELP),
 
		NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_TRAIN_FLUFF_LEFT), SetMinimalSize(15, 12), EndContainer(),
 
		NWidget(WWT_DROPDOWN, COLOUR_GREY, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetResize(1, 0),
 
		NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_TRAIN_FLUFF_RIGHT), SetMinimalSize(16, 12), EndContainer(),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_TRAIN_ENGINEWAGON_TOGGLE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_ENGINE_WAGON_SELECT, STR_REPLACE_ENGINE_WAGON_SELECT_HELP),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_TRAIN_FLUFF_LEFT), SetMinimalSize(15, 12), EndContainer(),
 
		NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetResize(1, 0),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_TRAIN_FLUFF_RIGHT), SetMinimalSize(16, 12), EndContainer(),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_TRAIN_WAGONREMOVE_TOGGLE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP),
 
		NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
	EndContainer(),
 
};
 
@@ -524,24 +524,24 @@ static const WindowDesc _replace_rail_ve
 
static const NWidgetPart _nested_replace_vehicle_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, RVW_WIDGET_CAPTION), SetMinimalSize(433, 14), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetMinimalSize(433, 14), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_LEFT_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, RVW_WIDGET_LEFT_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_RIGHT_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, RVW_WIDGET_RIGHT_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_LEFT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_RIGHT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
 
		NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0), EndContainer(),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_STOP_REPLACE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0), EndContainer(),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
 
		NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
	EndContainer(),
 
};
src/bootstrap_gui.cpp
Show inline comments
 
@@ -108,10 +108,10 @@ static const NWidgetPart _bootstrap_quer
 
		NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_MISSING_GRAPHICS_SET_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(WWT_PANEL, COLOUR_GREY, BAFDW_QUESTION), EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_BAFD_QUESTION), EndContainer(),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BAFDW_YES), SetDataTip(STR_MISSING_GRAPHICS_YES_DOWNLOAD, STR_NULL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BAFDW_NO), SetDataTip(STR_MISSING_GRAPHICS_NO_QUIT, STR_NULL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_YES), SetDataTip(STR_MISSING_GRAPHICS_YES_DOWNLOAD, STR_NULL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_NO), SetDataTip(STR_MISSING_GRAPHICS_NO_QUIT, STR_NULL),
 
		EndContainer(),
 
	EndContainer(),
 
};
 
@@ -152,14 +152,14 @@ public:
 
		}
 

	
 
		switch (widget) {
 
			case BAFDW_QUESTION:
 
			case WID_BAFD_QUESTION:
 
				/* The question is twice as wide as the buttons, and determine the height based on the width. */
 
				size->width = this->button_size.width * 2;
 
				size->height = GetStringHeight(STR_MISSING_GRAPHICS_SET_MESSAGE, size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT) + WD_FRAMETEXT_BOTTOM + WD_FRAMETEXT_TOP;
 
				break;
 

	
 
			case BAFDW_YES:
 
			case BAFDW_NO:
 
			case WID_BAFD_YES:
 
			case WID_BAFD_NO:
 
				*size = this->button_size;
 
				break;
 
		}
 
@@ -175,12 +175,12 @@ public:
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BAFDW_YES:
 
			case WID_BAFD_YES:
 
				/* We got permission to connect! Yay! */
 
				_network_content_client.Connect();
 
				break;
 

	
 
			case BAFDW_NO:
 
			case WID_BAFD_NO:
 
				_exit_game = true;
 
				break;
 

	
src/bridge_gui.cpp
Show inline comments
 
@@ -88,7 +88,7 @@ private:
 
	TileIndex end_tile;
 
	uint32 type;
 
	GUIBridgeList *bridges;
 
	int bridgetext_offset; ///< Horizontal offset of the text describing the bridge properties in #BBSW_BRIDGE_LIST relative to the left edge.
 
	int bridgetext_offset; ///< Horizontal offset of the text describing the bridge properties in #WID_BBS_BRIDGE_LIST relative to the left edge.
 
	Scrollbar *vscroll;
 

	
 
	/** Sort the bridges by their index */
 
@@ -126,11 +126,11 @@ private:
 
		this->bridges->Sort();
 

	
 
		/* Display the current sort variant */
 
		this->GetWidget<NWidgetCore>(BBSW_DROPDOWN_CRITERIA)->widget_data = this->sorter_names[this->bridges->SortType()];
 
		this->GetWidget<NWidgetCore>(WID_BBS_DROPDOWN_CRITERIA)->widget_data = this->sorter_names[this->bridges->SortType()];
 

	
 
		/* Set the modified widgets dirty */
 
		this->SetWidgetDirty(BBSW_DROPDOWN_CRITERIA);
 
		this->SetWidgetDirty(BBSW_BRIDGE_LIST);
 
		this->SetWidgetDirty(WID_BBS_DROPDOWN_CRITERIA);
 
		this->SetWidgetDirty(WID_BBS_BRIDGE_LIST);
 
	}
 

	
 
public:
 
@@ -141,9 +141,9 @@ public:
 
		bridges(bl)
 
	{
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(BBSW_SCROLLBAR);
 
		this->vscroll = this->GetScrollbar(WID_BBS_SCROLLBAR);
 
		/* Change the data, or the caption of the gui. Set it to road or rail, accordingly. */
 
		this->GetWidget<NWidgetCore>(BBSW_CAPTION)->widget_data = (GB(this->type, 15, 2) == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION;
 
		this->GetWidget<NWidgetCore>(WID_BBS_CAPTION)->widget_data = (GB(this->type, 15, 2) == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION;
 
		this->FinishInitNested(desc, GB(br_type, 15, 2)); // Initializes 'this->bridgetext_offset'.
 

	
 
		this->parent = FindWindowById(WC_BUILD_TOOLBAR, GB(this->type, 15, 2));
 
@@ -159,7 +159,7 @@ public:
 
		if (this->last_size > this->vscroll->GetCapacity()) {
 
			ResizeWindow(this, 0, (this->last_size - this->vscroll->GetCapacity()) * this->resize.step_height);
 
		}
 
		this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
		this->GetWidget<NWidgetCore>(WID_BBS_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	~BuildBridgeWindow()
 
@@ -172,14 +172,14 @@ public:
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case BBSW_DROPDOWN_ORDER: {
 
			case WID_BBS_DROPDOWN_ORDER: {
 
				Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
 
				d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better.
 
				d.height += padding.height;
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 
			case BBSW_DROPDOWN_CRITERIA: {
 
			case WID_BBS_DROPDOWN_CRITERIA: {
 
				Dimension d = {0, 0};
 
				for (const StringID *str = this->sorter_names; *str != INVALID_STRING_ID; str++) {
 
					d = maxdim(d, GetStringBoundingBox(*str));
 
@@ -189,7 +189,7 @@ public:
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 
			case BBSW_BRIDGE_LIST: {
 
			case WID_BBS_BRIDGE_LIST: {
 
				Dimension sprite_dim = {0, 0}; // Biggest bridge sprite dimension
 
				Dimension text_dim   = {0, 0}; // Biggest text dimension
 
				for (int i = 0; i < (int)this->bridges->Length(); i++) {
 
@@ -216,7 +216,7 @@ public:
 
	virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
 
	{
 
		/* Position the window so hopefully the first bridge from the list is under the mouse pointer. */
 
		NWidgetBase *list = this->GetWidget<NWidgetBase>(BBSW_BRIDGE_LIST);
 
		NWidgetBase *list = this->GetWidget<NWidgetBase>(WID_BBS_BRIDGE_LIST);
 
		Point corner; // point of the top left corner of the window.
 
		corner.y = Clamp(_cursor.pos.y - list->pos_y - 5, GetMainViewTop(), GetMainViewBottom() - sm_height);
 
		corner.x = Clamp(_cursor.pos.x - list->pos_x - 5, 0, _screen.width - sm_width);
 
@@ -226,11 +226,11 @@ public:
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case BBSW_DROPDOWN_ORDER:
 
			case WID_BBS_DROPDOWN_ORDER:
 
				this->DrawSortButtonState(widget, this->bridges->IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
				break;
 

	
 
			case BBSW_BRIDGE_LIST: {
 
			case WID_BBS_BRIDGE_LIST: {
 
				uint y = r.top;
 
				for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < (int)this->bridges->Length(); i++) {
 
					const BridgeSpec *b = this->bridges->Get(i)->spec;
 
@@ -265,8 +265,8 @@ public:
 
	{
 
		switch (widget) {
 
			default: break;
 
			case BBSW_BRIDGE_LIST: {
 
				uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, BBSW_BRIDGE_LIST);
 
			case WID_BBS_BRIDGE_LIST: {
 
				uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BBS_BRIDGE_LIST);
 
				if (i < this->bridges->Length()) {
 
					this->BuildBridge(i);
 
					delete this;
 
@@ -274,20 +274,20 @@ public:
 
				break;
 
			}
 

	
 
			case BBSW_DROPDOWN_ORDER:
 
			case WID_BBS_DROPDOWN_ORDER:
 
				this->bridges->ToggleSortOrder();
 
				this->SetDirty();
 
				break;
 

	
 
			case BBSW_DROPDOWN_CRITERIA:
 
				ShowDropDownMenu(this, this->sorter_names, this->bridges->SortType(), BBSW_DROPDOWN_CRITERIA, 0, 0);
 
			case WID_BBS_DROPDOWN_CRITERIA:
 
				ShowDropDownMenu(this, this->sorter_names, this->bridges->SortType(), WID_BBS_DROPDOWN_CRITERIA, 0, 0);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		if (widget == BBSW_DROPDOWN_CRITERIA && this->bridges->SortType() != index) {
 
		if (widget == WID_BBS_DROPDOWN_CRITERIA && this->bridges->SortType() != index) {
 
			this->bridges->SetSortType(index);
 

	
 
			this->SortBridgeList();
 
@@ -296,8 +296,8 @@ public:
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, BBSW_BRIDGE_LIST);
 
		this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
		this->vscroll->SetCapacityFromWidget(this, WID_BBS_BRIDGE_LIST);
 
		this->GetWidget<NWidgetCore>(WID_BBS_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 

	
 
		this->last_size = max(this->vscroll->GetCapacity(), this->last_size);
 
	}
 
@@ -328,23 +328,23 @@ static const NWidgetPart _nested_build_b
 
	/* Header */
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
 
		NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BBSW_CAPTION), SetDataTip(STR_SELECT_RAIL_BRIDGE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BBS_CAPTION), SetDataTip(STR_SELECT_RAIL_BRIDGE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 

	
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_VERTICAL),
 
			/* Sort order + criteria buttons */
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, BBSW_DROPDOWN_ORDER), SetFill(1, 0), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
 
				NWidget(WWT_DROPDOWN, COLOUR_DARK_GREEN, BBSW_DROPDOWN_CRITERIA), SetFill(1, 0), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA),
 
				NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_BBS_DROPDOWN_ORDER), SetFill(1, 0), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
 
				NWidget(WWT_DROPDOWN, COLOUR_DARK_GREEN, WID_BBS_DROPDOWN_CRITERIA), SetFill(1, 0), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA),
 
			EndContainer(),
 
			/* Matrix. */
 
			NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, BBSW_BRIDGE_LIST), SetFill(1, 0), SetResize(0, 22), SetDataTip(0x401, STR_SELECT_BRIDGE_SELECTION_TOOLTIP), SetScrollbar(BBSW_SCROLLBAR),
 
			NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, WID_BBS_BRIDGE_LIST), SetFill(1, 0), SetResize(0, 22), SetDataTip(0x401, STR_SELECT_BRIDGE_SELECTION_TOOLTIP), SetScrollbar(WID_BBS_SCROLLBAR),
 
		EndContainer(),
 

	
 
		/* scrollbar + resize button */
 
		NWidget(NWID_VERTICAL),
 
			NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, BBSW_SCROLLBAR),
 
			NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_BBS_SCROLLBAR),
 
			NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN),
 
		EndContainer(),
 
	EndContainer(),
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -48,35 +48,35 @@ uint GetEngineListHeight(VehicleType typ
 
static const NWidgetPart _nested_build_vehicle_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, BUILD_VEHICLE_WIDGET_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_BV_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_SORT_ASSENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0),
 
				NWidget(NWID_SPACER), SetFill(1, 1),
 
			EndContainer(),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_DROPDOWN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA),
 
				NWidget(WWT_DROPDOWN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA),
 
				NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA),
 
				NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_CARGO_FILTER_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
	/* Vehicle list. */
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, BUILD_VEHICLE_WIDGET_LIST), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x101, STR_NULL), SetScrollbar(BUILD_VEHICLE_WIDGET_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SCROLLBAR),
 
		NWidget(WWT_MATRIX, COLOUR_GREY, WID_BV_LIST), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x101, STR_NULL), SetScrollbar(WID_BV_SCROLLBAR),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_BV_SCROLLBAR),
 
	EndContainer(),
 
	/* Panel with details. */
 
	NWidget(WWT_PANEL, COLOUR_GREY, BUILD_VEHICLE_WIDGET_PANEL), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_BV_PANEL), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
 
	/* Build/rename buttons, resize button. */
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_SELECTION, INVALID_COLOUR, BUILD_VEHICLE_WIDGET_BUILD_SEL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_BUILD), SetResize(1, 0), SetFill(1, 0),
 
		NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BV_BUILD_SEL),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_BUILD), SetResize(1, 0), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_RENAME), SetResize(1, 0), SetFill(1, 0),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_RENAME), SetResize(1, 0), SetFill(1, 0),
 
		NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
	EndContainer(),
 
};
 
@@ -950,20 +950,20 @@ struct BuildVehicleWindow : Window {
 

	
 
		this->CreateNestedTree(desc);
 

	
 
		this->vscroll = this->GetScrollbar(BUILD_VEHICLE_WIDGET_SCROLLBAR);
 
		this->vscroll = this->GetScrollbar(WID_BV_SCROLLBAR);
 

	
 
		/* If we are just viewing the list of vehicles, we do not need the Build button.
 
		 * So we just hide it, and enlarge the Rename buton by the now vacant place. */
 
		if (this->listview_mode) this->GetWidget<NWidgetStacked>(BUILD_VEHICLE_WIDGET_BUILD_SEL)->SetDisplayedPlane(SZSP_NONE);
 
		if (this->listview_mode) this->GetWidget<NWidgetStacked>(WID_BV_BUILD_SEL)->SetDisplayedPlane(SZSP_NONE);
 

	
 
		NWidgetCore *widget = this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST);
 
		NWidgetCore *widget = this->GetWidget<NWidgetCore>(WID_BV_LIST);
 
		widget->tool_tip = STR_BUY_VEHICLE_TRAIN_LIST_TOOLTIP + type;
 

	
 
		widget = this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_BUILD);
 
		widget = this->GetWidget<NWidgetCore>(WID_BV_BUILD);
 
		widget->widget_data = STR_BUY_VEHICLE_TRAIN_BUY_VEHICLE_BUTTON + type;
 
		widget->tool_tip    = STR_BUY_VEHICLE_TRAIN_BUY_VEHICLE_TOOLTIP + type;
 

	
 
		widget = this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_RENAME);
 
		widget = this->GetWidget<NWidgetCore>(WID_BV_RENAME);
 
		widget->widget_data = STR_BUY_VEHICLE_TRAIN_RENAME_BUTTON + type;
 
		widget->tool_tip    = STR_BUY_VEHICLE_TRAIN_RENAME_TOOLTIP + type;
 

	
 
@@ -1194,23 +1194,23 @@ struct BuildVehicleWindow : Window {
 
	void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING:
 
			case WID_BV_SORT_ASSENDING_DESCENDING:
 
				this->descending_sort_order ^= true;
 
				_last_sort_order[this->vehicle_type] = this->descending_sort_order;
 
				this->eng_list.ForceRebuild();
 
				this->SetDirty();
 
				break;
 

	
 
			case BUILD_VEHICLE_WIDGET_LIST: {
 
				uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, BUILD_VEHICLE_WIDGET_LIST);
 
			case WID_BV_LIST: {
 
				uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BV_LIST);
 
				size_t num_items = this->eng_list.Length();
 
				this->sel_engine = (i < num_items) ? this->eng_list[i] : INVALID_ENGINE;
 
				this->SetDirty();
 
				if (click_count > 1 && !this->listview_mode) this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD, 1);
 
				if (click_count > 1 && !this->listview_mode) this->OnClick(pt, WID_BV_BUILD, 1);
 
				break;
 
			}
 

	
 
			case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: { // Select sorting criteria dropdown menu
 
			case WID_BV_SORT_DROPDOWN: { // Select sorting criteria dropdown menu
 
				uint32 hidden_mask = 0;
 
				/* Disable sorting by power or tractive effort when the original acceleration model for road vehicles is being used. */
 
				if (this->vehicle_type == VEH_ROAD &&
 
@@ -1224,15 +1224,15 @@ struct BuildVehicleWindow : Window {
 
						_settings_game.vehicle.train_acceleration_model == AM_ORIGINAL) {
 
					SetBit(hidden_mask, 4); // tractive effort
 
				}
 
				ShowDropDownMenu(this, _sort_listing[this->vehicle_type], this->sort_criteria, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, 0, hidden_mask);
 
				ShowDropDownMenu(this, _sort_listing[this->vehicle_type], this->sort_criteria, WID_BV_SORT_DROPDOWN, 0, hidden_mask);
 
				break;
 
			}
 

	
 
			case BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN: // Select cargo filtering criteria dropdown menu
 
				ShowDropDownMenu(this, this->cargo_filter_texts, this->cargo_filter_criteria, BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN, 0, 0);
 
			case WID_BV_CARGO_FILTER_DROPDOWN: // Select cargo filtering criteria dropdown menu
 
				ShowDropDownMenu(this, this->cargo_filter_texts, this->cargo_filter_criteria, WID_BV_CARGO_FILTER_DROPDOWN, 0, 0);
 
				break;
 

	
 
			case BUILD_VEHICLE_WIDGET_BUILD: {
 
			case WID_BV_BUILD: {
 
				EngineID sel_eng = this->sel_engine;
 
				if (sel_eng != INVALID_ENGINE) {
 
					CommandCallback *callback = (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildPrimaryVehicle;
 
@@ -1241,7 +1241,7 @@ struct BuildVehicleWindow : Window {
 
				break;
 
			}
 

	
 
			case BUILD_VEHICLE_WIDGET_RENAME: {
 
			case WID_BV_RENAME: {
 
				EngineID sel_eng = this->sel_engine;
 
				if (sel_eng != INVALID_ENGINE) {
 
					this->rename_engine = sel_eng;
 
@@ -1274,7 +1274,7 @@ struct BuildVehicleWindow : Window {
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case BUILD_VEHICLE_WIDGET_CAPTION:
 
			case WID_BV_CAPTION:
 
				if (this->vehicle_type == VEH_TRAIN && !this->listview_mode) {
 
					const RailtypeInfo *rti = GetRailTypeInfo(this->filter.railtype);
 
					SetDParam(0, rti->strings.build_caption);
 
@@ -1283,11 +1283,11 @@ struct BuildVehicleWindow : Window {
 
				}
 
				break;
 

	
 
			case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN:
 
			case WID_BV_SORT_DROPDOWN:
 
				SetDParam(0, _sort_listing[this->vehicle_type][this->sort_criteria]);
 
				break;
 

	
 
			case BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN:
 
			case WID_BV_CARGO_FILTER_DROPDOWN:
 
				SetDParam(0, this->cargo_filter_texts[this->cargo_filter_criteria]);
 
		}
 
	}
 
@@ -1295,16 +1295,16 @@ struct BuildVehicleWindow : Window {
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case BUILD_VEHICLE_WIDGET_LIST:
 
			case WID_BV_LIST:
 
				resize->height = GetEngineListHeight(this->vehicle_type);
 
				size->height = 3 * resize->height;
 
				break;
 

	
 
			case BUILD_VEHICLE_WIDGET_PANEL:
 
			case WID_BV_PANEL:
 
				size->height = this->details_height;
 
				break;
 

	
 
			case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING: {
 
			case WID_BV_SORT_ASSENDING_DESCENDING: {
 
				Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
 
				d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better.
 
				d.height += padding.height;
 
@@ -1317,12 +1317,12 @@ struct BuildVehicleWindow : Window {
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case BUILD_VEHICLE_WIDGET_LIST:
 
			case WID_BV_LIST:
 
				DrawEngineList(this->vehicle_type, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, &this->eng_list, this->vscroll->GetPosition(), min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->eng_list.Length()), this->sel_engine, false, DEFAULT_GROUP);
 
				break;
 

	
 
			case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING:
 
				this->DrawSortButtonState(BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING, this->descending_sort_order ? SBS_DOWN : SBS_UP);
 
			case WID_BV_SORT_ASSENDING_DESCENDING:
 
				this->DrawSortButtonState(WID_BV_SORT_ASSENDING_DESCENDING, this->descending_sort_order ? SBS_DOWN : SBS_UP);
 
				break;
 
		}
 
	}
 
@@ -1338,7 +1338,7 @@ struct BuildVehicleWindow : Window {
 
			int needed_height = this->details_height;
 
			/* Draw details panels. */
 
			if (this->sel_engine != INVALID_ENGINE) {
 
				NWidgetBase *nwi = this->GetWidget<NWidgetBase>(BUILD_VEHICLE_WIDGET_PANEL);
 
				NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_BV_PANEL);
 
				int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT,
 
						nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine);
 
				needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM);
 
@@ -1362,7 +1362,7 @@ struct BuildVehicleWindow : Window {
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		switch (widget) {
 
			case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN:
 
			case WID_BV_SORT_DROPDOWN:
 
				if (this->sort_criteria != index) {
 
					this->sort_criteria = index;
 
					_last_sort_criteria[this->vehicle_type] = this->sort_criteria;
 
@@ -1370,7 +1370,7 @@ struct BuildVehicleWindow : Window {
 
				}
 
				break;
 

	
 
			case BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN: // Select a cargo filter criteria
 
			case WID_BV_CARGO_FILTER_DROPDOWN: // Select a cargo filter criteria
 
				if (this->cargo_filter_criteria != index) {
 
					this->cargo_filter_criteria = index;
 
					_last_filter_criteria[this->vehicle_type] = this->cargo_filter[this->cargo_filter_criteria];
 
@@ -1385,8 +1385,8 @@ struct BuildVehicleWindow : Window {
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, BUILD_VEHICLE_WIDGET_LIST);
 
		this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
		this->vscroll->SetCapacityFromWidget(this, WID_BV_LIST);
 
		this->GetWidget<NWidgetCore>(WID_BV_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 
};
 

	
src/cheat_gui.cpp
Show inline comments
 
@@ -187,7 +187,7 @@ static const NWidgetPart _nested_cheat_w
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, CW_PANEL), SetDataTip(0x0, STR_CHEATS_TOOLTIP), EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_C_PANEL), SetDataTip(0x0, STR_CHEATS_TOOLTIP), EndContainer(),
 
};
 

	
 
/** GUI for the cheats. */
 
@@ -202,7 +202,7 @@ struct CheatWindow : Window {
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget != CW_PANEL) return;
 
		if (widget != WID_C_PANEL) return;
 

	
 
		int y = r.top + WD_FRAMERECT_TOP + this->header_height;
 
		DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, y, STR_CHEATS_WARNING, TC_FROMSTRING, SA_CENTER);
 
@@ -265,7 +265,7 @@ struct CheatWindow : Window {
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget != CW_PANEL) return;
 
		if (widget != WID_C_PANEL) return;
 

	
 
		uint width = 0;
 
		for (int i = 0; i != lengthof(_cheats_ui); i++) {
 
@@ -316,7 +316,7 @@ struct CheatWindow : Window {
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL);
 
		const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_C_PANEL);
 
		uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL);
 
		uint x = pt.x - wid->pos_x;
 
		bool rtl = _current_text_dir == TD_RTL;
src/company_gui.cpp
Show inline comments
 
@@ -218,18 +218,18 @@ static void DrawYearColumn(const Rect &r
 
static const NWidgetPart _nested_company_finances_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetDataTip(STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_CF_CAPTION), SetDataTip(STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, WID_CF_TOGGLE_SIZE), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_PANEL),
 
	NWidget(NWID_SELECTION, INVALID_COLOUR, WID_CF_SEL_PANEL),
 
		NWidget(WWT_PANEL, COLOUR_GREY),
 
			NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_CATEGORY), SetMinimalSize(120, 0), SetFill(0, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE1), SetMinimalSize(86, 0), SetFill(0, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE2), SetMinimalSize(86, 0), SetFill(0, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE3), SetMinimalSize(86, 0), SetFill(0, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_EXPS_CATEGORY), SetMinimalSize(120, 0), SetFill(0, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_EXPS_PRICE1), SetMinimalSize(86, 0), SetFill(0, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_EXPS_PRICE2), SetMinimalSize(86, 0), SetFill(0, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_EXPS_PRICE3), SetMinimalSize(86, 0), SetFill(0, 0),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
@@ -242,17 +242,17 @@ static const NWidgetPart _nested_company
 
			EndContainer(),
 
			NWidget(NWID_SPACER), SetFill(0, 0), SetMinimalSize(30, 0),
 
			NWidget(NWID_VERTICAL), // Vertical column with bank balance amount, loan amount, and total.
 
				NWidget(WWT_TEXT, COLOUR_GREY, CFW_BALANCE_VALUE), SetDataTip(STR_NULL, STR_NULL),
 
				NWidget(WWT_TEXT, COLOUR_GREY, CFW_LOAN_VALUE), SetDataTip(STR_NULL, STR_NULL),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CFW_LOAN_LINE), SetMinimalSize(0, 2), SetFill(1, 0),
 
				NWidget(WWT_TEXT, COLOUR_GREY, CFW_TOTAL_VALUE), SetDataTip(STR_NULL, STR_NULL),
 
				NWidget(WWT_TEXT, COLOUR_GREY, WID_CF_BALANCE_VALUE), SetDataTip(STR_NULL, STR_NULL),
 
				NWidget(WWT_TEXT, COLOUR_GREY, WID_CF_LOAN_VALUE), SetDataTip(STR_NULL, STR_NULL),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_LOAN_LINE), SetMinimalSize(0, 2), SetFill(1, 0),
 
				NWidget(WWT_TEXT, COLOUR_GREY, WID_CF_TOTAL_VALUE), SetDataTip(STR_NULL, STR_NULL),
 
			EndContainer(),
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_MAXLOAN),
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, WID_CF_SEL_MAXLOAN),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(NWID_SPACER), SetFill(0, 1), SetMinimalSize(25, 0),
 
					NWidget(NWID_VERTICAL), // Max loan information
 
						NWidget(WWT_EMPTY, COLOUR_GREY, CFW_MAXLOAN_GAP), SetFill(0, 0),
 
						NWidget(WWT_TEXT, COLOUR_GREY, CFW_MAXLOAN_VALUE), SetDataTip(STR_FINANCES_MAX_LOAN, STR_NULL),
 
						NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_MAXLOAN_GAP), SetFill(0, 0),
 
						NWidget(WWT_TEXT, COLOUR_GREY, WID_CF_MAXLOAN_VALUE), SetDataTip(STR_FINANCES_MAX_LOAN, STR_NULL),
 
						NWidget(NWID_SPACER), SetFill(0, 1),
 
					EndContainer(),
 
				EndContainer(),
 
@@ -260,11 +260,11 @@ static const NWidgetPart _nested_company
 
			NWidget(NWID_SPACER), SetFill(1, 1),
 
		EndContainer(),
 
	EndContainer(),
 
	NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_BUTTONS),
 
	NWidget(NWID_SELECTION, INVALID_COLOUR, WID_CF_SEL_BUTTONS),
 
		NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INCREASE_LOAN), SetFill(1, 0), SetDataTip(STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_REPAY_LOAN), SetFill(1, 0), SetDataTip(STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INFRASTRUCTURE), SetFill(1, 0), SetDataTip(STR_FINANCES_INFRASTRUCTURE_BUTTON, STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CF_INCREASE_LOAN), SetFill(1, 0), SetDataTip(STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CF_REPAY_LOAN), SetFill(1, 0), SetDataTip(STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CF_INFRASTRUCTURE), SetFill(1, 0), SetDataTip(STR_FINANCES_INFRASTRUCTURE_BUTTON, STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP),
 
		EndContainer(),
 
	EndContainer(),
 
};
 
@@ -290,17 +290,17 @@ struct CompanyFinancesWindow : Window {
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case CFW_CAPTION:
 
			case WID_CF_CAPTION:
 
				SetDParam(0, (CompanyID)this->window_number);
 
				SetDParam(1, (CompanyID)this->window_number);
 
				break;
 

	
 
			case CFW_MAXLOAN_VALUE:
 
			case WID_CF_MAXLOAN_VALUE:
 
				SetDParam(0, _economy.max_loan);
 
				break;
 

	
 
			case CFW_INCREASE_LOAN:
 
			case CFW_REPAY_LOAN:
 
			case WID_CF_INCREASE_LOAN:
 
			case WID_CF_REPAY_LOAN:
 
				SetDParam(0, LOAN_INTERVAL);
 
				break;
 
		}
 
@@ -310,24 +310,24 @@ struct CompanyFinancesWindow : Window {
 
	{
 
		int type = _settings_client.gui.expenses_layout;
 
		switch (widget) {
 
			case CFW_EXPS_CATEGORY:
 
			case WID_CF_EXPS_CATEGORY:
 
				size->width  = _expenses_list_types[type].GetCategoriesWidth();
 
				size->height = _expenses_list_types[type].GetHeight();
 
				break;
 

	
 
			case CFW_EXPS_PRICE1:
 
			case CFW_EXPS_PRICE2:
 
			case CFW_EXPS_PRICE3:
 
			case WID_CF_EXPS_PRICE1:
 
			case WID_CF_EXPS_PRICE2:
 
			case WID_CF_EXPS_PRICE3:
 
				size->height = _expenses_list_types[type].GetHeight();
 
				/* FALL THROUGH */
 
			case CFW_BALANCE_VALUE:
 
			case CFW_LOAN_VALUE:
 
			case CFW_TOTAL_VALUE:
 
			case WID_CF_BALANCE_VALUE:
 
			case WID_CF_LOAN_VALUE:
 
			case WID_CF_TOTAL_VALUE:
 
				SetDParam(0, CompanyFinancesWindow::max_money);
 
				size->width = max(GetStringBoundingBox(STR_FINANCES_NEGATIVE_INCOME).width, GetStringBoundingBox(STR_FINANCES_POSITIVE_INCOME).width) + padding.width;
 
				break;
 

	
 
			case CFW_MAXLOAN_GAP:
 
			case WID_CF_MAXLOAN_GAP:
 
				size->height = FONT_HEIGHT_NORMAL;
 
				break;
 
		}
 
@@ -336,44 +336,44 @@ struct CompanyFinancesWindow : Window {
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case CFW_EXPS_CATEGORY:
 
			case WID_CF_EXPS_CATEGORY:
 
				DrawCategories(r);
 
				break;
 

	
 
			case CFW_EXPS_PRICE1:
 
			case CFW_EXPS_PRICE2:
 
			case CFW_EXPS_PRICE3: {
 
			case WID_CF_EXPS_PRICE1:
 
			case WID_CF_EXPS_PRICE2:
 
			case WID_CF_EXPS_PRICE3: {
 
				const Company *c = Company::Get((CompanyID)this->window_number);
 
				int age = min(_cur_year - c->inaugurated_year, 2);
 
				int wid_offset = widget - CFW_EXPS_PRICE1;
 
				int wid_offset = widget - WID_CF_EXPS_PRICE1;
 
				if (wid_offset <= age) {
 
					DrawYearColumn(r, _cur_year - (age - wid_offset), c->yearly_expenses + (age - wid_offset));
 
				}
 
				break;
 
			}
 

	
 
			case CFW_BALANCE_VALUE: {
 
			case WID_CF_BALANCE_VALUE: {
 
				const Company *c = Company::Get((CompanyID)this->window_number);
 
				SetDParam(0, c->money);
 
				DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
 
				break;
 
			}
 

	
 
			case CFW_LOAN_VALUE: {
 
			case WID_CF_LOAN_VALUE: {
 
				const Company *c = Company::Get((CompanyID)this->window_number);
 
				SetDParam(0, c->current_loan);
 
				DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
 
				break;
 
			}
 

	
 
			case CFW_TOTAL_VALUE: {
 
			case WID_CF_TOTAL_VALUE: {
 
				const Company *c = Company::Get((CompanyID)this->window_number);
 
				SetDParam(0, c->money - c->current_loan);
 
				DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT);
 
				break;
 
			}
 

	
 
			case CFW_LOAN_LINE:
 
			case WID_CF_LOAN_LINE:
 
				GfxFillRect(r.left, r.top, r.right, r.top, PC_BLACK);
 
				break;
 
		}
 
@@ -386,12 +386,12 @@ struct CompanyFinancesWindow : Window {
 
	void SetupWidgets()
 
	{
 
		int plane = this->small ? SZSP_NONE : 0;
 
		this->GetWidget<NWidgetStacked>(CFW_SEL_PANEL)->SetDisplayedPlane(plane);
 
		this->GetWidget<NWidgetStacked>(CFW_SEL_MAXLOAN)->SetDisplayedPlane(plane);
 
		this->GetWidget<NWidgetStacked>(WID_CF_SEL_PANEL)->SetDisplayedPlane(plane);
 
		this->GetWidget<NWidgetStacked>(WID_CF_SEL_MAXLOAN)->SetDisplayedPlane(plane);
 

	
 
		CompanyID company = (CompanyID)this->window_number;
 
		plane = (company != _local_company) ? SZSP_NONE : 0;
 
		this->GetWidget<NWidgetStacked>(CFW_SEL_BUTTONS)->SetDisplayedPlane(plane);
 
		this->GetWidget<NWidgetStacked>(WID_CF_SEL_BUTTONS)->SetDisplayedPlane(plane);
 
	}
 

	
 
	virtual void OnPaint()
 
@@ -400,7 +400,7 @@ struct CompanyFinancesWindow : Window {
 
			if (!this->small) {
 
				/* Check that the expenses panel height matches the height needed for the layout. */
 
				int type = _settings_client.gui.expenses_layout;
 
				if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetBase>(CFW_EXPS_CATEGORY)->current_y) {
 
				if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetBase>(WID_CF_EXPS_CATEGORY)->current_y) {
 
					this->SetupWidgets();
 
					this->ReInit();
 
					return;
 
@@ -410,15 +410,15 @@ struct CompanyFinancesWindow : Window {
 
			/* Check that the loan buttons are shown only when the user owns the company. */
 
			CompanyID company = (CompanyID)this->window_number;
 
			int req_plane = (company != _local_company) ? SZSP_NONE : 0;
 
			if (req_plane != this->GetWidget<NWidgetStacked>(CFW_SEL_BUTTONS)->shown_plane) {
 
			if (req_plane != this->GetWidget<NWidgetStacked>(WID_CF_SEL_BUTTONS)->shown_plane) {
 
				this->SetupWidgets();
 
				this->ReInit();
 
				return;
 
			}
 

	
 
			const Company *c = Company::Get(company);
 
			this->SetWidgetDisabledState(CFW_INCREASE_LOAN, c->current_loan == _economy.max_loan); // Borrow button only shows when there is any more money to loan.
 
			this->SetWidgetDisabledState(CFW_REPAY_LOAN, company != _local_company || c->current_loan == 0); // Repay button only shows when there is any more money to repay.
 
			this->SetWidgetDisabledState(WID_CF_INCREASE_LOAN, c->current_loan == _economy.max_loan); // Borrow button only shows when there is any more money to loan.
 
			this->SetWidgetDisabledState(WID_CF_REPAY_LOAN, company != _local_company || c->current_loan == 0); // Repay button only shows when there is any more money to repay.
 
		}
 

	
 
		this->DrawWidgets();
 
@@ -427,7 +427,7 @@ struct CompanyFinancesWindow : Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case CFW_TOGGLE_SIZE: // toggle size
 
			case WID_CF_TOGGLE_SIZE: // toggle size
 
				this->small = !this->small;
 
				this->SetupWidgets();
 
				if (this->IsShaded()) {
 
@@ -439,15 +439,15 @@ struct CompanyFinancesWindow : Window {
 
				}
 
				break;
 

	
 
			case CFW_INCREASE_LOAN: // increase loan
 
			case WID_CF_INCREASE_LOAN: // increase loan
 
				DoCommandP(0, 0, _ctrl_pressed, CMD_INCREASE_LOAN | CMD_MSG(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY));
 
				break;
 

	
 
			case CFW_REPAY_LOAN: // repay loan
 
			case WID_CF_REPAY_LOAN: // repay loan
 
				DoCommandP(0, 0, _ctrl_pressed, CMD_DECREASE_LOAN | CMD_MSG(STR_ERROR_CAN_T_REPAY_LOAN));
 
				break;
 

	
 
			case CFW_INFRASTRUCTURE: // show infrastructure details
 
			case WID_CF_INFRASTRUCTURE: // show infrastructure details
 
				ShowCompanyInfrastructure((CompanyID)this->window_number);
 
				break;
 
		}
 
@@ -562,7 +562,7 @@ private:
 
		LiveryScheme scheme;
 

	
 
		/* Disallow other company colours for the primary colour */
 
		if (HasBit(this->sel, LS_DEFAULT) && widget == SCLW_WIDGET_PRI_COL_DROPDOWN) {
 
		if (HasBit(this->sel, LS_DEFAULT) && widget == WID_SCL_PRI_COL_DROPDOWN) {
 
			const Company *c;
 
			FOR_ALL_COMPANIES(c) {
 
				if (c->index != _local_company) SetBit(used_colours, c->colour);
 
@@ -581,7 +581,7 @@ private:
 
			list->push_back(new DropDownListColourItem(i, HasBit(used_colours, i)));
 
		}
 

	
 
		ShowDropDownList(this, list, widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? livery->colour1 : livery->colour2, widget);
 
		ShowDropDownList(this, list, widget == WID_SCL_PRI_COL_DROPDOWN ? livery->colour1 : livery->colour2, widget);
 
	}
 

	
 
public:
 
@@ -596,14 +596,14 @@ public:
 

	
 
		this->InitNested(desc, company);
 
		this->owner = company;
 
		this->LowerWidget(SCLW_WIDGET_CLASS_GENERAL);
 
		this->LowerWidget(WID_SCL_CLASS_GENERAL);
 
		this->InvalidateData(1);
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case SCLW_WIDGET_SPACER_DROPDOWN: {
 
			case WID_SCL_SPACER_DROPDOWN: {
 
				/* The matrix widget below needs enough room to print all the schemes. */
 
				Dimension d = {0, 0};
 
				for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
@@ -613,7 +613,7 @@ public:
 
				break;
 
			}
 

	
 
			case SCLW_WIDGET_MATRIX: {
 
			case WID_SCL_MATRIX: {
 
				uint livery_height = 0;
 
				for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
					if (_livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme)) {
 
@@ -621,17 +621,17 @@ public:
 
					}
 
				}
 
				size->height = livery_height * this->line_height;
 
				this->GetWidget<NWidgetCore>(SCLW_WIDGET_MATRIX)->widget_data = (livery_height << MAT_ROW_START) | (1 << MAT_COL_START);
 
				this->GetWidget<NWidgetCore>(WID_SCL_MATRIX)->widget_data = (livery_height << MAT_ROW_START) | (1 << MAT_COL_START);
 
				break;
 
			}
 

	
 
			case SCLW_WIDGET_SEC_COL_DROPDOWN:
 
			case WID_SCL_SEC_COL_DROPDOWN:
 
				if (!_loaded_newgrf_features.has_2CC) {
 
					size->width = 0;
 
					break;
 
				}
 
				/* FALL THROUGH */
 
			case SCLW_WIDGET_PRI_COL_DROPDOWN: {
 
			case WID_SCL_PRI_COL_DROPDOWN: {
 
				int padding = this->square.width + NWidgetScrollbar::GetVerticalDimension().width + 10;
 
				for (const StringID *id = _colour_dropdown; id != endof(_colour_dropdown); id++) {
 
					size->width = max(size->width, GetStringBoundingBox(*id).width + padding);
 
@@ -644,8 +644,8 @@ public:
 
	virtual void OnPaint()
 
	{
 
		/* Disable dropdown controls if no scheme is selected */
 
		this->SetWidgetDisabledState(SCLW_WIDGET_PRI_COL_DROPDOWN, this->sel == 0);
 
		this->SetWidgetDisabledState(SCLW_WIDGET_SEC_COL_DROPDOWN, this->sel == 0);
 
		this->SetWidgetDisabledState(WID_SCL_PRI_COL_DROPDOWN, this->sel == 0);
 
		this->SetWidgetDisabledState(WID_SCL_SEC_COL_DROPDOWN, this->sel == 0);
 

	
 
		this->DrawWidgets();
 
	}
 
@@ -653,8 +653,8 @@ public:
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case SCLW_WIDGET_PRI_COL_DROPDOWN:
 
			case SCLW_WIDGET_SEC_COL_DROPDOWN: {
 
			case WID_SCL_PRI_COL_DROPDOWN:
 
			case WID_SCL_SEC_COL_DROPDOWN: {
 
				const Company *c = Company::Get((CompanyID)this->window_number);
 
				LiveryScheme scheme = LS_DEFAULT;
 

	
 
@@ -664,7 +664,7 @@ public:
 
					}
 
					if (scheme == LS_END) scheme = LS_DEFAULT;
 
				}
 
				SetDParam(0, STR_COLOUR_DARK_BLUE + ((widget == SCLW_WIDGET_PRI_COL_DROPDOWN) ? c->livery[scheme].colour1 : c->livery[scheme].colour2));
 
				SetDParam(0, STR_COLOUR_DARK_BLUE + ((widget == WID_SCL_PRI_COL_DROPDOWN) ? c->livery[scheme].colour1 : c->livery[scheme].colour2));
 
				break;
 
			}
 
		}
 
@@ -672,20 +672,20 @@ public:
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget != SCLW_WIDGET_MATRIX) return;
 
		if (widget != WID_SCL_MATRIX) return;
 

	
 
		bool rtl = _current_text_dir == TD_RTL;
 

	
 
		/* Horizontal coordinates of scheme name column. */
 
		const NWidgetBase *nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_SPACER_DROPDOWN);
 
		const NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_SCL_SPACER_DROPDOWN);
 
		int sch_left = nwi->pos_x;
 
		int sch_right = sch_left + nwi->current_x - 1;
 
		/* Horizontal coordinates of first dropdown. */
 
		nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_PRI_COL_DROPDOWN);
 
		nwi = this->GetWidget<NWidgetBase>(WID_SCL_PRI_COL_DROPDOWN);
 
		int pri_left = nwi->pos_x;
 
		int pri_right = pri_left + nwi->current_x - 1;
 
		/* Horizontal coordinates of second dropdown. */
 
		nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_SEC_COL_DROPDOWN);
 
		nwi = this->GetWidget<NWidgetBase>(WID_SCL_SEC_COL_DROPDOWN);
 
		int sec_left = nwi->pos_x;
 
		int sec_right = sec_left + nwi->current_x - 1;
 

	
 
@@ -727,14 +727,14 @@ public:
 
	{
 
		switch (widget) {
 
			/* Livery Class buttons */
 
			case SCLW_WIDGET_CLASS_GENERAL:
 
			case SCLW_WIDGET_CLASS_RAIL:
 
			case SCLW_WIDGET_CLASS_ROAD:
 
			case SCLW_WIDGET_CLASS_SHIP:
 
			case SCLW_WIDGET_CLASS_AIRCRAFT:
 
				this->RaiseWidget(this->livery_class + SCLW_WIDGET_CLASS_GENERAL);
 
				this->livery_class = (LiveryClass)(widget - SCLW_WIDGET_CLASS_GENERAL);
 
				this->LowerWidget(this->livery_class + SCLW_WIDGET_CLASS_GENERAL);
 
			case WID_SCL_CLASS_GENERAL:
 
			case WID_SCL_CLASS_RAIL:
 
			case WID_SCL_CLASS_ROAD:
 
			case WID_SCL_CLASS_SHIP:
 
			case WID_SCL_CLASS_AIRCRAFT:
 
				this->RaiseWidget(this->livery_class + WID_SCL_CLASS_GENERAL);
 
				this->livery_class = (LiveryClass)(widget - WID_SCL_CLASS_GENERAL);
 
				this->LowerWidget(this->livery_class + WID_SCL_CLASS_GENERAL);
 

	
 
				/* Select the first item in the list */
 
				this->sel = 0;
 
@@ -748,16 +748,16 @@ public:
 
				this->ReInit();
 
				break;
 

	
 
			case SCLW_WIDGET_PRI_COL_DROPDOWN: // First colour dropdown
 
				ShowColourDropDownMenu(SCLW_WIDGET_PRI_COL_DROPDOWN);
 
			case WID_SCL_PRI_COL_DROPDOWN: // First colour dropdown
 
				ShowColourDropDownMenu(WID_SCL_PRI_COL_DROPDOWN);
 
				break;
 

	
 
			case SCLW_WIDGET_SEC_COL_DROPDOWN: // Second colour dropdown
 
				ShowColourDropDownMenu(SCLW_WIDGET_SEC_COL_DROPDOWN);
 
			case WID_SCL_SEC_COL_DROPDOWN: // Second colour dropdown
 
				ShowColourDropDownMenu(WID_SCL_SEC_COL_DROPDOWN);
 
				break;
 

	
 
			case SCLW_WIDGET_MATRIX: {
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SCLW_WIDGET_MATRIX);
 
			case WID_SCL_MATRIX: {
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SCL_MATRIX);
 
				LiveryScheme j = (LiveryScheme)((pt.y - wid->pos_y) / this->line_height);
 

	
 
				for (LiveryScheme scheme = LS_BEGIN; scheme <= j; scheme++) {
 
@@ -786,7 +786,7 @@ public:
 
	{
 
		for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
			if (HasBit(this->sel, scheme)) {
 
				DoCommandP(0, scheme | (widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOUR);
 
				DoCommandP(0, scheme | (widget == WID_SCL_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOUR);
 
			}
 
		}
 
	}
 
@@ -799,14 +799,14 @@ public:
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetsDisabledState(true, SCLW_WIDGET_CLASS_RAIL, SCLW_WIDGET_CLASS_ROAD, SCLW_WIDGET_CLASS_SHIP, SCLW_WIDGET_CLASS_AIRCRAFT, WIDGET_LIST_END);
 
		this->SetWidgetsDisabledState(true, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_CLASS_AIRCRAFT, WIDGET_LIST_END);
 

	
 
		bool current_class_valid = this->livery_class == LC_OTHER;
 
		if (_settings_client.gui.liveries == LIT_ALL || (_settings_client.gui.liveries == LIT_COMPANY && this->window_number == _local_company)) {
 
			for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
				if (HasBit(_loaded_newgrf_features.used_liveries, scheme)) {
 
					if (_livery_class[scheme] == this->livery_class) current_class_valid = true;
 
					this->EnableWidget(SCLW_WIDGET_CLASS_GENERAL + _livery_class[scheme]);
 
					this->EnableWidget(WID_SCL_CLASS_GENERAL + _livery_class[scheme]);
 
				} else {
 
					ClrBit(this->sel, scheme);
 
				}
 
@@ -815,7 +815,7 @@ public:
 

	
 
		if (!current_class_valid) {
 
			Point pt = {0, 0};
 
			this->OnClick(pt, SCLW_WIDGET_CLASS_GENERAL, 1);
 
			this->OnClick(pt, WID_SCL_CLASS_GENERAL, 1);
 
		} else if (data == 0) {
 
			this->ReInit();
 
		}
 
@@ -825,23 +825,23 @@ public:
 
static const NWidgetPart _nested_select_company_livery_widgets [] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, SCLW_WIDGET_CAPTION), SetDataTip(STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCL_CAPTION), SetDataTip(STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_GENERAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_RAIL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_ROAD), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRUCKLIST, STR_LIVERY_ROAD_VEHICLE_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_SHIP), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_AIRCRAFT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_GENERAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_RAIL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_ROAD), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRUCKLIST, STR_LIVERY_ROAD_VEHICLE_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_SHIP), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_AIRCRAFT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TOOLTIP),
 
		NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(90, 22), SetFill(1, 1), EndContainer(),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_PANEL, COLOUR_GREY, SCLW_WIDGET_SPACER_DROPDOWN), SetMinimalSize(150, 12), SetFill(1, 1), EndContainer(),
 
		NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_PRI_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1), SetDataTip(STR_BLACK_STRING, STR_LIVERY_PRIMARY_TOOLTIP),
 
		NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_SEC_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_SCL_SPACER_DROPDOWN), SetMinimalSize(150, 12), SetFill(1, 1), EndContainer(),
 
		NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SCL_PRI_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1), SetDataTip(STR_BLACK_STRING, STR_LIVERY_PRIMARY_TOOLTIP),
 
		NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SCL_SEC_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1),
 
				SetDataTip(STR_BLACK_STRING, STR_LIVERY_SECONDARY_TOOLTIP),
 
	EndContainer(),
 
	NWidget(WWT_MATRIX, COLOUR_GREY, SCLW_WIDGET_MATRIX), SetMinimalSize(275, 15), SetFill(1, 0), SetDataTip((1 << MAT_ROW_START) | (1 << MAT_COL_START), STR_LIVERY_PANEL_TOOLTIP),
 
	NWidget(WWT_MATRIX, COLOUR_GREY, WID_SCL_MATRIX), SetMinimalSize(275, 15), SetFill(1, 0), SetDataTip((1 << MAT_ROW_START) | (1 << MAT_COL_START), STR_LIVERY_PANEL_TOOLTIP),
 
};
 

	
 
static const WindowDesc _select_company_livery_desc(
 
@@ -899,122 +899,122 @@ void DrawCompanyManagerFace(CompanyManag
 
static const NWidgetPart _nested_select_company_manager_face_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, SCMFW_WIDGET_CAPTION), SetDataTip(STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TOOLTIP),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCMF_CAPTION), SetDataTip(STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCMF_TOGGLE_LARGE_SMALL), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TOOLTIP),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, SCMFW_WIDGET_SELECT_FACE),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_SCMF_SELECT_FACE),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 2),
 
		NWidget(NWID_HORIZONTAL), SetPIP(2, 2, 2),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(NWID_SPACER), SetFill(1, 0),
 
					NWidget(WWT_EMPTY, COLOUR_GREY, SCMFM_WIDGET_FACE), SetMinimalSize(92, 119),
 
					NWidget(WWT_EMPTY, COLOUR_GREY, WID_SCMF_FACE), SetMinimalSize(92, 119),
 
					NWidget(NWID_SPACER), SetFill(1, 0),
 
				EndContainer(),
 
				NWidget(NWID_SPACER), SetMinimalSize(0, 2),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_RANDOM_NEW_FACE), SetFill(1, 0), SetDataTip(STR_FACE_NEW_FACE_BUTTON, STR_FACE_NEW_FACE_TOOLTIP),
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, SCMFW_WIDGET_SEL_LOADSAVE), // Load/number/save buttons under the portrait in the advanced view.
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_RANDOM_NEW_FACE), SetFill(1, 0), SetDataTip(STR_FACE_NEW_FACE_BUTTON, STR_FACE_NEW_FACE_TOOLTIP),
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_LOADSAVE), // Load/number/save buttons under the portrait in the advanced view.
 
					NWidget(NWID_VERTICAL),
 
						NWidget(NWID_SPACER), SetMinimalSize(0, 5), SetFill(0, 1),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_LOAD), SetFill(1, 0), SetDataTip(STR_FACE_LOAD, STR_FACE_LOAD_TOOLTIP),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_FACECODE), SetFill(1, 0), SetDataTip(STR_FACE_FACECODE, STR_FACE_FACECODE_TOOLTIP),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_SAVE), SetFill(1, 0), SetDataTip(STR_FACE_SAVE, STR_FACE_SAVE_TOOLTIP),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_LOAD), SetFill(1, 0), SetDataTip(STR_FACE_LOAD, STR_FACE_LOAD_TOOLTIP),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_FACECODE), SetFill(1, 0), SetDataTip(STR_FACE_FACECODE, STR_FACE_FACECODE_TOOLTIP),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_SAVE), SetFill(1, 0), SetDataTip(STR_FACE_SAVE, STR_FACE_SAVE_TOOLTIP),
 
						NWidget(NWID_SPACER), SetMinimalSize(0, 5), SetFill(0, 1),
 
					EndContainer(),
 
				EndContainer(),
 
			EndContainer(),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON), SetFill(1, 0), SetDataTip(STR_FACE_ADVANCED, STR_FACE_ADVANCED_TOOLTIP),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON), SetFill(1, 0), SetDataTip(STR_FACE_ADVANCED, STR_FACE_ADVANCED_TOOLTIP),
 
				NWidget(NWID_SPACER), SetMinimalSize(0, 2),
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, SCMFW_WIDGET_SEL_MALEFEMALE), // Simple male/female face setting.
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_MALEFEMALE), // Simple male/female face setting.
 
					NWidget(NWID_VERTICAL),
 
						NWidget(NWID_SPACER), SetFill(0, 1),
 
						NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_MALE), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP),
 
						NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_FEMALE), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP),
 
						NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_MALE), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP),
 
						NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_FEMALE), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP),
 
						NWidget(NWID_SPACER), SetFill(0, 1),
 
					EndContainer(),
 
				EndContainer(),
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, SCMFW_WIDGET_SEL_PARTS), // Advanced face parts setting.
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_PARTS), // Advanced face parts setting.
 
					NWidget(NWID_VERTICAL),
 
						NWidget(NWID_SPACER), SetMinimalSize(0, 2),
 
						NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_MALE2), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_FEMALE2), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_MALE2), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_FEMALE2), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_SPACER), SetMinimalSize(0, 2),
 
						NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_ETHNICITY_EUR), SetFill(1, 0), SetDataTip(STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_ETHNICITY_AFR), SetFill(1, 0), SetDataTip(STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_ETHNICITY_EUR), SetFill(1, 0), SetDataTip(STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_ETHNICITY_AFR), SetFill(1, 0), SetDataTip(STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN),
 
						EndContainer(),
 
						NWidget(NWID_SPACER), SetMinimalSize(0, 4),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAS_MOUSTACHE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAS_MOUSTACHE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_HAS_GLASSES_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAS_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAS_GLASSES_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAS_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_HAIR_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR_L), SetDataTip(AWV_DECREASE, STR_FACE_HAIR_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR_R), SetDataTip(AWV_INCREASE, STR_FACE_HAIR_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAIR_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_L), SetDataTip(AWV_DECREASE, STR_FACE_HAIR_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAIR), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_R), SetDataTip(AWV_INCREASE, STR_FACE_HAIR_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_EYEBROWS_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS_L), SetDataTip(AWV_DECREASE, STR_FACE_EYEBROWS_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS_R), SetDataTip(AWV_INCREASE, STR_FACE_EYEBROWS_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYEBROWS_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_L), SetDataTip(AWV_DECREASE, STR_FACE_EYEBROWS_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYEBROWS), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_R), SetDataTip(AWV_INCREASE, STR_FACE_EYEBROWS_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_EYECOLOUR_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR_L), SetDataTip(AWV_DECREASE, STR_FACE_EYECOLOUR_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR_R), SetDataTip(AWV_INCREASE, STR_FACE_EYECOLOUR_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYECOLOUR_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_L), SetDataTip(AWV_DECREASE, STR_FACE_EYECOLOUR_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_R), SetDataTip(AWV_INCREASE, STR_FACE_EYECOLOUR_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_GLASSES_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES_L), SetDataTip(AWV_DECREASE, STR_FACE_GLASSES_TOOLTIP_2),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES_R), SetDataTip(AWV_INCREASE, STR_FACE_GLASSES_TOOLTIP_2),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_GLASSES_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_L), SetDataTip(AWV_DECREASE, STR_FACE_GLASSES_TOOLTIP_2),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_R), SetDataTip(AWV_INCREASE, STR_FACE_GLASSES_TOOLTIP_2),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_NOSE_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE_L), SetDataTip(AWV_DECREASE, STR_FACE_NOSE_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE_R), SetDataTip(AWV_INCREASE, STR_FACE_NOSE_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_NOSE_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_L), SetDataTip(AWV_DECREASE, STR_FACE_NOSE_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_NOSE), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_R), SetDataTip(AWV_INCREASE, STR_FACE_NOSE_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE_L), SetDataTip(AWV_DECREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE_R), SetDataTip(AWV_INCREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_LIPS_MOUSTACHE_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_L), SetDataTip(AWV_DECREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_R), SetDataTip(AWV_INCREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_CHIN_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN_L), SetDataTip(AWV_DECREASE, STR_FACE_CHIN_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN_R), SetDataTip(AWV_INCREASE, STR_FACE_CHIN_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_CHIN_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_L), SetDataTip(AWV_DECREASE, STR_FACE_CHIN_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_CHIN), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_R), SetDataTip(AWV_INCREASE, STR_FACE_CHIN_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_JACKET_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET_L), SetDataTip(AWV_DECREASE, STR_FACE_JACKET_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET_R), SetDataTip(AWV_INCREASE, STR_FACE_JACKET_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_JACKET_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_L), SetDataTip(AWV_DECREASE, STR_FACE_JACKET_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_JACKET), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_R), SetDataTip(AWV_INCREASE, STR_FACE_JACKET_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_COLLAR_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR_L), SetDataTip(AWV_DECREASE, STR_FACE_COLLAR_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR_R), SetDataTip(AWV_INCREASE, STR_FACE_COLLAR_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_COLLAR_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_L), SetDataTip(AWV_DECREASE, STR_FACE_COLLAR_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_COLLAR), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_R), SetDataTip(AWV_INCREASE, STR_FACE_COLLAR_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_TIE_EARRING_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING_L), SetDataTip(AWV_DECREASE, STR_FACE_TIE_EARRING_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING_R), SetDataTip(AWV_INCREASE, STR_FACE_TIE_EARRING_TOOLTIP),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_TIE_EARRING_TEXT), SetFill(1, 0),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_L), SetDataTip(AWV_DECREASE, STR_FACE_TIE_EARRING_TOOLTIP),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP),
 
							NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_R), SetDataTip(AWV_INCREASE, STR_FACE_TIE_EARRING_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_SPACER), SetFill(0, 1),
 
					EndContainer(),
 
@@ -1024,8 +1024,8 @@ static const NWidgetPart _nested_select_
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 2),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_FACE_CANCEL_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_ACCEPT), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_FACE_OK_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_FACE_CANCEL_TOOLTIP),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_ACCEPT), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_FACE_OK_TOOLTIP),
 
	EndContainer(),
 
};
 

	
 
@@ -1094,17 +1094,17 @@ public:
 
	}
 

	
 
	/**
 
	 * Select planes to display to the user with the #NWID_SELECTION widgets #SCMFW_WIDGET_SEL_LOADSAVE, #SCMFW_WIDGET_SEL_MALEFEMALE, and #SCMFW_WIDGET_SEL_PARTS.
 
	 * Select planes to display to the user with the #NWID_SELECTION widgets #WID_SCMF_SEL_LOADSAVE, #WID_SCMF_SEL_MALEFEMALE, and #WID_SCMF_SEL_PARTS.
 
	 * @param advanced Display advanced face management window.
 
	 */
 
	void SelectDisplayPlanes(bool advanced)
 
	{
 
		this->GetWidget<NWidgetStacked>(SCMFW_WIDGET_SEL_LOADSAVE)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE);
 
		this->GetWidget<NWidgetStacked>(SCMFW_WIDGET_SEL_PARTS)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE);
 
		this->GetWidget<NWidgetStacked>(SCMFW_WIDGET_SEL_MALEFEMALE)->SetDisplayedPlane(advanced ? SZSP_NONE : 0);
 
		this->GetWidget<NWidgetCore>(SCMFW_WIDGET_RANDOM_NEW_FACE)->widget_data = advanced ? STR_MAPGEN_RANDOM : STR_FACE_NEW_FACE_BUTTON;
 
		this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_LOADSAVE)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE);
 
		this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_PARTS)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE);
 
		this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_MALEFEMALE)->SetDisplayedPlane(advanced ? SZSP_NONE : 0);
 
		this->GetWidget<NWidgetCore>(WID_SCMF_RANDOM_NEW_FACE)->widget_data = advanced ? STR_MAPGEN_RANDOM : STR_FACE_NEW_FACE_BUTTON;
 

	
 
		NWidgetCore *wi = this->GetWidget<NWidgetCore>(SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON);
 
		NWidgetCore *wi = this->GetWidget<NWidgetCore>(WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON);
 
		if (advanced) {
 
			wi->SetDataTip(STR_FACE_SIMPLE, STR_FACE_SIMPLE_TOOLTIP);
 
		} else {
 
@@ -1138,50 +1138,50 @@ public:
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT:
 
			case SCMFW_WIDGET_TIE_EARRING_TEXT: {
 
				int offset = (widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT) * 2;
 
			case WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT:
 
			case WID_SCMF_TIE_EARRING_TEXT: {
 
				int offset = (widget - WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT) * 2;
 
				*size = maxdim(GetStringBoundingBox(PART_TEXTS_IS_FEMALE[offset]), GetStringBoundingBox(PART_TEXTS_IS_FEMALE[offset + 1]));
 
				size->width  += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
				size->height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				break;
 
			}
 

	
 
			case SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT:
 
			case WID_SCMF_LIPS_MOUSTACHE_TEXT:
 
				*size = maxdim(GetStringBoundingBox(STR_FACE_LIPS), GetStringBoundingBox(STR_FACE_MOUSTACHE));
 
				size->width  += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
				size->height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				break;
 

	
 
			case SCMFW_WIDGET_HAS_GLASSES_TEXT:
 
			case SCMFW_WIDGET_HAIR_TEXT:
 
			case SCMFW_WIDGET_EYEBROWS_TEXT:
 
			case SCMFW_WIDGET_EYECOLOUR_TEXT:
 
			case SCMFW_WIDGET_GLASSES_TEXT:
 
			case SCMFW_WIDGET_NOSE_TEXT:
 
			case SCMFW_WIDGET_CHIN_TEXT:
 
			case SCMFW_WIDGET_JACKET_TEXT:
 
			case SCMFW_WIDGET_COLLAR_TEXT:
 
				*size = GetStringBoundingBox(PART_TEXTS[widget - SCMFW_WIDGET_HAS_GLASSES_TEXT]);
 
			case WID_SCMF_HAS_GLASSES_TEXT:
 
			case WID_SCMF_HAIR_TEXT:
 
			case WID_SCMF_EYEBROWS_TEXT:
 
			case WID_SCMF_EYECOLOUR_TEXT:
 
			case WID_SCMF_GLASSES_TEXT:
 
			case WID_SCMF_NOSE_TEXT:
 
			case WID_SCMF_CHIN_TEXT:
 
			case WID_SCMF_JACKET_TEXT:
 
			case WID_SCMF_COLLAR_TEXT:
 
				*size = GetStringBoundingBox(PART_TEXTS[widget - WID_SCMF_HAS_GLASSES_TEXT]);
 
				size->width  += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
				size->height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				break;
 

	
 
			case SCMFW_WIDGET_HAS_MOUSTACHE_EARRING:
 
			case SCMFW_WIDGET_HAS_GLASSES:
 
			case WID_SCMF_HAS_MOUSTACHE_EARRING:
 
			case WID_SCMF_HAS_GLASSES:
 
				*size = this->yesno_dim;
 
				break;
 

	
 
			case SCMFW_WIDGET_EYECOLOUR:
 
			case SCMFW_WIDGET_CHIN:
 
			case SCMFW_WIDGET_EYEBROWS:
 
			case SCMFW_WIDGET_LIPS_MOUSTACHE:
 
			case SCMFW_WIDGET_NOSE:
 
			case SCMFW_WIDGET_HAIR:
 
			case SCMFW_WIDGET_JACKET:
 
			case SCMFW_WIDGET_COLLAR:
 
			case SCMFW_WIDGET_TIE_EARRING:
 
			case SCMFW_WIDGET_GLASSES:
 
			case WID_SCMF_EYECOLOUR:
 
			case WID_SCMF_CHIN:
 
			case WID_SCMF_EYEBROWS:
 
			case WID_SCMF_LIPS_MOUSTACHE:
 
			case WID_SCMF_NOSE:
 
			case WID_SCMF_HAIR:
 
			case WID_SCMF_JACKET:
 
			case WID_SCMF_COLLAR:
 
			case WID_SCMF_TIE_EARRING:
 
			case WID_SCMF_GLASSES:
 
				*size = this->number_dim;
 
				break;
 
		}
 
@@ -1190,14 +1190,14 @@ public:
 
	virtual void OnPaint()
 
	{
 
		/* lower the non-selected gender button */
 
		this->SetWidgetsLoweredState(!this->is_female, SCMFW_WIDGET_MALE, SCMFW_WIDGET_MALE2, WIDGET_LIST_END);
 
		this->SetWidgetsLoweredState( this->is_female, SCMFW_WIDGET_FEMALE, SCMFW_WIDGET_FEMALE2, WIDGET_LIST_END);
 
		this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2, WIDGET_LIST_END);
 
		this->SetWidgetsLoweredState( this->is_female, WID_SCMF_FEMALE, WID_SCMF_FEMALE2, WIDGET_LIST_END);
 

	
 
		/* advanced company manager face selection window */
 

	
 
		/* lower the non-selected ethnicity button */
 
		this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_EUR, !HasBit(this->ge, ETHNICITY_BLACK));
 
		this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_AFR,  HasBit(this->ge, ETHNICITY_BLACK));
 
		this->SetWidgetLoweredState(WID_SCMF_ETHNICITY_EUR, !HasBit(this->ge, ETHNICITY_BLACK));
 
		this->SetWidgetLoweredState(WID_SCMF_ETHNICITY_AFR,  HasBit(this->ge, ETHNICITY_BLACK));
 

	
 

	
 
		/* Disable dynamically the widgets which CompanyManagerFaceVariable has less than 2 options
 
@@ -1206,44 +1206,44 @@ public:
 

	
 
		/* Eye colour buttons */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_EYE_COLOUR].valid_values[this->ge] < 2,
 
				SCMFW_WIDGET_EYECOLOUR, SCMFW_WIDGET_EYECOLOUR_L, SCMFW_WIDGET_EYECOLOUR_R, WIDGET_LIST_END);
 
				WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_L, WID_SCMF_EYECOLOUR_R, WIDGET_LIST_END);
 

	
 
		/* Chin buttons */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_CHIN].valid_values[this->ge] < 2,
 
				SCMFW_WIDGET_CHIN, SCMFW_WIDGET_CHIN_L, SCMFW_WIDGET_CHIN_R, WIDGET_LIST_END);
 
				WID_SCMF_CHIN, WID_SCMF_CHIN_L, WID_SCMF_CHIN_R, WIDGET_LIST_END);
 

	
 
		/* Eyebrows buttons */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_EYEBROWS].valid_values[this->ge] < 2,
 
				SCMFW_WIDGET_EYEBROWS, SCMFW_WIDGET_EYEBROWS_L, SCMFW_WIDGET_EYEBROWS_R, WIDGET_LIST_END);
 
				WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_L, WID_SCMF_EYEBROWS_R, WIDGET_LIST_END);
 

	
 
		/* Lips or (if it a male face with a moustache) moustache buttons */
 
		this->SetWidgetsDisabledState(_cmf_info[this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS].valid_values[this->ge] < 2,
 
				SCMFW_WIDGET_LIPS_MOUSTACHE, SCMFW_WIDGET_LIPS_MOUSTACHE_L, SCMFW_WIDGET_LIPS_MOUSTACHE_R, WIDGET_LIST_END);
 
				WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_L, WID_SCMF_LIPS_MOUSTACHE_R, WIDGET_LIST_END);
 

	
 
		/* Nose buttons | male faces with moustache haven't any nose options */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_NOSE].valid_values[this->ge] < 2 || this->is_moust_male,
 
				SCMFW_WIDGET_NOSE, SCMFW_WIDGET_NOSE_L, SCMFW_WIDGET_NOSE_R, WIDGET_LIST_END);
 
				WID_SCMF_NOSE, WID_SCMF_NOSE_L, WID_SCMF_NOSE_R, WIDGET_LIST_END);
 

	
 
		/* Hair buttons */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_HAIR].valid_values[this->ge] < 2,
 
				SCMFW_WIDGET_HAIR, SCMFW_WIDGET_HAIR_L, SCMFW_WIDGET_HAIR_R, WIDGET_LIST_END);
 
				WID_SCMF_HAIR, WID_SCMF_HAIR_L, WID_SCMF_HAIR_R, WIDGET_LIST_END);
 

	
 
		/* Jacket buttons */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_JACKET].valid_values[this->ge] < 2,
 
				SCMFW_WIDGET_JACKET, SCMFW_WIDGET_JACKET_L, SCMFW_WIDGET_JACKET_R, WIDGET_LIST_END);
 
				WID_SCMF_JACKET, WID_SCMF_JACKET_L, WID_SCMF_JACKET_R, WIDGET_LIST_END);
 

	
 
		/* Collar buttons */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_COLLAR].valid_values[this->ge] < 2,
 
				SCMFW_WIDGET_COLLAR, SCMFW_WIDGET_COLLAR_L, SCMFW_WIDGET_COLLAR_R, WIDGET_LIST_END);
 
				WID_SCMF_COLLAR, WID_SCMF_COLLAR_L, WID_SCMF_COLLAR_R, WIDGET_LIST_END);
 

	
 
		/* Tie/earring buttons | female faces without earring haven't any earring options */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_TIE_EARRING].valid_values[this->ge] < 2 ||
 
					(this->is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge) == 0),
 
				SCMFW_WIDGET_TIE_EARRING, SCMFW_WIDGET_TIE_EARRING_L, SCMFW_WIDGET_TIE_EARRING_R, WIDGET_LIST_END);
 
				WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_L, WID_SCMF_TIE_EARRING_R, WIDGET_LIST_END);
 

	
 
		/* Glasses buttons | faces without glasses haven't any glasses options */
 
		this->SetWidgetsDisabledState(_cmf_info[CMFV_GLASSES].valid_values[this->ge] < 2 || GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge) == 0,
 
				SCMFW_WIDGET_GLASSES, SCMFW_WIDGET_GLASSES_L, SCMFW_WIDGET_GLASSES_R, WIDGET_LIST_END);
 
				WID_SCMF_GLASSES, WID_SCMF_GLASSES_L, WID_SCMF_GLASSES_R, WIDGET_LIST_END);
 

	
 
		this->DrawWidgets();
 
	}
 
@@ -1251,91 +1251,91 @@ public:
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT:
 
			case SCMFW_WIDGET_TIE_EARRING_TEXT: {
 
				StringID str = PART_TEXTS_IS_FEMALE[(widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT) * 2 + this->is_female];
 
			case WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT:
 
			case WID_SCMF_TIE_EARRING_TEXT: {
 
				StringID str = PART_TEXTS_IS_FEMALE[(widget - WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT) * 2 + this->is_female];
 
				DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_GOLD, SA_RIGHT);
 
				break;
 
			}
 

	
 
			case SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT:
 
			case WID_SCMF_LIPS_MOUSTACHE_TEXT:
 
				DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, (this->is_moust_male) ? STR_FACE_MOUSTACHE : STR_FACE_LIPS, TC_GOLD, SA_RIGHT);
 
				break;
 

	
 
			case SCMFW_WIDGET_HAS_GLASSES_TEXT:
 
			case SCMFW_WIDGET_HAIR_TEXT:
 
			case SCMFW_WIDGET_EYEBROWS_TEXT:
 
			case SCMFW_WIDGET_EYECOLOUR_TEXT:
 
			case SCMFW_WIDGET_GLASSES_TEXT:
 
			case SCMFW_WIDGET_NOSE_TEXT:
 
			case SCMFW_WIDGET_CHIN_TEXT:
 
			case SCMFW_WIDGET_JACKET_TEXT:
 
			case SCMFW_WIDGET_COLLAR_TEXT:
 
				DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, PART_TEXTS[widget - SCMFW_WIDGET_HAS_GLASSES_TEXT], TC_GOLD, SA_RIGHT);
 
			case WID_SCMF_HAS_GLASSES_TEXT:
 
			case WID_SCMF_HAIR_TEXT:
 
			case WID_SCMF_EYEBROWS_TEXT:
 
			case WID_SCMF_EYECOLOUR_TEXT:
 
			case WID_SCMF_GLASSES_TEXT:
 
			case WID_SCMF_NOSE_TEXT:
 
			case WID_SCMF_CHIN_TEXT:
 
			case WID_SCMF_JACKET_TEXT:
 
			case WID_SCMF_COLLAR_TEXT:
 
				DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, PART_TEXTS[widget - WID_SCMF_HAS_GLASSES_TEXT], TC_GOLD, SA_RIGHT);
 
				break;
 

	
 

	
 
			case SCMFW_WIDGET_HAS_MOUSTACHE_EARRING:
 
			case WID_SCMF_HAS_MOUSTACHE_EARRING:
 
				if (this->is_female) { // Only for female faces
 
					this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge), true);
 
					this->DrawFaceStringLabel(WID_SCMF_HAS_MOUSTACHE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge), true);
 
				} else { // Only for male faces
 
					this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE,   this->ge), true);
 
					this->DrawFaceStringLabel(WID_SCMF_HAS_MOUSTACHE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE,   this->ge), true);
 
				}
 
				break;
 

	
 
			case SCMFW_WIDGET_TIE_EARRING:
 
			case WID_SCMF_TIE_EARRING:
 
				if (this->is_female) { // Only for female faces
 
					this->DrawFaceStringLabel(SCMFW_WIDGET_TIE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false);
 
					this->DrawFaceStringLabel(WID_SCMF_TIE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false);
 
				} else { // Only for male faces
 
					this->DrawFaceStringLabel(SCMFW_WIDGET_TIE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false);
 
					this->DrawFaceStringLabel(WID_SCMF_TIE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false);
 
				}
 
				break;
 

	
 
			case SCMFW_WIDGET_LIPS_MOUSTACHE:
 
			case WID_SCMF_LIPS_MOUSTACHE:
 
				if (this->is_moust_male) { // Only for male faces with moustache
 
					this->DrawFaceStringLabel(SCMFW_WIDGET_LIPS_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_MOUSTACHE, this->ge), false);
 
					this->DrawFaceStringLabel(WID_SCMF_LIPS_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_MOUSTACHE, this->ge), false);
 
				} else { // Only for female faces or male faces without moustache
 
					this->DrawFaceStringLabel(SCMFW_WIDGET_LIPS_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_LIPS,      this->ge), false);
 
					this->DrawFaceStringLabel(WID_SCMF_LIPS_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_LIPS,      this->ge), false);
 
				}
 
				break;
 

	
 
			case SCMFW_WIDGET_HAS_GLASSES:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge), true );
 
			case WID_SCMF_HAS_GLASSES:
 
				this->DrawFaceStringLabel(WID_SCMF_HAS_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge), true );
 
				break;
 

	
 
			case SCMFW_WIDGET_HAIR:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_HAIR,        GetCompanyManagerFaceBits(this->face, CMFV_HAIR,        this->ge), false);
 
			case WID_SCMF_HAIR:
 
				this->DrawFaceStringLabel(WID_SCMF_HAIR,        GetCompanyManagerFaceBits(this->face, CMFV_HAIR,        this->ge), false);
 
				break;
 

	
 
			case SCMFW_WIDGET_EYEBROWS:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_EYEBROWS,    GetCompanyManagerFaceBits(this->face, CMFV_EYEBROWS,    this->ge), false);
 
			case WID_SCMF_EYEBROWS:
 
				this->DrawFaceStringLabel(WID_SCMF_EYEBROWS,    GetCompanyManagerFaceBits(this->face, CMFV_EYEBROWS,    this->ge), false);
 
				break;
 

	
 
			case SCMFW_WIDGET_EYECOLOUR:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_EYECOLOUR,   GetCompanyManagerFaceBits(this->face, CMFV_EYE_COLOUR,  this->ge), false);
 
			case WID_SCMF_EYECOLOUR:
 
				this->DrawFaceStringLabel(WID_SCMF_EYECOLOUR,   GetCompanyManagerFaceBits(this->face, CMFV_EYE_COLOUR,  this->ge), false);
 
				break;
 

	
 
			case SCMFW_WIDGET_GLASSES:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_GLASSES,     GetCompanyManagerFaceBits(this->face, CMFV_GLASSES,     this->ge), false);
 
			case WID_SCMF_GLASSES:
 
				this->DrawFaceStringLabel(WID_SCMF_GLASSES,     GetCompanyManagerFaceBits(this->face, CMFV_GLASSES,     this->ge), false);
 
				break;
 

	
 
			case SCMFW_WIDGET_NOSE:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_NOSE,        GetCompanyManagerFaceBits(this->face, CMFV_NOSE,        this->ge), false);
 
			case WID_SCMF_NOSE:
 
				this->DrawFaceStringLabel(WID_SCMF_NOSE,        GetCompanyManagerFaceBits(this->face, CMFV_NOSE,        this->ge), false);
 
				break;
 

	
 
			case SCMFW_WIDGET_CHIN:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_CHIN,        GetCompanyManagerFaceBits(this->face, CMFV_CHIN,        this->ge), false);
 
			case WID_SCMF_CHIN:
 
				this->DrawFaceStringLabel(WID_SCMF_CHIN,        GetCompanyManagerFaceBits(this->face, CMFV_CHIN,        this->ge), false);
 
				break;
 

	
 
			case SCMFW_WIDGET_JACKET:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_JACKET,      GetCompanyManagerFaceBits(this->face, CMFV_JACKET,      this->ge), false);
 
			case WID_SCMF_JACKET:
 
				this->DrawFaceStringLabel(WID_SCMF_JACKET,      GetCompanyManagerFaceBits(this->face, CMFV_JACKET,      this->ge), false);
 
				break;
 

	
 
			case SCMFW_WIDGET_COLLAR:
 
				this->DrawFaceStringLabel(SCMFW_WIDGET_COLLAR,      GetCompanyManagerFaceBits(this->face, CMFV_COLLAR,      this->ge), false);
 
			case WID_SCMF_COLLAR:
 
				this->DrawFaceStringLabel(WID_SCMF_COLLAR,      GetCompanyManagerFaceBits(this->face, CMFV_COLLAR,      this->ge), false);
 
				break;
 

	
 
			case SCMFM_WIDGET_FACE:
 
			case WID_SCMF_FACE:
 
				DrawCompanyManagerFace(this->face, Company::Get((CompanyID)this->window_number)->colour, r.left, r.top);
 
				break;
 
		}
 
@@ -1345,25 +1345,25 @@ public:
 
	{
 
		switch (widget) {
 
			/* Toggle size, advanced/simple face selection */
 
			case SCMFW_WIDGET_TOGGLE_LARGE_SMALL:
 
			case SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON:
 
			case WID_SCMF_TOGGLE_LARGE_SMALL:
 
			case WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON:
 
				this->advanced = !this->advanced;
 
				this->SelectDisplayPlanes(this->advanced);
 
				this->ReInit();
 
				break;
 

	
 
			/* OK button */
 
			case SCMFW_WIDGET_ACCEPT:
 
			case WID_SCMF_ACCEPT:
 
				DoCommandP(0, 0, this->face, CMD_SET_COMPANY_MANAGER_FACE);
 
				/* FALL THROUGH */
 

	
 
			/* Cancel button */
 
			case SCMFW_WIDGET_CANCEL:
 
			case WID_SCMF_CANCEL:
 
				delete this;
 
				break;
 

	
 
			/* Load button */
 
			case SCMFW_WIDGET_LOAD:
 
			case WID_SCMF_LOAD:
 
				this->face = _company_manager_face;
 
				ScaleAllCompanyManagerFaceBits(this->face);
 
				ShowErrorMessage(STR_FACE_LOAD_DONE, INVALID_STRING_ID, WL_INFO);
 
@@ -1372,54 +1372,54 @@ public:
 
				break;
 

	
 
			/* 'Company manager face number' button, view and/or set company manager face number */
 
			case SCMFW_WIDGET_FACECODE:
 
			case WID_SCMF_FACECODE:
 
				SetDParam(0, this->face);
 
				ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, this, CS_NUMERAL, QSF_NONE);
 
				break;
 

	
 
			/* Save button */
 
			case SCMFW_WIDGET_SAVE:
 
			case WID_SCMF_SAVE:
 
				_company_manager_face = this->face;
 
				ShowErrorMessage(STR_FACE_SAVE_DONE, INVALID_STRING_ID, WL_INFO);
 
				break;
 

	
 
			/* Toggle gender (male/female) button */
 
			case SCMFW_WIDGET_MALE:
 
			case SCMFW_WIDGET_FEMALE:
 
			case SCMFW_WIDGET_MALE2:
 
			case SCMFW_WIDGET_FEMALE2:
 
				SetCompanyManagerFaceBits(this->face, CMFV_GENDER, this->ge, (widget == SCMFW_WIDGET_FEMALE || widget == SCMFW_WIDGET_FEMALE2));
 
			case WID_SCMF_MALE:
 
			case WID_SCMF_FEMALE:
 
			case WID_SCMF_MALE2:
 
			case WID_SCMF_FEMALE2:
 
				SetCompanyManagerFaceBits(this->face, CMFV_GENDER, this->ge, (widget == WID_SCMF_FEMALE || widget == WID_SCMF_FEMALE2));
 
				ScaleAllCompanyManagerFaceBits(this->face);
 
				this->UpdateData();
 
				this->SetDirty();
 
				break;
 

	
 
			/* Randomize face button */
 
			case SCMFW_WIDGET_RANDOM_NEW_FACE:
 
			case WID_SCMF_RANDOM_NEW_FACE:
 
				RandomCompanyManagerFaceBits(this->face, this->ge, this->advanced);
 
				this->UpdateData();
 
				this->SetDirty();
 
				break;
 

	
 
			/* Toggle ethnicity (european/african) button */
 
			case SCMFW_WIDGET_ETHNICITY_EUR:
 
			case SCMFW_WIDGET_ETHNICITY_AFR:
 
				SetCompanyManagerFaceBits(this->face, CMFV_ETHNICITY, this->ge, widget - SCMFW_WIDGET_ETHNICITY_EUR);
 
			case WID_SCMF_ETHNICITY_EUR:
 
			case WID_SCMF_ETHNICITY_AFR:
 
				SetCompanyManagerFaceBits(this->face, CMFV_ETHNICITY, this->ge, widget - WID_SCMF_ETHNICITY_EUR);
 
				ScaleAllCompanyManagerFaceBits(this->face);
 
				this->UpdateData();
 
				this->SetDirty();
 
				break;
 

	
 
			default:
 
				/* Here all buttons from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R are handled.
 
				/* Here all buttons from WID_SCMF_HAS_MOUSTACHE_EARRING to WID_SCMF_GLASSES_R are handled.
 
				 * First it checks which CompanyManagerFaceVariable is being changed, and then either
 
				 * a: invert the value for boolean variables, or
 
				 * b: it checks inside of IncreaseCompanyManagerFaceBits() if a left (_L) butten is pressed and then decrease else increase the variable */
 
				if (widget >= SCMFW_WIDGET_HAS_MOUSTACHE_EARRING && widget <= SCMFW_WIDGET_GLASSES_R) {
 
				if (widget >= WID_SCMF_HAS_MOUSTACHE_EARRING && widget <= WID_SCMF_GLASSES_R) {
 
					CompanyManagerFaceVariable cmfv; // which CompanyManagerFaceVariable shall be edited
 

	
 
					if (widget < SCMFW_WIDGET_EYECOLOUR_L) { // Bool buttons
 
						switch (widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING) {
 
					if (widget < WID_SCMF_EYECOLOUR_L) { // Bool buttons
 
						switch (widget - WID_SCMF_HAS_MOUSTACHE_EARRING) {
 
							default: NOT_REACHED();
 
							case 0: cmfv = this->is_female ? CMFV_HAS_TIE_EARRING : CMFV_HAS_MOUSTACHE; break; // Has earring/moustache button
 
							case 1: cmfv = CMFV_HAS_GLASSES; break; // Has glasses button
 
@@ -1427,7 +1427,7 @@ public:
 
						SetCompanyManagerFaceBits(this->face, cmfv, this->ge, !GetCompanyManagerFaceBits(this->face, cmfv, this->ge));
 
						ScaleAllCompanyManagerFaceBits(this->face);
 
					} else { // Value buttons
 
						switch ((widget - SCMFW_WIDGET_EYECOLOUR_L) / 3) {
 
						switch ((widget - WID_SCMF_EYECOLOUR_L) / 3) {
 
							default: NOT_REACHED();
 
							case 0: cmfv = CMFV_EYE_COLOUR; break;  // Eye colour buttons
 
							case 1: cmfv = CMFV_CHIN; break;        // Chin buttons
 
@@ -1441,7 +1441,7 @@ public:
 
							case 9: cmfv = CMFV_GLASSES; break;     // Glasses buttons
 
						}
 
						/* 0 == left (_L), 1 == middle or 2 == right (_R) - button click */
 
						IncreaseCompanyManagerFaceBits(this->face, cmfv, this->ge, (((widget - SCMFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1);
 
						IncreaseCompanyManagerFaceBits(this->face, cmfv, this->ge, (((widget - WID_SCMF_EYECOLOUR_L) % 3) != 0) ? 1 : -1);
 
					}
 
					this->UpdateData();
 
					this->SetDirty();
 
@@ -1468,21 +1468,21 @@ public:
 

	
 
/** Both text values of parts of the face that depend on the #is_female boolean value. */
 
const StringID SelectCompanyManagerFaceWindow::PART_TEXTS_IS_FEMALE[] = {
 
	STR_FACE_MOUSTACHE, STR_FACE_EARRING, // SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT
 
	STR_FACE_TIE,       STR_FACE_EARRING, // SCMFW_WIDGET_TIE_EARRING_TEXT
 
	STR_FACE_MOUSTACHE, STR_FACE_EARRING, // WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT
 
	STR_FACE_TIE,       STR_FACE_EARRING, // WID_SCMF_TIE_EARRING_TEXT
 
};
 

	
 
/** Textual names for parts of the face. */
 
const StringID SelectCompanyManagerFaceWindow::PART_TEXTS[] = {
 
	STR_FACE_GLASSES,   // SCMFW_WIDGET_HAS_GLASSES_TEXT
 
	STR_FACE_HAIR,      // SCMFW_WIDGET_HAIR_TEXT
 
	STR_FACE_EYEBROWS,  // SCMFW_WIDGET_EYEBROWS_TEXT
 
	STR_FACE_EYECOLOUR, // SCMFW_WIDGET_EYECOLOUR_TEXT
 
	STR_FACE_GLASSES,   // SCMFW_WIDGET_GLASSES_TEXT
 
	STR_FACE_NOSE,      // SCMFW_WIDGET_NOSE_TEXT
 
	STR_FACE_CHIN,      // SCMFW_WIDGET_CHIN_TEXT
 
	STR_FACE_JACKET,    // SCMFW_WIDGET_JACKET_TEXT
 
	STR_FACE_COLLAR,    // SCMFW_WIDGET_COLLAR_TEXT
 
	STR_FACE_GLASSES,   // WID_SCMF_HAS_GLASSES_TEXT
 
	STR_FACE_HAIR,      // WID_SCMF_HAIR_TEXT
 
	STR_FACE_EYEBROWS,  // WID_SCMF_EYEBROWS_TEXT
 
	STR_FACE_EYECOLOUR, // WID_SCMF_EYECOLOUR_TEXT
 
	STR_FACE_GLASSES,   // WID_SCMF_GLASSES_TEXT
 
	STR_FACE_NOSE,      // WID_SCMF_NOSE_TEXT
 
	STR_FACE_CHIN,      // WID_SCMF_CHIN_TEXT
 
	STR_FACE_JACKET,    // WID_SCMF_JACKET_TEXT
 
	STR_FACE_COLLAR,    // WID_SCMF_COLLAR_TEXT
 
};
 

	
 
/** Company manager face selection window description */
 
@@ -1512,31 +1512,31 @@ static void DoSelectCompanyManagerFace(W
 
static const NWidgetPart _nested_company_infrastructure_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, CIW_WIDGET_CAPTION), SetDataTip(STR_COMPANY_INFRASTRUCTURE_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_CI_CAPTION), SetDataTip(STR_COMPANY_INFRASTRUCTURE_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(NWID_VERTICAL), SetPIP(WD_FRAMERECT_TOP, 4, WD_FRAMETEXT_BOTTOM),
 
			NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_RAIL_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_RAIL_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_RAIL_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_RAIL_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_ROAD_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_ROAD_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_ROAD_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_ROAD_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_WATER_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_WATER_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_WATER_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_WATER_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_STATION_DESC), SetMinimalTextLines(3, 0), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_STATION_COUNT), SetMinimalTextLines(3, 0), SetFill(0, 1),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_STATION_DESC), SetMinimalTextLines(3, 0), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_STATION_COUNT), SetMinimalTextLines(3, 0), SetFill(0, 1),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_TOTAL_DESC), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_TOTAL), SetFill(0, 1),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_TOTAL_DESC), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_TOTAL), SetFill(0, 1),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
@@ -1610,7 +1610,7 @@ struct CompanyInfrastructureWindow : Win
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case CIW_WIDGET_CAPTION:
 
			case WID_CI_CAPTION:
 
				SetDParam(0, (CompanyID)this->window_number);
 
				break;
 
		}
 
@@ -1621,7 +1621,7 @@ struct CompanyInfrastructureWindow : Win
 
		const Company *c = Company::Get((CompanyID)this->window_number);
 

	
 
		switch (widget) {
 
			case CIW_WIDGET_RAIL_DESC: {
 
			case WID_CI_RAIL_DESC: {
 
				uint lines = 1;
 

	
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_RAIL_SECT).width);
 
@@ -1642,7 +1642,7 @@ struct CompanyInfrastructureWindow : Win
 
				break;
 
			}
 

	
 
			case CIW_WIDGET_ROAD_DESC: {
 
			case WID_CI_ROAD_DESC: {
 
				uint lines = 1;
 

	
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_ROAD_SECT).width);
 
@@ -1660,22 +1660,22 @@ struct CompanyInfrastructureWindow : Win
 
				break;
 
			}
 

	
 
			case CIW_WIDGET_WATER_DESC:
 
			case WID_CI_WATER_DESC:
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_WATER_SECT).width);
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_CANALS).width + WD_FRAMERECT_LEFT);
 
				break;
 

	
 
			case CIW_WIDGET_STATION_DESC:
 
			case WID_CI_STATION_DESC:
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_STATION_SECT).width);
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_STATIONS).width + WD_FRAMERECT_LEFT);
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_AIRPORTS).width + WD_FRAMERECT_LEFT);
 
				break;
 

	
 
			case CIW_WIDGET_RAIL_COUNT:
 
			case CIW_WIDGET_ROAD_COUNT:
 
			case CIW_WIDGET_WATER_COUNT:
 
			case CIW_WIDGET_STATION_COUNT:
 
			case CIW_WIDGET_TOTAL: {
 
			case WID_CI_RAIL_COUNT:
 
			case WID_CI_ROAD_COUNT:
 
			case WID_CI_WATER_COUNT:
 
			case WID_CI_STATION_COUNT:
 
			case WID_CI_TOTAL: {
 
				/* Find the maximum count that is displayed. */
 
				uint32 max_val = 1000;  // Some random number to reserve enough space.
 
				Money max_cost = 10000; // Some random number to reserve enough space.
 
@@ -1707,7 +1707,7 @@ struct CompanyInfrastructureWindow : Win
 
				}
 

	
 
				/* Set height of the total line. */
 
				if (widget == CIW_WIDGET_TOTAL) {
 
				if (widget == WID_CI_TOTAL) {
 
					size->height = _settings_game.economy.infrastructure_maintenance ? max(size->height, EXP_LINESPACE + FONT_HEIGHT_NORMAL) : 0;
 
				}
 
				break;
 
@@ -1724,7 +1724,7 @@ struct CompanyInfrastructureWindow : Win
 
		int offs_right = _current_text_dir == TD_LTR ? 0 : WD_FRAMERECT_LEFT;
 

	
 
		switch (widget) {
 
			case CIW_WIDGET_RAIL_DESC:
 
			case WID_CI_RAIL_DESC:
 
				DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_RAIL_SECT);
 

	
 
				if (this->railtypes != RAILTYPES_NONE) {
 
@@ -1743,7 +1743,7 @@ struct CompanyInfrastructureWindow : Win
 

	
 
				break;
 

	
 
			case CIW_WIDGET_RAIL_COUNT:
 
			case WID_CI_RAIL_COUNT:
 
				/* Draw infrastructure count for each valid railtype. */
 
				for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
 
					if (HasBit(this->railtypes, rt)) {
 
@@ -1759,7 +1759,7 @@ struct CompanyInfrastructureWindow : Win
 
				}
 
				break;
 

	
 
			case CIW_WIDGET_ROAD_DESC:
 
			case WID_CI_ROAD_DESC:
 
				DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_ROAD_SECT);
 

	
 
				if (this->roadtypes != ROADTYPES_NONE) {
 
@@ -1772,7 +1772,7 @@ struct CompanyInfrastructureWindow : Win
 

	
 
				break;
 

	
 
			case CIW_WIDGET_ROAD_COUNT:
 
			case WID_CI_ROAD_COUNT:
 
				if (HasBit(this->roadtypes, ROADTYPE_ROAD)) {
 
					SetDParam(0, c->infrastructure.road[ROADTYPE_ROAD]);
 
					SetDParam(1, RoadMaintenanceCost(ROADTYPE_ROAD, c->infrastructure.road[ROADTYPE_ROAD]) * 12); // Convert to per year
 
@@ -1785,18 +1785,18 @@ struct CompanyInfrastructureWindow : Win
 
				}
 
				break;
 

	
 
			case CIW_WIDGET_WATER_DESC:
 
			case WID_CI_WATER_DESC:
 
				DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_WATER_SECT);
 
				DrawString(r.left + offs_left, r.right - offs_right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_CANALS);
 
				break;
 

	
 
			case CIW_WIDGET_WATER_COUNT:
 
			case WID_CI_WATER_COUNT:
 
				SetDParam(0, c->infrastructure.water);
 
				SetDParam(1, CanalMaintenanceCost(c->infrastructure.water) * 12); // Convert to per year
 
				DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
 
				break;
 

	
 
			case CIW_WIDGET_TOTAL:
 
			case WID_CI_TOTAL:
 
				if (_settings_game.economy.infrastructure_maintenance) {
 
					GfxFillRect(r.left, y, r.left + this->total_width, y, PC_WHITE);
 
					y += EXP_LINESPACE;
 
@@ -1805,13 +1805,13 @@ struct CompanyInfrastructureWindow : Win
 
				}
 
				break;
 

	
 
			case CIW_WIDGET_STATION_DESC:
 
			case WID_CI_STATION_DESC:
 
				DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_STATION_SECT);
 
				DrawString(r.left + offs_left, r.right - offs_right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_STATIONS);
 
				DrawString(r.left + offs_left, r.right - offs_right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_AIRPORTS);
 
				break;
 

	
 
			case CIW_WIDGET_STATION_COUNT:
 
			case WID_CI_STATION_COUNT:
 
				SetDParam(0, c->infrastructure.station);
 
				SetDParam(1, StationMaintenanceCost(c->infrastructure.station) * 12); // Convert to per year
 
				DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA);
 
@@ -1856,64 +1856,64 @@ static void ShowCompanyInfrastructure(Co
 
static const NWidgetPart _nested_company_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, CW_WIDGET_CAPTION), SetDataTip(STR_COMPANY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_C_CAPTION), SetDataTip(STR_COMPANY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(NWID_HORIZONTAL), SetPIP(4, 6, 4),
 
			NWidget(NWID_VERTICAL), SetPIP(4, 2, 4),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_FACE), SetMinimalSize(92, 119), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_FACE_TITLE), SetFill(1, 1), SetMinimalTextLines(2, 0),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_FACE), SetMinimalSize(92, 119), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_FACE_TITLE), SetFill(1, 1), SetMinimalTextLines(2, 0),
 
			EndContainer(),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(NWID_VERTICAL), SetPIP(4, 5, 5),
 
						NWidget(WWT_TEXT, COLOUR_GREY, CW_WIDGET_DESC_INAUGURATION), SetDataTip(STR_COMPANY_VIEW_INAUGURATED_TITLE, STR_NULL), SetFill(1, 0),
 
						NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_INAUGURATION), SetDataTip(STR_COMPANY_VIEW_INAUGURATED_TITLE, STR_NULL), SetFill(1, 0),
 
						NWidget(NWID_HORIZONTAL), SetPIP(0, 5, 0),
 
							NWidget(WWT_LABEL, COLOUR_GREY, CW_WIDGET_DESC_COLOUR_SCHEME), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_TITLE, STR_NULL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE), SetMinimalSize(30, 0), SetFill(0, 1),
 
							NWidget(WWT_LABEL, COLOUR_GREY, WID_C_DESC_COLOUR_SCHEME), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_TITLE, STR_NULL),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_COLOUR_SCHEME_EXAMPLE), SetMinimalSize(30, 0), SetFill(0, 1),
 
							NWidget(NWID_SPACER), SetFill(1, 0),
 
						EndContainer(),
 
						NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0),
 
							NWidget(NWID_VERTICAL),
 
								NWidget(WWT_TEXT, COLOUR_GREY, CW_WIDGET_DESC_VEHICLE), SetDataTip(STR_COMPANY_VIEW_VEHICLES_TITLE, STR_NULL),
 
								NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_VEHICLE), SetDataTip(STR_COMPANY_VIEW_VEHICLES_TITLE, STR_NULL),
 
								NWidget(NWID_SPACER), SetFill(0, 1),
 
							EndContainer(),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_DESC_VEHICLE_COUNTS), SetMinimalTextLines(4, 0),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_VEHICLE_COUNTS), SetMinimalTextLines(4, 0),
 
							NWidget(NWID_SPACER), SetFill(1, 0),
 
						EndContainer(),
 
					EndContainer(),
 
					NWidget(NWID_VERTICAL), SetPIP(4, 2, 4),
 
						NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_VIEW_BUILD_HQ),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_VIEW_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_VIEW_HQ_BUTTON, STR_COMPANY_VIEW_VIEW_HQ_TOOLTIP),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, CW_WIDGET_BUILD_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_BUILD_HQ_BUTTON, STR_COMPANY_VIEW_BUILD_HQ_TOOLTIP),
 
						NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_VIEW_BUILD_HQ),
 
							NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_VIEW_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_VIEW_HQ_BUTTON, STR_COMPANY_VIEW_VIEW_HQ_TOOLTIP),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_C_BUILD_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_BUILD_HQ_BUTTON, STR_COMPANY_VIEW_BUILD_HQ_TOOLTIP),
 
						EndContainer(),
 
						NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_RELOCATE),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, CW_WIDGET_RELOCATE_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_RELOCATE_HQ, STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS),
 
						NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_RELOCATE),
 
							NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_C_RELOCATE_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_RELOCATE_HQ, STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS),
 
							NWidget(NWID_SPACER), SetMinimalSize(90, 0),
 
						EndContainer(),
 
						NWidget(NWID_SPACER), SetFill(0, 1),
 
					EndContainer(),
 
				EndContainer(),
 
				NWidget(WWT_TEXT, COLOUR_GREY, CW_WIDGET_DESC_COMPANY_VALUE), SetDataTip(STR_COMPANY_VIEW_COMPANY_VALUE, STR_NULL), SetFill(1, 0),
 
				NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_COMPANY_VALUE), SetDataTip(STR_COMPANY_VIEW_COMPANY_VALUE, STR_NULL), SetFill(1, 0),
 
					NWidget(NWID_VERTICAL), SetPIP(4, 2, 4),
 
						NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0),
 
							NWidget(NWID_VERTICAL),
 
								NWidget(WWT_TEXT, COLOUR_GREY, CW_WIDGET_DESC_INFRASTRUCTURE), SetDataTip(STR_COMPANY_VIEW_INFRASTRUCTURE, STR_NULL),
 
								NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_INFRASTRUCTURE), SetDataTip(STR_COMPANY_VIEW_INFRASTRUCTURE, STR_NULL),
 
								NWidget(NWID_SPACER), SetFill(0, 1),
 
							EndContainer(),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_DESC_INFRASTRUCTURE_COUNTS), SetMinimalTextLines(5, 0), SetFill(1, 0),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_INFRASTRUCTURE_COUNTS), SetMinimalTextLines(5, 0), SetFill(1, 0),
 
							NWidget(NWID_VERTICAL),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_VIEW_INFRASTRUCTURE), SetDataTip(STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON, STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_VIEW_INFRASTRUCTURE), SetDataTip(STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON, STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP),
 
								NWidget(NWID_SPACER), SetFill(0, 1), SetMinimalSize(90, 0),
 
							EndContainer(),
 
						EndContainer(),
 
					EndContainer(),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_DESC_OWNERS),
 
					NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_DESC_OWNERS),
 
						NWidget(NWID_VERTICAL), SetPIP(5, 5, 4),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_DESC_OWNERS), SetMinimalTextLines(3, 0),
 
							NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_OWNERS), SetMinimalTextLines(3, 0),
 
							NWidget(NWID_SPACER), SetFill(0, 1),
 
						EndContainer(),
 
					EndContainer(),
 
@@ -1921,10 +1921,10 @@ static const NWidgetPart _nested_company
 
						NWidget(NWID_SPACER), SetMinimalSize(90, 0), SetFill(0, 1),
 
						/* Multi player buttons. */
 
						NWidget(NWID_HORIZONTAL),
 
							NWidget(WWT_EMPTY, COLOUR_GREY, CW_WIDGET_HAS_PASSWORD),
 
							NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_MULTIPLAYER),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_PASSWORD), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_JOIN), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP),
 
							NWidget(WWT_EMPTY, COLOUR_GREY, WID_C_HAS_PASSWORD),
 
							NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_MULTIPLAYER),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_PASSWORD), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP),
 
								NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_JOIN), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP),
 
							EndContainer(),
 
						EndContainer(),
 
					EndContainer(),
 
@@ -1933,16 +1933,16 @@ static const NWidgetPart _nested_company
 
		EndContainer(),
 
	EndContainer(),
 
	/* Button bars at the bottom. */
 
	NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_BUTTONS),
 
	NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_BUTTONS),
 
		NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_NEW_FACE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_NEW_FACE_BUTTON, STR_COMPANY_VIEW_NEW_FACE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COLOUR_SCHEME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_BUTTON, STR_COMPANY_VIEW_COLOUR_SCHEME_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_PRESIDENT_NAME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PRESIDENT_NAME_BUTTON, STR_COMPANY_VIEW_PRESIDENT_NAME_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_NAME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_COMPANY_NAME_BUTTON, STR_COMPANY_VIEW_COMPANY_NAME_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_NEW_FACE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_NEW_FACE_BUTTON, STR_COMPANY_VIEW_NEW_FACE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COLOUR_SCHEME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_BUTTON, STR_COMPANY_VIEW_COLOUR_SCHEME_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_PRESIDENT_NAME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PRESIDENT_NAME_BUTTON, STR_COMPANY_VIEW_PRESIDENT_NAME_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_NAME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_COMPANY_NAME_BUTTON, STR_COMPANY_VIEW_COMPANY_NAME_TOOLTIP),
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_BUY_SHARE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_BUY_SHARE_BUTTON, STR_COMPANY_VIEW_BUY_SHARE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_SELL_SHARE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_SELL_SHARE_BUTTON, STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_BUY_SHARE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_BUY_SHARE_BUTTON, STR_COMPANY_VIEW_BUY_SHARE_TOOLTIP),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_SELL_SHARE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_SELL_SHARE_BUTTON, STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP),
 
		EndContainer(),
 
	EndContainer(),
 
};
 
@@ -1965,23 +1965,23 @@ static const StringID _company_view_vehi
 
 */
 
struct CompanyWindow : Window
 
{
 
	CompanyWindowWidgets query_widget;
 
	CompanyWidgets query_widget;
 

	
 
	/** Display planes in the company window. */
 
	enum CompanyWindowPlanes {
 
		/* Display planes of the #CW_WIDGET_SELECT_MULTIPLAYER selection widget. */
 
		/* Display planes of the #WID_C_SELECT_MULTIPLAYER selection widget. */
 
		CWP_MP_C_PWD = 0, ///< Display the company password button.
 
		CWP_MP_C_JOIN,    ///< Display the join company button.
 

	
 
		/* Display planes of the #CW_WIDGET_SELECT_VIEW_BUILD_HQ selection widget. */
 
		/* Display planes of the #WID_C_SELECT_VIEW_BUILD_HQ selection widget. */
 
		CWP_VB_VIEW = 0,  ///< Display the view button
 
		CWP_VB_BUILD,     ///< Display the build button
 

	
 
		/* Display planes of the #CW_WIDGET_SELECT_RELOCATE selection widget. */
 
		/* Display planes of the #WID_C_SELECT_RELOCATE selection widget. */
 
		CWP_RELOCATE_SHOW = 0, ///< Show the relocate HQ button.
 
		CWP_RELOCATE_HIDE,     ///< Hide the relocate HQ button.
 

	
 
		/* Display planes of the #CW_WIDGET_SELECT_BUTTONS selection widget. */
 
		/* Display planes of the #WID_C_SELECT_BUTTONS selection widget. */
 
		CWP_BUTTONS_LOCAL = 0, ///< Buttons of the local company.
 
		CWP_BUTTONS_OTHER,     ///< Buttons of the other companies.
 
	};
 
@@ -2002,7 +2002,7 @@ struct CompanyWindow : Window
 

	
 
			/* Button bar selection. */
 
			int plane = local ? CWP_BUTTONS_LOCAL : CWP_BUTTONS_OTHER;
 
			NWidgetStacked *wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_BUTTONS);
 
			NWidgetStacked *wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_BUTTONS);
 
			if (plane != wi->shown_plane) {
 
				wi->SetDisplayedPlane(plane);
 
				this->SetDirty();
 
@@ -2011,18 +2011,18 @@ struct CompanyWindow : Window
 

	
 
			/* Build HQ button handling. */
 
			plane = (local && c->location_of_HQ == INVALID_TILE) ? CWP_VB_BUILD : CWP_VB_VIEW;
 
			wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_VIEW_BUILD_HQ);
 
			wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_VIEW_BUILD_HQ);
 
			if (plane != wi->shown_plane) {
 
				wi->SetDisplayedPlane(plane);
 
				this->SetDirty();
 
				return;
 
			}
 

	
 
			this->SetWidgetDisabledState(CW_WIDGET_VIEW_HQ, c->location_of_HQ == INVALID_TILE);
 
			this->SetWidgetDisabledState(WID_C_VIEW_HQ, c->location_of_HQ == INVALID_TILE);
 

	
 
			/* Enable/disable 'Relocate HQ' button. */
 
			plane = (!local || c->location_of_HQ == INVALID_TILE) ? CWP_RELOCATE_HIDE : CWP_RELOCATE_SHOW;
 
			wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_RELOCATE);
 
			wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_RELOCATE);
 
			if (plane != wi->shown_plane) {
 
				wi->SetDisplayedPlane(plane);
 
				this->SetDirty();
 
@@ -2037,7 +2037,7 @@ struct CompanyWindow : Window
 
					break;
 
				}
 
			}
 
			wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_DESC_OWNERS);
 
			wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_DESC_OWNERS);
 
			if (plane != wi->shown_plane) {
 
				wi->SetDisplayedPlane(plane);
 
				reinit = true;
 
@@ -2045,12 +2045,12 @@ struct CompanyWindow : Window
 

	
 
			/* Multiplayer buttons. */
 
			plane = ((!_networking) ? (int)SZSP_NONE : (int)(local ? CWP_MP_C_PWD : CWP_MP_C_JOIN));
 
			wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_MULTIPLAYER);
 
			wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_MULTIPLAYER);
 
			if (plane != wi->shown_plane) {
 
				wi->SetDisplayedPlane(plane);
 
				reinit = true;
 
			}
 
			this->SetWidgetDisabledState(CW_WIDGET_COMPANY_JOIN,   c->is_ai);
 
			this->SetWidgetDisabledState(WID_C_COMPANY_JOIN,   c->is_ai);
 

	
 
			if (reinit) {
 
				this->ReInit();
 
@@ -2061,19 +2061,19 @@ struct CompanyWindow : Window
 
		if (!local) {
 
			if (_settings_game.economy.allow_shares) { // Shares are allowed
 
				/* If all shares are owned by someone (none by nobody), disable buy button */
 
				this->SetWidgetDisabledState(CW_WIDGET_BUY_SHARE, GetAmountOwnedBy(c, INVALID_OWNER) == 0 ||
 
				this->SetWidgetDisabledState(WID_C_BUY_SHARE, GetAmountOwnedBy(c, INVALID_OWNER) == 0 ||
 
						/* Only 25% left to buy. If the company is human, disable buying it up.. TODO issues! */
 
						(GetAmountOwnedBy(c, INVALID_OWNER) == 1 && !c->is_ai) ||
 
						/* Spectators cannot do anything of course */
 
						_local_company == COMPANY_SPECTATOR);
 

	
 
				/* If the company doesn't own any shares, disable sell button */
 
				this->SetWidgetDisabledState(CW_WIDGET_SELL_SHARE, (GetAmountOwnedBy(c, _local_company) == 0) ||
 
				this->SetWidgetDisabledState(WID_C_SELL_SHARE, (GetAmountOwnedBy(c, _local_company) == 0) ||
 
						/* Spectators cannot do anything of course */
 
						_local_company == COMPANY_SPECTATOR);
 
			} else { // Shares are not allowed, disable buy/sell buttons
 
				this->DisableWidget(CW_WIDGET_BUY_SHARE);
 
				this->DisableWidget(CW_WIDGET_SELL_SHARE);
 
				this->DisableWidget(WID_C_BUY_SHARE);
 
				this->DisableWidget(WID_C_SELL_SHARE);
 
			}
 
		}
 

	
 
@@ -2083,7 +2083,7 @@ struct CompanyWindow : Window
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE: {
 
			case WID_C_DESC_COLOUR_SCHEME_EXAMPLE: {
 
				Point offset;
 
				Dimension d = GetSpriteSize(SPR_VEH_BUS_SW_VIEW, &offset);
 
				d.width -= offset.x;
 
@@ -2092,19 +2092,19 @@ struct CompanyWindow : Window
 
				break;
 
			}
 

	
 
			case CW_WIDGET_DESC_COMPANY_VALUE:
 
			case WID_C_DESC_COMPANY_VALUE:
 
				SetDParam(0, INT64_MAX); // Arguably the maximum company value
 
				size->width = GetStringBoundingBox(STR_COMPANY_VIEW_COMPANY_VALUE).width;
 
				break;
 

	
 
			case CW_WIDGET_DESC_VEHICLE_COUNTS:
 
			case WID_C_DESC_VEHICLE_COUNTS:
 
				SetDParam(0, 5000); // Maximum number of vehicles
 
				for (uint i = 0; i < lengthof(_company_view_vehicle_count_strings); i++) {
 
					size->width = max(size->width, GetStringBoundingBox(_company_view_vehicle_count_strings[i]).width);
 
				}
 
				break;
 

	
 
			case CW_WIDGET_DESC_INFRASTRUCTURE_COUNTS:
 
			case WID_C_DESC_INFRASTRUCTURE_COUNTS:
 
				SetDParam(0, UINT_MAX);
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_RAIL).width);
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_ROAD).width);
 
@@ -2114,7 +2114,7 @@ struct CompanyWindow : Window
 
				size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_NONE).width);
 
				break;
 

	
 
			case CW_WIDGET_DESC_OWNERS: {
 
			case WID_C_DESC_OWNERS: {
 
				const Company *c2;
 

	
 
				FOR_ALL_COMPANIES(c2) {
 
@@ -2127,7 +2127,7 @@ struct CompanyWindow : Window
 
			}
 

	
 
#ifdef ENABLE_NETWORK
 
			case CW_WIDGET_HAS_PASSWORD:
 
			case WID_C_HAS_PASSWORD:
 
				*size = maxdim(*size, GetSpriteSize(SPR_LOCK));
 
				break;
 
#endif /* ENABLE_NETWORK */
 
@@ -2138,16 +2138,16 @@ struct CompanyWindow : Window
 
	{
 
		const Company *c = Company::Get((CompanyID)this->window_number);
 
		switch (widget) {
 
			case CW_WIDGET_FACE:
 
			case WID_C_FACE:
 
				DrawCompanyManagerFace(c->face, c->colour, r.left, r.top);
 
				break;
 

	
 
			case CW_WIDGET_FACE_TITLE:
 
			case WID_C_FACE_TITLE:
 
				SetDParam(0, c->index);
 
				DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE, TC_FROMSTRING, SA_HOR_CENTER);
 
				break;
 

	
 
			case CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE: {
 
			case WID_C_DESC_COLOUR_SCHEME_EXAMPLE: {
 
				Point offset;
 
				Dimension d = GetSpriteSize(SPR_VEH_BUS_SW_VIEW, &offset);
 
				d.height -= offset.y;
 
@@ -2155,7 +2155,7 @@ struct CompanyWindow : Window
 
				break;
 
			}
 

	
 
			case CW_WIDGET_DESC_VEHICLE_COUNTS: {
 
			case WID_C_DESC_VEHICLE_COUNTS: {
 
				uint amounts[4];
 
				amounts[0] = c->group_all[VEH_TRAIN].num_vehicle;
 
				amounts[1] = c->group_all[VEH_ROAD].num_vehicle;
 
@@ -2179,7 +2179,7 @@ struct CompanyWindow : Window
 
				break;
 
			}
 

	
 
			case CW_WIDGET_DESC_INFRASTRUCTURE_COUNTS: {
 
			case WID_C_DESC_INFRASTRUCTURE_COUNTS: {
 
				uint y = r.top;
 

	
 
				/* Collect rail and road counts. */
 
@@ -2220,7 +2220,7 @@ struct CompanyWindow : Window
 
				break;
 
			}
 

	
 
			case CW_WIDGET_DESC_OWNERS: {
 
			case WID_C_DESC_OWNERS: {
 
				const Company *c2;
 
				uint y = r.top;
 

	
 
@@ -2238,7 +2238,7 @@ struct CompanyWindow : Window
 
			}
 

	
 
#ifdef ENABLE_NETWORK
 
			case CW_WIDGET_HAS_PASSWORD:
 
			case WID_C_HAS_PASSWORD:
 
				if (_networking && NetworkCompanyIsPassworded(c->index)) {
 
					DrawSprite(SPR_LOCK, PAL_NONE, r.left, r.top);
 
				}
 
@@ -2250,16 +2250,16 @@ struct CompanyWindow : Window
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case CW_WIDGET_CAPTION:
 
			case WID_C_CAPTION:
 
				SetDParam(0, (CompanyID)this->window_number);
 
				SetDParam(1, (CompanyID)this->window_number);
 
				break;
 

	
 
			case CW_WIDGET_DESC_INAUGURATION:
 
			case WID_C_DESC_INAUGURATION:
 
				SetDParam(0, Company::Get((CompanyID)this->window_number)->inaugurated_year);
 
				break;
 

	
 
			case CW_WIDGET_DESC_COMPANY_VALUE:
 
			case WID_C_DESC_COMPANY_VALUE:
 
				SetDParam(0, CalculateCompanyValue(Company::Get((CompanyID)this->window_number)));
 
				break;
 
		}
 
@@ -2268,26 +2268,26 @@ struct CompanyWindow : Window
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case CW_WIDGET_NEW_FACE: DoSelectCompanyManagerFace(this); break;
 
			case WID_C_NEW_FACE: DoSelectCompanyManagerFace(this); break;
 

	
 
			case CW_WIDGET_COLOUR_SCHEME:
 
			case WID_C_COLOUR_SCHEME:
 
				if (BringWindowToFrontById(WC_COMPANY_COLOUR, this->window_number)) break;
 
				new SelectCompanyLiveryWindow(&_select_company_livery_desc, (CompanyID)this->window_number);
 
				break;
 

	
 
			case CW_WIDGET_PRESIDENT_NAME:
 
				this->query_widget = CW_WIDGET_PRESIDENT_NAME;
 
			case WID_C_PRESIDENT_NAME:
 
				this->query_widget = WID_C_PRESIDENT_NAME;
 
				SetDParam(0, this->window_number);
 
				ShowQueryString(STR_PRESIDENT_NAME, STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION, MAX_LENGTH_PRESIDENT_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
 
				break;
 

	
 
			case CW_WIDGET_COMPANY_NAME:
 
				this->query_widget = CW_WIDGET_COMPANY_NAME;
 
			case WID_C_COMPANY_NAME:
 
				this->query_widget = WID_C_COMPANY_NAME;
 
				SetDParam(0, this->window_number);
 
				ShowQueryString(STR_COMPANY_NAME, STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION, MAX_LENGTH_COMPANY_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
 
				break;
 

	
 
			case CW_WIDGET_VIEW_HQ: {
 
			case WID_C_VIEW_HQ: {
 
				TileIndex tile = Company::Get((CompanyID)this->window_number)->location_of_HQ;
 
				if (_ctrl_pressed) {
 
					ShowExtraViewPortWindow(tile);
 
@@ -2297,50 +2297,50 @@ struct CompanyWindow : Window
 
				break;
 
			}
 

	
 
			case CW_WIDGET_BUILD_HQ:
 
			case WID_C_BUILD_HQ:
 
				if ((byte)this->window_number != _local_company) return;
 
				if (this->IsWidgetLowered(CW_WIDGET_BUILD_HQ)) {
 
				if (this->IsWidgetLowered(WID_C_BUILD_HQ)) {
 
					ResetObjectToPlace();
 
					this->RaiseButtons();
 
					break;
 
				}
 
				SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
 
				SetTileSelectSize(2, 2);
 
				this->LowerWidget(CW_WIDGET_BUILD_HQ);
 
				this->SetWidgetDirty(CW_WIDGET_BUILD_HQ);
 
				this->LowerWidget(WID_C_BUILD_HQ);
 
				this->SetWidgetDirty(WID_C_BUILD_HQ);
 
				break;
 

	
 
			case CW_WIDGET_RELOCATE_HQ:
 
				if (this->IsWidgetLowered(CW_WIDGET_RELOCATE_HQ)) {
 
			case WID_C_RELOCATE_HQ:
 
				if (this->IsWidgetLowered(WID_C_RELOCATE_HQ)) {
 
					ResetObjectToPlace();
 
					this->RaiseButtons();
 
					break;
 
				}
 
				SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
 
				SetTileSelectSize(2, 2);
 
				this->LowerWidget(CW_WIDGET_RELOCATE_HQ);
 
				this->SetWidgetDirty(CW_WIDGET_RELOCATE_HQ);
 
				this->LowerWidget(WID_C_RELOCATE_HQ);
 
				this->SetWidgetDirty(WID_C_RELOCATE_HQ);
 
				break;
 

	
 
			case CW_WIDGET_VIEW_INFRASTRUCTURE:
 
			case WID_C_VIEW_INFRASTRUCTURE:
 
				ShowCompanyInfrastructure((CompanyID)this->window_number);
 
				break;
 

	
 
			case CW_WIDGET_BUY_SHARE:
 
			case WID_C_BUY_SHARE:
 
				DoCommandP(0, this->window_number, 0, CMD_BUY_SHARE_IN_COMPANY | CMD_MSG(STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS));
 
				break;
 

	
 
			case CW_WIDGET_SELL_SHARE:
 
			case WID_C_SELL_SHARE:
 
				DoCommandP(0, this->window_number, 0, CMD_SELL_SHARE_IN_COMPANY | CMD_MSG(STR_ERROR_CAN_T_SELL_25_SHARE_IN));
 
				break;
 

	
 
#ifdef ENABLE_NETWORK
 
			case CW_WIDGET_COMPANY_PASSWORD:
 
			case WID_C_COMPANY_PASSWORD:
 
				if (this->window_number == _local_company) ShowNetworkCompanyPasswordWindow(this);
 
				break;
 

	
 
			case CW_WIDGET_COMPANY_JOIN: {
 
				this->query_widget = CW_WIDGET_COMPANY_JOIN;
 
			case WID_C_COMPANY_JOIN: {
 
				this->query_widget = WID_C_COMPANY_JOIN;
 
				CompanyID company = (CompanyID)this->window_number;
 
				if (_network_server) {
 
					NetworkServerDoMove(CLIENT_ID_SERVER, company);
 
@@ -2384,16 +2384,16 @@ struct CompanyWindow : Window
 
		switch (this->query_widget) {
 
			default: NOT_REACHED();
 

	
 
			case CW_WIDGET_PRESIDENT_NAME:
 
			case WID_C_PRESIDENT_NAME:
 
				DoCommandP(0, 0, 0, CMD_RENAME_PRESIDENT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_PRESIDENT), NULL, str);
 
				break;
 

	
 
			case CW_WIDGET_COMPANY_NAME:
 
			case WID_C_COMPANY_NAME:
 
				DoCommandP(0, 0, 0, CMD_RENAME_COMPANY | CMD_MSG(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME), NULL, str);
 
				break;
 

	
 
#ifdef ENABLE_NETWORK
 
			case CW_WIDGET_COMPANY_JOIN:
 
			case WID_C_COMPANY_JOIN:
 
				NetworkClientRequestMove((CompanyID)this->window_number, str);
 
				break;
 
#endif /* ENABLE_NETWORK */
 
@@ -2438,11 +2438,11 @@ struct BuyCompanyWindow : Window {
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case BCW_FACE:
 
			case WID_BC_FACE:
 
				*size = GetSpriteSize(SPR_GRADIENT);
 
				break;
 

	
 
			case BCW_QUESTION:
 
			case WID_BC_QUESTION:
 
				const Company *c = Company::Get((CompanyID)this->window_number);
 
				SetDParam(0, c->index);
 
				SetDParam(1, c->bankrupt_value);
 
@@ -2454,7 +2454,7 @@ struct BuyCompanyWindow : Window {
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case BCW_CAPTION:
 
			case WID_BC_CAPTION:
 
				SetDParam(0, STR_COMPANY_NAME);
 
				SetDParam(1, Company::Get((CompanyID)this->window_number)->index);
 
				break;
 
@@ -2464,13 +2464,13 @@ struct BuyCompanyWindow : Window {
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case BCW_FACE: {
 
			case WID_BC_FACE: {
 
				const Company *c = Company::Get((CompanyID)this->window_number);
 
				DrawCompanyManagerFace(c->face, c->colour, r.left, r.top);
 
				break;
 
			}
 

	
 
			case BCW_QUESTION: {
 
			case WID_BC_QUESTION: {
 
				const Company *c = Company::Get((CompanyID)this->window_number);
 
				SetDParam(0, c->index);
 
				SetDParam(1, c->bankrupt_value);
 
@@ -2483,11 +2483,11 @@ struct BuyCompanyWindow : Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BCW_NO:
 
			case WID_BC_NO:
 
				delete this;
 
				break;
 

	
 
			case BCW_YES:
 
			case WID_BC_YES:
 
				DoCommandP(0, this->window_number, 0, CMD_BUY_COMPANY | CMD_MSG(STR_ERROR_CAN_T_BUY_COMPANY));
 
				break;
 
		}
 
@@ -2497,17 +2497,17 @@ struct BuyCompanyWindow : Window {
 
static const NWidgetPart _nested_buy_company_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
 
		NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, BCW_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_BC_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE),
 
		NWidget(NWID_VERTICAL), SetPIP(8, 8, 8),
 
			NWidget(NWID_HORIZONTAL), SetPIP(8, 10, 8),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, BCW_FACE), SetFill(0, 1),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, BCW_QUESTION), SetMinimalSize(240, 0), SetFill(1, 1),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BC_FACE), SetFill(0, 1),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BC_QUESTION), SetMinimalSize(240, 0), SetFill(1, 1),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(100, 10, 100),
 
				NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_NO), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0),
 
				NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_YES), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0),
 
				NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, WID_BC_NO), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0),
 
				NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, WID_BC_YES), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
src/console_gui.cpp
Show inline comments
 
@@ -155,7 +155,7 @@ static const char *IConsoleHistoryAdd(co
 
static void IConsoleHistoryNavigate(int direction);
 

	
 
static const struct NWidgetPart _nested_console_window_widgets[] = {
 
	NWidget(WWT_EMPTY, INVALID_COLOUR, CW_BACKGROUND), SetResize(1, 1),
 
	NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_BACKGROUND), SetResize(1, 1),
 
};
 

	
 
static const WindowDesc _console_window_desc(
src/date_gui.cpp
Show inline comments
 
@@ -72,21 +72,21 @@ struct SetDateWindow : Window {
 
		switch (widget) {
 
			default: NOT_REACHED();
 

	
 
			case SDW_DAY:
 
			case WID_SD_DAY:
 
				for (uint i = 0; i < 31; i++) {
 
					list->push_back(new DropDownListStringItem(STR_ORDINAL_NUMBER_1ST + i, i + 1, false));
 
				}
 
				selected = this->date.day;
 
				break;
 

	
 
			case SDW_MONTH:
 
			case WID_SD_MONTH:
 
				for (uint i = 0; i < 12; i++) {
 
					list->push_back(new DropDownListStringItem(STR_MONTH_JAN + i, i, false));
 
				}
 
				selected = this->date.month;
 
				break;
 

	
 
			case SDW_YEAR:
 
			case WID_SD_YEAR:
 
				for (Year i = this->min_year; i <= this->max_year; i++) {
 
					DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false);
 
					item->SetParam(0, i);
 
@@ -105,19 +105,19 @@ struct SetDateWindow : Window {
 
		switch (widget) {
 
			default: return;
 

	
 
			case SDW_DAY:
 
			case WID_SD_DAY:
 
				for (uint i = 0; i < 31; i++) {
 
					d = maxdim(d, GetStringBoundingBox(STR_ORDINAL_NUMBER_1ST + i));
 
				}
 
				break;
 

	
 
			case SDW_MONTH:
 
			case WID_SD_MONTH:
 
				for (uint i = 0; i < 12; i++) {
 
					d = maxdim(d, GetStringBoundingBox(STR_MONTH_JAN + i));
 
				}
 
				break;
 

	
 
			case SDW_YEAR:
 
			case WID_SD_YEAR:
 
				for (Year i = this->min_year; i <= this->max_year; i++) {
 
					SetDParam(0, i);
 
					d = maxdim(d, GetStringBoundingBox(STR_JUST_INT));
 
@@ -133,22 +133,22 @@ struct SetDateWindow : Window {
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			case SDW_DAY:   SetDParam(0, this->date.day - 1 + STR_ORDINAL_NUMBER_1ST); break;
 
			case SDW_MONTH: SetDParam(0, this->date.month + STR_MONTH_JAN); break;
 
			case SDW_YEAR:  SetDParam(0, this->date.year); break;
 
			case WID_SD_DAY:   SetDParam(0, this->date.day - 1 + STR_ORDINAL_NUMBER_1ST); break;
 
			case WID_SD_MONTH: SetDParam(0, this->date.month + STR_MONTH_JAN); break;
 
			case WID_SD_YEAR:  SetDParam(0, this->date.year); break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SDW_DAY:
 
			case SDW_MONTH:
 
			case SDW_YEAR:
 
			case WID_SD_DAY:
 
			case WID_SD_MONTH:
 
			case WID_SD_YEAR:
 
				ShowDateDropDown(widget);
 
				break;
 

	
 
			case SDW_SET_DATE:
 
			case WID_SD_SET_DATE:
 
				if (this->callback != NULL) this->callback(this->parent, ConvertYMDToDate(this->date.year, this->date.month, this->date.day));
 
				delete this;
 
				break;
 
@@ -158,15 +158,15 @@ struct SetDateWindow : Window {
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		switch (widget) {
 
			case SDW_DAY:
 
			case WID_SD_DAY:
 
				this->date.day = index;
 
				break;
 

	
 
			case SDW_MONTH:
 
			case WID_SD_MONTH:
 
				this->date.month = index;
 
				break;
 

	
 
			case SDW_YEAR:
 
			case WID_SD_YEAR:
 
				this->date.year = index;
 
				break;
 
		}
 
@@ -183,13 +183,13 @@ static const NWidgetPart _nested_set_dat
 
	NWidget(WWT_PANEL, COLOUR_BROWN),
 
		NWidget(NWID_VERTICAL), SetPIP(6, 6, 6),
 
			NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(6, 6, 6),
 
				NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_DAY), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_DAY_TOOLTIP),
 
				NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_MONTH), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_MONTH_TOOLTIP),
 
				NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_YEAR), SetFill(1, 0), SetDataTip(STR_JUST_INT, STR_DATE_YEAR_TOOLTIP),
 
				NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_DAY), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_DAY_TOOLTIP),
 
				NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_MONTH), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_MONTH_TOOLTIP),
 
				NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_YEAR), SetFill(1, 0), SetDataTip(STR_JUST_INT, STR_DATE_YEAR_TOOLTIP),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(NWID_SPACER), SetFill(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SDW_SET_DATE), SetMinimalSize(100, 12), SetDataTip(STR_DATE_SET_DATE, STR_DATE_SET_DATE_TOOLTIP),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_SD_SET_DATE), SetMinimalSize(100, 12), SetDataTip(STR_DATE_SET_DATE, STR_DATE_SET_DATE_TOOLTIP),
 
				NWidget(NWID_SPACER), SetFill(1, 0),
 
			EndContainer(),
 
		EndContainer(),
src/depot_gui.cpp
Show inline comments
 
@@ -44,37 +44,37 @@
 
static const NWidgetPart _nested_train_depot_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, DEPOT_WIDGET_CAPTION), SetDataTip(STR_DEPOT_CAPTION, STR_NULL),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_VD_CAPTION), SetDataTip(STR_DEPOT_CAPTION, STR_NULL),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
		NWidget(WWT_STICKYBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_VERTICAL),
 
			NWidget(WWT_MATRIX, COLOUR_GREY, DEPOT_WIDGET_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1), SetScrollbar(DEPOT_WIDGET_V_SCROLL),
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, DEPOT_WIDGET_SHOW_H_SCROLL),
 
				NWidget(NWID_HSCROLLBAR, COLOUR_GREY, DEPOT_WIDGET_H_SCROLL),
 
			NWidget(WWT_MATRIX, COLOUR_GREY, WID_VD_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1), SetScrollbar(WID_VD_V_SCROLL),
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_H_SCROLL),
 
				NWidget(NWID_HSCROLLBAR, COLOUR_GREY, WID_VD_H_SCROLL),
 
			EndContainer(),
 
		EndContainer(),
 
		NWidget(NWID_VERTICAL),
 
			NWidget(WWT_IMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL), SetDataTip(0x0, STR_NULL), SetResize(0, 1), SetFill(0, 1),
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, DEPOT_WIDGET_SHOW_SELL_CHAIN),
 
				NWidget(WWT_IMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL_CHAIN), SetDataTip(SPR_SELL_CHAIN_TRAIN, STR_DEPOT_DRAG_WHOLE_TRAIN_TO_SELL_TOOLTIP), SetResize(0, 1), SetFill(0, 1),
 
			NWidget(WWT_IMGBTN, COLOUR_GREY, WID_VD_SELL), SetDataTip(0x0, STR_NULL), SetResize(0, 1), SetFill(0, 1),
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_SELL_CHAIN),
 
				NWidget(WWT_IMGBTN, COLOUR_GREY, WID_VD_SELL_CHAIN), SetDataTip(SPR_SELL_CHAIN_TRAIN, STR_DEPOT_DRAG_WHOLE_TRAIN_TO_SELL_TOOLTIP), SetResize(0, 1), SetFill(0, 1),
 
			EndContainer(),
 
			NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL_ALL), SetDataTip(0x0, STR_NULL),
 
			NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_AUTOREPLACE), SetDataTip(0x0, STR_NULL),
 
			NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_SELL_ALL), SetDataTip(0x0, STR_NULL),
 
			NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_AUTOREPLACE), SetDataTip(0x0, STR_NULL),
 
		EndContainer(),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, DEPOT_WIDGET_V_SCROLL),
 
		NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_VD_V_SCROLL),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_BUILD), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0),
 
		NWidget(WWT_TEXTBTN, COLOUR_GREY, DEPOT_WIDGET_CLONE), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_LOCATION), SetDataTip(STR_BUTTON_LOCATION, STR_NULL), SetFill(1, 1), SetResize(1, 0),
 
		NWidget(NWID_SELECTION, INVALID_COLOUR, DEPOT_WIDGET_SHOW_RENAME), // rename button
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_RENAME), SetDataTip(STR_BUTTON_RENAME, STR_DEPOT_RENAME_TOOLTIP), SetFill(1, 1), SetResize(1, 0),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_BUILD), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0),
 
		NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_VD_CLONE), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_LOCATION), SetDataTip(STR_BUTTON_LOCATION, STR_NULL), SetFill(1, 1), SetResize(1, 0),
 
		NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_RENAME), // rename button
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_RENAME), SetDataTip(STR_BUTTON_RENAME, STR_DEPOT_RENAME_TOOLTIP), SetFill(1, 1), SetResize(1, 0),
 
		EndContainer(),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_VEHICLE_LIST), SetDataTip(0x0, STR_NULL), SetFill(0, 1),
 
		NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_STOP_ALL), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_NULL), SetFill(0, 1),
 
		NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_START_ALL), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_NULL), SetFill(0, 1),
 
		NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_VEHICLE_LIST), SetDataTip(0x0, STR_NULL), SetFill(0, 1),
 
		NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_STOP_ALL), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_NULL), SetFill(0, 1),
 
		NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_START_ALL), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_NULL), SetFill(0, 1),
 
		NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
	EndContainer(),
 
};
 
@@ -144,7 +144,7 @@ static void TrainDepotMoveVehicle(const 
 
}
 

	
 
/**
 
 * Array containing the cell size in pixels of the #DEPOT_WIDGET_MATRIX widget for each vehicle type.
 
 * Array containing the cell size in pixels of the #WID_VD_MATRIX widget for each vehicle type.
 
 * @note The train vehicle type uses the entire row for each train.
 
 */
 
static Dimension _base_block_sizes[4];
 
@@ -221,13 +221,13 @@ struct DepotWindow : Window {
 
		this->num_columns = 1; // for non-trains this gets set in FinishInitNested()
 

	
 
		this->CreateNestedTree(desc);
 
		this->hscroll = (this->type == VEH_TRAIN ? this->GetScrollbar(DEPOT_WIDGET_H_SCROLL) : NULL);
 
		this->vscroll = this->GetScrollbar(DEPOT_WIDGET_V_SCROLL);
 
		this->hscroll = (this->type == VEH_TRAIN ? this->GetScrollbar(WID_VD_H_SCROLL) : NULL);
 
		this->vscroll = this->GetScrollbar(WID_VD_V_SCROLL);
 
		/* Don't show 'rename button' of aircraft hangar */
 
		this->GetWidget<NWidgetStacked>(DEPOT_WIDGET_SHOW_RENAME)->SetDisplayedPlane(type == VEH_AIRCRAFT ? SZSP_NONE : 0);
 
		this->GetWidget<NWidgetStacked>(WID_VD_SHOW_RENAME)->SetDisplayedPlane(type == VEH_AIRCRAFT ? SZSP_NONE : 0);
 
		/* Only train depots have a horizontal scrollbar and a 'sell chain' button */
 
		this->GetWidget<NWidgetStacked>(DEPOT_WIDGET_SHOW_H_SCROLL)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_HORIZONTAL);
 
		this->GetWidget<NWidgetStacked>(DEPOT_WIDGET_SHOW_SELL_CHAIN)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_NONE);
 
		this->GetWidget<NWidgetStacked>(WID_VD_SHOW_H_SCROLL)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_HORIZONTAL);
 
		this->GetWidget<NWidgetStacked>(WID_VD_SHOW_SELL_CHAIN)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_NONE);
 
		this->SetupWidgetData(type);
 
		this->FinishInitNested(desc, tile);
 

	
 
@@ -310,12 +310,12 @@ struct DepotWindow : Window {
 

	
 
	void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget != DEPOT_WIDGET_MATRIX) return;
 
		if (widget != WID_VD_MATRIX) return;
 

	
 
		bool rtl = _current_text_dir == TD_RTL;
 

	
 
		/* Set the row and number of boxes in each row based on the number of boxes drawn in the matrix */
 
		uint16 mat_data = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->widget_data;
 
		uint16 mat_data = this->GetWidget<NWidgetCore>(WID_VD_MATRIX)->widget_data;
 
		uint16 rows_in_display   = GB(mat_data, MAT_ROW_START, MAT_ROW_BITS);
 
		uint16 boxes_in_each_row = GB(mat_data, MAT_COL_START, MAT_COL_BITS);
 

	
 
@@ -346,7 +346,7 @@ struct DepotWindow : Window {
 

	
 
	void SetStringParameters(int widget) const
 
	{
 
		if (widget != DEPOT_WIDGET_CAPTION) return;
 
		if (widget != WID_VD_CAPTION) return;
 

	
 
		/* locate the depot struct */
 
		TileIndex tile = this->window_number;
 
@@ -368,7 +368,7 @@ struct DepotWindow : Window {
 

	
 
	DepotGUIAction GetVehicleFromDepotWndPt(int x, int y, const Vehicle **veh, GetDepotVehiclePtData *d) const
 
	{
 
		const NWidgetCore *matrix_widget = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX);
 
		const NWidgetCore *matrix_widget = this->GetWidget<NWidgetCore>(WID_VD_MATRIX);
 
		/* In case of RTL the widgets are swapped as a whole */
 
		if (_current_text_dir == TD_RTL) x = matrix_widget->current_x - x;
 

	
 
@@ -514,56 +514,56 @@ struct DepotWindow : Window {
 
	 */
 
	void SetupWidgetData(VehicleType type)
 
	{
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_STOP_ALL)->tool_tip     = STR_DEPOT_MASS_STOP_DEPOT_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_START_ALL)->tool_tip    = STR_DEPOT_MASS_START_DEPOT_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->tool_tip         = STR_DEPOT_TRAIN_SELL_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->tool_tip     = STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(WID_VD_STOP_ALL)->tool_tip     = STR_DEPOT_MASS_STOP_DEPOT_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(WID_VD_START_ALL)->tool_tip    = STR_DEPOT_MASS_START_DEPOT_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(WID_VD_SELL)->tool_tip         = STR_DEPOT_TRAIN_SELL_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->tool_tip     = STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TOOLTIP + type;
 

	
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_BUILD)->SetDataTip(STR_DEPOT_TRAIN_NEW_VEHICLES_BUTTON + type, STR_DEPOT_TRAIN_NEW_VEHICLES_TOOLTIP + type);
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_CLONE)->SetDataTip(STR_DEPOT_CLONE_TRAIN + type, STR_DEPOT_CLONE_TRAIN_DEPOT_INFO + type);
 
		this->GetWidget<NWidgetCore>(WID_VD_BUILD)->SetDataTip(STR_DEPOT_TRAIN_NEW_VEHICLES_BUTTON + type, STR_DEPOT_TRAIN_NEW_VEHICLES_TOOLTIP + type);
 
		this->GetWidget<NWidgetCore>(WID_VD_CLONE)->SetDataTip(STR_DEPOT_CLONE_TRAIN + type, STR_DEPOT_CLONE_TRAIN_DEPOT_INFO + type);
 

	
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_LOCATION)->tool_tip     = STR_DEPOT_TRAIN_LOCATION_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->tool_tip = STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->tool_tip  = STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->tool_tip       = STR_DEPOT_TRAIN_LIST_TOOLTIP + this->type;
 
		this->GetWidget<NWidgetCore>(WID_VD_LOCATION)->tool_tip     = STR_DEPOT_TRAIN_LOCATION_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->tool_tip = STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->tool_tip  = STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP + type;
 
		this->GetWidget<NWidgetCore>(WID_VD_MATRIX)->tool_tip       = STR_DEPOT_TRAIN_LIST_TOOLTIP + this->type;
 

	
 
		switch (type) {
 
			default: NOT_REACHED();
 

	
 
			case VEH_TRAIN:
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->widget_data = STR_TRAIN;
 
				this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_TRAIN;
 

	
 
				/* Sprites */
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->widget_data        = SPR_SELL_TRAIN;
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->widget_data    = SPR_SELL_ALL_TRAIN;
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->widget_data = SPR_REPLACE_TRAIN;
 
				this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data        = SPR_SELL_TRAIN;
 
				this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data    = SPR_SELL_ALL_TRAIN;
 
				this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_TRAIN;
 
				break;
 

	
 
			case VEH_ROAD:
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->widget_data = STR_LORRY;
 
				this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_LORRY;
 

	
 
				/* Sprites */
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->widget_data        = SPR_SELL_ROADVEH;
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->widget_data    = SPR_SELL_ALL_ROADVEH;
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->widget_data = SPR_REPLACE_ROADVEH;
 
				this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data        = SPR_SELL_ROADVEH;
 
				this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data    = SPR_SELL_ALL_ROADVEH;
 
				this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_ROADVEH;
 
				break;
 

	
 
			case VEH_SHIP:
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->widget_data = STR_SHIP;
 
				this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_SHIP;
 

	
 
				/* Sprites */
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->widget_data        = SPR_SELL_SHIP;
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->widget_data    = SPR_SELL_ALL_SHIP;
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->widget_data = SPR_REPLACE_SHIP;
 
				this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data        = SPR_SELL_SHIP;
 
				this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data    = SPR_SELL_ALL_SHIP;
 
				this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_SHIP;
 
				break;
 

	
 
			case VEH_AIRCRAFT:
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->widget_data = STR_PLANE;
 
				this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_PLANE;
 

	
 
				/* Sprites */
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->widget_data        = SPR_SELL_AIRCRAFT;
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->widget_data    = SPR_SELL_ALL_AIRCRAFT;
 
				this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->widget_data = SPR_REPLACE_AIRCRAFT;
 
				this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data        = SPR_SELL_AIRCRAFT;
 
				this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data    = SPR_SELL_ALL_AIRCRAFT;
 
				this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_AIRCRAFT;
 
				break;
 
		}
 
	}
 
@@ -576,7 +576,7 @@ struct DepotWindow : Window {
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case DEPOT_WIDGET_MATRIX: {
 
			case WID_VD_MATRIX: {
 
				uint min_height = 0;
 

	
 
				if (this->type == VEH_TRAIN) {
 
@@ -658,15 +658,15 @@ struct DepotWindow : Window {
 
		/* Setup disabled buttons. */
 
		TileIndex tile = this->window_number;
 
		this->SetWidgetsDisabledState(!IsTileOwner(tile, _local_company),
 
			DEPOT_WIDGET_STOP_ALL,
 
			DEPOT_WIDGET_START_ALL,
 
			DEPOT_WIDGET_SELL,
 
			DEPOT_WIDGET_SELL_CHAIN,
 
			DEPOT_WIDGET_SELL_ALL,
 
			DEPOT_WIDGET_BUILD,
 
			DEPOT_WIDGET_CLONE,
 
			DEPOT_WIDGET_RENAME,
 
			DEPOT_WIDGET_AUTOREPLACE,
 
			WID_VD_STOP_ALL,
 
			WID_VD_START_ALL,
 
			WID_VD_SELL,
 
			WID_VD_SELL_CHAIN,
 
			WID_VD_SELL_ALL,
 
			WID_VD_BUILD,
 
			WID_VD_CLONE,
 
			WID_VD_RENAME,
 
			WID_VD_AUTOREPLACE,
 
			WIDGET_LIST_END);
 

	
 
		this->DrawWidgets();
 
@@ -675,22 +675,22 @@ struct DepotWindow : Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case DEPOT_WIDGET_MATRIX: { // List
 
				NWidgetBase *nwi = this->GetWidget<NWidgetBase>(DEPOT_WIDGET_MATRIX);
 
			case WID_VD_MATRIX: { // List
 
				NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX);
 
				this->DepotClick(pt.x - nwi->pos_x, pt.y - nwi->pos_y);
 
				break;
 
			}
 

	
 
			case DEPOT_WIDGET_BUILD: // Build vehicle
 
			case WID_VD_BUILD: // Build vehicle
 
				ResetObjectToPlace();
 
				ShowBuildVehicleWindow(this->window_number, this->type);
 
				break;
 

	
 
			case DEPOT_WIDGET_CLONE: // Clone button
 
				this->SetWidgetDirty(DEPOT_WIDGET_CLONE);
 
				this->ToggleWidgetLoweredState(DEPOT_WIDGET_CLONE);
 
			case WID_VD_CLONE: // Clone button
 
				this->SetWidgetDirty(WID_VD_CLONE);
 
				this->ToggleWidgetLoweredState(WID_VD_CLONE);
 

	
 
				if (this->IsWidgetLowered(DEPOT_WIDGET_CLONE)) {
 
				if (this->IsWidgetLowered(WID_VD_CLONE)) {
 
					static const CursorID clone_icons[] = {
 
						SPR_CURSOR_CLONE_TRAIN, SPR_CURSOR_CLONE_ROADVEH,
 
						SPR_CURSOR_CLONE_SHIP, SPR_CURSOR_CLONE_AIRPLANE
 
@@ -702,7 +702,7 @@ struct DepotWindow : Window {
 
				}
 
				break;
 

	
 
			case DEPOT_WIDGET_LOCATION:
 
			case WID_VD_LOCATION:
 
				if (_ctrl_pressed) {
 
					ShowExtraViewPortWindow(this->window_number);
 
				} else {
 
@@ -710,20 +710,20 @@ struct DepotWindow : Window {
 
				}
 
				break;
 

	
 
			case DEPOT_WIDGET_RENAME: // Rename button
 
			case WID_VD_RENAME: // Rename button
 
				SetDParam(0, this->type);
 
				SetDParam(1, Depot::GetByTile((TileIndex)this->window_number)->index);
 
				ShowQueryString(STR_DEPOT_NAME, STR_DEPOT_RENAME_DEPOT_CAPTION, MAX_LENGTH_DEPOT_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
 
				break;
 

	
 
			case DEPOT_WIDGET_STOP_ALL:
 
			case DEPOT_WIDGET_START_ALL: {
 
			case WID_VD_STOP_ALL:
 
			case WID_VD_START_ALL: {
 
				VehicleListIdentifier vli(VL_DEPOT_LIST, this->type, this->owner);
 
				DoCommandP(this->window_number, (widget == DEPOT_WIDGET_START_ALL ? (1 << 0) : 0), vli.Pack(), CMD_MASS_START_STOP);
 
				DoCommandP(this->window_number, (widget == WID_VD_START_ALL ? (1 << 0) : 0), vli.Pack(), CMD_MASS_START_STOP);
 
				break;
 
			}
 

	
 
			case DEPOT_WIDGET_SELL_ALL:
 
			case WID_VD_SELL_ALL:
 
				/* Only open the confimation window if there are anything to sell */
 
				if (this->vehicle_list.Length() != 0 || this->wagon_list.Length() != 0) {
 
					TileIndex tile = this->window_number;
 
@@ -740,11 +740,11 @@ struct DepotWindow : Window {
 
				}
 
				break;
 

	
 
			case DEPOT_WIDGET_VEHICLE_LIST:
 
			case WID_VD_VEHICLE_LIST:
 
				ShowVehicleListWindow(GetTileOwner(this->window_number), this->type, (TileIndex)this->window_number);
 
				break;
 

	
 
			case DEPOT_WIDGET_AUTOREPLACE:
 
			case WID_VD_AUTOREPLACE:
 
				DoCommandP(this->window_number, this->type, 0, CMD_DEPOT_MASS_AUTOREPLACE);
 
				break;
 

	
 
@@ -761,11 +761,11 @@ struct DepotWindow : Window {
 

	
 
	virtual bool OnRightClick(Point pt, int widget)
 
	{
 
		if (widget != DEPOT_WIDGET_MATRIX) return false;
 
		if (widget != WID_VD_MATRIX) return false;
 

	
 
		GetDepotVehiclePtData gdvp = { NULL, NULL };
 
		const Vehicle *v = NULL;
 
		NWidgetBase *nwi = this->GetWidget<NWidgetBase>(DEPOT_WIDGET_MATRIX);
 
		NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX);
 
		DepotGUIAction mode = this->GetVehicleFromDepotWndPt(pt.x - nwi->pos_x, pt.y - nwi->pos_y, &v, &gdvp);
 

	
 
		if (this->type == VEH_TRAIN) v = gdvp.wagon;
 
@@ -831,13 +831,13 @@ struct DepotWindow : Window {
 
	virtual void OnPlaceObjectAbort()
 
	{
 
		/* abort clone */
 
		this->RaiseWidget(DEPOT_WIDGET_CLONE);
 
		this->SetWidgetDirty(DEPOT_WIDGET_CLONE);
 
		this->RaiseWidget(WID_VD_CLONE);
 
		this->SetWidgetDirty(WID_VD_CLONE);
 

	
 
		/* abort drag & drop */
 
		this->sel = INVALID_VEHICLE;
 
		this->vehicle_over = INVALID_VEHICLE;
 
		this->SetWidgetDirty(DEPOT_WIDGET_MATRIX);
 
		this->SetWidgetDirty(WID_VD_MATRIX);
 
	}
 

	
 
	virtual void OnMouseDrag(Point pt, int widget)
 
@@ -845,10 +845,10 @@ struct DepotWindow : Window {
 
		if (this->type != VEH_TRAIN || this->sel == INVALID_VEHICLE) return;
 

	
 
		/* A rail vehicle is dragged.. */
 
		if (widget != DEPOT_WIDGET_MATRIX) { // ..outside of the depot matrix.
 
		if (widget != WID_VD_MATRIX) { // ..outside of the depot matrix.
 
			if (this->vehicle_over != INVALID_VEHICLE) {
 
				this->vehicle_over = INVALID_VEHICLE;
 
				this->SetWidgetDirty(DEPOT_WIDGET_MATRIX);
 
				this->SetWidgetDirty(WID_VD_MATRIX);
 
			}
 
			return;
 
		}
 
@@ -883,14 +883,14 @@ struct DepotWindow : Window {
 
	virtual void OnDragDrop(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case DEPOT_WIDGET_MATRIX: {
 
			case WID_VD_MATRIX: {
 
				const Vehicle *v = NULL;
 
				VehicleID sel = this->sel;
 

	
 
				this->sel = INVALID_VEHICLE;
 
				this->SetDirty();
 

	
 
				NWidgetBase *nwi = this->GetWidget<NWidgetBase>(DEPOT_WIDGET_MATRIX);
 
				NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX);
 
				if (this->type == VEH_TRAIN) {
 
					GetDepotVehiclePtData gdvp = { NULL, NULL };
 

	
 
@@ -911,7 +911,7 @@ struct DepotWindow : Window {
 
				break;
 
			}
 

	
 
			case DEPOT_WIDGET_SELL: case DEPOT_WIDGET_SELL_CHAIN: {
 
			case WID_VD_SELL: case WID_VD_SELL_CHAIN: {
 
				if (this->IsWidgetDisabled(widget)) return;
 
				if (this->sel == INVALID_VEHICLE) return;
 

	
 
@@ -921,7 +921,7 @@ struct DepotWindow : Window {
 
				this->sel = INVALID_VEHICLE;
 
				this->SetDirty();
 

	
 
				int sell_cmd = (v->type == VEH_TRAIN && (widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
 
				int sell_cmd = (v->type == VEH_TRAIN && (widget == WID_VD_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
 
				DoCommandP(v->tile, v->index | sell_cmd << 20 | MAKE_ORDER_BACKUP_FLAG, 0, GetCmdSellVeh(v->type));
 
				break;
 
			}
 
@@ -935,20 +935,20 @@ struct DepotWindow : Window {
 

	
 
	virtual void OnTimeout()
 
	{
 
		if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL)) {
 
			this->RaiseWidget(DEPOT_WIDGET_SELL);
 
			this->SetWidgetDirty(DEPOT_WIDGET_SELL);
 
		if (!this->IsWidgetDisabled(WID_VD_SELL)) {
 
			this->RaiseWidget(WID_VD_SELL);
 
			this->SetWidgetDirty(WID_VD_SELL);
 
		}
 
		if (this->nested_array[DEPOT_WIDGET_SELL] != NULL && !this->IsWidgetDisabled(DEPOT_WIDGET_SELL_CHAIN)) {
 
			this->RaiseWidget(DEPOT_WIDGET_SELL_CHAIN);
 
			this->SetWidgetDirty(DEPOT_WIDGET_SELL_CHAIN);
 
		if (this->nested_array[WID_VD_SELL] != NULL && !this->IsWidgetDisabled(WID_VD_SELL_CHAIN)) {
 
			this->RaiseWidget(WID_VD_SELL_CHAIN);
 
			this->SetWidgetDirty(WID_VD_SELL_CHAIN);
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX);
 
		this->vscroll->SetCapacityFromWidget(this, DEPOT_WIDGET_MATRIX);
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_VD_MATRIX);
 
		this->vscroll->SetCapacityFromWidget(this, WID_VD_MATRIX);
 
		if (this->type == VEH_TRAIN) {
 
			this->hscroll->SetCapacity(nwi->current_x - this->header_width - this->count_width);
 
			nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
@@ -962,7 +962,7 @@ struct DepotWindow : Window {
 
	{
 
		if (this->sel != INVALID_VEHICLE) {
 
			_cursor.vehchain = _ctrl_pressed;
 
			this->SetWidgetDirty(DEPOT_WIDGET_MATRIX);
 
			this->SetWidgetDirty(WID_VD_MATRIX);
 
			return ES_HANDLED;
 
		}
 

	
src/dock_gui.cpp
Show inline comments
 
@@ -96,7 +96,7 @@ struct BuildDocksToolbarWindow : Window 
 

	
 
	BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
 
	{
 
		this->last_clicked_widget = DTW_END;
 
		this->last_clicked_widget = WID_DT_INVALID;
 
		this->InitNested(desc, window_number);
 
		this->OnInvalidateData();
 
		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
@@ -116,49 +116,49 @@ struct BuildDocksToolbarWindow : Window 
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP),
 
			DTW_DEPOT,
 
			DTW_STATION,
 
			DTW_BUOY,
 
			WID_DT_DEPOT,
 
			WID_DT_STATION,
 
			WID_DT_BUOY,
 
			WIDGET_LIST_END);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case DTW_CANAL: // Build canal button
 
				HandlePlacePushButton(this, DTW_CANAL, SPR_CURSOR_CANAL, HT_RECT);
 
			case WID_DT_CANAL: // Build canal button
 
				HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT);
 
				break;
 

	
 
			case DTW_LOCK: // Build lock button
 
				HandlePlacePushButton(this, DTW_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
 
			case WID_DT_LOCK: // Build lock button
 
				HandlePlacePushButton(this, WID_DT_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
 
				break;
 

	
 
			case DTW_DEMOLISH: // Demolish aka dynamite button
 
				HandlePlacePushButton(this, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
			case WID_DT_DEMOLISH: // Demolish aka dynamite button
 
				HandlePlacePushButton(this, WID_DT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
				break;
 

	
 
			case DTW_DEPOT: // Build depot button
 
			case WID_DT_DEPOT: // Build depot button
 
				if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
 
				if (HandlePlacePushButton(this, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
 
				if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
 
				break;
 

	
 
			case DTW_STATION: // Build station button
 
			case WID_DT_STATION: // Build station button
 
				if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
 
				if (HandlePlacePushButton(this, DTW_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
 
				if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
 
				break;
 

	
 
			case DTW_BUOY: // Build buoy button
 
			case WID_DT_BUOY: // Build buoy button
 
				if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
 
				HandlePlacePushButton(this, DTW_BUOY, SPR_CURSOR_BUOY, HT_RECT);
 
				HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT);
 
				break;
 

	
 
			case DTW_RIVER: // Build river button (in scenario editor)
 
			case WID_DT_RIVER: // Build river button (in scenario editor)
 
				if (_game_mode != GM_EDITOR) return;
 
				HandlePlacePushButton(this, DTW_RIVER, SPR_CURSOR_RIVER, HT_RECT);
 
				HandlePlacePushButton(this, WID_DT_RIVER, SPR_CURSOR_RIVER, HT_RECT);
 
				break;
 

	
 
			case DTW_BUILD_AQUEDUCT: // Build aqueduct button
 
				HandlePlacePushButton(this, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
 
			case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
 
				HandlePlacePushButton(this, WID_DT_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
 
				break;
 

	
 
			default: return;
 
@@ -177,23 +177,23 @@ struct BuildDocksToolbarWindow : Window 
 
	virtual void OnPlaceObject(Point pt, TileIndex tile)
 
	{
 
		switch (this->last_clicked_widget) {
 
			case DTW_CANAL: // Build canal button
 
			case WID_DT_CANAL: // Build canal button
 
				VpStartPlaceSizing(tile, (_game_mode == GM_EDITOR) ? VPM_X_AND_Y : VPM_X_OR_Y, DDSP_CREATE_WATER);
 
				break;
 

	
 
			case DTW_LOCK: // Build lock button
 
			case WID_DT_LOCK: // Build lock button
 
				DoCommandP(tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks);
 
				break;
 

	
 
			case DTW_DEMOLISH: // Demolish aka dynamite button
 
			case WID_DT_DEMOLISH: // Demolish aka dynamite button
 
				PlaceProc_DemolishArea(tile);
 
				break;
 

	
 
			case DTW_DEPOT: // Build depot button
 
			case WID_DT_DEPOT: // Build depot button
 
				DoCommandP(tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks);
 
				break;
 

	
 
			case DTW_STATION: { // Build station button
 
			case WID_DT_STATION: { // Build station button
 
				uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join
 

	
 
				/* tile is always the land tile, so need to evaluate _thd.pos */
 
@@ -207,15 +207,15 @@ struct BuildDocksToolbarWindow : Window 
 
				break;
 
			}
 

	
 
			case DTW_BUOY: // Build buoy button
 
			case WID_DT_BUOY: // Build buoy button
 
				DoCommandP(tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks);
 
				break;
 

	
 
			case DTW_RIVER: // Build river button (in scenario editor)
 
			case WID_DT_RIVER: // Build river button (in scenario editor)
 
				VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_RIVER);
 
				break;
 

	
 
			case DTW_BUILD_AQUEDUCT: // Build aqueduct button
 
			case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
 
				DoCommandP(tile, GetOtherAqueductEnd(tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge);
 
				break;
 

	
 
@@ -261,7 +261,7 @@ struct BuildDocksToolbarWindow : Window 
 
	{
 
		TileIndex tile_to = tile_from;
 

	
 
		if (this->last_clicked_widget == DTW_BUILD_AQUEDUCT) {
 
		if (this->last_clicked_widget == WID_DT_BUILD_AQUEDUCT) {
 
			GetOtherAqueductEnd(tile_from, &tile_to);
 
		} else {
 
			DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from));
 
@@ -269,7 +269,7 @@ struct BuildDocksToolbarWindow : Window 
 
				/* Locks and docks always select the tile "down" the slope. */
 
				tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir));
 
				/* Locks also select the tile "up" the slope. */
 
				if (this->last_clicked_widget == DTW_LOCK) tile_from = TileAddByDiagDir(tile_from, dir);
 
				if (this->last_clicked_widget == WID_DT_LOCK) tile_from = TileAddByDiagDir(tile_from, dir);
 
			}
 
		}
 

	
 
@@ -282,21 +282,21 @@ struct BuildDocksToolbarWindow : Window 
 
const uint16 _dockstoolbar_aqueduct_keys[] = {'B', '8', 0};
 

	
 
Hotkey<BuildDocksToolbarWindow> BuildDocksToolbarWindow::dockstoolbar_hotkeys[] = {
 
	Hotkey<BuildDocksToolbarWindow>('1', "canal", DTW_CANAL),
 
	Hotkey<BuildDocksToolbarWindow>('2', "lock", DTW_LOCK),
 
	Hotkey<BuildDocksToolbarWindow>('3', "demolish", DTW_DEMOLISH),
 
	Hotkey<BuildDocksToolbarWindow>('4', "depot", DTW_DEPOT),
 
	Hotkey<BuildDocksToolbarWindow>('5', "dock", DTW_STATION),
 
	Hotkey<BuildDocksToolbarWindow>('6', "buoy", DTW_BUOY),
 
	Hotkey<BuildDocksToolbarWindow>('7', "river", DTW_RIVER),
 
	Hotkey<BuildDocksToolbarWindow>(_dockstoolbar_aqueduct_keys, "aqueduct", DTW_BUILD_AQUEDUCT),
 
	Hotkey<BuildDocksToolbarWindow>('1', "canal", WID_DT_CANAL),
 
	Hotkey<BuildDocksToolbarWindow>('2', "lock", WID_DT_LOCK),
 
	Hotkey<BuildDocksToolbarWindow>('3', "demolish", WID_DT_DEMOLISH),
 
	Hotkey<BuildDocksToolbarWindow>('4', "depot", WID_DT_DEPOT),
 
	Hotkey<BuildDocksToolbarWindow>('5', "dock", WID_DT_STATION),
 
	Hotkey<BuildDocksToolbarWindow>('6', "buoy", WID_DT_BUOY),
 
	Hotkey<BuildDocksToolbarWindow>('7', "river", WID_DT_RIVER),
 
	Hotkey<BuildDocksToolbarWindow>(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT),
 
	HOTKEY_LIST_END(BuildDocksToolbarWindow)
 
};
 
Hotkey<BuildDocksToolbarWindow> *_dockstoolbar_hotkeys = BuildDocksToolbarWindow::dockstoolbar_hotkeys;
 

	
 
/**
 
 * Nested widget parts of docks toolbar, game version.
 
 * Position of #DTW_RIVER widget has changed.
 
 * Position of #WID_DT_RIVER widget has changed.
 
 */
 
static const NWidgetPart _nested_build_docks_toolbar_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
@@ -305,14 +305,14 @@ static const NWidgetPart _nested_build_d
 
		NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL_LTR),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP),
 
		NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEPOT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_STATION), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEPOT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_STATION), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
 
	EndContainer(),
 
};
 

	
 
@@ -349,7 +349,7 @@ EventState DockToolbarGlobalHotkeys(uint
 

	
 
/**
 
 * Nested widget parts of docks toolbar, scenario editor version.
 
 * Positions of #DTW_DEPOT, #DTW_STATION, and #DTW_BUOY widgets have changed.
 
 * Positions of #WID_DT_DEPOT, #WID_DT_STATION, and #WID_DT_BUOY widgets have changed.
 
 */
 
static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
@@ -358,12 +358,12 @@ static const NWidgetPart _nested_build_d
 
		NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_CREATE_LAKE_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_CREATE_LAKE_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP),
 
		NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_RIVER), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_RIVER, STR_WATERWAYS_TOOLBAR_CREATE_RIVER_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_RIVER), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_RIVER, STR_WATERWAYS_TOOLBAR_CREATE_RIVER_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUILD_AQUEDUCT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
 
	EndContainer(),
 
};
 

	
src/engine_gui.cpp
Show inline comments
 
@@ -50,10 +50,10 @@ static const NWidgetPart _nested_engine_
 
		NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_ENGINE_PREVIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE),
 
		NWidget(WWT_EMPTY, INVALID_COLOUR, EPW_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0),
 
		NWidget(WWT_EMPTY, INVALID_COLOUR, WID_EP_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0),
 
		NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(85, 10, 85),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, EPW_NO), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, EPW_YES), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_EP_NO), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_EP_YES), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 8),
 
	EndContainer(),
 
@@ -69,7 +69,7 @@ struct EnginePreviewWindow : Window {
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget != EPW_QUESTION) return;
 
		if (widget != WID_EP_QUESTION) return;
 

	
 
		EngineID engine = this->window_number;
 
		SetDParam(0, GetEngineCategoryName(engine));
 
@@ -80,7 +80,7 @@ struct EnginePreviewWindow : Window {
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		if (widget != EPW_QUESTION) return;
 
		if (widget != WID_EP_QUESTION) return;
 

	
 
		EngineID engine = this->window_number;
 
		SetDParam(0, GetEngineCategoryName(engine));
 
@@ -100,10 +100,10 @@ struct EnginePreviewWindow : Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case EPW_YES:
 
			case WID_EP_YES:
 
				DoCommandP(0, this->window_number, 0, CMD_WANT_ENGINE_PREVIEW);
 
				/* FALL THROUGH */
 
			case EPW_NO:
 
			case WID_EP_NO:
 
				delete this;
 
				break;
 
		}
src/error_gui.cpp
Show inline comments
 
@@ -32,10 +32,10 @@
 
static const NWidgetPart _nested_errmsg_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_RED),
 
		NWidget(WWT_CAPTION, COLOUR_RED, EMW_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION, STR_NULL),
 
		NWidget(WWT_CAPTION, COLOUR_RED, WID_EM_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION, STR_NULL),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_RED),
 
		NWidget(WWT_EMPTY, COLOUR_RED, EMW_MESSAGE), SetPadding(0, 2, 0, 2), SetMinimalSize(236, 32),
 
		NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_MESSAGE), SetPadding(0, 2, 0, 2), SetMinimalSize(236, 32),
 
	EndContainer(),
 
};
 

	
 
@@ -49,12 +49,12 @@ static const WindowDesc _errmsg_desc(
 
static const NWidgetPart _nested_errmsg_face_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_RED),
 
		NWidget(WWT_CAPTION, COLOUR_RED, EMW_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_NULL),
 
		NWidget(WWT_CAPTION, COLOUR_RED, WID_EM_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_NULL),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_RED),
 
		NWidget(NWID_HORIZONTAL), SetPIP(2, 1, 2),
 
			NWidget(WWT_EMPTY, COLOUR_RED, EMW_FACE), SetMinimalSize(92, 119), SetFill(0, 1), SetPadding(2, 0, 1, 0),
 
			NWidget(WWT_EMPTY, COLOUR_RED, EMW_MESSAGE), SetFill(0, 1), SetMinimalSize(238, 123),
 
			NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_FACE), SetMinimalSize(92, 119), SetFill(0, 1), SetPadding(2, 0, 1, 0),
 
			NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_MESSAGE), SetFill(0, 1), SetMinimalSize(238, 123),
 
		EndContainer(),
 
	EndContainer(),
 
};
 
@@ -141,8 +141,8 @@ bool _window_system_initialized = false;
 
/** Window class for displaying an error message window. */
 
struct ErrmsgWindow : public Window, ErrorMessageData {
 
private:
 
	uint height_summary;            ///< Height of the #summary_msg string in pixels in the #EMW_MESSAGE widget.
 
	uint height_detailed;           ///< Height of the #detailed_msg string in pixels in the #EMW_MESSAGE widget.
 
	uint height_summary;            ///< Height of the #summary_msg string in pixels in the #WID_EM_MESSAGE widget.
 
	uint height_detailed;           ///< Height of the #detailed_msg string in pixels in the #WID_EM_MESSAGE widget.
 

	
 
public:
 
	ErrmsgWindow(const ErrorMessageData &data) : Window(), ErrorMessageData(data)
 
@@ -152,7 +152,7 @@ public:
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget != EMW_MESSAGE) return;
 
		if (widget != WID_EM_MESSAGE) return;
 

	
 
		CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
 
		if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_size, this->textref_stack);
 
@@ -213,19 +213,19 @@ public:
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		if (widget == EMW_CAPTION) CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
 
		if (widget == WID_EM_CAPTION) CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case EMW_FACE: {
 
			case WID_EM_FACE: {
 
				const Company *c = Company::Get(this->face);
 
				DrawCompanyManagerFace(c->face, c->colour, r.left, r.top);
 
				break;
 
			}
 

	
 
			case EMW_MESSAGE:
 
			case WID_EM_MESSAGE:
 
				CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
 
				if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_size, this->textref_stack);
 

	
src/fios_gui.cpp
Show inline comments
 
@@ -71,37 +71,37 @@ void LoadCheckData::Clear()
 
static const NWidgetPart _nested_load_dialog_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, SLWW_WINDOWTITLE),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, SLWW_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(NWID_VERTICAL),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
				EndContainer(),
 
				NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SLWW_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON),
 
				NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND),
 
			NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2),
 
							SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(),
 
					NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR),
 
					NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2),
 
							SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(),
 
					NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR),
 
				EndContainer(),
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, SLWW_CONTENT_DOWNLOAD_SEL),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_CONTENT_DOWNLOAD), SetResize(1, 0),
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SL_CONTENT_DOWNLOAD_SEL),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_CONTENT_DOWNLOAD), SetResize(1, 0),
 
							SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
 
				EndContainer(),
 
			EndContainer(),
 
		EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, SLWW_DETAILS), SetResize(1, 1), SetFill(1, 1),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_MISSING_NEWGRFS), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SL_DETAILS), SetResize(1, 1), SetFill(1, 1),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_MISSING_NEWGRFS), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_NEWGRF_INFO), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_LOAD_BUTTON), SetDataTip(STR_SAVELOAD_LOAD_BUTTON, STR_SAVELOAD_LOAD_TOOLTIP), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_NEWGRF_INFO), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_LOAD_BUTTON), SetDataTip(STR_SAVELOAD_LOAD_BUTTON, STR_SAVELOAD_LOAD_TOOLTIP), SetFill(1, 0), SetResize(1, 0),
 
				EndContainer(),
 
				NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
			EndContainer(),
 
@@ -113,25 +113,25 @@ static const NWidgetPart _nested_load_di
 
static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, SLWW_WINDOWTITLE),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, SLWW_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(),
 
	NWidget(NWID_VERTICAL),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
			EndContainer(),
 
			NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SLWW_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON),
 
			NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON),
 
		EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND),
 
		NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2),
 
						SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(),
 
				NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR),
 
				NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2),
 
						SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(),
 
				NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_CONTENT_DOWNLOAD), SetResize(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_CONTENT_DOWNLOAD), SetResize(1, 0),
 
						SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
 
				NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
			EndContainer(),
 
@@ -143,34 +143,34 @@ static const NWidgetPart _nested_load_he
 
static const NWidgetPart _nested_save_dialog_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, SLWW_WINDOWTITLE),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, SLWW_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(),
 
	NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
		NWidget(NWID_VERTICAL),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0),
 
				EndContainer(),
 
				NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SLWW_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON),
 
				NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON),
 
			EndContainer(),
 
			NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND),
 
			NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND),
 
				NWidget(NWID_HORIZONTAL),
 
					NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetPadding(2, 1, 0, 2),
 
							SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(),
 
					NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR),
 
					NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetPadding(2, 1, 0, 2),
 
							SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(),
 
					NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR),
 
				EndContainer(),
 
				NWidget(WWT_EDITBOX, COLOUR_GREY, SLWW_SAVE_OSK_TITLE), SetPadding(3, 2, 2, 2), SetFill(1, 0), SetResize(1, 0),
 
				NWidget(WWT_EDITBOX, COLOUR_GREY, WID_SL_SAVE_OSK_TITLE), SetPadding(3, 2, 2, 2), SetFill(1, 0), SetResize(1, 0),
 
						SetDataTip(STR_SAVELOAD_OSKTITLE, STR_SAVELOAD_EDITBOX_TOOLTIP),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_DELETE_SELECTION), SetDataTip(STR_SAVELOAD_DELETE_BUTTON, STR_SAVELOAD_DELETE_TOOLTIP), SetFill(1, 0), SetResize(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SAVE_GAME),        SetDataTip(STR_SAVELOAD_SAVE_BUTTON, STR_SAVELOAD_SAVE_TOOLTIP),     SetFill(1, 0), SetResize(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_DELETE_SELECTION), SetDataTip(STR_SAVELOAD_DELETE_BUTTON, STR_SAVELOAD_DELETE_TOOLTIP), SetFill(1, 0), SetResize(1, 0),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SAVE_GAME),        SetDataTip(STR_SAVELOAD_SAVE_BUTTON, STR_SAVELOAD_SAVE_TOOLTIP),     SetFill(1, 0), SetResize(1, 0),
 
			EndContainer(),
 
		EndContainer(),
 
		NWidget(WWT_PANEL, COLOUR_GREY),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, SLWW_DETAILS), SetResize(1, 1), SetFill(1, 1),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SL_DETAILS), SetResize(1, 1), SetFill(1, 1),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(NWID_SPACER), SetResize(1, 0), SetFill(1, 1),
 
				NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
@@ -265,13 +265,13 @@ public:
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size);
 

	
 
		this->CreateNestedTree(desc, true);
 
		if (mode == SLD_LOAD_GAME) this->GetWidget<NWidgetStacked>(SLWW_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL);
 
		this->GetWidget<NWidgetCore>(SLWW_WINDOWTITLE)->widget_data = saveload_captions[mode];
 
		this->vscroll = this->GetScrollbar(SLWW_SCROLLBAR);
 
		if (mode == SLD_LOAD_GAME) this->GetWidget<NWidgetStacked>(WID_SL_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL);
 
		this->GetWidget<NWidgetCore>(WID_SL_CAPTION)->widget_data = saveload_captions[mode];
 
		this->vscroll = this->GetScrollbar(WID_SL_SCROLLBAR);
 

	
 
		this->FinishInitNested(desc, 0);
 

	
 
		this->LowerWidget(SLWW_DRIVES_DIRECTORIES_LIST);
 
		this->LowerWidget(WID_SL_DRIVES_DIRECTORIES_LIST);
 

	
 
		/* pause is only used in single-player, non-editor mode, non-menu mode. It
 
		 * will be unpaused in the WE_DESTROY event handler. */
 
@@ -307,7 +307,7 @@ public:
 

	
 
		/* Focus the edit box by default in the save windows */
 
		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) {
 
			this->SetFocusedWidget(SLWW_SAVE_OSK_TITLE);
 
			this->SetFocusedWidget(WID_SL_SAVE_OSK_TITLE);
 
		}
 
	}
 

	
 
@@ -323,14 +323,14 @@ public:
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case SLWW_SORT_BYNAME:
 
			case SLWW_SORT_BYDATE:
 
				if (((_savegame_sort_order & SORT_BY_NAME) != 0) == (widget == SLWW_SORT_BYNAME)) {
 
			case WID_SL_SORT_BYNAME:
 
			case WID_SL_SORT_BYDATE:
 
				if (((_savegame_sort_order & SORT_BY_NAME) != 0) == (widget == WID_SL_SORT_BYNAME)) {
 
					this->DrawSortButtonState(widget, _savegame_sort_order & SORT_DESCENDING ? SBS_DOWN : SBS_UP);
 
				}
 
				break;
 

	
 
			case SLWW_BACKGROUND: {
 
			case WID_SL_BACKGROUND: {
 
				static const char *path = NULL;
 
				static StringID str = STR_ERROR_UNABLE_TO_READ_DRIVE;
 
				static uint64 tot = 0;
 
@@ -346,7 +346,7 @@ public:
 
				break;
 
			}
 

	
 
			case SLWW_DRIVES_DIRECTORIES_LIST: {
 
			case WID_SL_DRIVES_DIRECTORIES_LIST: {
 
				GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, PC_BLACK);
 

	
 
				uint y = r.top + WD_FRAMERECT_TOP;
 
@@ -363,7 +363,7 @@ public:
 
				break;
 
			}
 

	
 
			case SLWW_DETAILS: {
 
			case WID_SL_DETAILS: {
 
				GfxFillRect(r.left + WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP,
 
						r.right - WD_FRAMERECT_RIGHT, r.top + FONT_HEIGHT_NORMAL * 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM, PC_GREY);
 
				DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL / 2 + WD_FRAMERECT_TOP, STR_SAVELOAD_DETAIL_CAPTION, TC_FROMSTRING, SA_HOR_CENTER);
 
@@ -462,16 +462,16 @@ public:
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case SLWW_BACKGROUND:
 
			case WID_SL_BACKGROUND:
 
				size->height = 2 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				break;
 

	
 
			case SLWW_DRIVES_DIRECTORIES_LIST:
 
			case WID_SL_DRIVES_DIRECTORIES_LIST:
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				size->height = resize->height * 10 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				break;
 
			case SLWW_SORT_BYNAME:
 
			case SLWW_SORT_BYDATE: {
 
			case WID_SL_SORT_BYNAME:
 
			case WID_SL_SORT_BYDATE: {
 
				Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
 
				d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better.
 
				d.height += padding.height;
 
@@ -492,33 +492,33 @@ public:
 
		this->DrawWidgets();
 

	
 
		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) {
 
			this->DrawEditBox(SLWW_SAVE_OSK_TITLE);
 
			this->DrawEditBox(WID_SL_SAVE_OSK_TITLE);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SLWW_SORT_BYNAME: // Sort save names by name
 
			case WID_SL_SORT_BYNAME: // Sort save names by name
 
				_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ?
 
					SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME;
 
				_savegame_sort_dirty = true;
 
				this->SetDirty();
 
				break;
 

	
 
			case SLWW_SORT_BYDATE: // Sort save names by date
 
			case WID_SL_SORT_BYDATE: // Sort save names by date
 
				_savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ?
 
					SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE;
 
				_savegame_sort_dirty = true;
 
				this->SetDirty();
 
				break;
 

	
 
			case SLWW_HOME_BUTTON: // OpenTTD 'button', jumps to OpenTTD directory
 
			case WID_SL_HOME_BUTTON: // OpenTTD 'button', jumps to OpenTTD directory
 
				FiosBrowseTo(&o_dir);
 
				this->InvalidateData();
 
				break;
 

	
 
			case SLWW_LOAD_BUTTON:
 
			case WID_SL_LOAD_BUTTON:
 
				if (this->selected != NULL && !_load_check_data.HasErrors() && (_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs())) {
 
					_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
 

	
 
@@ -532,13 +532,13 @@ public:
 
				}
 
				break;
 

	
 
			case SLWW_NEWGRF_INFO:
 
			case WID_SL_NEWGRF_INFO:
 
				if (_load_check_data.HasNewGrfs()) {
 
					ShowNewGRFSettings(false, false, false, &_load_check_data.grfconfig);
 
				}
 
				break;
 

	
 
			case SLWW_MISSING_NEWGRFS:
 
			case WID_SL_MISSING_NEWGRFS:
 
				if (!_network_available) {
 
					ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
 
				} else {
 
@@ -548,8 +548,8 @@ public:
 
				}
 
				break;
 

	
 
			case SLWW_DRIVES_DIRECTORIES_LIST: { // Click the listbox
 
				int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SLWW_DRIVES_DIRECTORIES_LIST, WD_FRAMERECT_TOP);
 
			case WID_SL_DRIVES_DIRECTORIES_LIST: { // Click the listbox
 
				int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SL_DRIVES_DIRECTORIES_LIST, WD_FRAMERECT_TOP);
 
				if (y == INT_MAX) return;
 

	
 
				const FiosItem *file = _fios_items.Get(y);
 
@@ -571,12 +571,12 @@ public:
 
							/* Copy clicked name to editbox */
 
							ttd_strlcpy(this->text.buf, file->title, this->text.max_bytes);
 
							UpdateTextBufferSize(&this->text);
 
							this->SetWidgetDirty(SLWW_SAVE_OSK_TITLE);
 
							this->SetWidgetDirty(WID_SL_SAVE_OSK_TITLE);
 
						}
 
					} else if (!_load_check_data.HasErrors()) {
 
						this->selected = file;
 
						if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) {
 
							this->OnClick(pt, SLWW_LOAD_BUTTON, 1);
 
							this->OnClick(pt, WID_SL_LOAD_BUTTON, 1);
 
						} else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
 
							SetFiosType(file->type);
 
							strecpy(_file_to_saveload.name, name, lastof(_file_to_saveload.name));
 
@@ -593,7 +593,7 @@ public:
 
				break;
 
			}
 

	
 
			case SLWW_CONTENT_DOWNLOAD:
 
			case WID_SL_CONTENT_DOWNLOAD:
 
				if (!_network_available) {
 
					ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
 
				} else {
 
@@ -607,7 +607,7 @@ public:
 
				}
 
				break;
 

	
 
			case SLWW_DELETE_SELECTION: case SLWW_SAVE_GAME: // Delete, Save game
 
			case WID_SL_DELETE_SELECTION: case WID_SL_SAVE_GAME: // Delete, Save game
 
				break;
 
		}
 
	}
 
@@ -615,7 +615,7 @@ public:
 
	virtual void OnMouseLoop()
 
	{
 
		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) {
 
			this->HandleEditBox(SLWW_SAVE_OSK_TITLE);
 
			this->HandleEditBox(WID_SL_SAVE_OSK_TITLE);
 
		}
 
	}
 

	
 
@@ -628,8 +628,8 @@ public:
 

	
 
		EventState state = ES_NOT_HANDLED;
 
		if ((_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) &&
 
				this->HandleEditBoxKey(SLWW_SAVE_OSK_TITLE, key, keycode, state) == HEBR_CONFIRM) {
 
			this->HandleButtonClick(SLWW_SAVE_GAME);
 
				this->HandleEditBoxKey(WID_SL_SAVE_OSK_TITLE, key, keycode, state) == HEBR_CONFIRM) {
 
			this->HandleButtonClick(WID_SL_SAVE_GAME);
 
		}
 

	
 
		return state;
 
@@ -641,7 +641,7 @@ public:
 
		 * in those saveload modes. */
 
		if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP)) return;
 

	
 
		if (this->IsWidgetLowered(SLWW_DELETE_SELECTION)) { // Delete button clicked
 
		if (this->IsWidgetLowered(WID_SL_DELETE_SELECTION)) { // Delete button clicked
 
			if (!FiosDelete(this->text.buf)) {
 
				ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, WL_ERROR);
 
			} else {
 
@@ -651,7 +651,7 @@ public:
 
			}
 

	
 
			UpdateTextBufferSize(&this->text);
 
		} else if (this->IsWidgetLowered(SLWW_SAVE_GAME)) { // Save button clicked
 
		} else if (this->IsWidgetLowered(WID_SL_SAVE_GAME)) { // Save button clicked
 
			if (_saveload_mode  == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
 
				_switch_mode = SM_SAVE_GAME;
 
				FiosMakeSavegameName(_file_to_saveload.name, this->text.buf, sizeof(_file_to_saveload.name));
 
@@ -667,7 +667,7 @@ public:
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, SLWW_DRIVES_DIRECTORIES_LIST);
 
		this->vscroll->SetCapacityFromWidget(this, WID_SL_DRIVES_DIRECTORIES_LIST);
 
	}
 

	
 
	/**
 
@@ -689,11 +689,11 @@ public:
 
				/* Selection changes */
 
				if (!gui_scope) break;
 
				if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) {
 
					this->SetWidgetDisabledState(SLWW_LOAD_BUTTON,
 
					this->SetWidgetDisabledState(WID_SL_LOAD_BUTTON,
 
							this->selected == NULL || _load_check_data.HasErrors() || !(_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()));
 
					this->SetWidgetDisabledState(SLWW_NEWGRF_INFO,
 
					this->SetWidgetDisabledState(WID_SL_NEWGRF_INFO,
 
							!_load_check_data.HasNewGrfs());
 
					this->SetWidgetDisabledState(SLWW_MISSING_NEWGRFS,
 
					this->SetWidgetDisabledState(WID_SL_MISSING_NEWGRFS,
 
							!_load_check_data.HasNewGrfs() || _load_check_data.grf_compatibility == GLC_ALL_GOOD);
 
				}
 
				break;

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)