(svn r12499) -Codechange: some coding style tweaks for network_internal.h.

This commit is contained in:
rubidium 2008-03-31 07:11:18 +00:00
parent 7c759731dc
commit b1e1c13420
4 changed files with 75 additions and 49 deletions

View File

@ -932,7 +932,7 @@
> >
</File> </File>
<File <File
RelativePath=".\..\src\engine.h" RelativePath=".\..\src\engine_func.h"
> >
</File> </File>
<File <File
@ -1192,7 +1192,11 @@
> >
</File> </File>
<File <File
RelativePath=".\..\src\order.h" RelativePath=".\..\src\order_base.h"
>
</File>
<File
RelativePath=".\..\src\order_func.h"
> >
</File> </File>
<File <File
@ -1344,7 +1348,11 @@
> >
</File> </File>
<File <File
RelativePath=".\..\src\station.h" RelativePath=".\..\src\station_base.h"
>
</File>
<File
RelativePath=".\..\src\station_func.h"
> >
</File> </File>
<File <File

View File

@ -929,7 +929,7 @@
> >
</File> </File>
<File <File
RelativePath=".\..\src\engine.h" RelativePath=".\..\src\engine_func.h"
> >
</File> </File>
<File <File
@ -1189,7 +1189,11 @@
> >
</File> </File>
<File <File
RelativePath=".\..\src\order.h" RelativePath=".\..\src\order_base.h"
>
</File>
<File
RelativePath=".\..\src\order_func.h"
> >
</File> </File>
<File <File
@ -1341,7 +1345,11 @@
> >
</File> </File>
<File <File
RelativePath=".\..\src\station.h" RelativePath=".\..\src\station_base.h"
>
</File>
<File
RelativePath=".\..\src\station_func.h"
> >
</File> </File>
<File <File

View File

@ -141,7 +141,7 @@ widgets/dropdown_type.h
economy_func.h economy_func.h
economy_type.h economy_type.h
core/endian_func.hpp core/endian_func.hpp
engine.h engine_func.h
engine_type.h engine_type.h
core/enum_type.hpp core/enum_type.hpp
fileio.h fileio.h
@ -206,7 +206,8 @@ sound/null_s.h
video/null_v.h video/null_v.h
oldpool.h oldpool.h
openttd.h openttd.h
order.h order_base.h
order_func.h
order_type.h order_type.h
core/overflowsafe_type.hpp core/overflowsafe_type.hpp
pathfind.h pathfind.h
@ -244,7 +245,8 @@ sound_func.h
sound_type.h sound_type.h
sprite.h sprite.h
spritecache.h spritecache.h
station.h station_base.h
station_func.h
station_gui.h station_gui.h
station_type.h station_type.h
stdafx.h stdafx.h

View File

