diff options
author | rubidium <rubidium@openttd.org> | 2009-03-19 17:56:45 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-19 17:56:45 +0000 |
commit | 485961b2600eba04021ef74430ebbba6c1934f8c (patch) | |
tree | 662d3480797caa08748edd04e6bfdccbf61c3ccb | |
parent | c297a99efffd370e3c66c29a05f213ba38e81334 (diff) | |
download | openttd-485961b2600eba04021ef74430ebbba6c1934f8c.tar.xz |
(svn r15766) -Fix [FS#2744]: Crash when opening the content list window twice; inconsistencies when clicking download twice.
-rw-r--r-- | src/network/network_content_gui.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 1e052fb79..73c1be9b9 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -95,7 +95,7 @@ public: /* Yes... these are the NewGRF windows */ InvalidateWindowClasses(WC_SAVELOAD); InvalidateWindowData(WC_GAME_OPTIONS, 0, 1); - InvalidateWindowData(WC_NETWORK_WINDOW, 0, 2); + InvalidateWindowData(WC_NETWORK_WINDOW, 1, 2); break; case CONTENT_TYPE_SCENARIO: @@ -319,7 +319,7 @@ public: * Create the content list window. * @param desc the window description to pass to Window's constructor. */ - NetworkContentListWindow(const WindowDesc *desc, bool select_all) : QueryStringBaseWindow(EDITBOX_MAX_SIZE, desc), selected(NULL), list_pos(0) + NetworkContentListWindow(const WindowDesc *desc, bool select_all) : QueryStringBaseWindow(EDITBOX_MAX_SIZE, desc, 1), selected(NULL), list_pos(0) { ttd_strlcpy(this->edit_str_buf, "", this->edit_str_size); this->afilter = CS_ALPHANUMERAL; @@ -383,7 +383,7 @@ public: } } - this->SetWidgetDisabledState(NCLWW_DOWNLOAD, filesize == 0); + this->SetWidgetDisabledState(NCLWW_DOWNLOAD, filesize == 0 || FindWindowById(WC_NETWORK_STATUS_WINDOW, 0) != NULL); this->SetWidgetDisabledState(NCLWW_UNSELECT, filesize == 0); this->SetWidgetDisabledState(NCLWW_SELECT_ALL, !show_select_all); this->SetWidgetDisabledState(NCLWW_SELECT_UPDATE, !show_select_upgrade); @@ -594,7 +594,7 @@ public: break; case NCLWW_DOWNLOAD: - new NetworkContentDownloadStatusWindow(); + if (BringWindowToFrontById(WC_NETWORK_STATUS_WINDOW, 0) == NULL) new NetworkContentDownloadStatusWindow(); break; } } @@ -782,6 +782,7 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type) _network_content_client.RequestContentList(cv, true); } + DeleteWindowById(WC_NETWORK_WINDOW, 1); new NetworkContentListWindow(&_network_content_list_desc, cv != NULL); #else ShowErrorMessage(STR_CONTENT_NO_ZLIB_SUB, STR_CONTENT_NO_ZLIB, 0, 0); |