Use standard small IDs in player colour tracking

This commit is contained in:
notmatthewbeshay 2026-03-11 01:52:37 +11:00
parent bdb3341a99
commit c8150b1338
3 changed files with 9 additions and 9 deletions

View file

@ -305,7 +305,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet)
//minecraft->setScreen(new ReceivingLevelScreen(this));
minecraft->player->entityId = packet->clientVersion;
BYTE networkSmallId = getSocket()->getSmallId();
std::uint8_t networkSmallId = getSocket()->getSmallId();
app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
minecraft->player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);
@ -375,7 +375,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet)
player->setCustomCape( app.GetPlayerCapeId(m_userIndex) );
BYTE networkSmallId = getSocket()->getSmallId();
std::uint8_t networkSmallId = getSocket()->getSmallId();
app.UpdatePlayerInfo(networkSmallId, packet->m_playerIndex, packet->m_uiGamePrivileges);
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges);

View file

@ -7816,7 +7816,7 @@ void CMinecraftApp::ClearTerrainFeaturePosition()
}
}
void CMinecraftApp::UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges)
void CMinecraftApp::UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges)
{
for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
{
@ -7833,7 +7833,7 @@ void CMinecraftApp::UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourInde
}
}
short CMinecraftApp::GetPlayerColour(BYTE networkSmallId)
short CMinecraftApp::GetPlayerColour(std::uint8_t networkSmallId)
{
short index = -1;
for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
@ -7848,7 +7848,7 @@ short CMinecraftApp::GetPlayerColour(BYTE networkSmallId)
}
unsigned int CMinecraftApp::GetPlayerPrivileges(BYTE networkSmallId)
unsigned int CMinecraftApp::GetPlayerPrivileges(std::uint8_t networkSmallId)
{
unsigned int privileges = 0;
for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)

View file

@ -722,13 +722,13 @@ public:
const wchar_t *GetGameRulesString(const std::wstring &key);
private:
BYTE m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's
std::uint8_t m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's
unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS];
public:
void UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges);
short GetPlayerColour(BYTE networkSmallId);
unsigned int GetPlayerPrivileges(BYTE networkSmallId);
void UpdatePlayerInfo(std::uint8_t networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges);
short GetPlayerColour(std::uint8_t networkSmallId);
unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId);
std::wstring getEntityName(eINSTANCEOF type);