(svn r23601) -Fix: fix the conflict in window number

pull/155/head
truebrain 13 years ago
parent 32ca564bca
commit c74ccfff1b

@ -149,7 +149,7 @@ struct AIListWindow : public Window {
for (int i = 0; i < this->selected; i++) it++; for (int i = 0; i < this->selected; i++) it++;
AIConfig::GetConfig(slot)->Change((*it).second->GetName(), (*it).second->GetVersion()); 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) virtual void OnClick(Point pt, int widget, int click_count)
@ -583,7 +583,7 @@ struct AIConfigWindow : public Window {
AIConfigWindow() : Window() 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->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR);
this->selected_slot = INVALID_COMPANY; this->selected_slot = INVALID_COMPANY;
NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIC_LIST); NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIC_LIST);
@ -752,7 +752,7 @@ struct AIConfigWindow : public Window {
/** Open the AI config window. */ /** Open the AI config window. */
void ShowAIConfigWindow() void ShowAIConfigWindow()
{ {
DeleteWindowById(WC_GAME_OPTIONS, 0); DeleteWindowByClass(WC_GAME_OPTIONS);
new AIConfigWindow(); new AIConfigWindow();
} }

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

@ -812,7 +812,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (ci == NULL) return CommandCost(); if (ci == NULL) return CommandCost();
/* Delete multiplayer progress bar */ /* Delete multiplayer progress bar */
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
Company *c = DoStartupNewCompany(false); Company *c = DoStartupNewCompany(false);

@ -83,7 +83,7 @@ static void CleanupGeneration()
_gw.abortp = NULL; _gw.abortp = NULL;
_gw.threaded = false; _gw.threaded = false;
DeleteWindowById(WC_MODAL_PROGRESS, 0); DeleteWindowByClass(WC_MODAL_PROGRESS);
ShowFirstError(); ShowFirstError();
MarkWholeScreenDirty(); MarkWholeScreenDirty();
} }

@ -443,7 +443,7 @@ struct AboutWindow : public Window {
AboutWindow() : Window() AboutWindow() : Window()
{ {
this->InitNested(&_about_desc); this->InitNested(&_about_desc, WN_GAME_OPTIONS_ABOUT);
this->counter = 5; this->counter = 5;
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y; this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
@ -501,7 +501,7 @@ struct AboutWindow : public Window {
void ShowAboutWindow() void ShowAboutWindow()
{ {
DeleteWindowById(WC_GAME_OPTIONS, 0); DeleteWindowByClass(WC_GAME_OPTIONS);
new AboutWindow(); new AboutWindow();
} }
@ -1114,7 +1114,7 @@ struct QueryStringWindow : public QueryStringBaseWindow
this->flags = flags; this->flags = flags;
InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars); InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars);
this->InitNested(desc); this->InitNested(desc, WN_QUERY_STRING);
this->parent = parent; this->parent = parent;
@ -1245,7 +1245,7 @@ static const WindowDesc _query_string_desc(
*/ */
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags) 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); new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, &_query_string_desc, parent, afilter, flags);
} }
@ -1267,7 +1267,7 @@ struct QueryWindow : public Window {
this->message = message; this->message = message;
this->proc = callback; this->proc = callback;
this->InitNested(desc); this->InitNested(desc, WN_CONFIRM_POPUP_QUERY);
this->parent = parent; this->parent = parent;
this->left = parent->left + (parent->width / 2) - (this->width / 2); this->left = parent->left + (parent->width / 2) - (this->width / 2);

@ -791,7 +791,7 @@ void NetworkDisconnect(bool blocking, bool close_admins)
if (_settings_client.network.server_advertise) NetworkUDPRemoveAdvertise(blocking); 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); NetworkClose(close_admins);

