Changeset - r18743:bbdd9a165607
[Not reviewed]
master
0 19 0
truebrain - 13 years ago 2011-12-19 20:50:21
truebrain@openttd.org
(svn r23601) -Fix: fix the conflict in window number
19 files changed with 146 insertions and 108 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -146,13 +146,13 @@ struct AIListWindow : public Window {
 
			AIConfig::GetConfig(slot)->Change(NULL);
 
		} else {
 
			ScriptInfoList::const_iterator it = this->ai_info_list->begin();
 
			for (int i = 0; i < this->selected; i++) it++;
 
			AIConfig::GetConfig(slot)->Change((*it).second->GetName(), (*it).second->GetVersion());
 
		}
 
		SetWindowDirty(WC_GAME_OPTIONS, 0);
 
		SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WID_AIL_LIST: { // Select one of the AIs
 
@@ -580,13 +580,13 @@ struct AIConfigWindow : public Window {
 
	CompanyID selected_slot; ///< The currently selected AI slot or \c INVALID_COMPANY.
 
	int line_height;         ///< Height of a single AI-name line.
 
	Scrollbar *vscroll;      ///< Cache of the vertical scrollbar.
 

	
 
	AIConfigWindow() : Window()
 
	{
 
		this->InitNested(&_ai_config_desc); // Initializes 'this->line_height' as a side effect.
 
		this->InitNested(&_ai_config_desc, WN_GAME_OPTIONS_AI); // Initializes 'this->line_height' as a side effect.
 
		this->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR);
 
		this->selected_slot = INVALID_COMPANY;
 
		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);
 
@@ -749,13 +749,13 @@ struct AIConfigWindow : public Window {
 
	}
 
};
 

	
 
/** Open the AI config window. */
 
void ShowAIConfigWindow()
 
{
 
	DeleteWindowById(WC_GAME_OPTIONS, 0);
 
	DeleteWindowByClass(WC_GAME_OPTIONS);
 
	new AIConfigWindow();
 
}
 

	
 
/**
 
 * Window with everything an AI prints via ScriptLog.
 
 */
src/bootstrap_gui.cpp
Show inline comments
 
@@ -129,13 +129,13 @@ class BootstrapAskForDownloadWindow : pu
 
	Dimension button_size; ///< The dimension of the button
 

	
 
public:
 
	/** Start listening to the content client events. */
 
	BootstrapAskForDownloadWindow() : Window()
 
	{
 
		this->InitNested(&_bootstrap_query_desc);
 
		this->InitNested(&_bootstrap_query_desc, WN_CONFIRM_POPUP_QUERY_BOOTSTRAP);
 
		_network_content_client.AddCallback(this);
 
	}
 

	
 
	/** Stop listening to the content client events. */
 
	~BootstrapAskForDownloadWindow()
 
	{
src/company_cmd.cpp
Show inline comments
 
@@ -809,13 +809,13 @@ CommandCost CmdCompanyCtrl(TileIndex til
 
			/* Has the network client a correct ClientIndex? */
 
			if (!(flags & DC_EXEC)) return CommandCost();
 
			NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id);
 
			if (ci == NULL) return CommandCost();
 

	
 
			/* Delete multiplayer progress bar */
 
			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
			Company *c = DoStartupNewCompany(false);
 

	
 
			/* A new company could not be created, revert to being a spectator */
 
			if (c == NULL) {
 
				if (_network_server) {
src/genworld.cpp
Show inline comments
 
@@ -80,13 +80,13 @@ static void CleanupGeneration()
 
	if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
 
	SetModalProgress(false);
 
	_gw.proc     = NULL;
 
	_gw.abortp   = NULL;
 
	_gw.threaded = false;
 

	
 
	DeleteWindowById(WC_MODAL_PROGRESS, 0);
 
	DeleteWindowByClass(WC_MODAL_PROGRESS);
 
	ShowFirstError();
 
	MarkWholeScreenDirty();
 
}
 

	
 
/**
 
 * The internal, real, generate function.
src/misc_gui.cpp
Show inline comments
 
@@ -440,13 +440,13 @@ struct AboutWindow : public Window {
 
	byte counter;                            ///< Used to scroll the text every 5 ticks
 
	int line_height;                         ///< The height of a single line
 
	static const int num_visible_lines = 19; ///< The number of lines visible simultaneously
 

	
 
	AboutWindow() : Window()
 
	{
 
		this->InitNested(&_about_desc);
 
		this->InitNested(&_about_desc, WN_GAME_OPTIONS_ABOUT);
 

	
 
		this->counter = 5;
 
		this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
@@ -498,13 +498,13 @@ struct AboutWindow : public Window {
 
		}
 
	}
 
};
 

	
 
void ShowAboutWindow()
 
{
 
	DeleteWindowById(WC_GAME_OPTIONS, 0);
 
	DeleteWindowByClass(WC_GAME_OPTIONS);
 
	new AboutWindow();
 
}
 

	
 
/**
 
 * Display estimated costs.
 
 * @param cost Estimated cost (or income if negative).
 
@@ -1111,13 +1111,13 @@ struct QueryStringWindow : public QueryS
 

	
 
		this->caption = caption;
 
		this->afilter = afilter;
 
		this->flags = flags;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars);
 

	
 
		this->InitNested(desc);
 
		this->InitNested(desc, WN_QUERY_STRING);
 

	
 
		this->parent = parent;
 

	
 
		this->SetFocusedWidget(WID_QS_TEXT);
 
		this->LowerWidget(WID_QS_TEXT);
 
	}
 
@@ -1242,13 +1242,13 @@ static const WindowDesc _query_string_de
 
 *        window. If NULL, results are handled by global function HandleOnEditText
 
 * @param afilter filters out unwanted character input
 
 * @param flags various flags, @see QueryStringFlags
 
 */
 
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
 
{
 
	DeleteWindowById(WC_QUERY_STRING, 0);
 
	DeleteWindowByClass(WC_QUERY_STRING);
 
	new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, &_query_string_desc, parent, afilter, flags);
 
}
 

	
 
/**
 
 * Window used for asking the user a YES/NO question.
 
 */
 
@@ -1264,13 +1264,13 @@ struct QueryWindow : public Window {
 
		 * overridden pretty often. We will copy these back for drawing */
 
		CopyOutDParam(this->params, 0, lengthof(this->params));
 
		this->caption = caption;
 
		this->message = message;
 
		this->proc    = callback;
 

	
 
		this->InitNested(desc);
 
		this->InitNested(desc, WN_CONFIRM_POPUP_QUERY);
 

	
 
		this->parent = parent;
 
		this->left = parent->left + (parent->width / 2) - (this->width / 2);
 
		this->top = parent->top + (parent->height / 2) - (this->height / 2);
 
	}
 

	
src/network/network.cpp
Show inline comments
 
@@ -788,13 +788,13 @@ void NetworkDisconnect(bool blocking, bo
 
			}
 
		}
 
	}
 

	
 
	if (_settings_client.network.server_advertise) NetworkUDPRemoveAdvertise(blocking);
 

	
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	NetworkClose(close_admins);
 

	
 
	/* Reinitialize the UDP stack, i.e. close all existing connections. */
 
	NetworkUDPInitialize();
 
}
src/network/network_client.cpp
Show inline comments
 
