src/network/network.h
branchNewGRF_ports
changeset 6720 35756db7e577
parent 6574 e1d1a12faaf7
child 6870 ca3fd1fbe311
equal deleted inserted replaced
6719:4cc327ad39d5 6720:35756db7e577
    18 // Remember: both client and server have to be compiled with this
    18 // Remember: both client and server have to be compiled with this
    19 //  option enabled to make it to work. If one of the two has it disabled
    19 //  option enabled to make it to work. If one of the two has it disabled
    20 //  nothing will happen.
    20 //  nothing will happen.
    21 //#define ENABLE_NETWORK_SYNC_EVERY_FRAME
    21 //#define ENABLE_NETWORK_SYNC_EVERY_FRAME
    22 
    22 
       
    23 /*
       
    24  * Dumps all commands that are sent/received to stderr and saves every month.
       
    25  * This log can become quite large over time; say in the order of two to three
       
    26  * times the bandwidth used for network games.
       
    27  */
       
    28 //#define DEBUG_DUMP_COMMANDS
       
    29 
       
    30 #ifdef DEBUG_DUMP_COMMANDS
       
    31 void CDECL debug_dump_commands(const char *s, ...);
       
    32 #endif /* DEBUG_DUMP_COMMANDS */
       
    33 
    23 // In theory sending 1 of the 2 seeds is enough to check for desyncs
    34 // In theory sending 1 of the 2 seeds is enough to check for desyncs
    24 //   so in theory, this next define can be left off.
    35 //   so in theory, this next define can be left off.
    25 //#define NETWORK_SEND_DOUBLE_SEED
    36 //#define NETWORK_SEND_DOUBLE_SEED
    26 
    37 
    27 // How many clients can we have? Like.. MAX_PLAYERS - 1 is the amount of
    38 // How many clients can we have? Like.. MAX_PLAYERS - 1 is the amount of
    42 
    53 
    43 struct NetworkPlayerInfo {
    54 struct NetworkPlayerInfo {
    44 	char company_name[NETWORK_NAME_LENGTH];         // Company name
    55 	char company_name[NETWORK_NAME_LENGTH];         // Company name
    45 	char password[NETWORK_PASSWORD_LENGTH];         // The password for the player
    56 	char password[NETWORK_PASSWORD_LENGTH];         // The password for the player
    46 	Year inaugurated_year;                          // What year the company started in
    57 	Year inaugurated_year;                          // What year the company started in
    47 	int64 company_value;                            // The company value
    58 	Money company_value;                            // The company value
    48 	int64 money;                                    // The amount of money the company has
    59 	Money money;                                    // The amount of money the company has
    49 	int64 income;                                   // How much did the company earned last year
    60 	Money income;                                   // How much did the company earned last year
    50 	uint16 performance;                             // What was his performance last month?
    61 	uint16 performance;                             // What was his performance last month?
    51 	bool use_password;                              // Is there a password
    62 	bool use_password;                              // Is there a password
    52 	uint16 num_vehicle[NETWORK_VEHICLE_TYPES];      // How many vehicles are there of this type?
    63 	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?
    64 	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, ..)
    65 	char players[NETWORK_PLAYERS_LENGTH];           // The players that control this company (Name1, name2, ..)
    74 	NETWORK_JOIN_STATUS_REGISTERING,
    85 	NETWORK_JOIN_STATUS_REGISTERING,
    75 
    86 
    76 	NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
    87 	NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
    77 };
    88 };
    78 
    89 
    79 // language ids for server_lang and client_lang
    90 /* Language ids for server_lang and client_lang. Do NOT modify the order. */
    80 enum NetworkLanguage {
    91 enum NetworkLanguage {
    81 	NETLANG_ANY     = 0,
    92 	NETLANG_ANY = 0,
    82 	NETLANG_ENGLISH = 1,
    93 	NETLANG_ENGLISH,
    83 	NETLANG_GERMAN  = 2,
    94 	NETLANG_GERMAN,
    84 	NETLANG_FRENCH  = 3,
    95 	NETLANG_FRENCH,
       
    96 	NETLANG_BRAZILIAN,
       
    97 	NETLANG_BULGARIAN,
       
    98 	NETLANG_CHINESE,
       
    99 	NETLANG_CZECH,
       
   100 	NETLANG_DANISH,
       
   101 	NETLANG_DUTCH,
       
   102 	NETLANG_ESPERANTO,
       
   103 	NETLANG_FINNISH,
       
   104 	NETLANG_HUNGARIAN,
       
   105 	NETLANG_ICELANDIC,
       
   106 	NETLANG_ITALIAN,
       
   107 	NETLANG_JAPANESE,
       
   108 	NETLANG_KOREAN,
       
   109 	NETLANG_LITHUANIAN,
       
   110 	NETLANG_NORWEGIAN,
       
   111 	NETLANG_POLISH,
       
   112 	NETLANG_PORTUGUESE,
       
   113 	NETLANG_ROMANIAN,
       
   114 	NETLANG_RUSSIAN,
       
   115 	NETLANG_SLOVAK,
       
   116 	NETLANG_SLOVENIAN,
       
   117 	NETLANG_SPANISH,
       
   118 	NETLANG_SWEDISH,
       
   119 	NETLANG_TURKISH,
       
   120 	NETLANG_UKRAINIAN,
       
   121 	NETLANG_COUNT
    85 };
   122 };
    86 
   123 
    87 VARDEF NetworkGameInfo _network_game_info;
   124 VARDEF NetworkGameInfo _network_game_info;
    88 VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
   125 VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
    89 VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
   126 VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];