summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-03-25 19:46:59 +0000
committerrubidium <rubidium@openttd.org>2012-03-25 19:46:59 +0000
commit1adb9a5c85f3773d3163b056ad0ed13a97347276 (patch)
treedd34a278938866534a033dc33a3c6f1926ce5c2b /src/network
parentf2f939906e78010ccf23e0d6a250d12a3a74a7af (diff)
downloadopenttd-1adb9a5c85f3773d3163b056ad0ed13a97347276.tar.xz
(svn r24070) -Fix [FS#5098]: the 'last joined' server was not properly selected anymore (adf88)
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_gamelist.cpp6
-rw-r--r--src/network/network_gui.cpp13
-rw-r--r--src/network/network_internal.h2
-rw-r--r--src/network/network_udp.cpp2
4 files changed, 10 insertions, 13 deletions
diff --git a/src/network/network_gamelist.cpp b/src/network/network_gamelist.cpp
index 8df84a80e..9acc09cd1 100644
--- a/src/network/network_gamelist.cpp
+++ b/src/network/network_gamelist.cpp
@@ -62,7 +62,7 @@ static void NetworkGameListHandleDelayedInsert()
}
item->manually |= ins_item->manually;
if (item->manually) NetworkRebuildHostList();
- UpdateNetworkGameWindow(false);
+ UpdateNetworkGameWindow();
}
free(ins_item);
}
@@ -105,7 +105,7 @@ NetworkGameList *NetworkGameListAddItem(NetworkAddress address)
}
DEBUG(net, 4, "[gamelist] added server to list");
- UpdateNetworkGameWindow(false);
+ UpdateNetworkGameWindow();
return item;
}
@@ -132,7 +132,7 @@ void NetworkGameListRemoveItem(NetworkGameList *remove)
DEBUG(net, 4, "[gamelist] removed server from list");
NetworkRebuildHostList();
- UpdateNetworkGameWindow(false);
+ UpdateNetworkGameWindow();
return;
}
prev_item = item;
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index acda5dab1..151776d74 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -72,9 +72,9 @@ void SortNetworkLanguages()
* found on the network.
* @param unselect unselect the currently selected item
*/
-void UpdateNetworkGameWindow(bool unselect)
+void UpdateNetworkGameWindow()
{
- InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME, unselect ? 1 : 0);
+ InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME, 0);
}
typedef GUIList<NetworkGameList*> GUIGameServerList;
@@ -438,6 +438,9 @@ protected:
public:
NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_CLIENT_NAME_LENGTH)
{
+ this->list_pos = SLP_INVALID;
+ this->server = NULL;
+
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_NG_SCROLLBAR);
this->FinishInitNested(desc, WN_NETWORK_WINDOW_GAME);
@@ -447,8 +450,6 @@ public:
InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120);
this->SetFocusedWidget(WID_NG_CLIENT);
- UpdateNetworkGameWindow(true);
-
this->field = WID_NG_CLIENT;
this->last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port));
this->server = this->last_joined;
@@ -791,10 +792,6 @@ public:
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (data == 1) {
- this->server = NULL;
- this->list_pos = SLP_INVALID;
- }
this->servers.ForceRebuild();
this->SetDirty();
}
diff --git a/src/network/network_internal.h b/src/network/network_internal.h
index b024b7c02..938682981 100644
--- a/src/network/network_internal.h
+++ b/src/network/network_internal.h
@@ -145,7 +145,7 @@ void NetworkTCPQueryServer(NetworkAddress address);
void GetBindAddresses(NetworkAddressList *addresses, uint16 port);
void NetworkAddServer(const char *b);
void NetworkRebuildHostList();
-void UpdateNetworkGameWindow(bool unselect);
+void UpdateNetworkGameWindow();
bool IsNetworkCompatibleVersion(const char *version);
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index a1eef9a9e..f58a39342 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -395,7 +395,7 @@ void ClientNetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAd
item->online = true;
- UpdateNetworkGameWindow(false);
+ UpdateNetworkGameWindow();
}
void ClientNetworkUDPSocketHandler::Receive_MASTER_RESPONSE_LIST(Packet *p, NetworkAddress *client_addr)