# network_type.h

Go to the documentation of this file.

    00001 /* $Id: network_type.h 18809 2010-01-15 16:41:15Z rubidium $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef NETWORK_TYPE_H
    00013 #define NETWORK_TYPE_H
    00014
    00015 #include "core/game.h"
    00016
    00017 #ifdef ENABLE_NETWORK
    00018
    00019 enum {
    00021   MAX_CLIENTS = 255,
    00022
    00028   MAX_CLIENT_SLOTS = 256,
    00029
    00031   NETWORK_VEHICLE_TYPES = 5,
    00032   NETWORK_STATION_TYPES = 5,
    00033 };
    00034
    00036 enum ClientID {
    00037   INVALID_CLIENT_ID = 0,
    00038   CLIENT_ID_SERVER  = 1,
    00039   CLIENT_ID_FIRST   = 2,
    00040 };
    00041
    00043 typedef uint8 ClientIndex;
    00044
    00046 struct NetworkCompanyStats {
    00047   uint16 num_vehicle[NETWORK_VEHICLE_TYPES];
    00048   uint16 num_station[NETWORK_STATION_TYPES];
    00049   bool ai;
    00050 };
    00051
    00053 struct NetworkCompanyState {
    00054   char password[NETWORK_PASSWORD_LENGTH];
    00055   uint16 months_empty;
    00056 };
    00057
    00058 struct NetworkClientInfo;
    00059
    00060 enum NetworkPasswordType {
    00061   NETWORK_GAME_PASSWORD,
    00062   NETWORK_COMPANY_PASSWORD,
    00063 };
    00064
    00065 enum DestType {
    00066   DESTTYPE_BROADCAST,
    00067   DESTTYPE_TEAM,
    00068   DESTTYPE_CLIENT,
    00069 };
    00070
    00072 enum NetworkAction {
    00073   NETWORK_ACTION_JOIN,
    00074   NETWORK_ACTION_LEAVE,
    00075   NETWORK_ACTION_SERVER_MESSAGE,
    00076   NETWORK_ACTION_CHAT,
    00077   NETWORK_ACTION_CHAT_COMPANY,
    00078   NETWORK_ACTION_CHAT_CLIENT,
    00079   NETWORK_ACTION_GIVE_MONEY,
    00080   NETWORK_ACTION_NAME_CHANGE,
    00081   NETWORK_ACTION_COMPANY_SPECTATOR,
    00082   NETWORK_ACTION_COMPANY_JOIN,
    00083   NETWORK_ACTION_COMPANY_NEW,
    00084 };
    00085
    00086 enum NetworkErrorCode {
    00087   NETWORK_ERROR_GENERAL, // Try to use this one like never
    00088
    00089   /* Signals from clients */
    00090   NETWORK_ERROR_DESYNC,
    00091   NETWORK_ERROR_SAVEGAME_FAILED,
    00092   NETWORK_ERROR_CONNECTION_LOST,
    00093   NETWORK_ERROR_ILLEGAL_PACKET,
    00094   NETWORK_ERROR_NEWGRF_MISMATCH,
    00095
    00096   /* Signals from servers */
    00097   NETWORK_ERROR_NOT_AUTHORIZED,
    00098   NETWORK_ERROR_NOT_EXPECTED,
    00099   NETWORK_ERROR_WRONG_REVISION,
    00100   NETWORK_ERROR_NAME_IN_USE,
    00101   NETWORK_ERROR_WRONG_PASSWORD,
    00102   NETWORK_ERROR_COMPANY_MISMATCH, // Happens in CLIENT_COMMAND
    00103   NETWORK_ERROR_KICKED,
    00104   NETWORK_ERROR_CHEATER,
    00105   NETWORK_ERROR_FULL,
    00106 };
    00107
    00108 #endif /* ENABLE_NETWORK */
    00109 #endif /* NETWORK_TYPE_H */