Files
@ r2563:3e19f473caed
Branch filter:
Location: cpp/openttd-patchpack/source/network_gamelist.c - annotation
r2563:3e19f473caed
1.5 KiB
text/x-c
(svn r3100) -Codechange [Clone vehicles] Major change to clone vehicles
removed duplicated code and added DoCommand, which used the define build commands added with autoreplace
This should not affect gameplay at all
removed duplicated code and added DoCommand, which used the define build commands added with autoreplace
This should not affect gameplay at all
r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r543:efdb197f91ad r1299:07d5483b3f76 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r738:f65fde6f029e r543:efdb197f91ad | /* $Id$ */
#include "stdafx.h"
#include "debug.h"
#include "network_data.h"
#ifdef ENABLE_NETWORK
//
// This file handles the GameList
// Also, it handles the request to a server for data about the server
extern void UpdateNetworkGameWindow(bool unselect);
NetworkGameList *NetworkGameListAddItem(uint32 ip, uint16 port)
{
NetworkGameList *item;
item = _network_game_list;
if (item != NULL) {
while (item->next != NULL) {
if (item->ip == ip && item->port == port)
return item;
item = item->next;
}
if (item->ip == ip && item->port == port)
return item;
item->next = malloc(sizeof(*item));
item = item->next;
} else {
item = malloc(sizeof(*item));
_network_game_list = item;
}
DEBUG(net, 4) ("[NET][GameList] Added server to list");
memset(item, 0, sizeof(*item));
item->next = NULL;
item->ip = ip;
item->port = port;
_network_game_count++;
UpdateNetworkGameWindow(false);
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;
}
}
#endif /* ENABLE_NETWORK */
|