# network_type.h

Go to the documentation of this file.

    00001 /* $Id: network_type.h 18052 2009-11-12 20:33:30Z 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 "../company_type.h"
    00016 #include "../economy_type.h"
    00017 #include "core/config.h"
    00018 #include "core/game.h"
    00019
    00020 #ifdef ENABLE_NETWORK
    00021
    00022 enum {
    00024   MAX_CLIENTS = 255,
    00025
    00031   MAX_CLIENT_SLOTS = 256,
    00032
    00034   NETWORK_VEHICLE_TYPES = 5,
    00035   NETWORK_STATION_TYPES = 5,
    00036 };
    00037
    00039 enum ClientID {
    00040   INVALID_CLIENT_ID = 0,
    00041   CLIENT_ID_SERVER  = 1,
    00042   CLIENT_ID_FIRST   = 2,
    00043 };
    00044
    00046 typedef uint8 ClientIndex;
    00047
    00049 struct NetworkCompanyStats {
    00050   uint16 num_vehicle[NETWORK_VEHICLE_TYPES];
    00051   uint16 num_station[NETWORK_STATION_TYPES];
    00052   bool ai;
    00053 };
    00054
    00056 struct NetworkCompanyState {
    00057   char password[NETWORK_PASSWORD_LENGTH];
    00058   uint16 months_empty;
    00059 };
    00060
    00061 struct NetworkClientInfo;
    00062
    00063 enum NetworkPasswordType {
    00064   NETWORK_GAME_PASSWORD,
    00065   NETWORK_COMPANY_PASSWORD,
    00066 };
    00067
    00068 enum DestType {
    00069   DESTTYPE_BROADCAST,
    00070   DESTTYPE_TEAM,
    00071   DESTTYPE_CLIENT,
    00072 };
    00073
    00075 enum NetworkAction {
    00076   NETWORK_ACTION_JOIN,
    00077   NETWORK_ACTION_LEAVE,
    00078   NETWORK_ACTION_SERVER_MESSAGE,
    00079   NETWORK_ACTION_CHAT,
    00080   NETWORK_ACTION_CHAT_COMPANY,
    00081   NETWORK_ACTION_CHAT_CLIENT,
    00082   NETWORK_ACTION_GIVE_MONEY,
    00083   NETWORK_ACTION_NAME_CHANGE,
    00084   NETWORK_ACTION_COMPANY_SPECTATOR,
    00085   NETWORK_ACTION_COMPANY_JOIN,
    00086   NETWORK_ACTION_COMPANY_NEW,
    00087 };
    00088
    00089 enum NetworkErrorCode {
    00090   NETWORK_ERROR_GENERAL, // Try to use this one like never
    00091
    00092   /* Signals from clients */
    00093   NETWORK_ERROR_DESYNC,
    00094   NETWORK_ERROR_SAVEGAME_FAILED,
    00095   NETWORK_ERROR_CONNECTION_LOST,
    00096   NETWORK_ERROR_ILLEGAL_PACKET,
    00097   NETWORK_ERROR_NEWGRF_MISMATCH,
    00098
    00099   /* Signals from servers */
    00100   NETWORK_ERROR_NOT_AUTHORIZED,
    00101   NETWORK_ERROR_NOT_EXPECTED,
    00102   NETWORK_ERROR_WRONG_REVISION,
    00103   NETWORK_ERROR_NAME_IN_USE,
    00104   NETWORK_ERROR_WRONG_PASSWORD,
    00105   NETWORK_ERROR_COMPANY_MISMATCH, // Happens in CLIENT_COMMAND
    00106   NETWORK_ERROR_KICKED,
    00107   NETWORK_ERROR_CHEATER,
    00108   NETWORK_ERROR_FULL,
    00109 };
    00110
    00111 #endif /* ENABLE_NETWORK */
    00112 #endif /* NETWORK_TYPE_H */