[Structs] use clientheader
This commit is contained in:
parent
52d9011561
commit
28b089f070
@ -180,7 +180,7 @@ namespace Components
|
|||||||
SteamID guid;
|
SteamID guid;
|
||||||
guid.bits = cl->steamID;
|
guid.bits = cl->steamID;
|
||||||
|
|
||||||
InsertBan({guid, cl->netchan.remoteAddress.ip});
|
InsertBan({guid, cl->header.netchan.remoteAddress.ip});
|
||||||
|
|
||||||
Game::SV_DropClient(cl, reason.data(), true);
|
Game::SV_DropClient(cl, reason.data(), true);
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto* cl = &Game::svs_clients[num];
|
const auto* cl = &Game::svs_clients[num];
|
||||||
if (cl->state == Game::CS_FREE)
|
if (cl->header.state == Game::CS_FREE)
|
||||||
{
|
{
|
||||||
Logger::Print("Client {} is not active\n", num);
|
Logger::Print("Client {} is not active\n", num);
|
||||||
return;
|
return;
|
||||||
|
@ -160,7 +160,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
char playerTitle[18];
|
char playerTitle[18];
|
||||||
|
|
||||||
if (Game::svs_clients[i].state >= Game::CS_CONNECTED)
|
if (Game::svs_clients[i].header.state >= Game::CS_CONNECTED)
|
||||||
{
|
{
|
||||||
strncpy_s(playerTitle, Game::Info_ValueForKey(Game::svs_clients[i].userinfo, "customTitle"), _TRUNCATE);
|
strncpy_s(playerTitle, Game::Info_ValueForKey(Game::svs_clients[i].userinfo, "customTitle"), _TRUNCATE);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < maxclientCount; ++i)
|
for (int i = 0; i < maxclientCount; ++i)
|
||||||
{
|
{
|
||||||
if (Game::svs_clients[i].state >= 3)
|
if (Game::svs_clients[i].header.state >= Game::CS_CONNECTED)
|
||||||
{
|
{
|
||||||
++clientCount;
|
++clientCount;
|
||||||
}
|
}
|
||||||
|
@ -81,9 +81,9 @@ namespace Components
|
|||||||
{
|
{
|
||||||
std::string list = Utils::String::VA("%c", 20);
|
std::string list = Utils::String::VA("%c", 20);
|
||||||
|
|
||||||
for (int i = 0; i < 18; ++i)
|
for (std::size_t i = 0; i < Game::MAX_CLIENTS; ++i)
|
||||||
{
|
{
|
||||||
if (Game::svs_clients[i].state >= 3)
|
if (Game::svs_clients[i].header.state >= 3)
|
||||||
{
|
{
|
||||||
list.append(Utils::String::VA(" %llX", Game::svs_clients[i].steamID));
|
list.append(Utils::String::VA(" %llX", Game::svs_clients[i].steamID));
|
||||||
|
|
||||||
|
@ -388,9 +388,9 @@ namespace Components
|
|||||||
{
|
{
|
||||||
Game::client_t* client = &Game::svs_clients[i];
|
Game::client_t* client = &Game::svs_clients[i];
|
||||||
|
|
||||||
if (client->state >= 3)
|
if (client->header.state >= Game::CS_CONNECTED)
|
||||||
{
|
{
|
||||||
if (address.getIP().full == Network::Address(client->netchan.remoteAddress).getIP().full)
|
if (address.getIP().full == Network::Address(client->header.netchan.remoteAddress).getIP().full)
|
||||||
{
|
{
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
@ -752,7 +752,7 @@ namespace Components
|
|||||||
|
|
||||||
if ((*Game::com_sv_running)->current.enabled)
|
if ((*Game::com_sv_running)->current.enabled)
|
||||||
{
|
{
|
||||||
if (Game::svs_clients[i].state < 3) continue;
|
if (Game::svs_clients[i].header.state < Game::CS_CONNECTED) continue;
|
||||||
|
|
||||||
playerInfo["score"] = Game::SV_GameClientNum_Score(i);
|
playerInfo["score"] = Game::SV_GameClientNum_Score(i);
|
||||||
playerInfo["ping"] = Game::svs_clients[i].ping;
|
playerInfo["ping"] = Game::svs_clients[i].ping;
|
||||||
|
@ -251,7 +251,7 @@ namespace Components
|
|||||||
const auto* ent = Game::GetPlayerEntity(entref);
|
const auto* ent = Game::GetPlayerEntity(entref);
|
||||||
const auto* client = Script::GetClient(ent);
|
const auto* client = Script::GetClient(ent);
|
||||||
|
|
||||||
std::string ip = Game::NET_AdrToString(client->netchan.remoteAddress);
|
std::string ip = Game::NET_AdrToString(client->header.netchan.remoteAddress);
|
||||||
|
|
||||||
if (const auto pos = ip.find_first_of(":"); pos != std::string::npos)
|
if (const auto pos = ip.find_first_of(":"); pos != std::string::npos)
|
||||||
ip.erase(ip.begin() + pos, ip.end()); // Erase port
|
ip.erase(ip.begin() + pos, ip.end()); // Erase port
|
||||||
|
@ -270,7 +270,7 @@ namespace Components
|
|||||||
Logger::Print(Game::conChannel_t::CON_CHANNEL_NETWORK, "Negative reliableAcknowledge from {} - cl->reliableSequence is {}, reliableAcknowledge is {}\n",
|
Logger::Print(Game::conChannel_t::CON_CHANNEL_NETWORK, "Negative reliableAcknowledge from {} - cl->reliableSequence is {}, reliableAcknowledge is {}\n",
|
||||||
client->name, client->reliableSequence, client->reliableAcknowledge);
|
client->name, client->reliableSequence, client->reliableAcknowledge);
|
||||||
client->reliableAcknowledge = client->reliableSequence;
|
client->reliableAcknowledge = client->reliableSequence;
|
||||||
SendCommand(Game::NS_SERVER, client->netchan.remoteAddress, "error", "EXE_LOSTRELIABLECOMMANDS");
|
SendCommand(Game::NS_SERVER, client->header.netchan.remoteAddress, "error", "EXE_LOSTRELIABLECOMMANDS");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < maxclientCount; ++i)
|
for (int i = 0; i < maxclientCount; ++i)
|
||||||
{
|
{
|
||||||
if (Game::svs_clients[i].state >= 3)
|
if (Game::svs_clients[i].header.state >= Game::CS_CONNECTED)
|
||||||
{
|
{
|
||||||
if (Game::svs_clients[i].bIsTestClient) ++botCount;
|
if (Game::svs_clients[i].bIsTestClient) ++botCount;
|
||||||
else ++clientCount;
|
else ++clientCount;
|
||||||
|
@ -208,7 +208,7 @@ namespace Components
|
|||||||
|
|
||||||
if ((*Game::com_sv_running)->current.enabled)
|
if ((*Game::com_sv_running)->current.enabled)
|
||||||
{
|
{
|
||||||
if (Game::svs_clients[i].state < 3) continue;
|
if (Game::svs_clients[i].header.state < Game::CS_CONNECTED) continue;
|
||||||
|
|
||||||
score = Game::SV_GameClientNum_Score(i);
|
score = Game::SV_GameClientNum_Score(i);
|
||||||
ping = Game::svs_clients[i].ping;
|
ping = Game::svs_clients[i].ping;
|
||||||
|
@ -42,7 +42,7 @@ namespace Components
|
|||||||
|
|
||||||
assert(VoicePacketCount[clientNum] >= 0);
|
assert(VoicePacketCount[clientNum] >= 0);
|
||||||
|
|
||||||
if (client->state == Game::CS_ACTIVE && VoicePacketCount[clientNum])
|
if (client->header.state == Game::CS_ACTIVE && VoicePacketCount[clientNum])
|
||||||
{
|
{
|
||||||
Game::MSG_Init(&msg, msg_buf.get(), 0x10000);
|
Game::MSG_Init(&msg, msg_buf.get(), 0x10000);
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Game::NET_OutOfBandVoiceData(Game::NS_SERVER, client->netchan.remoteAddress, msg.data, msg.cursize, true);
|
Game::NET_OutOfBandVoiceData(Game::NS_SERVER, client->header.netchan.remoteAddress, msg.data, msg.cursize, true);
|
||||||
VoicePacketCount[clientNum] = 0;
|
VoicePacketCount[clientNum] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ namespace Components
|
|||||||
Game::MSG_ReadData(msg, voicePacket.data, voicePacket.dataSize);
|
Game::MSG_ReadData(msg, voicePacket.data, voicePacket.dataSize);
|
||||||
for (auto otherPlayer = 0; otherPlayer < (*Game::sv_maxclients)->current.integer; ++otherPlayer)
|
for (auto otherPlayer = 0; otherPlayer < (*Game::sv_maxclients)->current.integer; ++otherPlayer)
|
||||||
{
|
{
|
||||||
if (otherPlayer != talker && Game::svs_clients[otherPlayer].state >= Game::CS_CONNECTED && !SV_ServerHasClientMuted(talker))
|
if (otherPlayer != talker && Game::svs_clients[otherPlayer].header.state >= Game::CS_CONNECTED && !SV_ServerHasClientMuted(talker))
|
||||||
{
|
{
|
||||||
SV_QueueVoicePacket(talker, otherPlayer, &voicePacket);
|
SV_QueueVoicePacket(talker, otherPlayer, &voicePacket);
|
||||||
}
|
}
|
||||||
@ -213,15 +213,15 @@ namespace Components
|
|||||||
|
|
||||||
void Voice::SV_VoicePacket(Game::netadr_t from, Game::msg_t* msg)
|
void Voice::SV_VoicePacket(Game::netadr_t from, Game::msg_t* msg)
|
||||||
{
|
{
|
||||||
auto qport = Game::MSG_ReadShort(msg);
|
const auto qport = Game::MSG_ReadShort(msg);
|
||||||
auto* cl = Game::SV_FindClientByAddress(from, qport, 0);
|
auto* cl = Game::SV_FindClientByAddress(from, qport, 0);
|
||||||
if (!cl || cl->state == Game::CS_ZOMBIE)
|
if (!cl || cl->header.state == Game::CS_ZOMBIE)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cl->lastPacketTime = *Game::svs_time;
|
cl->lastPacketTime = *Game::svs_time;
|
||||||
if (cl->state < Game::CS_ACTIVE)
|
if (cl->header.state < Game::CS_ACTIVE)
|
||||||
{
|
{
|
||||||
SV_PreGameUserVoice(cl, msg);
|
SV_PreGameUserVoice(cl, msg);
|
||||||
}
|
}
|
||||||
|
@ -884,8 +884,8 @@ namespace Game
|
|||||||
{
|
{
|
||||||
for (auto i = 0; i < *svs_clientCount; ++i)
|
for (auto i = 0; i < *svs_clientCount; ++i)
|
||||||
{
|
{
|
||||||
if (svs_clients[i].state != CS_FREE
|
if (svs_clients[i].header.state != CS_FREE
|
||||||
&& svs_clients[i].netchan.remoteAddress.type == NA_BOT)
|
&& svs_clients[i].header.netchan.remoteAddress.type == NA_BOT)
|
||||||
{
|
{
|
||||||
SV_GameDropClient(i, "GAME_GET_TO_COVER");
|
SV_GameDropClient(i, "GAME_GET_TO_COVER");
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ namespace Game
|
|||||||
DVAR_TYPE_COUNT = 0xA,
|
DVAR_TYPE_COUNT = 0xA,
|
||||||
} dvar_type;
|
} dvar_type;
|
||||||
|
|
||||||
typedef enum
|
enum clientState_t
|
||||||
{
|
{
|
||||||
CS_FREE = 0x0,
|
CS_FREE = 0x0,
|
||||||
CS_ZOMBIE = 0x1,
|
CS_ZOMBIE = 0x1,
|
||||||
@ -243,7 +243,7 @@ namespace Game
|
|||||||
CS_CONNECTED = 0x3,
|
CS_CONNECTED = 0x3,
|
||||||
CS_CLIENTLOADING = 0x4,
|
CS_CLIENTLOADING = 0x4,
|
||||||
CS_ACTIVE = 0x5,
|
CS_ACTIVE = 0x5,
|
||||||
} clientState_t;
|
};
|
||||||
|
|
||||||
enum serverState_t
|
enum serverState_t
|
||||||
{
|
{
|
||||||
@ -6301,17 +6301,28 @@ namespace Game
|
|||||||
bool topFire;
|
bool topFire;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct clientHeader_t
|
||||||
|
{
|
||||||
|
int state;
|
||||||
|
int sendAsActive;
|
||||||
|
int deltaMessage;
|
||||||
|
int rateDelayed;
|
||||||
|
int hasAckedBaselineData;
|
||||||
|
int hugeSnapshotSent;
|
||||||
|
netchan_t netchan;
|
||||||
|
float predictedOrigin[3];
|
||||||
|
int predictedOriginServerTime;
|
||||||
|
int migrationState;
|
||||||
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(clientHeader_t) == 1624);
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
typedef struct client_s
|
typedef struct client_s
|
||||||
{
|
{
|
||||||
clientState_t state; // 0
|
clientHeader_t header;
|
||||||
int sendAsActive; // 4
|
const char* dropReason; // 1624
|
||||||
int deltaMessage; // 8
|
|
||||||
char __pad1[12]; // 12
|
|
||||||
netchan_t netchan; // 24
|
|
||||||
char __pad2[20]; // 1604
|
|
||||||
const char* delayDropReason; // 1624
|
|
||||||
char userinfo[1024]; // 1628
|
char userinfo[1024]; // 1628
|
||||||
char __pad3[132096]; // 2652
|
char __pad3[132096]; // 2652
|
||||||
int reliableSequence; // 134748
|
int reliableSequence; // 134748
|
||||||
|
Loading…
x
Reference in New Issue
Block a user