@@ -178,13 +178,13 @@ void ClientNetworkGameSocketHandler::Cli
 
	/* We just want to close the connection.. */
 
	if (res == NETWORK_RECV_STATUS_CLOSE_QUERY) {
 
		this->NetworkSocketHandler::CloseConnection();
 
		this->CloseConnection(res);
 
		_networking = false;
 

	
 
		DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
		DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 
		return;
 
	}
 

	
 
	switch (res) {
 
		case NETWORK_RECV_STATUS_DESYNC:          errorno = NETWORK_ERROR_DESYNC; break;
 
		case NETWORK_RECV_STATUS_SAVEGAME:        errorno = NETWORK_ERROR_SAVEGAME_FAILED; break;
 
@@ -311,25 +311,25 @@ assert_compile(NETWORK_SERVER_ID_LENGTH 
 

	
 
/** Query the server for company information. */
 
NetworkRecvStatus ClientNetworkGameSocketHandler::SendCompanyInformationQuery()
 
{
 
	my_client->status = STATUS_COMPANY_INFO;
 
	_network_join_status = NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO;
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	Packet *p = new Packet(PACKET_CLIENT_COMPANY_INFO);
 
	my_client->SendPacket(p);
 
	return NETWORK_RECV_STATUS_OKAY;
 
}
 

	
 
/** Tell the server we would like to join. */
 
NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin()
 
{
 
	my_client->status = STATUS_JOIN;
 
	_network_join_status = NETWORK_JOIN_STATUS_AUTHORIZING;
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	Packet *p = new Packet(PACKET_CLIENT_JOIN);
 
	p->Send_string(_openttd_revision);
 
	p->Send_string(_settings_client.network.client_name); // Client name
 
	p->Send_uint8 (_network_join_as);     // PlayAs
 
	p->Send_uint8 (NETLANG_ANY);          // Language
 
@@ -528,22 +528,22 @@ bool ClientNetworkGameSocketHandler::IsC
 
extern bool SafeLoad(const char *filename, int mode, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = NULL);
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p)
 
{
 
	/* We try to join a server which is full */
 
	ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL);
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	return NETWORK_RECV_STATUS_SERVER_FULL;
 
}
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *p)
 
{
 
	/* We try to join a server where we are banned */
 
	ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, WL_CRITICAL);
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	return NETWORK_RECV_STATUS_SERVER_BANNED;
 
}
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_COMPANY_INFO(Packet *p)
 
{
 
@@ -575,13 +575,13 @@ NetworkRecvStatus ClientNetworkGameSocke
 
			company_info->num_station[i] = p->Recv_uint16();
 
		}
 
		company_info->ai               = p->Recv_bool();
 

	
 
		p->Recv_string(company_info->clients, sizeof(company_info->clients));
 

	
 
		SetWindowDirty(WC_NETWORK_WINDOW, 0);
 
		SetWindowDirty(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
 

	
 
		return NETWORK_RECV_STATUS_OKAY;
 
	}
 

	
 
	return NETWORK_RECV_STATUS_CLOSE_QUERY;
 
}
 
@@ -672,13 +672,13 @@ NetworkRecvStatus ClientNetworkGameSocke
 
			ShowErrorMessage(STR_NETWORK_ERROR_TOO_MANY_COMMANDS, INVALID_STRING_ID, WL_CRITICAL);
 
			break;
 
		default:
 
			ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL);
 
	}
 

	
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	return NETWORK_RECV_STATUS_SERVER_ERROR;
 
}
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(Packet *p)
 
{
 
@@ -767,13 +767,13 @@ NetworkRecvStatus ClientNetworkGameSocke
 
	/* We set the internal wait state when requesting the map. */
 
	if (this->status != STATUS_MAP_WAIT) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 

	
 
	/* But... only now we set the join status to waiting, instead of requesting. */
 
	_network_join_status = NETWORK_JOIN_STATUS_WAITING;
 
	_network_join_waiting = p->Recv_uint8();
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	return NETWORK_RECV_STATUS_OKAY;
 
}
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(Packet *p)
 
{
 
@@ -787,24 +787,24 @@ NetworkRecvStatus ClientNetworkGameSocke
 
	_frame_counter = _frame_counter_server = _frame_counter_max = p->Recv_uint32();
 

	
 
	_network_join_bytes = 0;
 
	_network_join_bytes_total = 0;
 

	
 
	_network_join_status = NETWORK_JOIN_STATUS_DOWNLOADING;
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	return NETWORK_RECV_STATUS_OKAY;
 
}
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_SIZE(Packet *p)
 
{
 
	if (this->status != STATUS_MAP) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
	if (this->savegame == NULL) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 

	
 
	_network_join_bytes_total = p->Recv_uint32();
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	return NETWORK_RECV_STATUS_OKAY;
 
}
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DATA(Packet *p)
 
{
 
@@ -812,24 +812,24 @@ NetworkRecvStatus ClientNetworkGameSocke
 
	if (this->savegame == NULL) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 

	
 
	/* We are still receiving data, put it to the file */
 
	this->savegame->AddPacket(p);
 

	
 
	_network_join_bytes = (uint32)this->savegame->written_bytes;
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	return NETWORK_RECV_STATUS_OKAY;
 
}
 

	
 
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *p)
 
