12 #ifndef NETWORK_INTERNAL_H 13 #define NETWORK_INTERNAL_H 18 #include "../command_type.h" 32 #define ENABLE_NETWORK_SYNC_EVERY_FRAME 38 #define NETWORK_SEND_DOUBLE_SEED 48 #ifdef DEBUG_DUMP_COMMANDS 51 #define _ddc_fastforward (false) 58 NETWORK_JOIN_STATUS_CONNECTING,
59 NETWORK_JOIN_STATUS_AUTHORIZING,
60 NETWORK_JOIN_STATUS_WAITING,
61 NETWORK_JOIN_STATUS_DOWNLOADING,
62 NETWORK_JOIN_STATUS_PROCESSING,
63 NETWORK_JOIN_STATUS_REGISTERING,
65 NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
66 NETWORK_JOIN_STATUS_END,
120 #ifdef NETWORK_SEND_DOUBLE_SEED 121 extern uint32 _sync_seed_2;
143 void NetworkAddServer(
const char *b);
144 void NetworkRebuildHostList();
167 void NetworkError(
StringID error_string);
168 void NetworkTextMessage(
NetworkAction action,
TextColour colour,
bool self_send,
const char *name,
const char *str =
"", int64 data = 0);
169 uint NetworkCalculateLag(
const NetworkClientSocket *cs);
Basic functions to receive and send TCP packets for game purposes.
void NetworkSyncCommandQueue(NetworkClientSocket *cs)
Sync our local command queue to the command queue of the given socket.
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.
NetworkJoinStatus _network_join_status
The status of joining.
bool IsNetworkCompatibleVersion(const char *version)
Checks whether the given version string is compatible with our version.
NetworkErrorCode
The error codes we send around in the protocols.
CommandPacket()
Make sure the pointer is NULL.
#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 _frame_counter
The current frame.
uint32 _sync_seed_1
Seed to compare during sync checks.
Class for handling the server side of the game connection.
void NetworkDistributeCommands()
Distribute the commands of ourself and the clients.
uint32 _frame_counter_server
The frame_counter of the server, if in network-mode.
NetworkAddressList _broadcast_list
List of broadcast addresses.
uint32 _network_join_bytes
The number of bytes we already downloaded.
Structure for buffering the build command when selecting a station to join.
uint8 _network_join_waiting
The number of clients waiting in front of us.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
uint32 _frame_counter_max
To where we may go with our clients.
NetworkLanguage
Language ids for server_lang and client_lang.
CompanyID company
company that is executing the command
uint32 _network_join_bytes_total
The total number of bytes to download.
uint32 frame
the frame in which this packet is executed
StringID GetNetworkErrorMsg(NetworkErrorCode err)
Retrieve the string id of an internal error number.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void GetBindAddresses(NetworkAddressList *addresses, uint16 port)
Get the addresses to bind to.
bool _network_udp_server
Is the UDP server started?
void UpdateNetworkGameWindow()
Update the network new window because a new server is found on the network.
void NetworkExecuteLocalCommandQueue()
Execute all commands on the local command queue that ought to be executed this frame.
bool NetworkFindName(char *new_name, const char *last)
Check whether a name is unique, and otherwise try to make it unique.
NetworkJoinStatus
Status of the clients during joining.
CompanyMask _network_company_passworded
Bitmask of the password status of all companies.
uint16 _network_udp_broadcast
Timeout for the UDP broadcasts.
uint8 _network_reconnect
Reconnect timeout.
uint8 _network_advertise_retries
The number of advertisement retries we did.
Network functions used by other parts of OpenTTD.
uint32 _last_sync_frame
Used in the server to store the last time a sync packet was sent to clients.
Everything we need to know about a command to be able to execute it.
bool _network_first_time
Whether we have finished joining or not.
Owner
Enum for all companies/owners.
uint32 _sync_frame
The frame to perform the sync check.
bool my_cmd
did the command originate from "me"
CommandPacket * next
the next command packet (if in queue)
NetworkAction
Actions that can be used for NetworkTextMessage.
void NetworkFreeLocalCommandQueue()
Free the local command queues.