maint: clean client_t struct

This commit is contained in:
FutureRave 2023-05-13 17:26:17 +01:00
parent d711d5f6c5
commit f14ea87e44
3 changed files with 17 additions and 7 deletions

View File

@ -98,7 +98,7 @@ namespace auth
{
static const auto is_first = []
{
static utils::nt::handle<> mutex = CreateMutexA(nullptr, FALSE, "boiii_mutex");
static utils::nt::handle mutex = CreateMutexA(nullptr, FALSE, "boiii_mutex");
return mutex && GetLastError() != ERROR_ALREADY_EXISTS;
}();
@ -134,8 +134,8 @@ namespace auth
const auto& fragment_packet = packet_buffer.get_buffer();
game::NET_OutOfBandData(
sock, adr, fragment_packet.data(),
game::NET_OutOfBandData(sock, adr,
fragment_packet.data(),
static_cast<int>(fragment_packet.size()));
});
}

View File

@ -1579,9 +1579,19 @@ namespace game
SV_CMD_RELIABLE_0 = 0x1,
};
enum
{
CS_FREE = 0x0,
CS_ZOMBIE = 0x1,
CS_RECONNECTING = 0x2,
CS_CONNECTED = 0x3,
CS_CLIENTLOADING = 0x4,
CS_ACTIVE = 0x5,
};
struct client_s
{
int client_state;
int state;
char __pad0[0x28];
netadr_t address;
char __pad1[20468];

View File

@ -205,7 +205,7 @@ namespace game
}
auto& client = client_states[index];
if (client.client_state <= 0)
if (client.state == CS_FREE)
{
return false;
}
@ -238,7 +238,7 @@ namespace game
{
foreach_client([&](client_s& client, const size_t index)
{
if (client.client_state > 0)
if (client.state != CS_FREE)
{
callback(client, index);
}