@ -181,7 +181,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
this->CloseConnection(res); this->CloseConnection(res);
_networking = false; _networking = false;
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
return; return;
} }
@ -314,7 +314,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendCompanyInformationQuery()
{ {
my_client->status = STATUS_COMPANY_INFO; my_client->status = STATUS_COMPANY_INFO;
_network_join_status = NETWORK_JOIN_STATUS_GETTING_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); Packet *p = new Packet(PACKET_CLIENT_COMPANY_INFO);
my_client->SendPacket(p); my_client->SendPacket(p);
@ -326,7 +326,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin()
{ {
my_client->status = STATUS_JOIN; my_client->status = STATUS_JOIN;
_network_join_status = NETWORK_JOIN_STATUS_AUTHORIZING; _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); Packet *p = new Packet(PACKET_CLIENT_JOIN);
p->Send_string(_openttd_revision); p->Send_string(_openttd_revision);
@ -531,7 +531,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p)
{ {
/* We try to join a server which is full */ /* We try to join a server which is full */
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL); 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; return NETWORK_RECV_STATUS_SERVER_FULL;
} }
@ -540,7 +540,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *
{ {
/* We try to join a server where we are banned */ /* We try to join a server where we are banned */
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, WL_CRITICAL); 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; return NETWORK_RECV_STATUS_SERVER_BANNED;
} }
@ -578,7 +578,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_COMPANY_INFO(Pa
p->Recv_string(company_info->clients, sizeof(company_info->clients)); 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_OKAY;
} }
@ -675,7 +675,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_ERROR(Packet *p
ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL); 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; return NETWORK_RECV_STATUS_SERVER_ERROR;
} }
@ -770,7 +770,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_WAIT(Packet *p)
/* But... only now we set the join status to waiting, instead of requesting. */ /* But... only now we set the join status to waiting, instead of requesting. */
_network_join_status = NETWORK_JOIN_STATUS_WAITING; _network_join_status = NETWORK_JOIN_STATUS_WAITING;
_network_join_waiting = p->Recv_uint8(); _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; return NETWORK_RECV_STATUS_OKAY;
} }
@ -790,7 +790,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(Packe
_network_join_bytes_total = 0; _network_join_bytes_total = 0;
_network_join_status = NETWORK_JOIN_STATUS_DOWNLOADING; _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; return NETWORK_RECV_STATUS_OKAY;
} }
@ -801,7 +801,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_SIZE(Packet
if (this->savegame == NULL) return NETWORK_RECV_STATUS_MALFORMED_PACKET; if (this->savegame == NULL) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
_network_join_bytes_total = p->Recv_uint32(); _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; return NETWORK_RECV_STATUS_OKAY;
} }
@ -815,7 +815,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DATA(Packet
this->savegame->AddPacket(p); this->savegame->AddPacket(p);
_network_join_bytes = (uint32)this->savegame->written_bytes; _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; return NETWORK_RECV_STATUS_OKAY;
} }
@ -826,7 +826,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
if (this->savegame == NULL) return NETWORK_RECV_STATUS_MALFORMED_PACKET; if (this->savegame == NULL) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
_network_join_status = NETWORK_JOIN_STATUS_PROCESSING; _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. * Make sure everything is set for reading.
@ -847,7 +847,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
this->last_packet = _realtime_tick; this->last_packet = _realtime_tick;
if (!load_success) { 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); ShowErrorMessage(STR_NETWORK_ERROR_SAVEGAMEERROR, INVALID_STRING_ID, WL_CRITICAL);
return NETWORK_RECV_STATUS_SAVEGAME; return NETWORK_RECV_STATUS_SAVEGAME;
} }

