network.h
changeset 5339 96ac3f4933bb
parent 5034 611ac18ac2b5
equal deleted inserted replaced
5338:a78592405640 5339:96ac3f4933bb
    51 	NETWORK_REVISION_LENGTH    =  15,
    51 	NETWORK_REVISION_LENGTH    =  15,
    52 	NETWORK_PASSWORD_LENGTH    =  20,
    52 	NETWORK_PASSWORD_LENGTH    =  20,
    53 	NETWORK_PLAYERS_LENGTH     = 200,
    53 	NETWORK_PLAYERS_LENGTH     = 200,
    54 	NETWORK_CLIENT_NAME_LENGTH =  25,
    54 	NETWORK_CLIENT_NAME_LENGTH =  25,
    55 	NETWORK_RCONCOMMAND_LENGTH = 500,
    55 	NETWORK_RCONCOMMAND_LENGTH = 500,
       
    56 
       
    57 	NETWORK_GRF_NAME_LENGTH    =  80, ///< Maximum length of the name of a GRF
       
    58 	/* Maximum number of GRFs that can be sent.
       
    59 	 * This value is related to number of handles (files) OpenTTD can open.
       
    60 	 * This is currently 64 and about 10 are currently used when OpenTTD loads
       
    61 	 * without any NewGRFs. Therefore one can only load about 55 NewGRFs, so
       
    62 	 * this is not a limit, but rather a way to easily check whether the limit
       
    63 	 * imposed by the handle count is reached. Secondly it isn't possible to
       
    64 	 * send much more GRF IDs + MD5sums in the PACKET_UDP_SERVER_RESPONSE, due
       
    65 	 * to the limited size of UDP packets. */
       
    66 	NETWORK_MAX_GRF_COUNT      =  55,
    56 
    67 
    57 	NETWORK_NUM_LANGUAGES      =   4,
    68 	NETWORK_NUM_LANGUAGES      =   4,
    58 };
    69 };
    59 
    70 
    60 // This is the struct used by both client and server
    71 // This is the struct used by both client and server
    64 	char server_name[NETWORK_NAME_LENGTH];          // Server name
    75 	char server_name[NETWORK_NAME_LENGTH];          // Server name
    65 	char hostname[NETWORK_HOSTNAME_LENGTH];         // Hostname of the server (if any)
    76 	char hostname[NETWORK_HOSTNAME_LENGTH];         // Hostname of the server (if any)
    66 	char server_revision[NETWORK_REVISION_LENGTH];  // The SVN version number the server is using (e.g.: 'r304')
    77 	char server_revision[NETWORK_REVISION_LENGTH];  // The SVN version number the server is using (e.g.: 'r304')
    67 	                                                //  It even shows a SVN version in release-version, so
    78 	                                                //  It even shows a SVN version in release-version, so
    68 	                                                //  it is easy to compare if a server is of the correct version
    79 	                                                //  it is easy to compare if a server is of the correct version
    69 	bool compatible;                                // Can we connect to this server or not? (based on server_revision)
    80 	bool version_compatible;                        // Can we connect to this server or not? (based on server_revision)
       
    81 	bool compatible;                                // Can we connect to this server or not? (based on server_revision _and_ grf_match
    70 	byte server_lang;                               // Language of the server (we should make a nice table for this)
    82 	byte server_lang;                               // Language of the server (we should make a nice table for this)
    71 	byte use_password;                              // Is set to != 0 if it uses a password
    83 	byte use_password;                              // Is set to != 0 if it uses a password
    72 	char server_password[NETWORK_PASSWORD_LENGTH];  // On the server: the game password, on the client: != "" if server has password
    84 	char server_password[NETWORK_PASSWORD_LENGTH];  // On the server: the game password, on the client: != "" if server has password
    73 	byte clients_max;                               // Max clients allowed on server
    85 	byte clients_max;                               // Max clients allowed on server
    74 	byte clients_on;                                // Current count of clients on server
    86 	byte clients_on;                                // Current count of clients on server
    82 	uint16 map_width;                               // Map width
    94 	uint16 map_width;                               // Map width
    83 	uint16 map_height;                              // Map height
    95 	uint16 map_height;                              // Map height
    84 	byte map_set;                                   // Graphical set
    96 	byte map_set;                                   // Graphical set
    85 	bool dedicated;                                 // Is this a dedicated server?
    97 	bool dedicated;                                 // Is this a dedicated server?
    86 	char rcon_password[NETWORK_PASSWORD_LENGTH];    // RCon password for the server. "" if rcon is disabled
    98 	char rcon_password[NETWORK_PASSWORD_LENGTH];    // RCon password for the server. "" if rcon is disabled
       
    99 	struct GRFConfig *grfconfig;                    // List of NewGRF files required
    87 } NetworkGameInfo;
   100 } NetworkGameInfo;
    88 
   101 
    89 typedef struct NetworkPlayerInfo {
   102 typedef struct NetworkPlayerInfo {
    90 	char company_name[NETWORK_NAME_LENGTH];         // Company name
   103 	char company_name[NETWORK_NAME_LENGTH];         // Company name
    91 	char password[NETWORK_PASSWORD_LENGTH];         // The password for the player
   104 	char password[NETWORK_PASSWORD_LENGTH];         // The password for the player