Files
@ r3478:523ece58cb16
Branch filter:
Location: cpp/openttd-patchpack/source/network.h - annotation
r3478:523ece58cb16
9.9 KiB
text/x-c
(svn r4323) -Regression: Clear the slot assignments of all vehicles heading twoards a road stop if that road stop gets removed
This issue was fixed in r2210 and reintroduced in r4259 when the multistop handling was overhauled.
This issue was fixed in r2210 and reintroduced in r4259 when the multistop handling was overhauled.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r211:4c75b0bae589 r211:4c75b0bae589 r211:4c75b0bae589 r663:a23aa2eec081 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r2153:b45e3461c6c4 r2153:b45e3461c6c4 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r668:c0236804c7cc r668:c0236804c7cc r668:c0236804c7cc r668:c0236804c7cc r668:c0236804c7cc r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r1026:26bcb9a458ed r1026:26bcb9a458ed r1026:26bcb9a458ed r1026:26bcb9a458ed r1026:26bcb9a458ed r1026:26bcb9a458ed r1026:26bcb9a458ed r1026:26bcb9a458ed r2071:5fee74696551 r2071:5fee74696551 r1026:26bcb9a458ed r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r211:4c75b0bae589 r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2881:c5bcb1dd0332 r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2944:25bed4e89f1d r2879:e5a04d608a3a r2944:25bed4e89f1d r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r2879:e5a04d608a3a r211:4c75b0bae589 r211:4c75b0bae589 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r1011:51e33a299a51 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r690:f69eb4b03951 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r543:efdb197f91ad r211:4c75b0bae589 r211:4c75b0bae589 r543:efdb197f91ad r211:4c75b0bae589 r211:4c75b0bae589 r543:efdb197f91ad r738:f65fde6f029e r543:efdb197f91ad r211:4c75b0bae589 r211:4c75b0bae589 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r670:64201ee8a65e r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r602:2cc515e0a01e r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r2079:7352903b4b15 r2079:7352903b4b15 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r3152:7cbfb2f5d335 r629:806084a01de5 r629:806084a01de5 r629:806084a01de5 r629:806084a01de5 r629:806084a01de5 r543:efdb197f91ad r543:efdb197f91ad r1026:26bcb9a458ed r1026:26bcb9a458ed r1026:26bcb9a458ed r3173:acfc19891f47 r3173:acfc19891f47 r1602:d98995321539 r1026:26bcb9a458ed r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r764:b278ee9c19c0 r764:b278ee9c19c0 r668:c0236804c7cc r2861:2a5e8951e185 r2861:2a5e8951e185 r764:b278ee9c19c0 r668:c0236804c7cc r690:f69eb4b03951 r690:f69eb4b03951 r690:f69eb4b03951 r690:f69eb4b03951 r785:98d70fb62afe r785:98d70fb62afe r1329:88de95f6e7d3 r774:3e6bfb2226bd r2944:25bed4e89f1d r2944:25bed4e89f1d r3041:6dced19ef528 r3041:6dced19ef528 r3041:6dced19ef528 r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r543:efdb197f91ad r211:4c75b0bae589 r1329:88de95f6e7d3 r543:efdb197f91ad r1329:88de95f6e7d3 r1093:18f56ef2d029 r1739:7cb77e0b4dd1 r228:7c3d0bd71799 r211:4c75b0bae589 | /* $Id$ */
#ifndef NETWORK_H
#define NETWORK_H
#define NOREV_STRING "norev000"
#ifdef ENABLE_NETWORK
#include "player.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
// frames. You can enable this if you have a lot of desyncs on a certain
// game.
// Remember: both client and server have to be compiled with this
// option enabled to make it to work. If one of the two has it disabled
// nothing will happen.
//#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.
//#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)
// Do not change this next line. It should _ALWAYS_ be MAX_CLIENTS + 1
#define MAX_CLIENT_INFO (MAX_CLIENTS + 1)
/* Stuff for the master-server */
#define NETWORK_MASTER_SERVER_PORT 3978
#define NETWORK_MASTER_SERVER_HOST "master.openttd.org"
#define NETWORK_MASTER_SERVER_WELCOME_MESSAGE "OpenTTDRegister"
#define NETWORK_DEFAULT_PORT 3979
#define MAX_INTERFACES 9
// How many vehicle/station types we put over the network
#define NETWORK_VEHICLE_TYPES 5
#define NETWORK_STATION_TYPES 5
enum {
NETWORK_NAME_LENGTH = 80,
NETWORK_HOSTNAME_LENGTH = 80,
NETWORK_REVISION_LENGTH = 10,
NETWORK_PASSWORD_LENGTH = 20,
NETWORK_PLAYERS_LENGTH = 200,
NETWORK_CLIENT_NAME_LENGTH = 25,
NETWORK_RCONCOMMAND_LENGTH = 500,
NETWORK_NUM_LANGUAGES = 4,
};
// This is the struct used by both client and server
// some fields will be empty on the client (like game_password) by default
// and only filled with data a player enters.
typedef struct NetworkGameInfo {
char server_name[NETWORK_NAME_LENGTH]; // Server name
char hostname[NETWORK_HOSTNAME_LENGTH]; // Hostname of the server (if any)
char server_revision[NETWORK_REVISION_LENGTH]; // The SVN version number the server is using (e.g.: 'r304')
// It even shows a SVN version in release-version, so
// it is easy to compare if a server is of the correct version
bool compatible; // Can we connect to this server or not? (based on server_revision)
byte server_lang; // Language of the server (we should make a nice table for this)
byte use_password; // Is set to != 0 if it uses a password
char server_password[NETWORK_PASSWORD_LENGTH]; // On the server: the game password, on the client: != "" if server has password
byte clients_max; // Max clients allowed on server
byte clients_on; // Current count of clients on server
byte companies_max; // Max companies allowed on server
byte companies_on; // How many started companies do we have (XXX - disabled for server atm, use ActivePlayerCount())
byte spectators_max; // Max spectators allowed on server
byte spectators_on; // How many spectators do we have? (XXX - disabled for server atm, use NetworkSpectatorCount())
uint16 game_date; // Current date
uint16 start_date; // When the game started
char map_name[NETWORK_NAME_LENGTH]; // Map which is played ["random" for a randomized map]
uint16 map_width; // Map width
uint16 map_height; // Map height
byte map_set; // Graphical set
bool dedicated; // Is this a dedicated server?
char rcon_password[NETWORK_PASSWORD_LENGTH]; // RCon password for the server. "" if rcon is disabled
} NetworkGameInfo;
typedef struct NetworkPlayerInfo {
char company_name[NETWORK_NAME_LENGTH]; // Company name
char password[NETWORK_PASSWORD_LENGTH]; // The password for the player
byte inaugurated_year; // What year the company started in
int64 company_value; // The company value
int64 money; // The amount of money the company has
int64 income; // How much did the company earned last year
uint16 performance; // What was his performance last month?
byte use_password; // 0: No password 1: There is a password
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?
char players[NETWORK_PLAYERS_LENGTH]; // The players that control this company (Name1, name2, ..)
uint16 months_empty; // How many months the company is empty
} NetworkPlayerInfo;
typedef struct NetworkClientInfo {
uint16 client_index; /// Index of the client (same as ClientState->index)
char client_name[NETWORK_CLIENT_NAME_LENGTH]; /// Name of the client
byte client_lang; /// The language of the client
byte client_playas; /// As which player is this client playing (PlayerID)
uint32 client_ip; /// IP-address of the client (so he can be banned)
uint16 join_date; /// Gamedate the player has joined
char unique_id[NETWORK_NAME_LENGTH]; /// Every play sends an unique id so we can indentify him
} NetworkClientInfo;
typedef struct NetworkGameList {
NetworkGameInfo info;
uint32 ip;
uint16 port;
bool online; // False if the server did not respond (default status)
bool manually; // True if the server was added manually
struct NetworkGameList *next;
} NetworkGameList;
typedef enum {
NETWORK_JOIN_STATUS_CONNECTING,
NETWORK_JOIN_STATUS_AUTHORIZING,
NETWORK_JOIN_STATUS_WAITING,
NETWORK_JOIN_STATUS_DOWNLOADING,
NETWORK_JOIN_STATUS_PROCESSING,
NETWORK_JOIN_STATUS_REGISTERING,
NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
} NetworkJoinStatus;
// language ids for server_lang and client_lang
typedef enum {
NETLANG_ANY = 0,
NETLANG_ENGLISH = 1,
NETLANG_GERMAN = 2,
NETLANG_FRENCH = 3,
} NetworkLanguage;
VARDEF NetworkGameList *_network_game_list;
VARDEF NetworkGameInfo _network_game_info;
VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
VARDEF char _network_player_name[NETWORK_NAME_LENGTH];
VARDEF char _network_default_ip[NETWORK_HOSTNAME_LENGTH];
VARDEF uint16 _network_own_client_index;
VARDEF char _network_unique_id[NETWORK_NAME_LENGTH]; // Our own unique ID
VARDEF uint32 _frame_counter_server; // The frame_counter of the server, if in network-mode
VARDEF uint32 _frame_counter_max; // To where we may go with our clients
VARDEF uint32 _last_sync_frame; // Used in the server to store the last time a sync packet was sent to clients.
// networking settings
VARDEF uint32 _network_ip_list[MAX_INTERFACES + 1]; // Network IPs
VARDEF uint16 _network_server_port;
/* We use bind_ip and bind_ip_host, where bind_ip_host is the readable form of
bind_ip_host, and bind_ip the numeric value, because we want a nice number
in the openttd.cfg, but we wants to use the uint32 internally.. */
VARDEF uint32 _network_server_bind_ip;
VARDEF char _network_server_bind_ip_host[NETWORK_HOSTNAME_LENGTH];
VARDEF bool _is_network_server; // Does this client wants to be a network-server?
VARDEF char _network_server_name[NETWORK_NAME_LENGTH];
VARDEF char _network_server_password[NETWORK_PASSWORD_LENGTH];
VARDEF char _network_rcon_password[NETWORK_PASSWORD_LENGTH];
VARDEF uint16 _network_max_join_time; ///< Time a client can max take to join
VARDEF bool _network_pause_on_join; ///< Pause the game when a client tries to join (more chance of succeeding join)
VARDEF uint16 _redirect_console_to_client;
VARDEF uint16 _network_sync_freq;
VARDEF uint8 _network_frame_freq;
VARDEF uint32 _sync_seed_1, _sync_seed_2;
VARDEF uint32 _sync_frame;
VARDEF bool _network_first_time;
// Vars needed for the join-GUI
VARDEF NetworkJoinStatus _network_join_status;
VARDEF uint8 _network_join_waiting;
VARDEF uint16 _network_join_kbytes;
VARDEF uint16 _network_join_kbytes_total;
VARDEF char _network_last_host[NETWORK_HOSTNAME_LENGTH];
VARDEF short _network_last_port;
VARDEF uint32 _network_last_host_ip;
VARDEF uint8 _network_reconnect;
VARDEF bool _network_udp_server;
VARDEF uint16 _network_udp_broadcast;
VARDEF byte _network_lan_internet;
VARDEF bool _network_advertise;
VARDEF bool _network_need_advertise;
VARDEF uint32 _network_last_advertise_frame;
VARDEF uint8 _network_advertise_retries;
VARDEF bool _network_autoclean_companies;
VARDEF uint8 _network_autoclean_unprotected; // Remove a company after X months
VARDEF uint8 _network_autoclean_protected; // Unprotect a company after X months
VARDEF uint16 _network_restart_game_date; // If this year is reached, the server automaticly restarts
NetworkGameList *NetworkQueryServer(const char* host, unsigned short port, bool game_info);
byte NetworkSpectatorCount(void);
VARDEF char *_network_host_list[10];
VARDEF char *_network_ban_list[25];
#endif /* ENABLE_NETWORK */
// Those variables must always be registered!
VARDEF bool _networking;
VARDEF bool _network_available; // is network mode available?
VARDEF bool _network_server; // network-server is active
VARDEF bool _network_dedicated; // are we a dedicated server?
VARDEF byte _network_playas; // an id to play as..
void ParseConnectionString(const char **player, const char **port, char *connection_string);
void NetworkUpdateClientInfo(uint16 client_index);
void NetworkAddServer(const char *b);
void NetworkRebuildHostList(void);
bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
#endif /* NETWORK_H */
|