@ -475,7 +475,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *p)
/* We have a file opened, thus are downloading internal content */ /* We have a file opened, thus are downloading internal content */
size_t toRead = (size_t)(p->size - p->pos); size_t toRead = (size_t)(p->size - p->pos);
if (fwrite(p->buffer + p->pos, 1, toRead, this->curFile) != toRead) { 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); ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
this->Close(); this->Close();
fclose(this->curFile); fclose(this->curFile);
@ -509,7 +509,7 @@ bool ClientNetworkContentSocketHandler::BeforeDownload()
const char *filename = GetFullFilename(this->curInfo, true); const char *filename = GetFullFilename(this->curInfo, true);
if (filename == NULL || (this->curFile = fopen(filename, "wb")) == NULL) { if (filename == NULL || (this->curFile = fopen(filename, "wb")) == NULL) {
/* Unless that fails ofcourse... */ /* 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); ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
return false; return false;
} }

@ -55,7 +55,7 @@ BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(c
_network_content_client.AddCallback(this); _network_content_client.AddCallback(this);
_network_content_client.DownloadSelectedContent(this->total_files, this->total_bytes); _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() BaseNetworkContentDownloadStatusWindow::~BaseNetworkContentDownloadStatusWindow()
@ -117,7 +117,7 @@ public:
*/ */
NetworkContentDownloadStatusWindow() : BaseNetworkContentDownloadStatusWindow(&_network_content_download_status_window_desc) 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 */ /** Free whatever we've allocated */
@ -163,17 +163,17 @@ public:
case CONTENT_TYPE_BASE_GRAPHICS: case CONTENT_TYPE_BASE_GRAPHICS:
BaseGraphics::FindSets(); BaseGraphics::FindSets();
SetWindowDirty(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
break; break;
case CONTENT_TYPE_BASE_SOUNDS: case CONTENT_TYPE_BASE_SOUNDS:
BaseSounds::FindSets(); BaseSounds::FindSets();
SetWindowDirty(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
break; break;
case CONTENT_TYPE_BASE_MUSIC: case CONTENT_TYPE_BASE_MUSIC:
BaseMusic::FindSets(); BaseMusic::FindSets();
SetWindowDirty(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
break; break;
case CONTENT_TYPE_NEWGRF: case CONTENT_TYPE_NEWGRF:
@ -193,7 +193,7 @@ public:
} }
/* Always invalidate the download window; tell it we are going to be gone */ /* 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) virtual void OnClick(Point pt, int widget, int click_count)
@ -205,7 +205,7 @@ public:
} else { } else {
/* If downloading succeeded, close the online content window. This will close /* If downloading succeeded, close the online content window. This will close
* the current window as well. */ * the current window as well. */
DeleteWindowById(WC_NETWORK_WINDOW, 1); DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
} }
} }
} }
@ -357,7 +357,7 @@ public:
{ {
this->CreateNestedTree(desc); this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_NCL_SCROLLBAR); 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->GetWidget<NWidgetStacked>(WID_NCL_SEL_ALL_UPDATE)->SetDisplayedPlane(select_all);
@ -658,7 +658,7 @@ public:
break; break;
case WID_NCL_DOWNLOAD: 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; break;
} }
} }
@ -801,7 +801,7 @@ public:
} }
/* If data == 2 then the status window caused this OnInvalidate */ /* 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_UNSELECT, this->filesize_sum == 0);
this->SetWidgetDisabledState(WID_NCL_SELECT_ALL, !show_select_all); this->SetWidgetDisabledState(WID_NCL_SELECT_ALL, !show_select_all);
this->SetWidgetDisabledState(WID_NCL_SELECT_UPDATE, !show_select_upgrade); this->SetWidgetDisabledState(WID_NCL_SELECT_UPDATE, !show_select_upgrade);
@ -915,7 +915,7 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type)
_network_content_client.RequestContentList(cv, true); _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); new NetworkContentListWindow(&_network_content_list_desc, cv != NULL);
#else #else
ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR); ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR);

@ -74,7 +74,7 @@ void SortNetworkLanguages()
*/ */
void UpdateNetworkGameWindow(bool unselect) 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 GUIList<NetworkGameList*> GUIGameServerList;
@ -425,7 +425,7 @@ public:
{ {
this->CreateNestedTree(desc); this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR); 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); ttd_strlcpy(this->edit_str_buf, _settings_client.network.client_name, this->edit_str_size);
this->afilter = CS_ALPHANUMERAL; this->afilter = CS_ALPHANUMERAL;
@ -651,7 +651,7 @@ public:
this->field = widget; this->field = widget;
switch (widget) { switch (widget) {
case WID_NG_CANCEL: // Cancel button case WID_NG_CANCEL: // Cancel button
DeleteWindowById(WC_NETWORK_WINDOW, 0); DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
break; break;
case WID_NG_CONN_BTN: // 'Connection' droplist case WID_NG_CONN_BTN: // 'Connection' droplist
@ -980,7 +980,8 @@ static const WindowDesc _network_game_window_desc(
void ShowNetworkGameWindow() void ShowNetworkGameWindow()
{ {
static bool first = true; 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 */ /* Only show once */
if (first) { if (first) {
@ -1000,7 +1001,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_NAME_LENGTH) 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); ttd_strlcpy(this->edit_str_buf, _settings_client.network.server_name, this->edit_str_size);
@ -1316,7 +1317,8 @@ static const WindowDesc _network_start_server_window_desc(
static void ShowNetworkStartServerWindow() 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); new NetworkStartServerWindow(&_network_start_server_window_desc);
} }
@ -1332,7 +1334,7 @@ struct NetworkLobbyWindow : public Window {
{ {
this->CreateNestedTree(desc); this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_NL_SCROLLBAR); this->vscroll = this->GetScrollbar(WID_NL_SCROLLBAR);
this->FinishInitNested(desc, 0); this->FinishInitNested(desc, WN_NETWORK_WINDOW_LOBBY);
this->OnResize(); this->OnResize();
} }
@ -1608,7 +1610,8 @@ static const WindowDesc _network_lobby_window_desc(
*/ */
static void ShowNetworkLobbyWindow(NetworkGameList *ngl) 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 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 NetworkUDPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // general data
@ -1623,7 +1626,7 @@ static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
*/ */
NetworkCompanyInfo *GetLobbyCompanyInfo(CompanyID company) 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; return (lobby != NULL && company < MAX_COMPANIES) ? &lobby->company_info[company] : NULL;
} }
@ -1990,8 +1993,8 @@ struct NetworkJoinStatusWindow : Window {
NetworkJoinStatusWindow(const WindowDesc *desc) : Window() NetworkJoinStatusWindow(const WindowDesc *desc) : Window()
{ {
this->parent = FindWindowById(WC_NETWORK_WINDOW, 0); this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
this->InitNested(desc, 0); this->InitNested(desc, WN_NETWORK_STATUS_WINDOW_JOIN);
} }
virtual void DrawWidget(const Rect &r, int widget) const virtual void DrawWidget(const Rect &r, int widget) const
@ -2100,13 +2103,13 @@ static const WindowDesc _network_join_status_window_desc(
void ShowJoinStatusWindow() 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); new NetworkJoinStatusWindow(&_network_join_status_window_desc);
} }
void ShowNetworkNeedPassword(NetworkPasswordType npt) 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; if (w == NULL) return;
w->password_type = npt; w->password_type = npt;

@ -277,7 +277,7 @@ void GRFParameterInfo::SetValue(struct GRFConfig *config, uint32 value)
SB(config->param[this->param_nr], this->first_bit, this->num_bit, value); 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); 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);
} }
/** /**
@ -688,7 +688,7 @@ void DoScanNewGRFFiles(void *callback)
/* Yes... these are the NewGRF windows */ /* Yes... these are the NewGRF windows */
InvalidateWindowClassesData(WC_SAVELOAD, 0, true); 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(); if (callback != NULL) ((NewGRFScanCallback*)callback)->OnNewGRFsScanned();
DeleteWindowByClass(WC_MODAL_PROGRESS); DeleteWindowByClass(WC_MODAL_PROGRESS);