{
 
	if (this->status != STATUS_MAP) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
	if (this->savegame == NULL) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 

	
 
	_network_join_status = NETWORK_JOIN_STATUS_PROCESSING;
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0);
 
	SetWindowDirty(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 

	
 
	/*
 
	 * Make sure everything is set for reading.
 
	 *
 
	 * We need the local copy and reset this->savegame because when
 
	 * loading fails the network gets reset upon loading the intro
 
@@ -844,13 +844,13 @@ NetworkRecvStatus ClientNetworkGameSocke
 
	bool load_success = SafeLoad(NULL, SL_LOAD, GM_NORMAL, NO_DIRECTORY, lf);
 

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

	
 
	if (!load_success) {
 
		DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
		DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 
		ShowErrorMessage(STR_NETWORK_ERROR_SAVEGAMEERROR, INVALID_STRING_ID, WL_CRITICAL);
 
		return NETWORK_RECV_STATUS_SAVEGAME;
 
	}
 
	/* If the savegame has successfully loaded, ALL windows have been removed,
 
	 * only toolbar/statusbar and gamefield are visible */
 

	
src/network/network_content.cpp
Show inline comments
 
@@ -472,13 +472,13 @@ bool ClientNetworkContentSocketHandler::
 
			return false;
 
		}
 
	} else {
 
		/* We have a file opened, thus are downloading internal content */
 
		size_t toRead = (size_t)(p->size - p->pos);
 
		if (fwrite(p->buffer + p->pos, 1, toRead, this->curFile) != toRead) {
 
			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
 
			ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
 
			this->Close();
 
			fclose(this->curFile);
 
			this->curFile = NULL;
 

	
 
			return false;
 
@@ -506,13 +506,13 @@ bool ClientNetworkContentSocketHandler::
 

	
 
	if (this->curInfo->filesize != 0) {
 
		/* The filesize is > 0, so we are going to download it */
 
		const char *filename = GetFullFilename(this->curInfo, true);
 
		if (filename == NULL || (this->curFile = fopen(filename, "wb")) == NULL) {
 
			/* Unless that fails ofcourse... */
 
			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
 
			ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
 
			return false;
 
		}
 
	}
 
	return true;
 
}
src/network/network_content_gui.cpp
Show inline comments
 
@@ -52,13 +52,13 @@ static const WindowDesc _network_content
 
BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(const WindowDesc *desc) :
 
		cur_id(UINT32_MAX)
 
{
 
	_network_content_client.AddCallback(this);
 
	_network_content_client.DownloadSelectedContent(this->total_files, this->total_bytes);
 

	
 
	this->InitNested(desc, 0);
 
	this->InitNested(desc, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
 
}
 

	
 
BaseNetworkContentDownloadStatusWindow::~BaseNetworkContentDownloadStatusWindow()
 
{
 
	_network_content_client.RemoveCallback(this);
 
}
 
@@ -114,13 +114,13 @@ public:
 
	/**
 
	 * Create a new download window based on a list of content information
 
	 * with flags whether to download them or not.
 
	 */
 
	NetworkContentDownloadStatusWindow() : BaseNetworkContentDownloadStatusWindow(&_network_content_download_status_window_desc)
 
	{
 
		this->parent = FindWindowById(WC_NETWORK_WINDOW, 1);
 
		this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
 
	}
 

	
 
	/** Free whatever we've allocated */
 
	~NetworkContentDownloadStatusWindow()
 
	{
 
		TarScanner::Mode mode = TarScanner::NONE;
 
@@ -160,23 +160,23 @@ public:
 
				case CONTENT_TYPE_AI_LIBRARY:
 
					AI::Rescan();
 
					break;
 

	
 
				case CONTENT_TYPE_BASE_GRAPHICS:
 
					BaseGraphics::FindSets();
 
					SetWindowDirty(WC_GAME_OPTIONS, 0);
 
					SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
 
					break;
 

	
 
				case CONTENT_TYPE_BASE_SOUNDS:
 
					BaseSounds::FindSets();
 
					SetWindowDirty(WC_GAME_OPTIONS, 0);
 
					SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
 
					break;
 

	
 
				case CONTENT_TYPE_BASE_MUSIC:
 
					BaseMusic::FindSets();
 
					SetWindowDirty(WC_GAME_OPTIONS, 0);
 
					SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
 
					break;
 

	
 
				case CONTENT_TYPE_NEWGRF:
 
					ScanNewGRFFiles(NULL);
 
					break;
 

	
 
@@ -190,25 +190,25 @@ public:
 
				default:
 
					break;
 
			}
 
		}
 

	
 
		/* Always invalidate the download window; tell it we are going to be gone */
 
		InvalidateWindowData(WC_NETWORK_WINDOW, 1, 2);
 
		InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST, 2);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == WID_NCDS_CANCELOK) {
 
			if (this->downloaded_bytes != this->total_bytes) {
 
				_network_content_client.Close();
 
				delete this;
 
			} else {
 
				/* If downloading succeeded, close the online content window. This will close
 
				 * the current window as well. */
 
				DeleteWindowById(WC_NETWORK_WINDOW, 1);
 
				DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
 
			}
 
		}
 
	}
 

	
 
	virtual void OnDownloadProgress(const ContentInfo *ci, int bytes)
 
	{
 
@@ -354,13 +354,13 @@ public:
 
			auto_select(select_all),
 
			selected(NULL),
 
			list_pos(0)
 
	{
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(WID_NCL_SCROLLBAR);
 
		this->FinishInitNested(desc, 1);
 
		this->FinishInitNested(desc, WN_NETWORK_WINDOW_CONTENT_LIST);
 

	
 
		this->GetWidget<NWidgetStacked>(WID_NCL_SEL_ALL_UPDATE)->SetDisplayedPlane(select_all);
 

	
 
		this->afilter = CS_ALPHANUMERAL;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, EDITBOX_MAX_LENGTH);
 
		this->SetFocusedWidget(WID_NCL_FILTER);
 
@@ -655,13 +655,13 @@ public:
 
					extern void OpenBrowser(const char *url);
 
					OpenBrowser(this->selected->url);
 
				}
 
				break;
 

	
 
			case WID_NCL_DOWNLOAD:
 
				if (BringWindowToFrontById(WC_NETWORK_STATUS_WINDOW, 0) == NULL) new NetworkContentDownloadStatusWindow();
 
				if (BringWindowToFrontById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD) == NULL) new NetworkContentDownloadStatusWindow();
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnMouseLoop()
 
	{
 
@@ -798,13 +798,13 @@ public:
 
				default:
 
					break;
 
			}
 
		}
 

	
 
		/* If data == 2 then the status window caused this OnInvalidate */
 
		this->SetWidgetDisabledState(WID_NCL_DOWNLOAD, this->filesize_sum == 0 || (FindWindowById(WC_NETWORK_STATUS_WINDOW, 0) != NULL && data != 2));
 
		this->SetWidgetDisabledState(WID_NCL_DOWNLOAD, this->filesize_sum == 0 || (FindWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD) != NULL && data != 2));
 
		this->SetWidgetDisabledState(WID_NCL_UNSELECT, this->filesize_sum == 0);
 
		this->SetWidgetDisabledState(WID_NCL_SELECT_ALL, !show_select_all);
 
		this->SetWidgetDisabledState(WID_NCL_SELECT_UPDATE, !show_select_upgrade);
 
		this->SetWidgetDisabledState(WID_NCL_OPEN_URL, this->selected == NULL || StrEmpty(this->selected->url));
 

	
 
		this->GetWidget<NWidgetCore>(WID_NCL_CANCEL)->widget_data = this->filesize_sum == 0 ? STR_AI_SETTINGS_CLOSE : STR_AI_LIST_CANCEL;
 
@@ -912,13 +912,13 @@ void ShowNetworkContentListWindow(Conten
 
	if (cv == NULL) {
 
		_network_content_client.RequestContentList(type);
 
	} else {
 
		_network_content_client.RequestContentList(cv, true);
 
	}
 

	
 
	DeleteWindowById(WC_NETWORK_WINDOW, 1);
 
	DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
 
	new NetworkContentListWindow(&_network_content_list_desc, cv != NULL);
 
#else
 
	ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR);
 
	/* Connection failed... clean up the mess */
 
	if (cv != NULL) {
 
		for (ContentIterator iter = cv->Begin(); iter != cv->End(); iter++) delete *iter;
src/network/network_gui.cpp
Show inline comments
 
@@ -71,13 +71,13 @@ void SortNetworkLanguages()
 
 * Update the network new window because a new server is
 
 * found on the network.
 
 * @param unselect unselect the currently selected item
 
 */
 
void UpdateNetworkGameWindow(bool unselect)
 
{
 
	InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect ? 1 : 0);
 
	InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME, unselect ? 1 : 0);
 
}
 

	
 
typedef GUIList<NetworkGameList*> GUIGameServerList;
 
