summaryrefslogtreecommitdiff
path: root/network_gamelist.c
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-12-20 22:14:39 +0000
committerdominik <dominik@openttd.org>2004-12-20 22:14:39 +0000
commit7cfaa8a418cf5e04d66e3b4207b13a29db134145 (patch)
tree29c55a04aa27eeacd62949e6621a682a22dc3cc0 /network_gamelist.c
parent3bbea05a93f922a7e3c98f5474748027032ef2a9 (diff)
downloadopenttd-7cfaa8a418cf5e04d66e3b4207b13a29db134145.tar.xz
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
Diffstat (limited to 'network_gamelist.c')
-rw-r--r--network_gamelist.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/network_gamelist.c b/network_gamelist.c
index 63856a9bf..7f2f6a5d4 100644
--- a/network_gamelist.c
+++ b/network_gamelist.c
@@ -65,6 +65,33 @@ NetworkGameList *NetworkGameListAddItem(uint32 ip, uint16 port)
return item;
}
+void NetworkGameListRemoveItem(NetworkGameList *remove)
+{
+ NetworkGameList *item;
+
+ item = _network_game_list;
+
+ // examine head of the list
+ if ( remove == _network_game_list ) {
+ _network_game_list = remove->next;
+ free(remove);
+ DEBUG(net, 4) ("[NET][GameList] Removed server from list");
+ return;
+ }
+
+ // examine each item
+ while ( item->next != NULL ) {
+ if ( item->next == remove )
+ {
+ item->next = remove->next;
+ free(remove);
+ DEBUG(net, 4) ("[NET][GameList] Removed server from list");
+ return;
+ }
+ item = item->next;
+ }
+}
+
void NetworkGameListAddQueriedItem(const NetworkGameInfo *info, bool server_online)
{
// We queried a server and now we are going to add it to the list