@ -284,7 +284,7 @@ struct NewGRFParametersWindow : public Window {
if (!this->action14present && this->grf_config->num_params > 0) { if (!this->action14present && this->grf_config->num_params > 0) {
this->grf_config->num_params--; this->grf_config->num_params--;
this->InvalidateData(); this->InvalidateData();
SetWindowClassesDirty(WC_GAME_OPTIONS); // Is always the newgrf window SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
} }
break; break;
@ -293,7 +293,7 @@ struct NewGRFParametersWindow : public Window {
if (!this->action14present && c->num_params < c->num_valid_params) { if (!this->action14present && c->num_params < c->num_valid_params) {
c->param[c->num_params++] = 0; c->param[c->num_params++] = 0;
this->InvalidateData(); this->InvalidateData();
SetWindowClassesDirty(WC_GAME_OPTIONS); // Is always the newgrf window SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
} }
break; break;
} }
@ -349,7 +349,7 @@ struct NewGRFParametersWindow : public Window {
case WID_NP_RESET: case WID_NP_RESET:
this->grf_config->SetParameterDefaults(); this->grf_config->SetParameterDefaults();
this->InvalidateData(); this->InvalidateData();
SetWindowClassesDirty(WC_GAME_OPTIONS); // Is always the newgrf window SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
break; break;
case WID_NP_ACCEPT: case WID_NP_ACCEPT:
@ -727,7 +727,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
this->GetWidget<NWidgetStacked>(WID_NS_SHOW_REMOVE)->SetDisplayedPlane(this->editable ? 0 : 1); 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->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); InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size);
this->SetFocusedWidget(WID_NS_FILTER); this->SetFocusedWidget(WID_NS_FILTER);
@ -1940,7 +1940,7 @@ struct ScanProgressWindow : public Window {
/** Create the window. */ /** Create the window. */
ScanProgressWindow() : Window(), last_name(NULL), scanned(0) ScanProgressWindow() : Window(), last_name(NULL), scanned(0)
{ {
this->InitNested(&_scan_progress_desc); this->InitNested(&_scan_progress_desc, 1);
} }
/** Free the last name buffer. */ /** Free the last name buffer. */

@ -1089,7 +1089,7 @@ struct MessageOptionsWindow : Window {
MessageOptionsWindow(const WindowDesc *desc) : Window() 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' */ /* Set up the initial disabled buttons in the case of 'off' or 'full' */
NewsDisplay all_val = _news_type_data[0].display; NewsDisplay all_val = _news_type_data[0].display;
for (int i = 0; i < NT_END; i++) { for (int i = 0; i < NT_END; i++) {
@ -1345,6 +1345,6 @@ static const WindowDesc _message_options_desc(
*/ */
void ShowMessageOptions() void ShowMessageOptions()
{ {
DeleteWindowById(WC_GAME_OPTIONS, 0); DeleteWindowByClass(WC_GAME_OPTIONS);
new MessageOptionsWindow(&_message_options_desc); new MessageOptionsWindow(&_message_options_desc);
} }

@ -414,9 +414,9 @@ struct BuildRailToolbarWindow : Window {
RailType railtype; ///< Rail type to build. RailType railtype; ///< Rail type to build.
int last_user_action; ///< Last started user action. 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->SetupRailToolbar(railtype);
this->DisableWidget(WID_RAT_REMOVE); this->DisableWidget(WID_RAT_REMOVE);
this->last_user_action = WIDGET_LIST_END; this->last_user_action = WIDGET_LIST_END;
@ -735,6 +735,7 @@ struct BuildRailToolbarWindow : Window {
DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL); DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL); DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL); DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
DeleteWindowById(WC_SELECT_STATION, 0); DeleteWindowById(WC_SELECT_STATION, 0);
DeleteWindowByClass(WC_BUILD_BRIDGE); DeleteWindowByClass(WC_BUILD_BRIDGE);
} }
@ -841,7 +842,7 @@ Window *ShowBuildRailToolbar(RailType railtype)
DeleteWindowByClass(WC_BUILD_TOOLBAR); DeleteWindowByClass(WC_BUILD_TOOLBAR);
_cur_railtype = railtype; _cur_railtype = railtype;
_remove_button_clicked = false; _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) EventState RailToolbarGlobalHotkeys(uint16 key, uint16 keycode)
@ -1533,14 +1534,14 @@ public:
case WID_BS_DRAG_SIGNALS_DENSITY_DECREASE: case WID_BS_DRAG_SIGNALS_DENSITY_DECREASE:
if (_settings_client.gui.drag_signals_density > 1) { if (_settings_client.gui.drag_signals_density > 1) {
_settings_client.gui.drag_signals_density--; _settings_client.gui.drag_signals_density--;
SetWindowDirty(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_SETTINGS);
} }
break; break;
case WID_BS_DRAG_SIGNALS_DENSITY_INCREASE: case WID_BS_DRAG_SIGNALS_DENSITY_INCREASE:
if (_settings_client.gui.drag_signals_density < 20) { if (_settings_client.gui.drag_signals_density < 20) {
_settings_client.gui.drag_signals_density++; _settings_client.gui.drag_signals_density++;
SetWindowDirty(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_SETTINGS);
} }
break; break;
@ -1777,7 +1778,7 @@ static const NWidgetPart _nested_build_waypoint_widgets[] = {
static const WindowDesc _build_waypoint_desc( static const WindowDesc _build_waypoint_desc(
WDP_AUTO, 0, 0, WDP_AUTO, 0, 0,
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WC_BUILD_WAYPOINT, WC_BUILD_TOOLBAR,
WDF_CONSTRUCTION, WDF_CONSTRUCTION,
_nested_build_waypoint_widgets, lengthof(_nested_build_waypoint_widgets) _nested_build_waypoint_widgets, lengthof(_nested_build_waypoint_widgets)
); );

@ -826,7 +826,7 @@ static const WindowDesc _build_road_scen_desc(
Window *ShowBuildRoadScenToolbar() Window *ShowBuildRoadScenToolbar()
{ {
_cur_roadtype = ROADTYPE_ROAD; _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) EventState RoadToolbarEditorGlobalHotkeys(uint16 key, uint16 keycode)

@ -1717,7 +1717,7 @@ CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
GamelogStopAction(); GamelogStopAction();
} }
SetWindowDirty(WC_GAME_OPTIONS, 0); SetWindowClassesDirty(WC_GAME_OPTIONS);
} }
return CommandCost(); return CommandCost();
@ -1754,7 +1754,7 @@ CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32
return CommandCost(); return CommandCost();
} }
SetWindowDirty(WC_GAME_OPTIONS, 0); SetWindowClassesDirty(WC_GAME_OPTIONS);
} }
return CommandCost(); return CommandCost();
@ -1783,7 +1783,9 @@ bool SetSettingValue(uint index, int32 value, bool force_newgame)
Write_ValidateSetting(var2, sd, value); Write_ValidateSetting(var2, sd, value);
} }
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); 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; return true;
} }

