Changeset - r18172:1d60aac3e14f
[Not reviewed]
master
0 1 0
planetmaker - 13 years ago 2011-10-07 08:17:47
planetmaker@openttd.org
(svn r23011) -Fix [FS#4791]: When the last used server is deleted from the list also clear the last used server if it is the same (monoid)
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/network/network_gui.cpp
Show inline comments
 
@@ -713,15 +713,14 @@ public:
 
				/* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */
 
				if (click_count > 1 && !this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1);
 
				break;
 
			}
 

	
 
			case NGWW_LASTJOINED: {
 
				NetworkGameList *last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port));
 
				if (last_joined != NULL) {
 
					this->server = last_joined;
 
				if (this->last_joined != NULL) {
 
					this->server = this->last_joined;
 

	
 
					/* search the position of the newly selected server */
 
					for (uint i = 0; i < this->servers.Length(); i++) {
 
						if (this->servers[i] == this->server) {
 
							this->list_pos = i;
 
							break;
 
@@ -858,12 +857,13 @@ public:
 
		}
 

	
 
		if (this->field != NGWW_CLIENT) {
 
			if (this->server != NULL) {
 
				if (keycode == WKC_DELETE) { // Press 'delete' to remove servers
 
					NetworkGameListRemoveItem(this->server);
 
					if (this->server == this->last_joined) this->last_joined = NULL;
 
					this->server = NULL;
 
					this->list_pos = SLP_INVALID;
 
				}
 
			}
 
			return state;
 
		}
0 comments (0 inline, 0 general)