@ -10,58 +10,66 @@
#include "core/config.h" #include "core/config.h"
#include "core/game.h" #include "core/game.h"
// If this line is enable, every frame will have a sync test /**
// this is not needed in normal games. Normal is like 1 sync in 100 * If this line is enable, every frame will have a sync test
// frames. You can enable this if you have a lot of desyncs on a certain * this is not needed in normal games. Normal is like 1 sync in 100
// game. * frames. You can enable this if you have a lot of desyncs on a certain
// Remember: both client and server have to be compiled with this * game.
// option enabled to make it to work. If one of the two has it disabled * Remember: both client and server have to be compiled with this
// nothing will happen. * option enabled to make it to work. If one of the two has it disabled
* nothing will happen.
*/
//#define ENABLE_NETWORK_SYNC_EVERY_FRAME //#define ENABLE_NETWORK_SYNC_EVERY_FRAME
// In theory sending 1 of the 2 seeds is enough to check for desyncs /**
// so in theory, this next define can be left off. * In theory sending 1 of the 2 seeds is enough to check for desyncs
* so in theory, this next define can be left off.
*/
//#define NETWORK_SEND_DOUBLE_SEED //#define NETWORK_SEND_DOUBLE_SEED
// How many clients can we have? Like.. MAX_PLAYERS - 1 is the amount of
// players that can really play.. so.. a max of 4 spectators.. gives us..
// MAX_PLAYERS + 3
#define MAX_CLIENTS (MAX_PLAYERS + 3)
enum {
/**
* How many clients can we have? Like.. MAX_PLAYERS - 1 is the amount of
* players that can really play.. so.. a max of 4 spectators.. gives us..
* MAX_PLAYERS + 3
*/
MAX_CLIENTS = MAX_PLAYERS + 3,
// Do not change this next line. It should _ALWAYS_ be MAX_CLIENTS + 1 /** Do not change this next line. It should _ALWAYS_ be MAX_CLIENTS + 1 */
#define MAX_CLIENT_INFO (MAX_CLIENTS + 1) MAX_CLIENT_INFO = MAX_CLIENTS + 1,
#define MAX_INTERFACES 9 /** Maximum number of internet interfaces supported. */
MAX_INTERFACES = 9,
/** How many vehicle/station types we put over the network */
// How many vehicle/station types we put over the network NETWORK_VEHICLE_TYPES = 5,
#define NETWORK_VEHICLE_TYPES 5 NETWORK_STATION_TYPES = 5,
#define NETWORK_STATION_TYPES 5 }
struct NetworkPlayerInfo { struct NetworkPlayerInfo {
char company_name[NETWORK_NAME_LENGTH]; // Company name char company_name[NETWORK_NAME_LENGTH]; ///< Company name
char password[NETWORK_PASSWORD_LENGTH]; // The password for the player char password[NETWORK_PASSWORD_LENGTH]; ///< The password for the player
Year inaugurated_year; // What year the company started in Year inaugurated_year; ///< What year the company started in
Money company_value; // The company value Money company_value; ///< The company value
Money money; // The amount of money the company has Money money; ///< The amount of money the company has
Money income; // How much did the company earned last year Money income; ///< How much did the company earned last year
uint16 performance; // What was his performance last month? uint16 performance; ///< What was his performance last month?
bool use_password; // Is there a password bool use_password; ///< Is there a password
uint16 num_vehicle[NETWORK_VEHICLE_TYPES]; // How many vehicles are there of this type? uint16 num_vehicle[NETWORK_VEHICLE_TYPES]; ///< How many vehicles are there of this type?
uint16 num_station[NETWORK_STATION_TYPES]; // How many stations are there of this type? uint16 num_station[NETWORK_STATION_TYPES]; ///< How many stations are there of this type?
char players[NETWORK_PLAYERS_LENGTH]; // The players that control this company (Name1, name2, ..) char players[NETWORK_PLAYERS_LENGTH]; ///< The players that control this company (Name1, name2, ..)
uint16 months_empty; // How many months the company is empty uint16 months_empty; ///< How many months the company is empty
}; };
struct NetworkClientInfo { struct NetworkClientInfo {
uint16 client_index; // Index of the client (same as ClientState->index) uint16 client_index; ///< Index of the client (same as ClientState->index)
char client_name[NETWORK_CLIENT_NAME_LENGTH]; // Name of the client char client_name[NETWORK_CLIENT_NAME_LENGTH]; ///< Name of the client
byte client_lang; // The language of the client byte client_lang; ///< The language of the client
PlayerID client_playas; // As which player is this client playing (PlayerID) PlayerID client_playas; ///< As which player is this client playing (PlayerID)
uint32 client_ip; // IP-address of the client (so he can be banned) uint32 client_ip; ///< IP-address of the client (so he can be banned)
Date join_date; // Gamedate the player has joined Date join_date; ///< Gamedate the player has joined
char unique_id[NETWORK_UNIQUE_ID_LENGTH]; // Every play sends an unique id so we can indentify him char unique_id[NETWORK_UNIQUE_ID_LENGTH]; ///< Every play sends an unique id so we can indentify him
}; };
enum NetworkJoinStatus { enum NetworkJoinStatus {
@ -75,7 +83,7 @@ enum NetworkJoinStatus {
NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO, NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
}; };
/* Language ids for server_lang and client_lang. Do NOT modify the order. */ /** Language ids for server_lang and client_lang. Do NOT modify the order. */
enum NetworkLanguage { enum NetworkLanguage {
NETLANG_ANY = 0, NETLANG_ANY = 0,
NETLANG_ENGLISH, NETLANG_ENGLISH,