@ -130,7 +130,7 @@ struct GameOptionsWindow : Window {
this->opt = &GetGameSettings(); this->opt = &GetGameSettings();
this->reload = false; this->reload = false;
this->InitNested(desc); this->InitNested(desc, WN_GAME_OPTIONS_GAME_OPTIONS);
this->OnInvalidateData(0); this->OnInvalidateData(0);
} }
@ -464,7 +464,7 @@ struct GameOptionsWindow : Window {
case WID_GO_TOWNNAME_DROPDOWN: // Town names case WID_GO_TOWNNAME_DROPDOWN: // Town names
if (_game_mode == GM_MENU || Town::GetNumItems() == 0) { if (_game_mode == GM_MENU || Town::GetNumItems() == 0) {
this->opt->game_creation.town_name = index; this->opt->game_creation.town_name = index;
SetWindowDirty(WC_GAME_OPTIONS, 0); SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_GAME_OPTIONS);
} }
break; break;
@ -603,7 +603,7 @@ static const WindowDesc _game_options_desc(
/** Open the game options window. */ /** Open the game options window. */
void ShowGameOptions() void ShowGameOptions()
{ {
DeleteWindowById(WC_GAME_OPTIONS, 0); DeleteWindowByClass(WC_GAME_OPTIONS);
new GameOptionsWindow(&_game_options_desc); new GameOptionsWindow(&_game_options_desc);
} }
@ -624,7 +624,7 @@ public:
GameDifficultyWindow(const WindowDesc *desc) : Window() GameDifficultyWindow(const WindowDesc *desc) : Window()
{ {
this->InitNested(desc); this->InitNested(desc, WN_GAME_OPTIONS_GAME_DIFFICULTY);
/* Setup disabled buttons when creating window /* Setup disabled buttons when creating window
* disable all other difficulty buttons during gameplay except for 'custom' */ * disable all other difficulty buttons during gameplay except for 'custom' */
@ -879,7 +879,7 @@ static const WindowDesc _game_difficulty_desc(
/** Open the game-difficulty window. */ /** Open the game-difficulty window. */
void ShowGameDifficulty() void ShowGameDifficulty()
{ {
DeleteWindowById(WC_GAME_OPTIONS, 0); DeleteWindowByClass(WC_GAME_OPTIONS);
new GameDifficultyWindow(&_game_difficulty_desc); new GameDifficultyWindow(&_game_difficulty_desc);
} }
@ -1594,7 +1594,7 @@ struct GameSettingsWindow : Window {
this->CreateNestedTree(desc); this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_GS_SCROLLBAR); 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()); this->vscroll->SetCount(_settings_main_page.Length());
} }
@ -1793,7 +1793,7 @@ static const WindowDesc _settings_selection_desc(
/** Open advanced settings window. */ /** Open advanced settings window. */
void ShowGameSettings() void ShowGameSettings()
{ {
DeleteWindowById(WC_GAME_OPTIONS, 0); DeleteWindowByClass(WC_GAME_OPTIONS);
new GameSettingsWindow(&_settings_selection_desc); new GameSettingsWindow(&_settings_selection_desc);
} }

@ -479,7 +479,7 @@ struct SignWindow : QueryStringBaseWindow, SignList {
this->caption = STR_EDIT_SIGN_CAPTION; this->caption = STR_EDIT_SIGN_CAPTION;
this->afilter = CS_ALPHANUMERAL; this->afilter = CS_ALPHANUMERAL;
this->InitNested(desc); this->InitNested(desc, WN_QUERY_STRING_SIGN);
this->LowerWidget(WID_QES_TEXT); this->LowerWidget(WID_QES_TEXT);
UpdateSignEditWindow(si); UpdateSignEditWindow(si);
@ -656,7 +656,7 @@ void HandleClickOnSign(const Sign *si)
void ShowRenameSignWindow(const Sign *si) void ShowRenameSignWindow(const Sign *si)
{ {
/* Delete all other edit windows */ /* Delete all other edit windows */
DeleteWindowById(WC_QUERY_STRING, 0); DeleteWindowByClass(WC_QUERY_STRING);
new SignWindow(&_query_sign_edit_desc, si); new SignWindow(&_query_sign_edit_desc, si);
} }
@ -667,7 +667,7 @@ void ShowRenameSignWindow(const Sign *si)
*/ */
void DeleteRenameSignWindow(SignID sign) 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; if (w != NULL && w->cur_sign == sign) delete w;
} }

@ -12,6 +12,33 @@
#ifndef WINDOW_TYPE_H #ifndef WINDOW_TYPE_H
#define 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. * Window classes.
*/ */
@ -39,7 +66,7 @@ enum WindowClass {
/** /**
* Build toolbar; Window numbers: * Build toolbar; Window numbers:
* - 0 = #RailToolbarWidgets * - #TRANSPORT_RAIL = #RailToolbarWidgets
* - #TRANSPORT_AIR = #AirportToolbarWidgets * - #TRANSPORT_AIR = #AirportToolbarWidgets
* - #TRANSPORT_WATER = #DockToolbarWidgets * - #TRANSPORT_WATER = #DockToolbarWidgets
* - #TRANSPORT_ROAD = #RoadToolbarWidgets * - #TRANSPORT_ROAD = #RoadToolbarWidgets
@ -48,8 +75,8 @@ enum WindowClass {
/** /**
* Scenario build toolbar; Window numbers: * Scenario build toolbar; Window numbers:
* - 0 = #RoadToolbarWidgets
* - #TRANSPORT_WATER = #DockToolbarWidgets * - #TRANSPORT_WATER = #DockToolbarWidgets
* - #TRANSPORT_ROAD = #RoadToolbarWidgets
*/ */
WC_SCEN_BUILD_TOOLBAR, WC_SCEN_BUILD_TOOLBAR,
@ -90,16 +117,16 @@ enum WindowClass {
WC_TOOLTIPS, WC_TOOLTIPS,
/** /**
* Query string window; Window numbers: (TODO - CONFLICT) * Query string window; Window numbers:
* - 0 = #QueryStringWidgets * - #WN_QUERY_STRING = #QueryStringWidgets
* - 0 = #QueryEditSignWidgets * - #WN_QUERY_STRING_SIGN = #QueryEditSignWidgets
*/ */
WC_QUERY_STRING, WC_QUERY_STRING,
/** /**
* Popup with confirm question; Window numbers: (TODO - CONFLICT) * Popup with confirm question; Window numbers:
* - 0 = #BootstrapAskForDownloadWidgets * - #WN_CONFIRM_POPUP_QUERY = #QueryWidgets
* - 0 = #QueryWidgets * - #WN_CONFIRM_POPUP_QUERY_BOOTSTRAP = #BootstrapAskForDownloadWidgets
*/ */
WC_CONFIRM_POPUP_QUERY, WC_CONFIRM_POPUP_QUERY,
@ -365,14 +392,19 @@ enum WindowClass {
WC_TRUCK_STATION, WC_TRUCK_STATION,
/** /**
* Build depot; Window numbers: (TODO - CONFLICT) * Build depot; Window numbers:
* - #TRANSPORT_WATER = #BuildDockDepotWidgets * - #TRANSPORT_WATER = #BuildDockDepotWidgets
* - #TRANSPORT_RAIL = #BuildRailDepotWidgets * - #TRANSPORT_RAIL = #BuildRailDepotWidgets
* - #TRANSPORT_RAIL = #BuildRailWaypointWidgets
* - #TRANSPORT_ROAD = #BuildRoadDepotWidgets * - #TRANSPORT_ROAD = #BuildRoadDepotWidgets
*/ */
WC_BUILD_DEPOT, WC_BUILD_DEPOT,
/**
* Build waypoint; Window numbers:
* - #TRANSPORT_RAIL = #BuildRailWaypointWidgets
*/
WC_BUILD_WAYPOINT,
/** /**
* Found a town; Window numbers: * Found a town; Window numbers:
* - 0 = #TownFoundingWidgets * - 0 = #TownFoundingWidgets
@ -407,19 +439,19 @@ enum WindowClass {
WC_GENERATE_LANDSCAPE, WC_GENERATE_LANDSCAPE,
/** /**
* Progress report of landscape generation; Window numbers: (TODO - CONFLICT) * Progress report of landscape generation; Window numbers:
* - 0 = #GenerationProgressWidgets * - 0 = #GenerationProgressWidgets
* - 0 = #ScanProgressWidgets * - 1 = #ScanProgressWidgets
*/ */
WC_MODAL_PROGRESS, WC_MODAL_PROGRESS,
/** /**
* Network window; Window numbers: (TODO - CONFLICT) * Network window; Window numbers:
* - 0 = #NetworkGameWidgets * - #WN_NETWORK_WINDOW_GAME = #NetworkGameWidgets
* - 0 = #NetworkLobbyWidgets * - #WN_NETWORK_WINDOW_LOBBY = #NetworkLobbyWidgets
* - 1 = #NetworkContentListWidgets * - #WN_NETWORK_WINDOW_CONTENT_LIST = #NetworkContentListWidgets
* - 1 = #NetworkStartServerWidgets * - #WN_NETWORK_WINDOW_START = #NetworkStartServerWidgets
*/ */
WC_NETWORK_WINDOW, WC_NETWORK_WINDOW,
@ -436,9 +468,9 @@ enum WindowClass {
WC_CLIENT_LIST_POPUP, WC_CLIENT_LIST_POPUP,
/** /**
* Network status window; Window numbers: (TODO - CONFLICT) * Network status window; Window numbers:
* - 0 = #NetworkJoinStatusWidgets * - #WN_NETWORK_STATUS_WINDOW_JOIN = #NetworkJoinStatusWidgets
* - 0 = #NetworkContentDownloadStatusWidgets * - #WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD = #NetworkContentDownloadStatusWidgets
*/ */
WC_NETWORK_STATUS_WINDOW, WC_NETWORK_STATUS_WINDOW,
@ -554,14 +586,14 @@ enum WindowClass {
WC_MUSIC_TRACK_SELECTION, WC_MUSIC_TRACK_SELECTION,
/** /**
* Game options window; Window numbers: (TODO - CONFLICT) * Game options window; Window numbers:
* - 0 = #AIConfigWidgets * - #WN_GAME_OPTIONS_AI = #AIConfigWidgets
* - 0 = #AboutWidgets * - #WN_GAME_OPTIONS_ABOUT = #AboutWidgets
* - 0 = #NewGRFStateWidgets * - #WN_GAME_OPTIONS_NEWGRF_STATE = #NewGRFStateWidgets
* - 0 = #MessageOptionWidgets * - #WN_GAME_OPTIONS_MESSAGE_OPTION = #MessageOptionWidgets
* - 0 = #GameOptionsWidgets * - #WN_GAME_OPTIONS_GAME_OPTIONS = #GameOptionsWidgets
* - 0 = #GameDifficultyWidgets * - #WN_GAME_OPTIONS_GAME_DIFFICULTY = #GameDifficultyWidgets
* - 0 = #GameSettingsWidgets * - #WN_GAME_OPTIONS_GAME_SETTINGS = #GameSettingsWidgets
*/ */
WC_GAME_OPTIONS, WC_GAME_OPTIONS,

Loading…
Cancel
Save