# HG changeset patch # User dominik # Date 1104922079 0 # Node ID 076a21cc614ac7401fe6867c61dd586eff1c1637 # Parent 2e2a86b6c9989a912a18291444af209c7e19b506 (svn r1383) Fix: You can now also delete automatically found servers by pressing "del" Fix: The scrollbar is correctly updated when deleting servers diff -r 2e2a86b6c998 -r 076a21cc614a network_gui.c --- a/network_gui.c Wed Jan 05 10:20:51 2005 +0000 +++ b/network_gui.c Wed Jan 05 10:47:59 2005 +0000 @@ -76,6 +76,21 @@ extern const char _openttd_revision[]; +static FiosItem *selected_map = NULL; // to highlight slected map + +// called when a new server is found on the network +void UpdateNetworkGameWindow(bool unselect) +{ + Window *w; + w = FindWindowById(WC_NETWORK_WINDOW, 0); + if (w != NULL) { + if (unselect) + _selected_item = NULL; + w->vscroll.count = _network_game_count; + SetWindowDirty(w); + } +} + static void NetworkGameWindowWndProc(Window *w, WindowEvent *e) { switch(e->event) { @@ -334,10 +349,14 @@ case WE_KEYPRESS: if (_selected_field != 3) { if ( e->keypress.keycode == WKC_DELETE ) { // press 'delete' to remove servers - if (_selected_item != NULL && _selected_item->manually) { + if (_selected_item != NULL) { NetworkGameListRemoveItem(_selected_item); NetworkRebuildHostList(); SetWindowDirty(w); + _network_game_count--; + // reposition scrollbar + if (_network_game_count >= w->vscroll.cap && w->vscroll.pos > _network_game_count-w->vscroll.cap) w->vscroll.pos--; + UpdateNetworkGameWindow(false); _selected_item = NULL; } } @@ -411,21 +430,6 @@ NetworkGameWindowWndProc, }; -static FiosItem *selected_map = NULL; // to highlight slected map - -// called when a new server is found on the network -void UpdateNetworkGameWindow(bool unselect) -{ - Window *w; - w = FindWindowById(WC_NETWORK_WINDOW, 0); - if (w != NULL) { - if (unselect) - _selected_item = NULL; - w->vscroll.count = _network_game_count; - SetWindowDirty(w); - } -} - void ShowNetworkGameWindow() { uint i;