From 9ddd227eb3757473bce23b4cafec894a4e4eaa36 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 2 Feb 2007 21:32:58 +0000 Subject: (svn r8544) -Codechange: move game list related function/struct declarations to network_gamelist.h --- src/network/network.h | 12 ------------ src/network/network_gamelist.cpp | 14 ++++++++++---- src/network/network_gamelist.h | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/network/network.h b/src/network/network.h index b091cab86..55535f223 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -65,16 +65,6 @@ typedef struct NetworkClientInfo { char unique_id[NETWORK_NAME_LENGTH]; // Every play sends an unique id so we can indentify him } NetworkClientInfo; -typedef struct NetworkGameList { - NetworkGameInfo info; - uint32 ip; - uint16 port; - bool online; // False if the server did not respond (default status) - bool manually; // True if the server was added manually - uint8 retries; - struct NetworkGameList *next; -} NetworkGameList; - typedef enum { NETWORK_JOIN_STATUS_CONNECTING, NETWORK_JOIN_STATUS_AUTHORIZING, @@ -94,8 +84,6 @@ typedef enum { NETLANG_FRENCH = 3, } NetworkLanguage; -VARDEF NetworkGameList *_network_game_list; - VARDEF NetworkGameInfo _network_game_info; VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS]; VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO]; diff --git a/src/network/network_gamelist.cpp b/src/network/network_gamelist.cpp index 4a9b8683b..c4b51c230 100644 --- a/src/network/network_gamelist.cpp +++ b/src/network/network_gamelist.cpp @@ -4,17 +4,23 @@ #include "../stdafx.h" #include "../debug.h" -#include "network_data.h" #include "../newgrf_config.h" #include "../helpers.hpp" +#include "core/game.h" #include "network_udp.h" +#include "network_gamelist.h" +#include "network_gui.h" + +/** + * @file network_gamelist.cpp This file handles the GameList + * Also, it handles the request to a server for data about the server + */ + +NetworkGameList *_network_game_list = NULL; /** Should we stop/contiue requerying of offline servers? */ static bool _stop_requerying = false; -// This file handles the GameList -// Also, it handles the request to a server for data about the server - /** Add a new item to the linked gamelist. If the IP and Port match * return the existing item instead of adding it again * @param ip the IP-address (inet_addr) of the to-be added item diff --git a/src/network/network_gamelist.h b/src/network/network_gamelist.h index 7914f05cd..e552ff9cc 100644 --- a/src/network/network_gamelist.h +++ b/src/network/network_gamelist.h @@ -3,10 +3,22 @@ #ifndef NETWORK_GAMELIST_H #define NETWORK_GAMELIST_H -void NetworkGameListClear(void); +/** Structure with information shown in the game list (GUI) */ +struct NetworkGameList { + NetworkGameInfo info; ///< The game information of this server + uint32 ip; ///< The IP of the game server + uint16 port; ///< The port of the game server + bool online; ///< False if the server did not respond (default status) + bool manually; ///< True if the server was added manually + uint8 retries; ///< Number of retries (to stop requerying) + NetworkGameList *next; ///< Next pointer to make a linked game list +}; + +/** Game list of this client */ +extern NetworkGameList *_network_game_list; + NetworkGameList *NetworkGameListAddItem(uint32 ip, uint16 port); void NetworkGameListRemoveItem(NetworkGameList *remove); -void NetworkGameListAddQueriedItem(const NetworkGameInfo *info, bool server_online); void NetworkGameListRequery(void); #endif /* NETWORK_GAMELIST_H */ -- cgit v1.2.3-54-g00ecf