Codechange: automatic adding of _t to (u)int types, and WChar to char32_t

for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
Rubidium
2023-05-08 19:01:06 +02:00
committed by rubidium42
parent 4f4810dc28
commit eaae0bb5e7
564 changed files with 4561 additions and 4561 deletions

View File

@@ -35,7 +35,7 @@ const std::string &NetworkAddress::GetHostname()
* Get the port.
* @return the port.
*/
uint16 NetworkAddress::GetPort() const
uint16_t NetworkAddress::GetPort() const
{
switch (this->address.ss_family) {
case AF_UNSPEC:
@@ -54,7 +54,7 @@ uint16 NetworkAddress::GetPort() const
* Set the port.
* @param port set the port number.
*/
void NetworkAddress::SetPort(uint16 port)
void NetworkAddress::SetPort(uint16_t port)
{
switch (this->address.ss_family) {
case AF_UNSPEC:
@@ -77,7 +77,7 @@ void NetworkAddress::SetPort(uint16 port)
* @param with_family Whether to add the familty to the address (e.g. IPv4).
* @return The format string for the address.
*/
static const char *GetAddressFormatString(uint16 family, bool with_family)
static const char *GetAddressFormatString(uint16_t family, bool with_family)
{
switch (family) {
case AF_INET: return with_family ? "{}:{} (IPv4)" : "{}:{}";
@@ -169,17 +169,17 @@ bool NetworkAddress::IsInNetmask(const std::string &netmask)
if (mask_address.GetAddressLength() == 0) return false;
uint32 *ip;
uint32 *mask;
uint32_t *ip;
uint32_t *mask;
switch (this->address.ss_family) {
case AF_INET:
ip = (uint32*)&((struct sockaddr_in*)&this->address)->sin_addr.s_addr;
mask = (uint32*)&((struct sockaddr_in*)&mask_address.address)->sin_addr.s_addr;
ip = (uint32_t*)&((struct sockaddr_in*)&this->address)->sin_addr.s_addr;
mask = (uint32_t*)&((struct sockaddr_in*)&mask_address.address)->sin_addr.s_addr;
break;
case AF_INET6:
ip = (uint32*)&((struct sockaddr_in6*)&this->address)->sin6_addr;
mask = (uint32*)&((struct sockaddr_in6*)&mask_address.address)->sin6_addr;
ip = (uint32_t*)&((struct sockaddr_in6*)&this->address)->sin6_addr;
mask = (uint32_t*)&((struct sockaddr_in6*)&mask_address.address)->sin6_addr;
break;
default:
@@ -187,7 +187,7 @@ bool NetworkAddress::IsInNetmask(const std::string &netmask)
}
while (cidr > 0) {
uint32 msk = cidr >= 32 ? (uint32)-1 : htonl(-(1 << (32 - cidr)));
uint32_t msk = cidr >= 32 ? (uint32_t)-1 : htonl(-(1 << (32 - cidr)));
if ((*mask++ & msk) != (*ip++ & msk)) return false;
cidr -= 32;
@@ -448,14 +448,14 @@ void NetworkAddress::Listen(int socktype, SocketList *sockets)
* @param company Pointer to the company variable to set iff indicated.
* @return A valid ServerAddress of the parsed information.
*/
/* static */ ServerAddress ServerAddress::Parse(const std::string &connection_string, uint16 default_port, CompanyID *company_id)
/* static */ ServerAddress ServerAddress::Parse(const std::string &connection_string, uint16_t default_port, CompanyID *company_id)
{
if (StrStartsWith(connection_string, "+")) {
std::string_view invite_code = ParseCompanyFromConnectionString(connection_string, company_id);
return ServerAddress(SERVER_ADDRESS_INVITE_CODE, std::string(invite_code));
}
uint16 port = default_port;
uint16_t port = default_port;
std::string_view ip = ParseFullConnectionString(connection_string, port, company_id);
return ServerAddress(SERVER_ADDRESS_DIRECT, std::string(ip) + ":" + std::to_string(port));
}

View File

@@ -72,7 +72,7 @@ public:
* @param port the port
* @param family the address family
*/
NetworkAddress(std::string_view hostname = "", uint16 port = 0, int family = AF_UNSPEC) :
NetworkAddress(std::string_view hostname = "", uint16_t port = 0, int family = AF_UNSPEC) :
address_length(0),
resolved(false)
{
@@ -102,8 +102,8 @@ public:
return this->address_length;
}
uint16 GetPort() const;
void SetPort(uint16 port);
uint16_t GetPort() const;
void SetPort(uint16_t port);
/**
* Check whether the IP address has been resolved already
@@ -209,7 +209,7 @@ public:
ServerAddressType type; ///< The type of this ServerAddress.
std::string connection_string; ///< The connection string for this ServerAddress.
static ServerAddress Parse(const std::string &connection_string, uint16 default_port, CompanyID *company_id = nullptr);
static ServerAddress Parse(const std::string &connection_string, uint16_t default_port, CompanyID *company_id = nullptr);
};
#endif /* NETWORK_CORE_ADDRESS_H */

View File

@@ -18,15 +18,15 @@ const char *NetworkContentServerConnectionString();
const char *NetworkContentMirrorUriString();
const char *NetworkSurveyUriString();
static const uint16 NETWORK_COORDINATOR_SERVER_PORT = 3976; ///< The default port of the Game Coordinator server (TCP)
static const uint16 NETWORK_STUN_SERVER_PORT = 3975; ///< The default port of the STUN server (TCP)
static const uint16 NETWORK_TURN_SERVER_PORT = 3974; ///< The default port of the TURN server (TCP)
static const uint16 NETWORK_CONTENT_SERVER_PORT = 3978; ///< The default port of the content server (TCP)
static const uint16 NETWORK_DEFAULT_PORT = 3979; ///< The default port of the game server (TCP & UDP)
static const uint16 NETWORK_ADMIN_PORT = 3977; ///< The default port for admin network
static const uint16 NETWORK_DEFAULT_DEBUGLOG_PORT = 3982; ///< The default port debug-log is sent to (TCP)
static const uint16_t NETWORK_COORDINATOR_SERVER_PORT = 3976; ///< The default port of the Game Coordinator server (TCP)
static const uint16_t NETWORK_STUN_SERVER_PORT = 3975; ///< The default port of the STUN server (TCP)
static const uint16_t NETWORK_TURN_SERVER_PORT = 3974; ///< The default port of the TURN server (TCP)
static const uint16_t NETWORK_CONTENT_SERVER_PORT = 3978; ///< The default port of the content server (TCP)
static const uint16_t NETWORK_DEFAULT_PORT = 3979; ///< The default port of the game server (TCP & UDP)
static const uint16_t NETWORK_ADMIN_PORT = 3977; ///< The default port for admin network
static const uint16_t NETWORK_DEFAULT_DEBUGLOG_PORT = 3982; ///< The default port debug-log is sent to (TCP)
static const uint16 UDP_MTU = 1460; ///< Number of bytes we can pack in a single UDP packet
static const uint16_t UDP_MTU = 1460; ///< Number of bytes we can pack in a single UDP packet
static const std::string NETWORK_SURVEY_DETAILS_LINK = "https://survey.openttd.org/participate"; ///< Link with more details & privacy statement of the survey.
/*
@@ -37,14 +37,14 @@ static const std::string NETWORK_SURVEY_DETAILS_LINK = "https://survey.openttd.o
* 00000000 00000000 0bbbbbbb aaaaaaaa -> aaaaaaaa 0bbbbbbb
* Send_uint16(GB(size, 0, 15)
*
* Packets up to 1 GiB, first uint16 has high bit set so it knows to read a
* next uint16 for the remaining bits of the size.
* Packets up to 1 GiB, first uint16_t has high bit set so it knows to read a
* next uint16_t for the remaining bits of the size.
* 00dddddd cccccccc bbbbbbbb aaaaaaaa -> cccccccc 10dddddd aaaaaaaa bbbbbbbb
* Send_uint16(GB(size, 16, 14) | 0b10 << 14)
* Send_uint16(GB(size, 0, 16))
*/
static const uint16 TCP_MTU = 32767; ///< Number of bytes we can pack in a single TCP packet
static const uint16 COMPAT_MTU = 1460; ///< Number of bytes we can pack in a single packet for backward compatibility
static const uint16_t TCP_MTU = 32767; ///< Number of bytes we can pack in a single TCP packet
static const uint16_t COMPAT_MTU = 1460; ///< Number of bytes we can pack in a single packet for backward compatibility
static const byte NETWORK_GAME_ADMIN_VERSION = 3; ///< What version of the admin network do we use?
static const byte NETWORK_GAME_INFO_VERSION = 6; ///< What version of game-info do we use?

View File

@@ -199,7 +199,7 @@ void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info, bool
/* NETWORK_GAME_INFO_VERSION = 5 */
GameInfo *game_info = Game::GetInfo();
p->Send_uint32(game_info == nullptr ? -1 : (uint32)game_info->GetVersion());
p->Send_uint32(game_info == nullptr ? -1 : (uint32_t)game_info->GetVersion());
p->Send_string(game_info == nullptr ? "" : game_info->GetName());
/* NETWORK_GAME_INFO_VERSION = 4 */
@@ -284,7 +284,7 @@ void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfo
/* Ensure that the maximum number of NewGRFs and the field in the network
* protocol are matched to eachother. If that is not the case anymore a
* check must be added to ensure the received data is still valid. */
static_assert(std::numeric_limits<uint8>::max() == NETWORK_MAX_GRF_COUNT);
static_assert(std::numeric_limits<uint8_t>::max() == NETWORK_MAX_GRF_COUNT);
uint num_grfs = p->Recv_uint8();
GRFConfig **dst = &info->grfconfig;

View File

@@ -94,8 +94,8 @@ struct NetworkServerGameInfo {
GRFConfig *grfconfig; ///< List of NewGRF files used
TimerGameCalendar::Date start_date; ///< When the game started
TimerGameCalendar::Date game_date; ///< Current date
uint16 map_width; ///< Map width
uint16 map_height; ///< Map height
uint16_t map_width; ///< Map width
uint16_t map_height; ///< Map height
std::string server_name; ///< Server name
std::string server_revision; ///< The version number the server is using (e.g.: 'r304' or 0.5.0)
bool dedicated; ///< Is this a dedicated server?
@@ -128,7 +128,7 @@ struct NamedGRFIdentifier {
std::string name; ///< The name of the NewGRF.
};
/** Lookup table for the GameInfo in case of #NST_LOOKUP_ID. */
typedef std::unordered_map<uint32, NamedGRFIdentifier> GameInfoNewGRFLookupTable;
typedef std::unordered_map<uint32_t, NamedGRFIdentifier> GameInfoNewGRFLookupTable;
extern NetworkServerGameInfo _network_game_info;

View File

@@ -103,13 +103,13 @@ bool Packet::CanWriteToPacket(size_t bytes_to_write)
/*
* The next couple of functions make sure we can send
* uint8, uint16, uint32 and uint64 endian-safe
* uint8_t, uint16_t, uint32_t and uint64_t endian-safe
* over the network. The least significant bytes are
* sent first.
*
* So 0x01234567 would be sent as 67 45 23 01.
*
* A bool is sent as a uint8 where zero means false
* A bool is sent as a uint8_t where zero means false
* and non-zero means true.
*/
@@ -126,7 +126,7 @@ void Packet::Send_bool(bool data)
* Package a 8 bits integer in the packet.
* @param data The data to send.
*/
void Packet::Send_uint8(uint8 data)
void Packet::Send_uint8(uint8_t data)
{
assert(this->CanWriteToPacket(sizeof(data)));
this->buffer.emplace_back(data);
@@ -136,7 +136,7 @@ void Packet::Send_uint8(uint8 data)
* Package a 16 bits integer in the packet.
* @param data The data to send.
*/
void Packet::Send_uint16(uint16 data)
void Packet::Send_uint16(uint16_t data)
{
assert(this->CanWriteToPacket(sizeof(data)));
this->buffer.emplace_back(GB(data, 0, 8));
@@ -147,7 +147,7 @@ void Packet::Send_uint16(uint16 data)
* Package a 32 bits integer in the packet.
* @param data The data to send.
*/
void Packet::Send_uint32(uint32 data)
void Packet::Send_uint32(uint32_t data)
{
assert(this->CanWriteToPacket(sizeof(data)));
this->buffer.emplace_back(GB(data, 0, 8));
@@ -160,7 +160,7 @@ void Packet::Send_uint32(uint32 data)
* Package a 64 bits integer in the packet.
* @param data The data to send.
*/
void Packet::Send_uint64(uint64 data)
void Packet::Send_uint64(uint64_t data)
{
assert(this->CanWriteToPacket(sizeof(data)));
this->buffer.emplace_back(GB(data, 0, 8));
@@ -191,8 +191,8 @@ void Packet::Send_string(const std::string_view data)
*/
void Packet::Send_buffer(const std::vector<byte> &data)
{
assert(this->CanWriteToPacket(sizeof(uint16) + data.size()));
this->Send_uint16((uint16)data.size());
assert(this->CanWriteToPacket(sizeof(uint16_t) + data.size()));
this->Send_uint16((uint16_t)data.size());
this->buffer.insert(this->buffer.end(), data.begin(), data.end());
}
@@ -314,9 +314,9 @@ bool Packet::Recv_bool()
* Read a 8 bits integer from the packet.
* @return The read data.
*/
uint8 Packet::Recv_uint8()
uint8_t Packet::Recv_uint8()
{
uint8 n;
uint8_t n;
if (!this->CanReadFromPacket(sizeof(n), true)) return 0;
@@ -328,14 +328,14 @@ uint8 Packet::Recv_uint8()
* Read a 16 bits integer from the packet.
* @return The read data.
*/
uint16 Packet::Recv_uint16()
uint16_t Packet::Recv_uint16()
{
uint16 n;
uint16_t n;
if (!this->CanReadFromPacket(sizeof(n), true)) return 0;
n = (uint16)this->buffer[this->pos++];
n += (uint16)this->buffer[this->pos++] << 8;
n = (uint16_t)this->buffer[this->pos++];
n += (uint16_t)this->buffer[this->pos++] << 8;
return n;
}
@@ -343,16 +343,16 @@ uint16 Packet::Recv_uint16()
* Read a 32 bits integer from the packet.
* @return The read data.
*/
uint32 Packet::Recv_uint32()
uint32_t Packet::Recv_uint32()
{
uint32 n;
uint32_t n;
if (!this->CanReadFromPacket(sizeof(n), true)) return 0;
n = (uint32)this->buffer[this->pos++];
n += (uint32)this->buffer[this->pos++] << 8;
n += (uint32)this->buffer[this->pos++] << 16;
n += (uint32)this->buffer[this->pos++] << 24;
n = (uint32_t)this->buffer[this->pos++];
n += (uint32_t)this->buffer[this->pos++] << 8;
n += (uint32_t)this->buffer[this->pos++] << 16;
n += (uint32_t)this->buffer[this->pos++] << 24;
return n;
}
@@ -360,20 +360,20 @@ uint32 Packet::Recv_uint32()
* Read a 64 bits integer from the packet.
* @return The read data.
*/
uint64 Packet::Recv_uint64()
uint64_t Packet::Recv_uint64()
{
uint64 n;
uint64_t n;
if (!this->CanReadFromPacket(sizeof(n), true)) return 0;
n = (uint64)this->buffer[this->pos++];
n += (uint64)this->buffer[this->pos++] << 8;
n += (uint64)this->buffer[this->pos++] << 16;
n += (uint64)this->buffer[this->pos++] << 24;
n += (uint64)this->buffer[this->pos++] << 32;
n += (uint64)this->buffer[this->pos++] << 40;
n += (uint64)this->buffer[this->pos++] << 48;
n += (uint64)this->buffer[this->pos++] << 56;
n = (uint64_t)this->buffer[this->pos++];
n += (uint64_t)this->buffer[this->pos++] << 8;
n += (uint64_t)this->buffer[this->pos++] << 16;
n += (uint64_t)this->buffer[this->pos++] << 24;
n += (uint64_t)this->buffer[this->pos++] << 32;
n += (uint64_t)this->buffer[this->pos++] << 40;
n += (uint64_t)this->buffer[this->pos++] << 48;
n += (uint64_t)this->buffer[this->pos++] << 56;
return n;
}
@@ -383,7 +383,7 @@ uint64 Packet::Recv_uint64()
*/
std::vector<byte> Packet::Recv_buffer()
{
uint16 size = this->Recv_uint16();
uint16_t size = this->Recv_uint16();
if (size == 0 || !this->CanReadFromPacket(size, true)) return {};
std::vector<byte> data;

View File

@@ -17,8 +17,8 @@
#include "core.h"
#include "../../string_type.h"
typedef uint16 PacketSize; ///< Size of the whole packet.
typedef uint8 PacketType; ///< Identifier for the packet
typedef uint16_t PacketSize; ///< Size of the whole packet.
typedef uint8_t PacketType; ///< Identifier for the packet
/**
* Internal entity of a packet. As everything is sent as a packet,
@@ -65,10 +65,10 @@ public:
bool CanWriteToPacket(size_t bytes_to_write);
void Send_bool (bool data);
void Send_uint8 (uint8 data);
void Send_uint16(uint16 data);
void Send_uint32(uint32 data);
void Send_uint64(uint64 data);
void Send_uint8 (uint8_t data);
void Send_uint16(uint16_t data);
void Send_uint32(uint32_t data);
void Send_uint64(uint64_t data);
void Send_string(const std::string_view data);
void Send_buffer(const std::vector<byte> &data);
size_t Send_bytes (const byte *begin, const byte *end);
@@ -82,10 +82,10 @@ public:
bool CanReadFromPacket(size_t bytes_to_read, bool close_connection = false);
bool Recv_bool ();
uint8 Recv_uint8 ();
uint16 Recv_uint16();
uint32 Recv_uint32();
uint64 Recv_uint64();
uint8_t Recv_uint8 ();
uint16_t Recv_uint16();
uint32_t Recv_uint32();
uint64_t Recv_uint64();
std::vector<byte> Recv_buffer();
std::string Recv_string(size_t length, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK);

View File

@@ -114,7 +114,7 @@ private:
public:
TCPConnecter() {};
TCPConnecter(const std::string &connection_string, uint16 default_port, const NetworkAddress &bind_address = {}, int family = AF_UNSPEC);
TCPConnecter(const std::string &connection_string, uint16_t default_port, const NetworkAddress &bind_address = {}, int family = AF_UNSPEC);
virtual ~TCPConnecter();
/**
@@ -143,7 +143,7 @@ private:
public:
ServerAddress server_address; ///< Address we are connecting to.
TCPServerConnecter(const std::string &connection_string, uint16 default_port);
TCPServerConnecter(const std::string &connection_string, uint16_t default_port);
void SetConnected(SOCKET sock);
void SetFailure();

View File

@@ -136,8 +136,8 @@ protected:
/**
* Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet):
* uint16 Update type (see #AdminUpdateType). Note integer type - see "Certain Packet Information" in docs/admin_network.md.
* uint16 Update frequency (see #AdminUpdateFrequency), setting #ADMIN_FREQUENCY_POLL is always ignored.
* uint16_t Update type (see #AdminUpdateType). Note integer type - see "Certain Packet Information" in docs/admin_network.md.
* uint16_t Update frequency (see #AdminUpdateFrequency), setting #ADMIN_FREQUENCY_POLL is always ignored.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -145,8 +145,8 @@ protected:
/**
* Poll the server for certain updates, an invalid poll (e.g. not existent id) gets silently dropped:
* uint8 #AdminUpdateType the server should answer for, only if #AdminUpdateFrequency #ADMIN_FREQUENCY_POLL is advertised in the PROTOCOL packet. Note integer type - see "Certain Packet Information" in docs/admin_network.md.
* uint32 ID relevant to the packet type, e.g.
* uint8_t #AdminUpdateType the server should answer for, only if #AdminUpdateFrequency #ADMIN_FREQUENCY_POLL is advertised in the PROTOCOL packet. Note integer type - see "Certain Packet Information" in docs/admin_network.md.
* uint32_t ID relevant to the packet type, e.g.
* - the client ID for #ADMIN_UPDATE_CLIENT_INFO. Use UINT32_MAX to show all clients.
* - the company ID for #ADMIN_UPDATE_COMPANY_INFO. Use UINT32_MAX to show all companies.
* @param p The packet that was just received.
@@ -156,9 +156,9 @@ protected:
/**
* Send chat as the server:
* uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see #NetworkAction).
* uint8 Destination type such as DESTTYPE_BROADCAST (see #DestType).
* uint32 ID of the destination such as company or client id.
* uint8_t Action such as NETWORK_ACTION_CHAT_CLIENT (see #NetworkAction).
* uint8_t Destination type such as DESTTYPE_BROADCAST (see #DestType).
* uint32_t ID of the destination such as company or client id.
* string Message.
* @param p The packet that was just received.
* @return The state the network should have.
@@ -168,7 +168,7 @@ protected:
/**
* Send chat from the external source:
* string Name of the source this message came from.
* uint16 TextColour to use for the message.
* uint16_t TextColour to use for the message.
* string Name of the user who sent the messsage.
* string Message.
* @param p The packet that was just received.
@@ -194,7 +194,7 @@ protected:
/**
* Ping the server, requiring the server to reply with a pong packet.
* uint32 Integer value to pass to the server, which is quoted in the reply.
* uint32_t Integer value to pass to the server, which is quoted in the reply.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -216,7 +216,7 @@ protected:
/**
* An error was caused by this admin connection (connection gets closed).
* uint8 NetworkErrorCode the error caused.
* uint8_t NetworkErrorCode the error caused.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -224,10 +224,10 @@ protected:
/**
* Inform a just joined admin about the protocol specifics:
* uint8 Protocol version.
* uint8_t Protocol version.
* bool Further protocol data follows (repeats through all update packet types).
* uint16 Update packet type.
* uint16 Frequencies allowed for this update packet (bitwise).
* uint16_t Update packet type.
* uint16_t Frequencies allowed for this update packet (bitwise).
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -239,11 +239,11 @@ protected:
* string OpenTTD version string.
* bool Server is dedicated.
* string Name of the Map.
* uint32 Random seed of the Map.
* uint8 Landscape of the Map.
* uint32 Start date of the Map.
* uint16 Map width.
* uint16 Map height.
* uint32_t Random seed of the Map.
* uint8_t Landscape of the Map.
* uint32_t Start date of the Map.
* uint16_t Map width.
* uint16_t Map height.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -265,7 +265,7 @@ protected:
/**
* Send the current date of the game:
* uint32 Current game date.
* uint32_t Current game date.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -273,7 +273,7 @@ protected:
/**
* Notification of a new client:
* uint32 ID of the new client.
* uint32_t ID of the new client.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -281,12 +281,12 @@ protected:
/**
* Client information of a specific client:
* uint32 ID of the client.
* uint32_t ID of the client.
* string Network address of the client.
* string Name of the client.
* uint8 Language of the client.
* uint32 Date the client joined the game.
* uint8 ID of the company the client is playing as (255 for spectators).
* uint8_t Language of the client.
* uint32_t Date the client joined the game.
* uint8_t ID of the company the client is playing as (255 for spectators).
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -294,9 +294,9 @@ protected:
/**
* Client update details on a specific client (e.g. after rename or move):
* uint32 ID of the client.
* uint32_t ID of the client.
* string Name of the client.
* uint8 ID of the company the client is playing as (255 for spectators).
* uint8_t ID of the company the client is playing as (255 for spectators).
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -304,7 +304,7 @@ protected:
/**
* Notification about a client leaving the game.
* uint32 ID of the client that just left.
* uint32_t ID of the client that just left.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -312,8 +312,8 @@ protected:
/**
* Notification about a client error (and thus the clients disconnection).
* uint32 ID of the client that made the error.
* uint8 Error the client made (see NetworkErrorCode).
* uint32_t ID of the client that made the error.
* uint8_t Error the client made (see NetworkErrorCode).
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -321,7 +321,7 @@ protected:
/**
* Notification of a new company:
* uint8 ID of the new company.
* uint8_t ID of the new company.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -329,12 +329,12 @@ protected:
/**
* Company information on a specific company:
* uint8 ID of the company.
* uint8_t ID of the company.
* string Name of the company.
* string Name of the companies manager.
* uint8 Main company colour.
* uint8_t Main company colour.
* bool Company is password protected.
* uint32 Year the company was inaugurated.
* uint32_t Year the company was inaugurated.
* bool Company is an AI.
* @param p The packet that was just received.
* @return The state the network should have.
@@ -343,16 +343,16 @@ protected:
/**
* Company information of a specific company:
* uint8 ID of the company.
* uint8_t ID of the company.
* string Name of the company.
* string Name of the companies manager.
* uint8 Main company colour.
* uint8_t Main company colour.
* bool Company is password protected.
* uint8 Quarters of bankruptcy.
* uint8 Owner of share 1.
* uint8 Owner of share 2.
* uint8 Owner of share 3.
* uint8 Owner of share 4.
* uint8_t Quarters of bankruptcy.
* uint8_t Owner of share 1.
* uint8_t Owner of share 2.
* uint8_t Owner of share 3.
* uint8_t Owner of share 4.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -360,8 +360,8 @@ protected:
/**
* Notification about a removed company (e.g. due to bankruptcy).
* uint8 ID of the company.
* uint8 Reason for being removed (see #AdminCompanyRemoveReason).
* uint8_t ID of the company.
* uint8_t Reason for being removed (see #AdminCompanyRemoveReason).
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -369,17 +369,17 @@ protected:
/**
* Economy update of a specific company:
* uint8 ID of the company.
* uint64 Money.
* uint64 Loan.
* int64 Income.
* uint16 Delivered cargo (this quarter).
* uint64 Company value (last quarter).
* uint16 Performance (last quarter).
* uint16 Delivered cargo (last quarter).
* uint64 Company value (previous quarter).
* uint16 Performance (previous quarter).
* uint16 Delivered cargo (previous quarter).
* uint8_t ID of the company.
* uint64_t Money.
* uint64_t Loan.
* int64_t Income.
* uint16_t Delivered cargo (this quarter).
* uint64_t Company value (last quarter).
* uint16_t Performance (last quarter).
* uint16_t Delivered cargo (last quarter).
* uint64_t Company value (previous quarter).
* uint16_t Performance (previous quarter).
* uint16_t Delivered cargo (previous quarter).
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -387,17 +387,17 @@ protected:
/**
* Company statistics on stations and vehicles:
* uint8 ID of the company.
* uint16 Number of trains.
* uint16 Number of lorries.
* uint16 Number of busses.
* uint16 Number of planes.
* uint16 Number of ships.
* uint16 Number of train stations.
* uint16 Number of lorry stations.
* uint16 Number of bus stops.
* uint16 Number of airports and heliports.
* uint16 Number of harbours.
* uint8_t ID of the company.
* uint16_t Number of trains.
* uint16_t Number of lorries.
* uint16_t Number of busses.
* uint16_t Number of planes.
* uint16_t Number of ships.
* uint16_t Number of train stations.
* uint16_t Number of lorry stations.
* uint16_t Number of bus stops.
* uint16_t Number of airports and heliports.
* uint16_t Number of harbours.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -405,11 +405,11 @@ protected:
/**
* Send chat from the game into the admin network:
* uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see #NetworkAction).
* uint8 Destination type such as DESTTYPE_BROADCAST (see #DestType).
* uint32 ID of the client who sent this message.
* uint8_t Action such as NETWORK_ACTION_CHAT_CLIENT (see #NetworkAction).
* uint8_t Destination type such as DESTTYPE_BROADCAST (see #DestType).
* uint32_t ID of the client who sent this message.
* string Message.
* uint64 Money (only when it is a 'give money' action).
* uint64_t Money (only when it is a 'give money' action).
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -417,7 +417,7 @@ protected:
/**
* Result of an rcon command:
* uint16 Colour as it would be used on the server or a client.
* uint16_t Colour as it would be used on the server or a client.
* string Output of the executed command.
* @param p The packet that was just received.
* @return The state the network should have.
@@ -445,7 +445,7 @@ protected:
*
* These three fields are repeated until the packet is full:
* bool Data to follow.
* uint16 ID of the DoCommand.
* uint16_t ID of the DoCommand.
* string Name of DoCommand.
* @param p The packet that was just received.
* @return The state the network should have.
@@ -461,12 +461,12 @@ protected:
* across different versions / revisions of OpenTTD.
* Data provided in this packet is for logging purposes only.
*
* uint32 ID of the client sending the command.
* uint8 ID of the company (0..MAX_COMPANIES-1).
* uint16 ID of the command.
* uint32_t ID of the client sending the command.
* uint8_t ID of the company (0..MAX_COMPANIES-1).
* uint16_t ID of the command.
* <var> Command specific buffer with encoded parameters of variable length.
* The content differs per command and can change without notification.
* uint32 Frame of execution.
* uint32_t Frame of execution.
* @param p The packet that was just received.
* @return The state the network should have.
*/
@@ -474,7 +474,7 @@ protected:
/**
* Send a ping-reply (pong) to the admin that sent us the ping packet.
* uint32 Integer identifier - should be the same as read from the admins ping packet.
* uint32_t Integer identifier - should be the same as read from the admins ping packet.
* @param p The packet that was just received.
* @return The state the network should have.
*/

View File

@@ -27,7 +27,7 @@ static std::vector<TCPConnecter *> _tcp_connecters;
* @param default_port If not indicated in connection_string, what port to use.
* @param bind_address The local bind address to use. Defaults to letting the OS find one.
*/
TCPConnecter::TCPConnecter(const std::string &connection_string, uint16 default_port, const NetworkAddress &bind_address, int family) :
TCPConnecter::TCPConnecter(const std::string &connection_string, uint16_t default_port, const NetworkAddress &bind_address, int family) :
bind_address(bind_address),
family(family)
{
@@ -41,7 +41,7 @@ TCPConnecter::TCPConnecter(const std::string &connection_string, uint16 default_
* @param connection_string The address to connect to.
* @param default_port If not indicated in connection_string, what port to use.
*/
TCPServerConnecter::TCPServerConnecter(const std::string &connection_string, uint16 default_port) :
TCPServerConnecter::TCPServerConnecter(const std::string &connection_string, uint16_t default_port) :
server_address(ServerAddress::Parse(connection_string, default_port))
{
switch (this->server_address.type) {

View File

@@ -26,9 +26,9 @@ protected:
/**
* Client requesting a list of content info:
* byte type
* uint32 openttd version (or 0xFFFFFFFF if using a list)
* uint32_t openttd version (or 0xFFFFFFFF if using a list)
* Only if the above value is 0xFFFFFFFF:
* uint8 count
* uint8_t count
* string branch-name ("vanilla" for upstream OpenTTD)
* string release version (like "12.0")
* @param p The packet that was just received.
@@ -38,8 +38,8 @@ protected:
/**
* Client requesting a list of content info:
* uint16 count of ids
* uint32 id (count times)
* uint16_t count of ids
* uint32_t id (count times)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
@@ -50,10 +50,10 @@ protected:
* 'unique' id; GRF ID for NewGRFS, shortname and for base
* graphics and AIs.
* Scenarios and AI libraries are not supported
* uint8 count of requests
* uint8_t count of requests
* for each request:
* uint8 type
* unique id (uint32)
* uint8_t type
* unique id (uint32_t)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
@@ -64,10 +64,10 @@ protected:
* 'unique' id; GRF ID + MD5 checksum for NewGRFS, shortname and
* xor-ed MD5 checksums for base graphics and AIs.
* Scenarios and AI libraries are not supported
* uint8 count of requests
* uint8_t count of requests
* for each request:
* uint8 type
* unique id (uint32)
* uint8_t type
* unique id (uint32_t)
* md5 (16 bytes)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
@@ -77,15 +77,15 @@ protected:
/**
* Server sending list of content info:
* byte type (invalid ID == does not exist)
* uint32 id
* uint32 file_size
* uint32_t id
* uint32_t file_size
* string name (max 32 characters)
* string version (max 16 characters)
* uint32 unique id
* uint8 md5sum (16 bytes)
* uint8 dependency count
* uint32 unique id of dependency (dependency count times)
* uint8 tag count
* uint32_t unique id
* uint8_t md5sum (16 bytes)
* uint8_t dependency count
* uint32_t unique id of dependency (dependency count times)
* uint8_t tag count
* string tag (max 32 characters for tag count times)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
@@ -94,8 +94,8 @@ protected:
/**
* Client requesting the actual content:
* uint16 count of unique ids
* uint32 unique id (count times)
* uint16_t count of unique ids
* uint32_t unique id (count times)
* @param p The packet that was just received.
* @return True upon success, otherwise false.
*/
@@ -103,8 +103,8 @@ protected:
/**
* Server sending list of content info:
* uint32 unique id
* uint32 file size (0 == does not exist)
* uint32_t unique id
* uint32_t file size (0 == does not exist)
* string file name (max 48 characters)
* After this initial packet, packets with the actual data are send using
* the same packet type.

View File

@@ -62,13 +62,13 @@ struct ContentInfo {
ContentType type = INVALID_CONTENT_TYPE; ///< Type of content
ContentID id = INVALID_CONTENT_ID; ///< Unique (server side) ID for the content
uint32 filesize = 0; ///< Size of the file
uint32_t filesize = 0; ///< Size of the file
std::string filename; ///< Filename (for the .tar.gz; only valid on download)
std::string name; ///< Name of the content
std::string version; ///< Version of the content
std::string url; ///< URL related to the content
std::string description; ///< Description of the content
uint32 unique_id = 0; ///< Unique ID; either GRF ID or shortname
uint32_t unique_id = 0; ///< Unique ID; either GRF ID or shortname
MD5Hash md5sum; ///< The MD5 checksum
std::vector<ContentID> dependencies; ///< The dependencies (unique server side ids)
StringList tags; ///< Tags associated with the content

View File

@@ -77,7 +77,7 @@ protected:
* permanent error causing the connection to be dropped, or in response
* to a request that is invalid.
*
* uint8 Type of error (see NetworkCoordinatorErrorType).
* uint8_t Type of error (see NetworkCoordinatorErrorType).
* string Details of the error.
*
* @param p The packet that was just received.
@@ -89,9 +89,9 @@ protected:
* Server is starting a multiplayer game and wants to let the
* Game Coordinator know.
*
* uint8 Game Coordinator protocol version.
* uint8 Type of game (see ServerGameType).
* uint16 Local port of the server.
* uint8_t Game Coordinator protocol version.
* uint8_t Type of game (see ServerGameType).
* uint16_t Local port of the server.
* string Invite code the server wants to use (can be empty; coordinator will assign a new invite code).
* string Secret that belongs to the invite code (empty if invite code is empty).
*
@@ -105,7 +105,7 @@ protected:
*
* string Invite code that can be used to join this server.
* string Secret that belongs to the invite code (only needed if reusing the invite code on next SERVER_REGISTER).
* uint8 Type of connection was detected (see ConnectionType).
* uint8_t Type of connection was detected (see ConnectionType).
*
* @param p The packet that was just received.
* @return True upon success, otherwise false.
@@ -115,7 +115,7 @@ protected:
/**
* Send an update of the current state of the server to the Game Coordinator.
*
* uint8 Game Coordinator protocol version.
* uint8_t Game Coordinator protocol version.
* Serialized NetworkGameInfo. See game_info.hpp for details.
*
* @param p The packet that was just received.
@@ -126,10 +126,10 @@ protected:
/**
* Client requests a list of all public servers.
*
* uint8 Game Coordinator protocol version.
* uint8 Game-info version used by this client.
* uint8_t Game Coordinator protocol version.
* uint8_t Game-info version used by this client.
* string Revision of the client.
* uint32 (Game Coordinator protocol >= 4) Cursor as received from GC_NEWGRF_LOOKUP, or zero.
* uint32_t (Game Coordinator protocol >= 4) Cursor as received from GC_NEWGRF_LOOKUP, or zero.
*
* @param p The packet that was just received.
* @return True upon success, otherwise false.
@@ -141,7 +141,7 @@ protected:
* of these packets are received after a request till all servers are
* sent over. Last packet will have server count of 0.
*
* uint16 Amount of public servers in this packet.
* uint16_t Amount of public servers in this packet.
* For each server:
* string Connection string for this server.
* Serialized NetworkGameInfo. See game_info.hpp for details.
@@ -154,7 +154,7 @@ protected:
/**
* Client wants to connect to a Server.
*
* uint8 Game Coordinator protocol version.
* uint8_t Game Coordinator protocol version.
* string Invite code of the Server to join.
*
* @param p The packet that was just received.
@@ -177,9 +177,9 @@ protected:
/**
* Client or Server failed to connect to the remote side.
*
* uint8 Game Coordinator protocol version.
* uint8_t Game Coordinator protocol version.
* string Token to track the current connect request.
* uint8 Tracking number to track current connect request.
* uint8_t Tracking number to track current connect request.
*
* @param p The packet that was just received.
* @return True upon success, otherwise false.
@@ -202,7 +202,7 @@ protected:
* Client informs the Game Coordinator the connection with the Server is
* established. The Client will disconnect from the Game Coordinator next.
*
* uint8 Game Coordinator protocol version.
* uint8_t Game Coordinator protocol version.
* string Token to track the current connect request.
*
* @param p The packet that was just received.
@@ -215,9 +215,9 @@ protected:
* the indicated peer, which is a Server.
*
* string Token to track the current connect request.
* uint8 Tracking number to track current connect request.
* uint8_t Tracking number to track current connect request.
* string Hostname of the peer.
* uint16 Port of the peer.
* uint16_t Port of the peer.
*
* @param p The packet that was just received.
* @return True upon success, otherwise false.
@@ -242,9 +242,9 @@ protected:
/**
* Client/server informs the Game Coordinator the result of a STUN request.
*
* uint8 Game Coordinator protocol version.
* uint8_t Game Coordinator protocol version.
* string Token to track the current connect request.
* uint8 Interface number, as given during STUN request.
* uint8_t Interface number, as given during STUN request.
* bool Whether the STUN connection was successful.
*
* @param p The packet that was just received.
@@ -258,10 +258,10 @@ protected:
* the local address as used with the STUN request.
*
* string Token to track the current connect request.
* uint8 Tracking number to track current connect request.
* uint8 Interface number, as given during STUN request.
* uint8_t Tracking number to track current connect request.
* uint8_t Interface number, as given during STUN request.
* string Host of the peer.
* uint16 Port of the peer.
* uint16_t Port of the peer.
*
* @param p The packet that was just received.
* @return True upon success, otherwise false.
@@ -273,10 +273,10 @@ protected:
* as used by the NewGRF deserialization in GC_LISTING.
* This packet is sent after a CLIENT_LISTING request, but before GC_LISTING.
*
* uint32 Lookup table cursor.
* uint16 Number of NewGRFs in the packet, with for each of the NewGRFs:
* uint32 Lookup table index for the NewGRF.
* uint32 Unique NewGRF ID.
* uint32_t Lookup table cursor.
* uint16_t Number of NewGRFs in the packet, with for each of the NewGRFs:
* uint32_t Lookup table index for the NewGRF.
* uint32_t Unique NewGRF ID.
* byte[16] MD5 checksum of the NewGRF
* string Name of the NewGRF.
*
@@ -296,7 +296,7 @@ protected:
* peer, which is a TURN server.
*
* string Token to track the current connect request.
* uint8 Tracking number to track current connect request.
* uint8_t Tracking number to track current connect request.
* string Ticket to hand over to the TURN server.
* string Connection string of the TURN server.
*

View File

@@ -176,15 +176,15 @@ protected:
* Try to join the server:
* string OpenTTD revision (norev000 if no revision).
* string Name of the client (max NETWORK_NAME_LENGTH).
* uint8 ID of the company to play as (1..MAX_COMPANIES).
* uint8 ID of the clients Language.
* uint8_t ID of the company to play as (1..MAX_COMPANIES).
* uint8_t ID of the clients Language.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_CLIENT_JOIN(Packet *p);
/**
* The client made an error:
* uint8 Error code caused (see NetworkErrorCode).
* uint8_t Error code caused (see NetworkErrorCode).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_ERROR(Packet *p);
@@ -204,8 +204,8 @@ protected:
/**
* Send information about a client:
* uint32 ID of the client (always unique on a server. 1 = server, 0 is invalid).
* uint8 ID of the company the client is playing as (255 for spectators).
* uint32_t ID of the client (always unique on a server. 1 = server, 0 is invalid).
* uint8_t ID of the company the client is playing as (255 for spectators).
* string Name of the client.
* @param p The packet that was just received.
*/
@@ -219,7 +219,7 @@ protected:
/**
* Indication to the client that the server needs a company password:
* uint32 Generation seed.
* uint32_t Generation seed.
* string Network ID of the server.
* @param p The packet that was just received.
*/
@@ -227,7 +227,7 @@ protected:
/**
* Send a password to the server to authorize:
* uint8 Password type (see NetworkPasswordType).
* uint8_t Password type (see NetworkPasswordType).
* string The password.
* @param p The packet that was just received.
*/
@@ -235,7 +235,7 @@ protected:
/**
* Send a password to the server to authorize
* uint8 Password type (see NetworkPasswordType).
* uint8_t Password type (see NetworkPasswordType).
* string The password.
* @param p The packet that was just received.
*/
@@ -243,8 +243,8 @@ protected:
/**
* The client is joined and ready to receive their map:
* uint32 Own client ID.
* uint32 Generation seed.
* uint32_t Own client ID.
* uint32_t Generation seed.
* string Network ID of the server.
* @param p The packet that was just received.
*/
@@ -252,28 +252,28 @@ protected:
/**
* Request the map from the server.
* uint32 NewGRF version (release versions of OpenTTD only).
* uint32_t NewGRF version (release versions of OpenTTD only).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_CLIENT_GETMAP(Packet *p);
/**
* Notification that another client is currently receiving the map:
* uint8 Number of clients waiting in front of you.
* uint8_t Number of clients waiting in front of you.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_WAIT(Packet *p);
/**
* Sends that the server will begin with sending the map to the client:
* uint32 Current frame.
* uint32_t Current frame.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_MAP_BEGIN(Packet *p);
/**
* Sends the size of the map to the client.
* uint32 Size of the (compressed) map (in bytes).
* uint32_t Size of the (compressed) map (in bytes).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_MAP_SIZE(Packet *p);
@@ -299,79 +299,79 @@ protected:
/**
* A client joined (PACKET_CLIENT_MAP_OK), what usually directly follows is a PACKET_SERVER_CLIENT_INFO:
* uint32 ID of the client that just joined the game.
* uint32_t ID of the client that just joined the game.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_JOIN(Packet *p);
/**
* Sends the current frame counter to the client:
* uint32 Frame counter
* uint32 Frame counter max (how far may the client walk before the server?)
* uint32 General seed 1 (dependent on compile settings, not default).
* uint32 General seed 2 (dependent on compile settings, not default).
* uint8 Random token to validate the client is actually listening (only occasionally present).
* uint32_t Frame counter
* uint32_t Frame counter max (how far may the client walk before the server?)
* uint32_t General seed 1 (dependent on compile settings, not default).
* uint32_t General seed 2 (dependent on compile settings, not default).
* uint8_t Random token to validate the client is actually listening (only occasionally present).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_FRAME(Packet *p);
/**
* Sends a sync-check to the client:
* uint32 Frame counter.
* uint32 General seed 1.
* uint32 General seed 2 (dependent on compile settings, not default).
* uint32_t Frame counter.
* uint32_t General seed 1.
* uint32_t General seed 2 (dependent on compile settings, not default).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_SYNC(Packet *p);
/**
* Tell the server we are done with this frame:
* uint32 Current frame counter of the client.
* uint8 The random token that the server sent in the PACKET_SERVER_FRAME packet.
* uint32_t Current frame counter of the client.
* uint8_t The random token that the server sent in the PACKET_SERVER_FRAME packet.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_CLIENT_ACK(Packet *p);
/**
* Send a DoCommand to the Server:
* uint8 ID of the company (0..MAX_COMPANIES-1).
* uint32 ID of the command (see command.h).
* uint8_t ID of the company (0..MAX_COMPANIES-1).
* uint32_t ID of the command (see command.h).
* <var> Command specific buffer with encoded parameters of variable length.
* The content differs per command and can change without notification.
* uint8 ID of the callback.
* uint8_t ID of the callback.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_CLIENT_COMMAND(Packet *p);
/**
* Sends a DoCommand to the client:
* uint8 ID of the company (0..MAX_COMPANIES-1).
* uint32 ID of the command (see command.h).
* uint8_t ID of the company (0..MAX_COMPANIES-1).
* uint32_t ID of the command (see command.h).
* <var> Command specific buffer with encoded parameters of variable length.
* The content differs per command and can change without notification.
* uint8 ID of the callback.
* uint32 Frame of execution.
* uint8_t ID of the callback.
* uint32_t Frame of execution.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_COMMAND(Packet *p);
/**
* Sends a chat-packet to the server:
* uint8 ID of the action (see NetworkAction).
* uint8 ID of the destination type (see DestType).
* uint32 ID of the client or company (destination of the chat).
* uint8_t ID of the action (see NetworkAction).
* uint8_t ID of the destination type (see DestType).
* uint32_t ID of the client or company (destination of the chat).
* string Message (max NETWORK_CHAT_LENGTH).
* uint64 data (used e.g. for 'give money' actions).
* uint64_t data (used e.g. for 'give money' actions).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_CLIENT_CHAT(Packet *p);
/**
* Sends a chat-packet to the client:
* uint8 ID of the action (see NetworkAction).
* uint32 ID of the client (origin of the chat).
* uint8_t ID of the action (see NetworkAction).
* uint32_t ID of the client (origin of the chat).
* string Message (max NETWORK_CHAT_LENGTH).
* uint64 data (used e.g. for 'give money' actions).
* uint64_t data (used e.g. for 'give money' actions).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_CHAT(Packet *p);
@@ -379,7 +379,7 @@ protected:
/**
* Sends a chat-packet for external source to the client:
* string Name of the source this message came from.
* uint16 TextColour to use for the message.
* uint16_t TextColour to use for the message.
* string Name of the user who sent the messsage.
* string Message (max NETWORK_CHAT_LENGTH).
* @param p The packet that was just received.
@@ -408,22 +408,22 @@ protected:
/**
* The client made an error and is quitting the game.
* uint8 Error of the code caused (see NetworkErrorCode).
* uint8_t Error of the code caused (see NetworkErrorCode).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_CLIENT_ERROR(Packet *p);
/**
* Notification that a client left the game:
* uint32 ID of the client.
* uint32_t ID of the client.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_QUIT(Packet *p);
/**
* Inform all clients that one client made an error and thus has quit/been disconnected:
* uint32 ID of the client that caused the error.
* uint8 Code of the error caused (see NetworkErrorCode).
* uint32_t ID of the client that caused the error.
* uint8_t Code of the error caused (see NetworkErrorCode).
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_ERROR_QUIT(Packet *p);
@@ -442,7 +442,7 @@ protected:
/**
* Send the result of an issues RCon command back to the client:
* uint16 Colour code.
* uint16_t Colour code.
* string Output of the RCon command
* @param p The packet that was just received.
*/
@@ -458,9 +458,9 @@ protected:
/**
* Sends information about all used GRFs to the client:
* uint8 Amount of GRFs (the following data is repeated this many times, i.e. per GRF data).
* uint32 GRF ID
* 16 * uint8 MD5 checksum of the GRF
* uint8_t Amount of GRFs (the following data is repeated this many times, i.e. per GRF data).
* uint32_t GRF ID
* 16 * uint8_t MD5 checksum of the GRF
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_CHECK_NEWGRFS(Packet *p);
@@ -473,15 +473,15 @@ protected:
/**
* Move a client from one company into another:
* uint32 ID of the client.
* uint8 ID of the new company.
* uint32_t ID of the client.
* uint8_t ID of the new company.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_MOVE(Packet *p);
/**
* Request the server to move this client into another company:
* uint8 ID of the company the client wants to join.
* uint8_t ID of the company the client wants to join.
* string Password, if the company is password protected.
* @param p The packet that was just received.
*/
@@ -489,15 +489,15 @@ protected:
/**
* Update the clients knowledge of which company is password protected:
* uint16 Bitwise representation of each company
* uint16_t Bitwise representation of each company
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_COMPANY_UPDATE(Packet *p);
/**
* Update the clients knowledge of the max settings:
* uint8 Maximum number of companies allowed.
* uint8 Maximum number of spectators allowed.
* uint8_t Maximum number of companies allowed.
* uint8_t Maximum number of spectators allowed.
* @param p The packet that was just received.
*/
virtual NetworkRecvStatus Receive_SERVER_CONFIG_UPDATE(Packet *p);
@@ -507,8 +507,8 @@ protected:
NetworkGameSocketHandler(SOCKET s);
public:
ClientID client_id; ///< Client identifier
uint32 last_frame; ///< Last frame we have executed
uint32 last_frame_server; ///< Last frame the server has executed
uint32_t last_frame; ///< Last frame we have executed
uint32_t last_frame_server; ///< Last frame the server has executed
CommandQueue incoming_queue; ///< The command-queue awaiting handling
std::chrono::steady_clock::time_point last_packet; ///< Time we received the last frame.

View File

@@ -140,7 +140,7 @@ public:
* @param port The port to listen on.
* @return true if listening succeeded.
*/
static bool Listen(uint16 port)
static bool Listen(uint16_t port)
{
assert(sockets.size() == 0);

View File

@@ -31,9 +31,9 @@ protected:
* Send a STUN request to the STUN server letting the Game Coordinator know
* what our actually public IP:port is.
*
* uint8 Game Coordinator protocol version.
* uint8_t Game Coordinator protocol version.
* string Token to track the current STUN request.
* uint8 Which interface number this is (for example, IPv4 or IPv6).
* uint8_t Which interface number this is (for example, IPv4 or IPv6).
* The Game Coordinator relays this number back in later packets.
*
* @param p The packet that was just received.

View File

@@ -44,7 +44,7 @@ protected:
* Client or servers wants to connect to the TURN server (on request by
* the Game Coordinator).
*
* uint8 Game Coordinator protocol version.
* uint8_t Game Coordinator protocol version.
* string Token to track the current TURN request.
*
* @param p The packet that was just received.