OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
10 #ifndef NETWORK_INTERNAL_H
11 #define NETWORK_INTERNAL_H
16 #include "../command_type.h"
28 #define ENABLE_NETWORK_SYNC_EVERY_FRAME
34 #define NETWORK_SEND_DOUBLE_SEED
44 #ifdef DEBUG_DUMP_COMMANDS
47 #define _ddc_fastforward (false)
54 NETWORK_JOIN_STATUS_CONNECTING,
55 NETWORK_JOIN_STATUS_AUTHORIZING,
56 NETWORK_JOIN_STATUS_WAITING,
57 NETWORK_JOIN_STATUS_DOWNLOADING,
58 NETWORK_JOIN_STATUS_PROCESSING,
59 NETWORK_JOIN_STATUS_REGISTERING,
61 NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
62 NETWORK_JOIN_STATUS_END,
116 #ifdef NETWORK_SEND_DOUBLE_SEED
117 extern uint32 _sync_seed_2;
139 void NetworkAddServer(
const char *b);
140 void NetworkRebuildHostList();
163 void NetworkError(
StringID error_string);
164 void NetworkTextMessage(
NetworkAction action,
TextColour colour,
bool self_send,
const char *name,
const char *str =
"", int64 data = 0);
165 uint NetworkCalculateLag(
const NetworkClientSocket *cs);
uint8 _network_join_waiting
The number of clients waiting in front of us.
uint8 _network_reconnect
Reconnect timeout.
NetworkAction
Actions that can be used for NetworkTextMessage.
uint32 frame
the frame in which this packet is executed
NetworkJoinStatus
Status of the clients during joining.
uint32 _network_join_bytes
The number of bytes we already downloaded.
bool NetworkFindName(char *new_name, const char *last)
Check whether a name is unique, and otherwise try to make it unique.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
void NetworkDistributeCommands()
Distribute the commands of ourself and the clients.
Structure for buffering the build command when selecting a station to join.
bool _network_first_time
Whether we have finished joining or not.
CommandPacket * next
the next command packet (if in queue)
Owner
Enum for all companies/owners.
NetworkLanguage
Language ids for server_lang and client_lang.
CompanyID company
company that is executing the command
Everything we need to know about a command to be able to execute it.
std::vector< NetworkAddress > NetworkAddressList
Type for a list of addresses.
bool _network_udp_server
Is the UDP server started?
uint16 _network_udp_broadcast
Timeout for the UDP broadcasts.
CompanyMask _network_company_passworded
Bitmask of the password status of all companies.
bool my_cmd
did the command originate from "me"
void GetBindAddresses(NetworkAddressList *addresses, uint16 port)
Get the addresses to bind to.
Class for handling the server side of the game connection.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
#define _ddc_fastforward
Helper variable to make the dedicated server go fast until the (first) join.
Wrapper for (un)resolved network addresses; there's no reason to transform a numeric IP to a string a...
uint32 _last_sync_frame
Used in the server to store the last time a sync packet was sent to clients.
CommandPacket()
Make sure the pointer is nullptr.
void NetworkSyncCommandQueue(NetworkClientSocket *cs)
Sync our local command queue to the command queue of the given socket.
uint32 _sync_seed_1
Seed to compare during sync checks.
uint32 _sync_frame
The frame to perform the sync check.
NetworkJoinStatus _network_join_status
The status of joining.
uint32 _frame_counter
The current frame.
@ INVALID_COMPANY
An invalid company.
void NetworkExecuteLocalCommandQueue()
Execute all commands on the local command queue that ought to be executed this frame.
bool IsNetworkCompatibleVersion(const char *version)
Checks whether the given version string is compatible with our version.
uint8 _network_advertise_retries
The number of advertisement retries we did.
StringID GetNetworkErrorMsg(NetworkErrorCode err)
Retrieve the string id of an internal error number.
NetworkAddressList _broadcast_list
List of broadcast addresses.
void UpdateNetworkGameWindow()
Update the network new window because a new server is found on the network.
uint32 _frame_counter_server
The frame_counter of the server, if in network-mode.
const char * GenerateCompanyPasswordHash(const char *password, const char *password_server_id, uint32 password_game_seed)
Hash the given password using server ID and game seed.
void NetworkFreeLocalCommandQueue()
Free the local command queues.
uint32 _network_join_bytes_total
The total number of bytes to download.
uint32 _frame_counter_max
To where we may go with our clients.
NetworkErrorCode
The error codes we send around in the protocols.