# network_type.h

Go to the documentation of this file.

    00001 /* $Id: network_type.h 15242 2009-01-23 22:18:06Z rubidium $ */
    00002
    00005 #ifndef NETWORK_TYPE_H
    00006 #define NETWORK_TYPE_H
    00007
    00008 #ifdef ENABLE_NETWORK
    00009
    00010 #include "../company_type.h"
    00011 #include "../economy_type.h"
    00012 #include "core/config.h"
    00013 #include "core/game.h"
    00014
    00015 enum {
    00017   MAX_CLIENTS = 255,
    00018
    00020   NCI_BITS_PER_POOL_BLOCK = 3, // => 8 items per block
    00027   MAX_CLIENT_SLOTS = 256,
    00028
    00030   MAX_INTERFACES = 9,
    00031
    00033   NETWORK_VEHICLE_TYPES = 5,
    00034   NETWORK_STATION_TYPES = 5,
    00035 };
    00036
    00038 enum ClientID {
    00039   INVALID_CLIENT_ID = 0,
    00040   CLIENT_ID_SERVER  = 1,
    00041   CLIENT_ID_FIRST   = 2,
    00042 };
    00043
    00045 typedef uint8 ClientIndex;
    00046
    00048 struct NetworkCompanyStats {
    00049   uint16 num_vehicle[NETWORK_VEHICLE_TYPES];
    00050   uint16 num_station[NETWORK_STATION_TYPES];
    00051   bool ai;
    00052 };
    00053
    00055 struct NetworkCompanyState {
    00056   char password[NETWORK_PASSWORD_LENGTH];
    00057   uint16 months_empty;
    00058 };
    00059
    00060 struct NetworkClientInfo;
    00061
    00062 enum NetworkPasswordType {
    00063   NETWORK_GAME_PASSWORD,
    00064   NETWORK_COMPANY_PASSWORD,
    00065 };
    00066
    00067 enum DestType {
    00068   DESTTYPE_BROADCAST,
    00069   DESTTYPE_TEAM,
    00070   DESTTYPE_CLIENT,
    00071 };
    00072
    00074 enum NetworkAction {
    00075   NETWORK_ACTION_JOIN,
    00076   NETWORK_ACTION_LEAVE,
    00077   NETWORK_ACTION_SERVER_MESSAGE,
    00078   NETWORK_ACTION_CHAT,
    00079   NETWORK_ACTION_CHAT_COMPANY,
    00080   NETWORK_ACTION_CHAT_CLIENT,
    00081   NETWORK_ACTION_GIVE_MONEY,
    00082   NETWORK_ACTION_NAME_CHANGE,
    00083   NETWORK_ACTION_COMPANY_SPECTATOR,
    00084   NETWORK_ACTION_COMPANY_JOIN,
    00085   NETWORK_ACTION_COMPANY_NEW,
    00086 };
    00087
    00089 enum NetworkServerMessage {
    00090   NETWORK_SERVER_MESSAGE_GAME_PAUSED_PLAYERS,
    00091   NETWORK_SERVER_MESSAGE_GAME_UNPAUSED_PLAYERS,
    00092   NETWORK_SERVER_MESSAGE_GAME_PAUSED_CONNECT,
    00093   NETWORK_SERVER_MESSAGE_GAME_UNPAUSED_CONNECT,
    00094   NETWORK_SERVER_MESSAGE_GAME_UNPAUSED_CONNECT_FAIL,
    00095   NETWORK_SERVER_MESSAGE_END
    00096 };
    00097
    00098 enum NetworkErrorCode {
    00099   NETWORK_ERROR_GENERAL, // Try to use this one like never
    00100
    00101   /* Signals from clients */
    00102   NETWORK_ERROR_DESYNC,
    00103   NETWORK_ERROR_SAVEGAME_FAILED,
    00104   NETWORK_ERROR_CONNECTION_LOST,
    00105   NETWORK_ERROR_ILLEGAL_PACKET,
    00106   NETWORK_ERROR_NEWGRF_MISMATCH,
    00107
    00108   /* Signals from servers */
    00109   NETWORK_ERROR_NOT_AUTHORIZED,
    00110   NETWORK_ERROR_NOT_EXPECTED,
    00111   NETWORK_ERROR_WRONG_REVISION,
    00112   NETWORK_ERROR_NAME_IN_USE,
    00113   NETWORK_ERROR_WRONG_PASSWORD,
    00114   NETWORK_ERROR_COMPANY_MISMATCH, // Happens in CLIENT_COMMAND
    00115   NETWORK_ERROR_KICKED,
    00116   NETWORK_ERROR_CHEATER,
    00117   NETWORK_ERROR_FULL,
    00118 };
    00119
    00120 #endif /* ENABLE_NETWORK */
    00121 #endif /* NETWORK_TYPE_H */