typedef uint16 ServerListPosition;
 
static const ServerListPosition SLP_INVALID = 0xFFFF;
 

	
 
@@ -422,13 +422,13 @@ protected:
 

	
 
public:
 
	NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_CLIENT_NAME_LENGTH)
 
	{
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR);
 
		this->FinishInitNested(desc, 0);
 
		this->FinishInitNested(desc, WN_NETWORK_WINDOW_GAME);
 

	
 
		ttd_strlcpy(this->edit_str_buf, _settings_client.network.client_name, this->edit_str_size);
 
		this->afilter = CS_ALPHANUMERAL;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120);
 
		this->SetFocusedWidget(WID_NG_CLIENT);
 

	
 
@@ -648,13 +648,13 @@ public:
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		this->field = widget;
 
		switch (widget) {
 
			case WID_NG_CANCEL: // Cancel button
 
				DeleteWindowById(WC_NETWORK_WINDOW, 0);
 
				DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
 
				break;
 

	
 
			case WID_NG_CONN_BTN: // 'Connection' droplist
 
				ShowDropDownMenu(this, _lan_internet_types_dropdown, _settings_client.network.lan_internet, WID_NG_CONN_BTN, 0, 0); // do it for widget WID_NSS_CONN_BTN
 
				break;
 

	
 
@@ -977,13 +977,14 @@ static const WindowDesc _network_game_wi
 
	_nested_network_game_widgets, lengthof(_nested_network_game_widgets)
 
);
 

	
 
void ShowNetworkGameWindow()
 
