equal
deleted
inserted
replaced
7 // This file handles the GameList |
7 // This file handles the GameList |
8 // Also, it handles the request to a server for data about the server |
8 // Also, it handles the request to a server for data about the server |
9 |
9 |
10 extern void UpdateNetworkGameWindow(bool unselect); |
10 extern void UpdateNetworkGameWindow(bool unselect); |
11 |
11 |
12 static void NetworkGameListClear(void) |
|
13 { |
|
14 NetworkGameList *item; |
|
15 NetworkGameList *next; |
|
16 |
|
17 item = _network_game_list; |
|
18 |
|
19 while (item != NULL) { |
|
20 next = item->next; |
|
21 free(item); |
|
22 item = next; |
|
23 } |
|
24 _network_game_list = NULL; |
|
25 _network_game_count = 0; |
|
26 |
|
27 UpdateNetworkGameWindow(true); |
|
28 |
|
29 DEBUG(net, 4)("[NET][GameList] Cleared list"); |
|
30 } |
|
31 |
12 |
32 NetworkGameList *NetworkGameListAddItem(uint32 ip, uint16 port) |
13 NetworkGameList *NetworkGameListAddItem(uint32 ip, uint16 port) |
33 { |
14 { |
34 NetworkGameList *item; |
15 NetworkGameList *item; |
35 |
16 |
90 } |
71 } |
91 item = item->next; |
72 item = item->next; |
92 } |
73 } |
93 } |
74 } |
94 |
75 |
95 static void NetworkGameListAddQueriedItem(const NetworkGameInfo *info, bool server_online) |
|
96 { |
|
97 // We queried a server and now we are going to add it to the list |
|
98 NetworkGameList *item; |
|
99 |
|
100 item = NetworkGameListAddItem(_network_last_host_ip, _network_last_port); |
|
101 item->online = server_online; |
|
102 memcpy(&item->info, info, sizeof(NetworkGameInfo)); |
|
103 ttd_strlcpy(item->info.hostname, _network_last_host, sizeof(item->info.hostname)); |
|
104 |
|
105 UpdateNetworkGameWindow(false); |
|
106 } |
|
107 |
|
108 #endif /* ENABLE_NETWORK */ |
76 #endif /* ENABLE_NETWORK */ |
109 |
|
110 |
|