mirror of https://github.com/OpenTTD/OpenTTD
(svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted
parent
3061d70387
commit
d04ebf2fa5
|
@ -179,7 +179,7 @@ public:
|
||||||
* @param address the other address.
|
* @param address the other address.
|
||||||
* @return < 0 if address is less, 0 if equal and > 0 if address is more
|
* @return < 0 if address is less, 0 if equal and > 0 if address is more
|
||||||
*/
|
*/
|
||||||
int CompareTo(NetworkAddress address)
|
int CompareTo(NetworkAddress &address)
|
||||||
{
|
{
|
||||||
int r = this->GetAddressLength() - address.GetAddressLength();
|
int r = this->GetAddressLength() - address.GetAddressLength();
|
||||||
if (r == 0) r = this->address.ss_family - address.address.ss_family;
|
if (r == 0) r = this->address.ss_family - address.address.ss_family;
|
||||||
|
@ -193,7 +193,7 @@ public:
|
||||||
* @param address the other address.
|
* @param address the other address.
|
||||||
* @return true if both match.
|
* @return true if both match.
|
||||||
*/
|
*/
|
||||||
bool operator == (NetworkAddress address)
|
bool operator == (NetworkAddress &address)
|
||||||
{
|
{
|
||||||
return this->CompareTo(address) == 0;
|
return this->CompareTo(address) == 0;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ public:
|
||||||
* @param address the other address.
|
* @param address the other address.
|
||||||
* @return true if both match.
|
* @return true if both match.
|
||||||
*/
|
*/
|
||||||
bool operator == (NetworkAddress address) const
|
bool operator == (NetworkAddress &address) const
|
||||||
{
|
{
|
||||||
return const_cast<NetworkAddress*>(this)->CompareTo(address) == 0;
|
return const_cast<NetworkAddress*>(this)->CompareTo(address) == 0;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ public:
|
||||||
* Compare the address of this class with the address of another.
|
* Compare the address of this class with the address of another.
|
||||||
* @param address the other address.
|
* @param address the other address.
|
||||||
*/
|
*/
|
||||||
bool operator < (NetworkAddress address)
|
bool operator < (NetworkAddress &address)
|
||||||
{
|
{
|
||||||
return this->CompareTo(address) < 0;
|
return this->CompareTo(address) < 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,10 +120,11 @@ protected:
|
||||||
/* Constants for sorting servers */
|
/* Constants for sorting servers */
|
||||||
static GUIGameServerList::SortFunction * const sorter_funcs[];
|
static GUIGameServerList::SortFunction * const sorter_funcs[];
|
||||||
|
|
||||||
byte field; ///< selected text-field
|
byte field; ///< selected text-field
|
||||||
NetworkGameList *server; ///< selected server
|
NetworkGameList *server; ///< selected server
|
||||||
GUIGameServerList servers; ///< list with game servers.
|
NetworkGameList *last_joined; ///< the last joined server
|
||||||
ServerListPosition list_pos; ///< position of the selected server
|
GUIGameServerList servers; ///< list with game servers.
|
||||||
|
ServerListPosition list_pos; ///< position of the selected server
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Re)build the network game list as its amount has changed because
|
* (Re)build the network game list as its amount has changed because
|
||||||
|
@ -337,6 +338,8 @@ public:
|
||||||
this->server = NULL;
|
this->server = NULL;
|
||||||
this->list_pos = SLP_INVALID;
|
this->list_pos = SLP_INVALID;
|
||||||
|
|
||||||
|
this->last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port));
|
||||||
|
|
||||||
this->servers.SetListing(this->last_sorting);
|
this->servers.SetListing(this->last_sorting);
|
||||||
this->servers.SetSortFuncs(this->sorter_funcs);
|
this->servers.SetSortFuncs(this->sorter_funcs);
|
||||||
this->servers.ForceRebuild();
|
this->servers.ForceRebuild();
|
||||||
|
@ -403,9 +406,8 @@ public:
|
||||||
y += NET_PRC__SIZE_OF_ROW;
|
y += NET_PRC__SIZE_OF_ROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NetworkGameList *last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port));
|
|
||||||
/* Draw the last joined server, if any */
|
/* Draw the last joined server, if any */
|
||||||
if (last_joined != NULL) this->DrawServerLine(last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, last_joined == sel);
|
if (this->last_joined != NULL) this->DrawServerLine(this->last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, this->last_joined == sel);
|
||||||
|
|
||||||
/* Draw the right menu */
|
/* Draw the right menu */
|
||||||
GfxFillRect(this->widget[NGWW_DETAILS].left + 1, 43, this->widget[NGWW_DETAILS].right - 1, 92, 157);
|
GfxFillRect(this->widget[NGWW_DETAILS].left + 1, 43, this->widget[NGWW_DETAILS].right - 1, 92, 157);
|
||||||
|
|
Loading…
Reference in New Issue