author | rubidium |
Mon, 18 Dec 2006 12:26:55 +0000 | |
changeset 5339 | 96ac3f4933bb |
parent 5034 | 611ac18ac2b5 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
211 | 3 |
#ifndef NETWORK_H |
4 |
#define NETWORK_H |
|
5 |
||
663
80c66fd07863
(svn r1098) -Fix: server without revision build doesn't care about the client's version. Also moved all revision things where it belongs (network.c)
darkvater
parents:
662
diff
changeset
|
6 |
#define NOREV_STRING "norev000" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
7 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
8 |
#ifdef ENABLE_NETWORK |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
9 |
|
2153
ecfc674410b4
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
2079
diff
changeset
|
10 |
#include "player.h" |
ecfc674410b4
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
2079
diff
changeset
|
11 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
12 |
// If this line is enable, every frame will have a sync test |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
13 |
// this is not needed in normal games. Normal is like 1 sync in 100 |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
14 |
// frames. You can enable this if you have a lot of desyncs on a certain |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
15 |
// game. |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
16 |
// Remember: both client and server have to be compiled with this |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
17 |
// option enabled to make it to work. If one of the two has it disabled |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
18 |
// nothing will happen. |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
19 |
//#define ENABLE_NETWORK_SYNC_EVERY_FRAME |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
20 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
21 |
// In theory sending 1 of the 2 seeds is enough to check for desyncs |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
22 |
// so in theory, this next define can be left off. |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
23 |
//#define NETWORK_SEND_DOUBLE_SEED |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
24 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
25 |
// How many clients can we have? Like.. MAX_PLAYERS - 1 is the amount of |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
26 |
// players that can really play.. so.. a max of 4 spectators.. gives us.. |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
27 |
// MAX_PLAYERS + 3 |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
28 |
#define MAX_CLIENTS (MAX_PLAYERS + 3) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
29 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
30 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
31 |
// Do not change this next line. It should _ALWAYS_ be MAX_CLIENTS + 1 |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
32 |
#define MAX_CLIENT_INFO (MAX_CLIENTS + 1) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
33 |
|
668
1fe298df8526
(svn r1106) -Add: [Network] Added master-server protocol and advertise to
truelight
parents:
663
diff
changeset
|
34 |
/* Stuff for the master-server */ |
1fe298df8526
(svn r1106) -Add: [Network] Added master-server protocol and advertise to
truelight
parents:
663
diff
changeset
|
35 |
#define NETWORK_MASTER_SERVER_PORT 3978 |
1fe298df8526
(svn r1106) -Add: [Network] Added master-server protocol and advertise to
truelight
parents:
663
diff
changeset
|
36 |
#define NETWORK_MASTER_SERVER_HOST "master.openttd.org" |
1fe298df8526
(svn r1106) -Add: [Network] Added master-server protocol and advertise to
truelight
parents:
663
diff
changeset
|
37 |
#define NETWORK_MASTER_SERVER_WELCOME_MESSAGE "OpenTTDRegister" |
1fe298df8526
(svn r1106) -Add: [Network] Added master-server protocol and advertise to
truelight
parents:
663
diff
changeset
|
38 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
39 |
#define NETWORK_DEFAULT_PORT 3979 |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
40 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
41 |
#define MAX_INTERFACES 9 |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
42 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
43 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
44 |
// How many vehicle/station types we put over the network |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
45 |
#define NETWORK_VEHICLE_TYPES 5 |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
46 |
#define NETWORK_STATION_TYPES 5 |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
47 |
|
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1011
diff
changeset
|
48 |
enum { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
49 |
NETWORK_NAME_LENGTH = 80, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
50 |
NETWORK_HOSTNAME_LENGTH = 80, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
51 |
NETWORK_REVISION_LENGTH = 15, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
52 |
NETWORK_PASSWORD_LENGTH = 20, |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1011
diff
changeset
|
53 |
NETWORK_PLAYERS_LENGTH = 200, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
54 |
NETWORK_CLIENT_NAME_LENGTH = 25, |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1011
diff
changeset
|
55 |
NETWORK_RCONCOMMAND_LENGTH = 500, |
2071
3083c580f4dc
(svn r2581) Fix: Behave a bit safer if central server sends bogus information about clients.
ludde
parents:
1812
diff
changeset
|
56 |
|
5339
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
57 |
NETWORK_GRF_NAME_LENGTH = 80, ///< Maximum length of the name of a GRF |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
58 |
/* Maximum number of GRFs that can be sent. |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
59 |
* This value is related to number of handles (files) OpenTTD can open. |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
60 |
* This is currently 64 and about 10 are currently used when OpenTTD loads |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
61 |
* without any NewGRFs. Therefore one can only load about 55 NewGRFs, so |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
62 |
* this is not a limit, but rather a way to easily check whether the limit |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
63 |
* imposed by the handle count is reached. Secondly it isn't possible to |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
64 |
* send much more GRF IDs + MD5sums in the PACKET_UDP_SERVER_RESPONSE, due |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
65 |
* to the limited size of UDP packets. */ |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
66 |
NETWORK_MAX_GRF_COUNT = 55, |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
67 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
68 |
NETWORK_NUM_LANGUAGES = 4, |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1011
diff
changeset
|
69 |
}; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
70 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
71 |
// This is the struct used by both client and server |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
72 |
// some fields will be empty on the client (like game_password) by default |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
73 |
// and only filled with data a player enters. |
211 | 74 |
typedef struct NetworkGameInfo { |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
75 |
char server_name[NETWORK_NAME_LENGTH]; // Server name |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
76 |
char hostname[NETWORK_HOSTNAME_LENGTH]; // Hostname of the server (if any) |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
77 |
char server_revision[NETWORK_REVISION_LENGTH]; // The SVN version number the server is using (e.g.: 'r304') |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
78 |
// It even shows a SVN version in release-version, so |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
79 |
// it is easy to compare if a server is of the correct version |
5339
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
80 |
bool version_compatible; // Can we connect to this server or not? (based on server_revision) |
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
81 |
bool compatible; // Can we connect to this server or not? (based on server_revision _and_ grf_match |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
82 |
byte server_lang; // Language of the server (we should make a nice table for this) |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
83 |
byte use_password; // Is set to != 0 if it uses a password |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
84 |
char server_password[NETWORK_PASSWORD_LENGTH]; // On the server: the game password, on the client: != "" if server has password |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
85 |
byte clients_max; // Max clients allowed on server |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
86 |
byte clients_on; // Current count of clients on server |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
87 |
byte companies_max; // Max companies allowed on server |
2944
2360b2da2bb0
(svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents:
2881
diff
changeset
|
88 |
byte companies_on; // How many started companies do we have (XXX - disabled for server atm, use ActivePlayerCount()) |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
89 |
byte spectators_max; // Max spectators allowed on server |
2944
2360b2da2bb0
(svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents:
2881
diff
changeset
|
90 |
byte spectators_on; // How many spectators do we have? (XXX - disabled for server atm, use NetworkSpectatorCount()) |
4289
8981ce44336d
(svn r5919) -Cleanup: use the type Date when the variable really is a date
rubidium
parents:
4285
diff
changeset
|
91 |
Date game_date; // Current date |
8981ce44336d
(svn r5919) -Cleanup: use the type Date when the variable really is a date
rubidium
parents:
4285
diff
changeset
|
92 |
Date start_date; // When the game started |
2879
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
93 |
char map_name[NETWORK_NAME_LENGTH]; // Map which is played ["random" for a randomized map] |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
94 |
uint16 map_width; // Map width |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
95 |
uint16 map_height; // Map height |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
96 |
byte map_set; // Graphical set |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
97 |
bool dedicated; // Is this a dedicated server? |
365ecd52f2db
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
Darkvater
parents:
2861
diff
changeset
|
98 |
char rcon_password[NETWORK_PASSWORD_LENGTH]; // RCon password for the server. "" if rcon is disabled |
5339
96ac3f4933bb
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5034
diff
changeset
|
99 |
struct GRFConfig *grfconfig; // List of NewGRF files required |
211 | 100 |
} NetworkGameInfo; |
101 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
102 |
typedef struct NetworkPlayerInfo { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
103 |
char company_name[NETWORK_NAME_LENGTH]; // Company name |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
104 |
char password[NETWORK_PASSWORD_LENGTH]; // The password for the player |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
105 |
Year inaugurated_year; // What year the company started in |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
106 |
int64 company_value; // The company value |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
107 |
int64 money; // The amount of money the company has |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
108 |
int64 income; // How much did the company earned last year |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
109 |
uint16 performance; // What was his performance last month? |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
110 |
byte use_password; // 0: No password 1: There is a password |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
111 |
uint16 num_vehicle[NETWORK_VEHICLE_TYPES]; // How many vehicles are there of this type? |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
112 |
uint16 num_station[NETWORK_STATION_TYPES]; // How many stations are there of this type? |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
113 |
char players[NETWORK_PLAYERS_LENGTH]; // The players that control this company (Name1, name2, ..) |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
114 |
uint16 months_empty; // How many months the company is empty |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
115 |
} NetworkPlayerInfo; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
116 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
117 |
typedef struct NetworkClientInfo { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
118 |
uint16 client_index; // Index of the client (same as ClientState->index) |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
119 |
char client_name[NETWORK_CLIENT_NAME_LENGTH]; // Name of the client |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
120 |
byte client_lang; // The language of the client |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
121 |
byte client_playas; // As which player is this client playing (PlayerID) |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
122 |
uint32 client_ip; // IP-address of the client (so he can be banned) |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
123 |
Date join_date; // Gamedate the player has joined |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
124 |
char unique_id[NETWORK_NAME_LENGTH]; // Every play sends an unique id so we can indentify him |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
125 |
} NetworkClientInfo; |
211 | 126 |
|
127 |
typedef struct NetworkGameList { |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
128 |
NetworkGameInfo info; |
211 | 129 |
uint32 ip; |
130 |
uint16 port; |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
131 |
bool online; // False if the server did not respond (default status) |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
132 |
bool manually; // True if the server was added manually |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
133 |
struct NetworkGameList *next; |
211 | 134 |
} NetworkGameList; |
135 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
136 |
typedef enum { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
137 |
NETWORK_JOIN_STATUS_CONNECTING, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
138 |
NETWORK_JOIN_STATUS_AUTHORIZING, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
139 |
NETWORK_JOIN_STATUS_WAITING, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
140 |
NETWORK_JOIN_STATUS_DOWNLOADING, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
141 |
NETWORK_JOIN_STATUS_PROCESSING, |
670
d164965bb35a
(svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents:
668
diff
changeset
|
142 |
NETWORK_JOIN_STATUS_REGISTERING, |
239 | 143 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
144 |
NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
145 |
} NetworkJoinStatus; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
146 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
147 |
// language ids for server_lang and client_lang |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
148 |
typedef enum { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
149 |
NETLANG_ANY = 0, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
150 |
NETLANG_ENGLISH = 1, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
151 |
NETLANG_GERMAN = 2, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
152 |
NETLANG_FRENCH = 3, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
153 |
} NetworkLanguage; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
154 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
155 |
VARDEF NetworkGameList *_network_game_list; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
156 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
157 |
VARDEF NetworkGameInfo _network_game_info; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
158 |
VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS]; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
159 |
VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO]; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
160 |
|
3623
9b612a4bbd39
(svn r4521) - Fix: be consistent about the size of the player-name in MP. This hopefully fixes a crash on lesser OS's (eg Win98). Use ttd_strlcpy() to just copy over strings and properly terminate them because different implementations of snprintf() behave differently. Courtesy of TrueLight
Darkvater
parents:
3173
diff
changeset
|
161 |
VARDEF char _network_player_name[NETWORK_CLIENT_NAME_LENGTH]; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
162 |
VARDEF char _network_default_ip[NETWORK_HOSTNAME_LENGTH]; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
163 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
164 |
VARDEF uint16 _network_own_client_index; |
602
f0afb4018788
(svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
600
diff
changeset
|
165 |
VARDEF char _network_unique_id[NETWORK_NAME_LENGTH]; // Our own unique ID |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
166 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
167 |
VARDEF uint32 _frame_counter_server; // The frame_counter of the server, if in network-mode |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
168 |
VARDEF uint32 _frame_counter_max; // To where we may go with our clients |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
169 |
|
2079
c9c32cf56cb9
(svn r2589) Fix: [network] Fixed static variable that wasn't initialized. Would stop the sync checking from working in some cases.
ludde
parents:
2071
diff
changeset
|
170 |
VARDEF uint32 _last_sync_frame; // Used in the server to store the last time a sync packet was sent to clients. |
c9c32cf56cb9
(svn r2589) Fix: [network] Fixed static variable that wasn't initialized. Would stop the sync checking from working in some cases.
ludde
parents:
2071
diff
changeset
|
171 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
172 |
// networking settings |
4034
581c6cb62e72
(svn r5293) -Fix: Not all network interfaces are capable of broadcasting. Don't record those which aren't
tron
parents:
3994
diff
changeset
|
173 |
VARDEF uint32 _broadcast_list[MAX_INTERFACES + 1]; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
174 |
|
3152
00aa2d4cf39e
(svn r3775) Fix loading of server_port from config file, introduced in Darkvater's unified configuration changes (r3719+)
peter1138
parents:
3041
diff
changeset
|
175 |
VARDEF uint16 _network_server_port; |
629
4bb1f0fb0109
(svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents:
627
diff
changeset
|
176 |
/* We use bind_ip and bind_ip_host, where bind_ip_host is the readable form of |
4bb1f0fb0109
(svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents:
627
diff
changeset
|
177 |
bind_ip_host, and bind_ip the numeric value, because we want a nice number |
4bb1f0fb0109
(svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents:
627
diff
changeset
|
178 |
in the openttd.cfg, but we wants to use the uint32 internally.. */ |
4bb1f0fb0109
(svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents:
627
diff
changeset
|
179 |
VARDEF uint32 _network_server_bind_ip; |
4bb1f0fb0109
(svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents:
627
diff
changeset
|
180 |
VARDEF char _network_server_bind_ip_host[NETWORK_HOSTNAME_LENGTH]; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
181 |
VARDEF bool _is_network_server; // Does this client wants to be a network-server? |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
182 |
VARDEF char _network_server_name[NETWORK_NAME_LENGTH]; |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1011
diff
changeset
|
183 |
VARDEF char _network_server_password[NETWORK_PASSWORD_LENGTH]; |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1011
diff
changeset
|
184 |
VARDEF char _network_rcon_password[NETWORK_PASSWORD_LENGTH]; |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1011
diff
changeset
|
185 |
|
3173
f56ca618721b
(svn r3805) - [FS#62] Fix doxygen comments to refer to the correct parameter. (sulai)
peter1138
parents:
3152
diff
changeset
|
186 |
VARDEF uint16 _network_max_join_time; ///< Time a client can max take to join |
f56ca618721b
(svn r3805) - [FS#62] Fix doxygen comments to refer to the correct parameter. (sulai)
peter1138
parents:
3152
diff
changeset
|
187 |
VARDEF bool _network_pause_on_join; ///< Pause the game when a client tries to join (more chance of succeeding join) |
1602
79f98b4b83fc
(svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents:
1441
diff
changeset
|
188 |
|
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1011
diff
changeset
|
189 |
VARDEF uint16 _redirect_console_to_client; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
190 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
191 |
VARDEF uint16 _network_sync_freq; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
192 |
VARDEF uint8 _network_frame_freq; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
193 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
194 |
VARDEF uint32 _sync_seed_1, _sync_seed_2; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
195 |
VARDEF uint32 _sync_frame; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
196 |
VARDEF bool _network_first_time; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
197 |
// Vars needed for the join-GUI |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
198 |
VARDEF NetworkJoinStatus _network_join_status; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
199 |
VARDEF uint8 _network_join_waiting; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
200 |
VARDEF uint16 _network_join_kbytes; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
201 |
VARDEF uint16 _network_join_kbytes_total; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
202 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
203 |
VARDEF char _network_last_host[NETWORK_HOSTNAME_LENGTH]; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
204 |
VARDEF short _network_last_port; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
205 |
VARDEF uint32 _network_last_host_ip; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
206 |
VARDEF uint8 _network_reconnect; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
207 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
208 |
VARDEF bool _network_udp_server; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
209 |
VARDEF uint16 _network_udp_broadcast; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
210 |
|
764
7e1e17b7c7d4
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
738
diff
changeset
|
211 |
VARDEF byte _network_lan_internet; |
7e1e17b7c7d4
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
738
diff
changeset
|
212 |
|
2861
e42d249af3cb
(svn r3409) - Change the server advertisement interval to use the frame counter instead
peter1138
parents:
2380
diff
changeset
|
213 |
VARDEF bool _network_need_advertise; |
e42d249af3cb
(svn r3409) - Change the server advertisement interval to use the frame counter instead
peter1138
parents:
2380
diff
changeset
|
214 |
VARDEF uint32 _network_last_advertise_frame; |
764
7e1e17b7c7d4
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
738
diff
changeset
|
215 |
VARDEF uint8 _network_advertise_retries; |
668
1fe298df8526
(svn r1106) -Add: [Network] Added master-server protocol and advertise to
truelight
parents:
663
diff
changeset
|
216 |
|
690
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
670
diff
changeset
|
217 |
VARDEF bool _network_autoclean_companies; |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
670
diff
changeset
|
218 |
VARDEF uint8 _network_autoclean_unprotected; // Remove a company after X months |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
670
diff
changeset
|
219 |
VARDEF uint8 _network_autoclean_protected; // Unprotect a company after X months |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
670
diff
changeset
|
220 |
|
4293
4b7006c1b5eb
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4289
diff
changeset
|
221 |
VARDEF Year _network_restart_game_year; // If this year is reached, the server automaticly restarts |
4716
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4344
diff
changeset
|
222 |
VARDEF uint8 _network_min_players; // Minimum number of players for game to unpause |
785
bba7b3b35dec
(svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents:
774
diff
changeset
|
223 |
|
1329 | 224 |
NetworkGameList *NetworkQueryServer(const char* host, unsigned short port, bool game_info); |
774
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
773
diff
changeset
|
225 |
|
2944
2360b2da2bb0
(svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents:
2881
diff
changeset
|
226 |
byte NetworkSpectatorCount(void); |
2360b2da2bb0
(svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents:
2881
diff
changeset
|
227 |
|
3041
96c5e9e8c3f3
(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
Darkvater
parents:
2944
diff
changeset
|
228 |
VARDEF char *_network_host_list[10]; |
96c5e9e8c3f3
(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
Darkvater
parents:
2944
diff
changeset
|
229 |
VARDEF char *_network_ban_list[25]; |
96c5e9e8c3f3
(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
Darkvater
parents:
2944
diff
changeset
|
230 |
|
4038
20e6144653b9
(svn r5298) Hide function declarations and remove function stubs which aren't needed in the !ENABLE_NETWORK case
tron
parents:
4034
diff
changeset
|
231 |
void ParseConnectionString(const char **player, const char **port, char *connection_string); |
20e6144653b9
(svn r5298) Hide function declarations and remove function stubs which aren't needed in the !ENABLE_NETWORK case
tron
parents:
4034
diff
changeset
|
232 |
void NetworkUpdateClientInfo(uint16 client_index); |
20e6144653b9
(svn r5298) Hide function declarations and remove function stubs which aren't needed in the !ENABLE_NETWORK case
tron
parents:
4034
diff
changeset
|
233 |
void NetworkAddServer(const char *b); |
20e6144653b9
(svn r5298) Hide function declarations and remove function stubs which aren't needed in the !ENABLE_NETWORK case
tron
parents:
4034
diff
changeset
|
234 |
void NetworkRebuildHostList(void); |
20e6144653b9
(svn r5298) Hide function declarations and remove function stubs which aren't needed in the !ENABLE_NETWORK case
tron
parents:
4034
diff
changeset
|
235 |
bool NetworkChangeCompanyPassword(byte argc, char *argv[]); |
20e6144653b9
(svn r5298) Hide function declarations and remove function stubs which aren't needed in the !ENABLE_NETWORK case
tron
parents:
4034
diff
changeset
|
236 |
void NetworkPopulateCompanyInfo(void); |
5034
611ac18ac2b5
(svn r7076) -Codechange: Prefer includes instead of using extern. Move UpdateNetworkGameWindow
Darkvater
parents:
4880
diff
changeset
|
237 |
void UpdateNetworkGameWindow(bool unselect); |
4716
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4344
diff
changeset
|
238 |
void CheckMinPlayers(void); |
4038
20e6144653b9
(svn r5298) Hide function declarations and remove function stubs which aren't needed in the !ENABLE_NETWORK case
tron
parents:
4034
diff
changeset
|
239 |
|
4829
9a0a034d0f55
(svn r6753) -Codechange: Move some function declerations from functions.h into network.h
Darkvater
parents:
4716
diff
changeset
|
240 |
void NetworkStartUp(void); |
9a0a034d0f55
(svn r6753) -Codechange: Move some function declerations from functions.h into network.h
Darkvater
parents:
4716
diff
changeset
|
241 |
void NetworkUDPClose(void); |
9a0a034d0f55
(svn r6753) -Codechange: Move some function declerations from functions.h into network.h
Darkvater
parents:
4716
diff
changeset
|
242 |
void NetworkShutDown(void); |
9a0a034d0f55
(svn r6753) -Codechange: Move some function declerations from functions.h into network.h
Darkvater
parents:
4716
diff
changeset
|
243 |
void NetworkGameLoop(void); |
9a0a034d0f55
(svn r6753) -Codechange: Move some function declerations from functions.h into network.h
Darkvater
parents:
4716
diff
changeset
|
244 |
void NetworkUDPGameLoop(void); |
9a0a034d0f55
(svn r6753) -Codechange: Move some function declerations from functions.h into network.h
Darkvater
parents:
4716
diff
changeset
|
245 |
bool NetworkServerStart(void); |
4880
aac84a9dcd03
(svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents:
4830
diff
changeset
|
246 |
bool NetworkClientConnectGame(const char *host, uint16 port); |
4829
9a0a034d0f55
(svn r6753) -Codechange: Move some function declerations from functions.h into network.h
Darkvater
parents:
4716
diff
changeset
|
247 |
void NetworkReboot(void); |
9a0a034d0f55
(svn r6753) -Codechange: Move some function declerations from functions.h into network.h
Darkvater
parents:
4716
diff
changeset
|
248 |
void NetworkDisconnect(void); |
4830
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
249 |
|
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
250 |
VARDEF bool _networking; ///< are we in networking mode? |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
251 |
VARDEF bool _network_server; ///< network-server is active |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
252 |
VARDEF bool _network_available; ///< is network mode available? |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
253 |
|
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
254 |
#else /* ENABLE_NETWORK */ |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
255 |
/* Network function stubs when networking is disabled */ |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
256 |
|
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
257 |
static inline void NetworkStartUp(void) {} |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
258 |
static inline void NetworkShutDown(void) {} |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
259 |
|
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
260 |
#define _networking 0 |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
261 |
#define _network_server 0 |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
262 |
#define _network_available 0 |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
263 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
264 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
239
diff
changeset
|
265 |
|
4830
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
266 |
/* These variables must always be registered! */ |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
267 |
VARDEF bool _network_dedicated; ///< are we a dedicated server? |
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4829
diff
changeset
|
268 |
VARDEF bool _network_advertise; ///< is the server advertising to the master server? |
4880
aac84a9dcd03
(svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents:
4830
diff
changeset
|
269 |
VARDEF PlayerID _network_playas; ///< an id to play as.. (see players.h:Players) |
211 | 270 |
|
271 |
#endif /* NETWORK_H */ |