{
 
	static bool first = true;
 
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
 
	DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
 
	DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
 

	
 
	/* Only show once */
 
	if (first) {
 
		first = false;
 
		/* add all servers from the config file to our list */
 
		for (char **iter = _network_host_list.Begin(); iter != _network_host_list.End(); iter++) {
 
@@ -997,13 +998,13 @@ void ShowNetworkGameWindow()
 
struct NetworkStartServerWindow : public QueryStringBaseWindow {
 
	byte field;                  ///< Selected text-field
 
	byte widget_id;              ///< The widget that has the pop-up input menu
 

	
 
	NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_NAME_LENGTH)
 
	{
 
		this->InitNested(desc, 0);
 
		this->InitNested(desc, WN_NETWORK_WINDOW_START);
 

	
 
		ttd_strlcpy(this->edit_str_buf, _settings_client.network.server_name, this->edit_str_size);
 

	
 
		this->afilter = CS_ALPHANUMERAL;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 160);
 
		this->SetFocusedWidget(WID_NSS_GAMENAME);
 
@@ -1313,13 +1314,14 @@ static const WindowDesc _network_start_s
 
	WDF_UNCLICK_BUTTONS,
 
	_nested_network_start_server_window_widgets, lengthof(_nested_network_start_server_window_widgets)
 
);
 

	
 
static void ShowNetworkStartServerWindow()
 
{
 
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
 
	DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
 
	DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY);
 

	
 
	new NetworkStartServerWindow(&_network_start_server_window_desc);
 
}
 

	
 
struct NetworkLobbyWindow : public Window {
 
	CompanyID company;       ///< Select company
 
@@ -1329,13 +1331,13 @@ struct NetworkLobbyWindow : public Windo
 

	
 
	NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) :
 
			Window(), company(INVALID_COMPANY), server(ngl)
 
	{
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(WID_NL_SCROLLBAR);
 
		this->FinishInitNested(desc, 0);
 
		this->FinishInitNested(desc, WN_NETWORK_WINDOW_LOBBY);
 
		this->OnResize();
 
	}
 

	
 
	CompanyID NetworkLobbyFindCompanyIndex(byte pos) const
 
	{
 
		/* Scroll through all this->company_info and get the 'pos' item that is not empty */
 
@@ -1605,13 +1607,14 @@ static const WindowDesc _network_lobby_w
 
/**
 
 * Show the networklobbywindow with the selected server.
 
 * @param ngl Selected game pointer which is passed to the new window.
 
 */
 
static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
 
{
 
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
 
	DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
 
	DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
 

	
 
	NetworkTCPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // company info
 
	NetworkUDPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // general data
 

	
 
	new NetworkLobbyWindow(&_network_lobby_window_desc, ngl);
 
}
 
@@ -1620,13 +1623,13 @@ static void ShowNetworkLobbyWindow(Netwo
 
 * Get the company information of a given company to fill for the lobby.
 
 * @param company the company to get the company info struct from.
 
 * @return the company info struct to write the (downloaded) data to.
 
 */
 
NetworkCompanyInfo *GetLobbyCompanyInfo(CompanyID company)
 
{
 
	NetworkLobbyWindow *lobby = dynamic_cast<NetworkLobbyWindow*>(FindWindowById(WC_NETWORK_WINDOW, 0));
 
	NetworkLobbyWindow *lobby = dynamic_cast<NetworkLobbyWindow*>(FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_LOBBY));
 
	return (lobby != NULL && company < MAX_COMPANIES) ? &lobby->company_info[company] : NULL;
 
}
 

	
 
/* The window below gives information about the connected clients
 
 *  and also makes able to give money to them, kick them (if server)
 
 *  and stuff like that. */
 
@@ -1987,14 +1990,14 @@ uint32 _network_join_bytes_total;       
 

	
 
struct NetworkJoinStatusWindow : Window {
 
	NetworkPasswordType password_type;
 

	
 
	NetworkJoinStatusWindow(const WindowDesc *desc) : Window()
 
	{
 
		this->parent = FindWindowById(WC_NETWORK_WINDOW, 0);
 
		this->InitNested(desc, 0);
 
		this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
 
		this->InitNested(desc, WN_NETWORK_STATUS_WINDOW_JOIN);
 
	}
 

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

	
 
@@ -2097,19 +2100,19 @@ static const WindowDesc _network_join_st
 
	WDF_MODAL,
 
	_nested_network_join_status_window_widgets, lengthof(_nested_network_join_status_window_widgets)
 
);
 

	
 
void ShowJoinStatusWindow()
 
{
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 
	new NetworkJoinStatusWindow(&_network_join_status_window_desc);
 
}
 

	
 
void ShowNetworkNeedPassword(NetworkPasswordType npt)
 
{
 
	NetworkJoinStatusWindow *w = (NetworkJoinStatusWindow *)FindWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
	NetworkJoinStatusWindow *w = (NetworkJoinStatusWindow *)FindWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 
	if (w == NULL) return;
 
	w->password_type = npt;
 

	
 
	StringID caption;
 
	switch (npt) {
 
		default: NOT_REACHED();
src/newgrf_config.cpp
Show inline comments
 
@@ -274,13 +274,13 @@ void GRFParameterInfo::SetValue(struct G
 
	if (this->num_bit == 32) {
 
		config->param[this->param_nr] = value;
 
	} else {
 
		SB(config->param[this->param_nr], this->first_bit, this->num_bit, value);
 
	}
 
	config->num_params = max<uint>(config->num_params, this->param_nr + 1);
 
	SetWindowClassesDirty(WC_GAME_OPTIONS); // Is always the newgrf window
 
	SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
 
}
 

	
 
/**
 
 * Update the palettes of the graphics from the config file.
 
 * Called when changing the default palette in advanced settings.
 
 * @param p1 Unused.
 
@@ -685,13 +685,13 @@ void DoScanNewGRFFiles(void *callback)
 

	
 
	_modal_progress_work_mutex->EndCritical();
 
	_modal_progress_paint_mutex->BeginCritical();
 

	
 
	/* Yes... these are the NewGRF windows */
 
	InvalidateWindowClassesData(WC_SAVELOAD, 0, true);
 
	InvalidateWindowData(WC_GAME_OPTIONS, 0, GOID_NEWGRF_RESCANNED, true);
 
	InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE, GOID_NEWGRF_RESCANNED, true);
 
	if (callback != NULL) ((NewGRFScanCallback*)callback)->OnNewGRFsScanned();
 

	
 
	DeleteWindowByClass(WC_MODAL_PROGRESS);
 
	SetModalProgress(false);
 
	MarkWholeScreenDirty();
 
	_modal_progress_paint_mutex->EndCritical();
src/newgrf_gui.cpp
Show inline comments
 
@@ -281,22 +281,22 @@ struct NewGRFParametersWindow : public W
 
	{
 
		switch (widget) {
 
			case WID_NP_NUMPAR_DEC:
 
				if (!this->action14present && this->grf_config->num_params > 0) {
 
					this->grf_config->num_params--;
 
					this->InvalidateData();
 
					SetWindowClassesDirty(WC_GAME_OPTIONS); // Is always the newgrf window
 
					SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
 
				}
 
				break;
 

	
 
			case WID_NP_NUMPAR_INC: {
 
				GRFConfig *c = this->grf_config;
 
				if (!this->action14present && c->num_params < c->num_valid_params) {
 
					c->param[c->num_params++] = 0;
 
					this->InvalidateData();
 
					SetWindowClassesDirty(WC_GAME_OPTIONS); // Is always the newgrf window
 
					SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
 
				}
 
				break;
 
			}
 

	
 
			case WID_NP_BACKGROUND: {
 
				uint num = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NP_BACKGROUND);
 
@@ -346,13 +346,13 @@ struct NewGRFParametersWindow : public W
 
				break;
 
			}
 

	
 
			case WID_NP_RESET:
 
				this->grf_config->SetParameterDefaults();
 
				this->InvalidateData();
 
				SetWindowClassesDirty(WC_GAME_OPTIONS); // Is always the newgrf window
 
				SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
 
				break;
 

	
 
			case WID_NP_ACCEPT:
 
				delete this;
 
				break;
 
		}
 
@@ -724,13 +724,13 @@ struct NewGRFWindow : public QueryString
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(WID_NS_SCROLLBAR);
 
		this->vscroll2 = this->GetScrollbar(WID_NS_SCROLL2BAR);
 

	
 
		this->GetWidget<NWidgetStacked>(WID_NS_SHOW_REMOVE)->SetDisplayedPlane(this->editable ? 0 : 1);
 
		this->GetWidget<NWidgetStacked>(WID_NS_SHOW_APPLY)->SetDisplayedPlane(this->editable ? 0 : SZSP_HORIZONTAL);
 
		this->FinishInitNested(desc);
 
		this->FinishInitNested(desc, WN_GAME_OPTIONS_NEWGRF_STATE);
 

	
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size);
 
		this->SetFocusedWidget(WID_NS_FILTER);
 

	
 
		this->avails.SetListing(this->last_sorting);
 
		this->avails.SetFiltering(this->last_filtering);
 
@@ -1937,13 +1937,13 @@ struct ScanProgressWindow : public Windo
 
	char *last_name; ///< The name of the last 'seen' NewGRF.
 
	int scanned;     ///< The number of NewGRFs that we have seen.
 

	
 
	/** Create the window. */
 
	ScanProgressWindow() : Window(), last_name(NULL), scanned(0)
 
	{
 
		this->InitNested(&_scan_progress_desc);
 
		this->InitNested(&_scan_progress_desc, 1);
 
	}
 

	
 
	/** Free the last name buffer. */
 
	~ScanProgressWindow()
 
	{
 
		free(last_name);
src/news_gui.cpp
Show inline comments
 
@@ -1086,13 +1086,13 @@ struct MessageOptionsWindow : Window {
 
	static const StringID message_opt[]; ///< Message report options, 'off', 'summary', or 'full'.
 
	int state;                           ///< Option value for setting all categories at once.
 
	Dimension dim_message_opt;           ///< Amount of space needed for a label such that all labels will fit.
 

	
 
	MessageOptionsWindow(const WindowDesc *desc) : Window()
 
	{
 
		this->InitNested(desc);
 
		this->InitNested(desc, WN_GAME_OPTIONS_MESSAGE_OPTION);
 
		/* Set up the initial disabled buttons in the case of 'off' or 'full' */
 
		NewsDisplay all_val = _news_type_data[0].display;
 
		for (int i = 0; i < NT_END; i++) {
 
			this->SetMessageButtonStates(_news_type_data[i].display, i);
 
			/* If the value doesn't match the ALL-button value, set the ALL-button value to 'off' */
 
			if (_news_type_data[i].display != all_val) all_val = ND_OFF;
 
@@ -1342,9 +1342,9 @@ static const WindowDesc _message_options
 

	
 
/**
 
 * Show the settings window for news messages.
 
 */
 
void ShowMessageOptions()
 
{
 
	DeleteWindowById(WC_GAME_OPTIONS, 0);
 
	DeleteWindowByClass(WC_GAME_OPTIONS);
 
	new MessageOptionsWindow(&_message_options_desc);
 
}
src/rail_gui.cpp
Show inline comments
 
@@ -411,15 +411,15 @@ static void HandleAutoSignalPlacement()
 

	
 
/** Rail toolbar management class. */
 
struct BuildRailToolbarWindow : Window {
 
	RailType railtype;    ///< Rail type to build.
 
	int last_user_action; ///< Last started user action.
 

	
 
	BuildRailToolbarWindow(const WindowDesc *desc, WindowNumber window_number, RailType railtype) : Window()
 
	BuildRailToolbarWindow(const WindowDesc *desc, RailType railtype) : Window()
 
	{
 
		this->InitNested(desc);
 
		this->InitNested(desc, TRANSPORT_RAIL);
 
		this->SetupRailToolbar(railtype);
 
		this->DisableWidget(WID_RAT_REMOVE);
 
		this->last_user_action = WIDGET_LIST_END;
 

	
 
		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
	}
 
@@ -732,12 +732,13 @@ struct BuildRailToolbarWindow : Window {
 
		this->DisableWidget(WID_RAT_REMOVE);
 
		this->SetWidgetDirty(WID_RAT_REMOVE);
 

	
 
		DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
 
		DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
 
		DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
 
		DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
 
		DeleteWindowById(WC_SELECT_STATION, 0);
 
		DeleteWindowByClass(WC_BUILD_BRIDGE);
 
	}
 

	
 
	virtual void OnPlacePresize(Point pt, TileIndex tile)
 
	{
 
@@ -838,13 +839,13 @@ Window *ShowBuildRailToolbar(RailType ra
 
	if (!Company::IsValidID(_local_company)) return NULL;
 
	if (!ValParamRailtype(railtype)) return NULL;
 

	
 
	DeleteWindowByClass(WC_BUILD_TOOLBAR);
 
	_cur_railtype = railtype;
 
	_remove_button_clicked = false;
 
	return new BuildRailToolbarWindow(&_build_rail_desc, TRANSPORT_RAIL, railtype);
 
	return new BuildRailToolbarWindow(&_build_rail_desc, railtype);
 
}
 

	
 
EventState RailToolbarGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) return ES_NOT_HANDLED;
 
	extern RailType _last_built_railtype;
 
@@ -1530,20 +1531,20 @@ public:
 
				_convert_signal_button = !_convert_signal_button;
 
				break;
 

	
 
			case WID_BS_DRAG_SIGNALS_DENSITY_DECREASE:
 
				if (_settings_client.gui.drag_signals_density > 1) {
 
					_settings_client.gui.drag_signals_density--;
 
					SetWindowDirty(WC_GAME_OPTIONS, 0);
 
					SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_SETTINGS);
 
				}
 
				break;
 

	
 
			case WID_BS_DRAG_SIGNALS_DENSITY_INCREASE:
 
				if (_settings_client.gui.drag_signals_density < 20) {
 
					_settings_client.gui.drag_signals_density++;
 
					SetWindowDirty(WC_GAME_OPTIONS, 0);
 
					SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_SETTINGS);
 
				}
 
				break;
 

	
 
			default: break;
 
		}
 

	
 
@@ -1774,13 +1775,13 @@ static const NWidgetPart _nested_build_w
 
		EndContainer(),
 
	EndContainer(),
 
};
 

	
 
static const WindowDesc _build_waypoint_desc(
 
	WDP_AUTO, 0, 0,
 
	WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
 
	WC_BUILD_WAYPOINT, WC_BUILD_TOOLBAR,
 
	WDF_CONSTRUCTION,
 
	_nested_build_waypoint_widgets, lengthof(_nested_build_waypoint_widgets)
 
);
 

	
 
static void ShowBuildWaypointPicker(Window *parent)
 
{
src/road_gui.cpp
Show inline comments
 
@@ -823,13 +823,13 @@ static const WindowDesc _build_road_scen
 
 * Show the road building toolbar in the scenario editor.
 
 * @return The just opened toolbar.
 
 */
 
Window *ShowBuildRoadScenToolbar()
 
{
 
	_cur_roadtype = ROADTYPE_ROAD;
 
	return AllocateWindowDescFront<BuildRoadToolbarWindow>(&_build_road_scen_desc, 0);
 
	return AllocateWindowDescFront<BuildRoadToolbarWindow>(&_build_road_scen_desc, TRANSPORT_ROAD);
 
}
 

	
 
EventState RoadToolbarEditorGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	int num = CheckHotkeyMatch<BuildRoadToolbarWindow>(_roadtoolbar_hotkeys, keycode, NULL, true);
 
	if (num == -1) return ES_NOT_HANDLED;
src/settings.cpp
Show inline comments
 
@@ -1714,13 +1714,13 @@ CommandCost CmdChangeSetting(TileIndex t
 
		if (sd->desc.flags & SGF_NO_NETWORK) {
 
			GamelogStartAction(GLAT_SETTING);
 
			GamelogSetting(sd->desc.name, oldval, newval);
 
			GamelogStopAction();
 
		}
 

	
 
		SetWindowDirty(WC_GAME_OPTIONS, 0);
 
		SetWindowClassesDirty(WC_GAME_OPTIONS);
 
	}
 

	
 
	return CommandCost();
 
}
 

	
 
/**
 
@@ -1751,13 +1751,13 @@ CommandCost CmdChangeCompanySetting(Tile
 

	
 
		if (sd->desc.proc != NULL && !sd->desc.proc(newval)) {
 
			WriteValue(var, sd->save.conv, (int64)oldval);
 
			return CommandCost();
 
		}
 

	
 
		SetWindowDirty(WC_GAME_OPTIONS, 0);
 
		SetWindowClassesDirty(WC_GAME_OPTIONS);
 
	}
 

	
 
	return CommandCost();
 
}
 

	
 
/**
 
@@ -1780,13 +1780,15 @@ bool SetSettingValue(uint index, int32 v
 

	
 
		if (_game_mode != GM_MENU) {
 
			void *var2 = GetVariableAddress(&_settings_newgame, &sd->save);
 
			Write_ValidateSetting(var2, sd, value);
 
		}
 
		if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
 
		SetWindowDirty(WC_GAME_OPTIONS, 0);
 

	
 
		SetWindowClassesDirty(WC_GAME_OPTIONS);
 

	
 
		return true;
 
	}
 

	
 
	if (force_newgame) {
 
		void *var2 = GetVariableAddress(&_settings_newgame, &sd->save);
 
		Write_ValidateSetting(var2, sd, value);
src/settings_gui.cpp
Show inline comments
 
@@ -127,13 +127,13 @@ struct GameOptionsWindow : Window {
 

	
 
	GameOptionsWindow(const WindowDesc *desc) : Window()
 
	{
 
		this->opt = &GetGameSettings();
 
		this->reload = false;
 

	
 
		this->InitNested(desc);
 
		this->InitNested(desc, WN_GAME_OPTIONS_GAME_OPTIONS);
 
		this->OnInvalidateData(0);
 
	}
 

	
 
	~GameOptionsWindow()
 
	{
 
		DeleteWindowById(WC_CUSTOM_CURRENCY, 0);
 
@@ -461,13 +461,13 @@ struct GameOptionsWindow : Window {
 
				}
 
				break;
 

	
 
			case WID_GO_TOWNNAME_DROPDOWN: // Town names
 
				if (_game_mode == GM_MENU || Town::GetNumItems() == 0) {
 
					this->opt->game_creation.town_name = index;
 
					SetWindowDirty(WC_GAME_OPTIONS, 0);
 
					SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
 
				}
 
				break;
 

	
 
			case WID_GO_AUTOSAVE_DROPDOWN: // Autosave options
 
				_settings_client.gui.autosave = index;
 
				this->SetDirty();
 
@@ -600,13 +600,13 @@ static const WindowDesc _game_options_de
 
	_nested_game_options_widgets, lengthof(_nested_game_options_widgets)
 
);
 

	
 
/** Open the game options window. */
 
void ShowGameOptions()
 
{
 
	DeleteWindowById(WC_GAME_OPTIONS, 0);
 
	DeleteWindowByClass(WC_GAME_OPTIONS);
 
	new GameOptionsWindow(&_game_options_desc);
 
}
 

	
 
extern void StartupEconomy();
 

	
 
void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
 
@@ -621,13 +621,13 @@ public:
 
	static const uint GAME_DIFFICULTY_NUM = 18;
 
	/** The number of widgets per difficulty setting */
 
	static const uint WIDGETS_PER_DIFFICULTY = 3;
 

	
 
	GameDifficultyWindow(const WindowDesc *desc) : Window()
 
	{
 
		this->InitNested(desc);
 
		this->InitNested(desc, WN_GAME_OPTIONS_GAME_DIFFICULTY);
 

	
 
		/* Setup disabled buttons when creating window
 
		 * disable all other difficulty buttons during gameplay except for 'custom' */
 
		this->SetWidgetsDisabledState(_game_mode != GM_MENU,
 
			WID_GD_LVL_EASY,
 
			WID_GD_LVL_MEDIUM,
 
@@ -876,13 +876,13 @@ static const WindowDesc _game_difficulty
 
	_nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets)
 
);
 

	
 
/** Open the game-difficulty window. */
 
void ShowGameDifficulty()
 
{
 
	DeleteWindowById(WC_GAME_OPTIONS, 0);
 
	DeleteWindowByClass(WC_GAME_OPTIONS);
 
	new GameDifficultyWindow(&_game_difficulty_desc);
 
}
 

	
 
static int SETTING_HEIGHT = 11;    ///< Height of a single setting in the tree view in pixels
 
static const int LEVEL_WIDTH = 15; ///< Indenting width of a sub-page in pixels
 

	
 
@@ -1591,13 +1591,13 @@ struct GameSettingsWindow : Window {
 

	
 
		this->valuewindow_entry = NULL; // No setting entry for which a entry window is opened
 
		this->clicked_entry = NULL; // No numeric setting buttons are depressed
 

	
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(WID_GS_SCROLLBAR);
 
		this->FinishInitNested(desc, 0);
 
		this->FinishInitNested(desc, WN_GAME_OPTIONS_GAME_SETTINGS);
 

	
 
		this->vscroll->SetCount(_settings_main_page.Length());
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
@@ -1790,13 +1790,13 @@ static const WindowDesc _settings_select
 
	_nested_settings_selection_widgets, lengthof(_nested_settings_selection_widgets)
 
);
 

	
 
/** Open advanced settings window. */
 
void ShowGameSettings()
 
{
 
	DeleteWindowById(WC_GAME_OPTIONS, 0);
 
	DeleteWindowByClass(WC_GAME_OPTIONS);
 
	new GameSettingsWindow(&_settings_selection_desc);
 
}
 

	
 

	
 
/**
 
 * Draw [<][>] boxes.
src/signs_gui.cpp
Show inline comments
 
@@ -476,13 +476,13 @@ struct SignWindow : QueryStringBaseWindo
 

	
 
	SignWindow(const WindowDesc *desc, const Sign *si) : QueryStringBaseWindow(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
 
	{
 
		this->caption = STR_EDIT_SIGN_CAPTION;
 
		this->afilter = CS_ALPHANUMERAL;
 

	
 
		this->InitNested(desc);
 
		this->InitNested(desc, WN_QUERY_STRING_SIGN);
 

	
 
		this->LowerWidget(WID_QES_TEXT);
 
		UpdateSignEditWindow(si);
 
		this->SetFocusedWidget(WID_QES_TEXT);
 
	}
 

	
 
@@ -653,21 +653,21 @@ void HandleClickOnSign(const Sign *si)
 
 * Show the window to change the text of a sign.
 
 * @param si The sign to show the window for.
 
 */
 
void ShowRenameSignWindow(const Sign *si)
 
{
 
	/* Delete all other edit windows */
 
	DeleteWindowById(WC_QUERY_STRING, 0);
 
	DeleteWindowByClass(WC_QUERY_STRING);
 

	
 
	new SignWindow(&_query_sign_edit_desc, si);
 
}
 

	
 
/**
 
 * Close the sign window associated with the given sign.
 
 * @param sign The sign to close the window for.
 
 */
 
void DeleteRenameSignWindow(SignID sign)
 
{
 
	SignWindow *w = dynamic_cast<SignWindow *>(FindWindowById(WC_QUERY_STRING, 0));
 
	SignWindow *w = dynamic_cast<SignWindow *>(FindWindowById(WC_QUERY_STRING, WN_QUERY_STRING_SIGN));
 

	
 
	if (w != NULL && w->cur_sign == sign) delete w;
 
}
src/window_type.h
Show inline comments
 
@@ -10,12 +10,39 @@
 
/** @file window_type.h Types related to windows */
 

	
 
#ifndef WINDOW_TYPE_H
 
#define WINDOW_TYPE_H
 

	
 
/**
 
 * Window numbers.
 
 */
 
enum WindowNumberEnum {
 
	WN_GAME_OPTIONS_AI = 0,          ///< AI settings.
 
	WN_GAME_OPTIONS_ABOUT,           ///< About window.
 
	WN_GAME_OPTIONS_NEWGRF_STATE,    ///< NewGRF settings.
 
	WN_GAME_OPTIONS_MESSAGE_OPTION,  ///< News settings.
 
	WN_GAME_OPTIONS_GAME_OPTIONS,    ///< Game options.
 
	WN_GAME_OPTIONS_GAME_DIFFICULTY, ///< Game difficulty.
 
	WN_GAME_OPTIONS_GAME_SETTINGS,   ///< Game settings.
 

	
 
	WN_QUERY_STRING = 0,  ///< Query string.
 
	WN_QUERY_STRING_SIGN, ///< Query string for signs.
 

	
 
	WN_CONFIRM_POPUP_QUERY = 0,       ///< Query popup confirm.
 
	WN_CONFIRM_POPUP_QUERY_BOOTSTRAP, ///< Query popup confirm for bootstrap.
 

	
 
	WN_NETWORK_WINDOW_GAME = 0,     ///< Network game window.
 
	WN_NETWORK_WINDOW_LOBBY,        ///< Network lobby window.
 
	WN_NETWORK_WINDOW_CONTENT_LIST, ///< Network content list.
 
	WN_NETWORK_WINDOW_START,        ///< Network start server.
 

	
 
	WN_NETWORK_STATUS_WINDOW_JOIN = 0,         ///< Network join status.
 
	WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD, ///< Network content download status.
 
};
 

	
 
/**
 
 * Window classes.
 
 */
 
enum WindowClass {
 
	WC_NONE, ///< No window, redirects to WC_MAIN_WINDOW.
 

	
 
	/**
 
@@ -36,23 +63,23 @@ enum WindowClass {
 
	 *   - 0 = #StatusbarWidget
 
	 */
 
	WC_STATUS_BAR,
 

	
 
	/**
 
	 * Build toolbar; Window numbers:
 
	 *   - 0 = #RailToolbarWidgets
 
	 *   - #TRANSPORT_RAIL = #RailToolbarWidgets
 
	 *   - #TRANSPORT_AIR = #AirportToolbarWidgets
 
	 *   - #TRANSPORT_WATER = #DockToolbarWidgets
 
	 *   - #TRANSPORT_ROAD = #RoadToolbarWidgets
 
	 */
 
	WC_BUILD_TOOLBAR,
 

	
 
	/**
 
	 * Scenario build toolbar; Window numbers:
 
	 *   - 0 = #RoadToolbarWidgets
 
	 *   - #TRANSPORT_WATER = #DockToolbarWidgets
 
	 *   - #TRANSPORT_ROAD = #RoadToolbarWidgets
 
	 */
 
	WC_SCEN_BUILD_TOOLBAR,
 

	
 
	/**
 
	 * Build trees toolbar; Window numbers:
 
	 *   - 0 = #BuildTreesWidgets
 
@@ -87,22 +114,22 @@ enum WindowClass {
 
	 * Tooltip window; Window numbers:
 
	 *   - 0 = #ToolTipsWidgets
 
	 */
 
	WC_TOOLTIPS,
 

	
 
	/**
 
	 * Query string window; Window numbers: (TODO - CONFLICT)
 
	 *   - 0 = #QueryStringWidgets
 
	 *   - 0 = #QueryEditSignWidgets
 
	 * Query string window; Window numbers:
 
	 *   - #WN_QUERY_STRING = #QueryStringWidgets
 
	 *   - #WN_QUERY_STRING_SIGN = #QueryEditSignWidgets
 
	 */
 
	WC_QUERY_STRING,
 

	
 
	/**
 
	 * Popup with confirm question; Window numbers: (TODO - CONFLICT)
 
	 *   - 0 = #BootstrapAskForDownloadWidgets
 
	 *   - 0 = #QueryWidgets
 
	 * Popup with confirm question; Window numbers:
 
	 *   - #WN_CONFIRM_POPUP_QUERY = #QueryWidgets
 
	 *   - #WN_CONFIRM_POPUP_QUERY_BOOTSTRAP = #BootstrapAskForDownloadWidgets
 
	 */
 
	WC_CONFIRM_POPUP_QUERY,
 

	
 

	
 
	/**
 
	 * Saveload window; Window numbers:
 
@@ -362,21 +389,26 @@ enum WindowClass {
 
	 * Build truck station; Window numbers:
 
	 *   - #TRANSPORT_ROAD = #BuildRoadStationWidgets
 
	 */
 
	WC_TRUCK_STATION,
 

	
 
	/**
 
	 * Build depot; Window numbers: (TODO - CONFLICT)
 
	 * Build depot; Window numbers:
 
	 *   - #TRANSPORT_WATER = #BuildDockDepotWidgets
 
	 *   - #TRANSPORT_RAIL = #BuildRailDepotWidgets
 
	 *   - #TRANSPORT_RAIL = #BuildRailWaypointWidgets
 
	 *   - #TRANSPORT_ROAD = #BuildRoadDepotWidgets
 
	 */
 
	WC_BUILD_DEPOT,
 

	
 
	/**
 
	 * Build waypoint; Window numbers:
 
	 *   - #TRANSPORT_RAIL = #BuildRailWaypointWidgets
 
	 */
 
	WC_BUILD_WAYPOINT,
 

	
 
	/**
 
	 * Found a town; Window numbers:
 
	 *   - 0 = #TownFoundingWidgets
 
	 */
 
	WC_FOUND_TOWN,
 

	
 
	/**
 
@@ -404,25 +436,25 @@ enum WindowClass {
 
	 *   - GLWM_SCENARIO = #CreateScenarioWidgets
 
	 *   - #GenenerateLandscapeWindowMode = #GenerateLandscapeWidgets
 
	 */
 
	WC_GENERATE_LANDSCAPE,
 

	
 
	/**
 
	 * Progress report of landscape generation; Window numbers: (TODO - CONFLICT)
 
	 * Progress report of landscape generation; Window numbers:
 
	 *   - 0 = #GenerationProgressWidgets
 
	 *   - 0 = #ScanProgressWidgets
 
	 *   - 1 = #ScanProgressWidgets
 
	 */
 
	WC_MODAL_PROGRESS,
 

	
 

	
 
	/**
 
	 * Network window; Window numbers: (TODO - CONFLICT)
 
	 *   - 0 = #NetworkGameWidgets
 
	 *   - 0 = #NetworkLobbyWidgets
 
	 *   - 1 = #NetworkContentListWidgets
 
	 *   - 1 = #NetworkStartServerWidgets
 
	 * Network window; Window numbers:
 
	 *   - #WN_NETWORK_WINDOW_GAME = #NetworkGameWidgets
 
	 *   - #WN_NETWORK_WINDOW_LOBBY = #NetworkLobbyWidgets
 
	 *   - #WN_NETWORK_WINDOW_CONTENT_LIST = #NetworkContentListWidgets
 
	 *   - #WN_NETWORK_WINDOW_START = #NetworkStartServerWidgets
 
	 */
 
	WC_NETWORK_WINDOW,
 

	
 
	/**
 
	 * Client list; Window numbers:
 
	 *   - 0 = #ClientListWidgets
 
@@ -433,15 +465,15 @@ enum WindowClass {
 
	 * Popup for the client list; Window numbers:
 
	 *   - #ClientID = #ClientListPopupWidgets
 
	 */
 
	WC_CLIENT_LIST_POPUP,
 

	
 
	/**
 
	 * Network status window; Window numbers: (TODO - CONFLICT)
 
	 *   - 0 = #NetworkJoinStatusWidgets
 
	 *   - 0 = #NetworkContentDownloadStatusWidgets
 
	 * Network status window; Window numbers:
 
	 *   - #WN_NETWORK_STATUS_WINDOW_JOIN = #NetworkJoinStatusWidgets
 
	 *   - #WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD = #NetworkContentDownloadStatusWidgets
 
	 */
 
	WC_NETWORK_STATUS_WINDOW,
 

	
 
	/**
 
	 * Chatbox; Window numbers:
 
	 *   - #DestType = #NetWorkChatWidgets
 
@@ -551,20 +583,20 @@ enum WindowClass {
 
	 * Music track selection; Window numbers:
 
	 *   - 0 = MusicTrackSelectionWidgets
 
	 */
 
	WC_MUSIC_TRACK_SELECTION,
 

	
 
	/**
 
	 * Game options window; Window numbers: (TODO - CONFLICT)
 
	 *   - 0 = #AIConfigWidgets
 
	 *   - 0 = #AboutWidgets
 
	 *   - 0 = #NewGRFStateWidgets
 
	 *   - 0 = #MessageOptionWidgets
 
	 *   - 0 = #GameOptionsWidgets
 
	 *   - 0 = #GameDifficultyWidgets
 
	 *   - 0 = #GameSettingsWidgets
 
	 * Game options window; Window numbers:
 
	 *   - #WN_GAME_OPTIONS_AI = #AIConfigWidgets
 
	 *   - #WN_GAME_OPTIONS_ABOUT = #AboutWidgets
 
	 *   - #WN_GAME_OPTIONS_NEWGRF_STATE = #NewGRFStateWidgets
 
	 *   - #WN_GAME_OPTIONS_MESSAGE_OPTION = #MessageOptionWidgets
 
	 *   - #WN_GAME_OPTIONS_GAME_OPTIONS = #GameOptionsWidgets
 
	 *   - #WN_GAME_OPTIONS_GAME_DIFFICULTY = #GameDifficultyWidgets
 
	 *   - #WN_GAME_OPTIONS_GAME_SETTINGS = #GameSettingsWidgets
 
	 */
 
	WC_GAME_OPTIONS,
 

	
 
	/**
 
	 * Custom currency; Window numbers:
 
	 *   - 0 = #CustomCurrencyWidgets
0 comments (0 inline, 0 general)