src/network/network.h
changeset 6248 e4a2ed7e5613
parent 6247 7d81e3a5d803
child 6793 05d91fa1c75c
equal deleted inserted replaced
6247:7d81e3a5d803 6248:e4a2ed7e5613
    38 
    38 
    39 // How many vehicle/station types we put over the network
    39 // How many vehicle/station types we put over the network
    40 #define NETWORK_VEHICLE_TYPES 5
    40 #define NETWORK_VEHICLE_TYPES 5
    41 #define NETWORK_STATION_TYPES 5
    41 #define NETWORK_STATION_TYPES 5
    42 
    42 
    43 typedef struct NetworkPlayerInfo {
    43 struct NetworkPlayerInfo {
    44 	char company_name[NETWORK_NAME_LENGTH];         // Company name
    44 	char company_name[NETWORK_NAME_LENGTH];         // Company name
    45 	char password[NETWORK_PASSWORD_LENGTH];         // The password for the player
    45 	char password[NETWORK_PASSWORD_LENGTH];         // The password for the player
    46 	Year inaugurated_year;                          // What year the company started in
    46 	Year inaugurated_year;                          // What year the company started in
    47 	int64 company_value;                            // The company value
    47 	int64 company_value;                            // The company value
    48 	int64 money;                                    // The amount of money the company has
    48 	int64 money;                                    // The amount of money the company has
    51 	bool use_password;                              // Is there a password
    51 	bool use_password;                              // Is there a password
    52 	uint16 num_vehicle[NETWORK_VEHICLE_TYPES];      // How many vehicles are there of this type?
    52 	uint16 num_vehicle[NETWORK_VEHICLE_TYPES];      // How many vehicles are there of this type?
    53 	uint16 num_station[NETWORK_STATION_TYPES];      // How many stations are there of this type?
    53 	uint16 num_station[NETWORK_STATION_TYPES];      // How many stations are there of this type?
    54 	char players[NETWORK_PLAYERS_LENGTH];           // The players that control this company (Name1, name2, ..)
    54 	char players[NETWORK_PLAYERS_LENGTH];           // The players that control this company (Name1, name2, ..)
    55 	uint16 months_empty;                            // How many months the company is empty
    55 	uint16 months_empty;                            // How many months the company is empty
    56 } NetworkPlayerInfo;
    56 };
    57 
    57 
    58 typedef struct NetworkClientInfo {
    58 struct NetworkClientInfo {
    59 	uint16 client_index;                            // Index of the client (same as ClientState->index)
    59 	uint16 client_index;                            // Index of the client (same as ClientState->index)
    60 	char client_name[NETWORK_CLIENT_NAME_LENGTH];   // Name of the client
    60 	char client_name[NETWORK_CLIENT_NAME_LENGTH];   // Name of the client
    61 	byte client_lang;                               // The language of the client
    61 	byte client_lang;                               // The language of the client
    62 	PlayerID client_playas;                         // As which player is this client playing (PlayerID)
    62 	PlayerID client_playas;                         // As which player is this client playing (PlayerID)
    63 	uint32 client_ip;                               // IP-address of the client (so he can be banned)
    63 	uint32 client_ip;                               // IP-address of the client (so he can be banned)
    64 	Date join_date;                                 // Gamedate the player has joined
    64 	Date join_date;                                 // Gamedate the player has joined
    65 	char unique_id[NETWORK_NAME_LENGTH];            // Every play sends an unique id so we can indentify him
    65 	char unique_id[NETWORK_NAME_LENGTH];            // Every play sends an unique id so we can indentify him
    66 } NetworkClientInfo;
    66 };
    67 
    67 
    68 typedef enum {
    68 enum NetworkJoinStatus {
    69 	NETWORK_JOIN_STATUS_CONNECTING,
    69 	NETWORK_JOIN_STATUS_CONNECTING,
    70 	NETWORK_JOIN_STATUS_AUTHORIZING,
    70 	NETWORK_JOIN_STATUS_AUTHORIZING,
    71 	NETWORK_JOIN_STATUS_WAITING,
    71 	NETWORK_JOIN_STATUS_WAITING,
    72 	NETWORK_JOIN_STATUS_DOWNLOADING,
    72 	NETWORK_JOIN_STATUS_DOWNLOADING,
    73 	NETWORK_JOIN_STATUS_PROCESSING,
    73 	NETWORK_JOIN_STATUS_PROCESSING,
    74 	NETWORK_JOIN_STATUS_REGISTERING,
    74 	NETWORK_JOIN_STATUS_REGISTERING,
    75 
    75 
    76 	NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
    76 	NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
    77 } NetworkJoinStatus;
    77 };
    78 
    78 
    79 // language ids for server_lang and client_lang
    79 // language ids for server_lang and client_lang
    80 typedef enum {
    80 enum NetworkLanguage {
    81 	NETLANG_ANY     = 0,
    81 	NETLANG_ANY     = 0,
    82 	NETLANG_ENGLISH = 1,
    82 	NETLANG_ENGLISH = 1,
    83 	NETLANG_GERMAN  = 2,
    83 	NETLANG_GERMAN  = 2,
    84 	NETLANG_FRENCH  = 3,
    84 	NETLANG_FRENCH  = 3,
    85 } NetworkLanguage;
    85 };
    86 
    86 
    87 VARDEF NetworkGameInfo _network_game_info;
    87 VARDEF NetworkGameInfo _network_game_info;
    88 VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
    88 VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
    89 VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
    89 VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
    90 
    90