mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-06-05 05:42:55 +00:00
Remove BYTE from network player IDs
This commit is contained in:
parent
990d3a9986
commit
d041044000
|
|
@ -847,7 +847,7 @@ void PlayerList::tick()
|
|||
EnterCriticalSection(&m_closePlayersCS);
|
||||
while(!m_smallIdsToClose.empty())
|
||||
{
|
||||
BYTE smallId = m_smallIdsToClose.front();
|
||||
std::uint8_t smallId = m_smallIdsToClose.front();
|
||||
m_smallIdsToClose.pop_front();
|
||||
|
||||
std::shared_ptr<ServerPlayer> player = nullptr;
|
||||
|
|
@ -873,7 +873,7 @@ void PlayerList::tick()
|
|||
EnterCriticalSection(&m_kickPlayersCS);
|
||||
while(!m_smallIdsToKick.empty())
|
||||
{
|
||||
BYTE smallId = m_smallIdsToKick.front();
|
||||
std::uint8_t smallId = m_smallIdsToKick.front();
|
||||
m_smallIdsToKick.pop_front();
|
||||
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(smallId);
|
||||
if( selectedPlayer != NULL )
|
||||
|
|
@ -1416,14 +1416,14 @@ bool PlayerList::canReceiveAllPackets(std::shared_ptr<ServerPlayer> player)
|
|||
return false;
|
||||
}
|
||||
|
||||
void PlayerList::kickPlayerByShortId(BYTE networkSmallId)
|
||||
void PlayerList::kickPlayerByShortId(std::uint8_t networkSmallId)
|
||||
{
|
||||
EnterCriticalSection(&m_kickPlayersCS);
|
||||
m_smallIdsToKick.push_back(networkSmallId);
|
||||
LeaveCriticalSection(&m_kickPlayersCS);
|
||||
}
|
||||
|
||||
void PlayerList::closePlayerConnectionBySmallId(BYTE networkSmallId)
|
||||
void PlayerList::closePlayerConnectionBySmallId(std::uint8_t networkSmallId)
|
||||
{
|
||||
EnterCriticalSection(&m_closePlayersCS);
|
||||
m_smallIdsToClose.push_back(networkSmallId);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include "../../Minecraft.World/Util/ArrayWithLength.h"
|
||||
|
||||
|
|
@ -30,9 +31,9 @@ private:
|
|||
|
||||
// 4J Added
|
||||
std::vector<PlayerUID> m_bannedXuids;
|
||||
std::deque<BYTE> m_smallIdsToKick;
|
||||
std::deque<std::uint8_t> m_smallIdsToKick;
|
||||
CRITICAL_SECTION m_kickPlayersCS;
|
||||
std::deque<BYTE> m_smallIdsToClose;
|
||||
std::deque<std::uint8_t> m_smallIdsToClose;
|
||||
CRITICAL_SECTION m_closePlayersCS;
|
||||
/* 4J - removed
|
||||
Set<String> bans = new HashSet<String>();
|
||||
|
|
@ -119,8 +120,8 @@ public:
|
|||
void setAllowCheatsForAllPlayers(bool allowCommands);
|
||||
|
||||
// 4J Added
|
||||
void kickPlayerByShortId(BYTE networkSmallId);
|
||||
void closePlayerConnectionBySmallId(BYTE networkSmallId);
|
||||
void kickPlayerByShortId(std::uint8_t networkSmallId);
|
||||
void closePlayerConnectionBySmallId(std::uint8_t networkSmallId);
|
||||
bool isXuidBanned(PlayerUID xuid);
|
||||
// AP added for Vita so the range can be increased once the level starts
|
||||
void setViewDistance(int newViewDistance);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ KickPlayerPacket::KickPlayerPacket()
|
|||
m_networkSmallId = 0;
|
||||
}
|
||||
|
||||
KickPlayerPacket::KickPlayerPacket(BYTE networkSmallId)
|
||||
KickPlayerPacket::KickPlayerPacket(std::uint8_t networkSmallId)
|
||||
{
|
||||
m_networkSmallId = networkSmallId;
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ void KickPlayerPacket::handle(PacketListener *listener)
|
|||
|
||||
void KickPlayerPacket::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
m_networkSmallId = (int)dis->readByte();
|
||||
m_networkSmallId = static_cast<std::uint8_t>(dis->readByte());
|
||||
}
|
||||
|
||||
void KickPlayerPacket::write(DataOutputStream *dos) //throws IOException
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "Packet.h"
|
||||
|
||||
class KickPlayerPacket : public Packet, public std::enable_shared_from_this<KickPlayerPacket>
|
||||
{
|
||||
public:
|
||||
BYTE m_networkSmallId;
|
||||
std::uint8_t m_networkSmallId;
|
||||
|
||||
KickPlayerPacket();
|
||||
KickPlayerPacket(BYTE networkSmallId);
|
||||
KickPlayerPacket(std::uint8_t networkSmallId);
|
||||
|
||||
virtual void handle(PacketListener *listener);
|
||||
virtual void read(DataInputStream *dis);
|
||||
|
|
@ -19,4 +20,4 @@ public:
|
|||
public:
|
||||
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new KickPlayerPacket()); }
|
||||
virtual int getId() { return 159; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ PlayerInfoPacket::PlayerInfoPacket()
|
|||
m_entityId = -1;
|
||||
}
|
||||
|
||||
PlayerInfoPacket::PlayerInfoPacket(BYTE networkSmallId, short playerColourIndex, unsigned int playerPrivileges)
|
||||
PlayerInfoPacket::PlayerInfoPacket(std::uint8_t networkSmallId, short playerColourIndex, unsigned int playerPrivileges)
|
||||
{
|
||||
m_networkSmallId = networkSmallId;
|
||||
m_playerColourIndex = playerColourIndex;
|
||||
|
|
@ -38,7 +38,7 @@ PlayerInfoPacket::PlayerInfoPacket(std::shared_ptr<ServerPlayer> player)
|
|||
|
||||
void PlayerInfoPacket::read(DataInputStream *dis)
|
||||
{
|
||||
m_networkSmallId = dis->readByte();
|
||||
m_networkSmallId = static_cast<std::uint8_t>(dis->readByte());
|
||||
m_playerColourIndex = dis->readShort();
|
||||
m_playerPrivileges = dis->readInt();
|
||||
m_entityId = dis->readInt();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
#include "Packet.h"
|
||||
|
||||
|
|
@ -11,14 +12,14 @@ class PlayerInfoPacket : public Packet, public std::enable_shared_from_this<Play
|
|||
//std::wstring name;
|
||||
//bool add;
|
||||
//int latency;
|
||||
short m_networkSmallId;
|
||||
std::uint8_t m_networkSmallId;
|
||||
short m_playerColourIndex;
|
||||
unsigned int m_playerPrivileges;
|
||||
int m_entityId;
|
||||
|
||||
PlayerInfoPacket();
|
||||
//PlayerInfoPacket(const std::wstring &name, bool add, int latency);
|
||||
PlayerInfoPacket(BYTE networkSmallId, short playerColourIndex, unsigned int playerPrivileges = 0);
|
||||
PlayerInfoPacket(std::uint8_t networkSmallId, short playerColourIndex, unsigned int playerPrivileges = 0);
|
||||
PlayerInfoPacket(std::shared_ptr<ServerPlayer> player);
|
||||
|
||||
virtual void read(DataInputStream *dis);
|
||||
|
|
@ -29,4 +30,4 @@ class PlayerInfoPacket : public Packet, public std::enable_shared_from_this<Play
|
|||
public:
|
||||
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new PlayerInfoPacket()); }
|
||||
virtual int getId() { return 201; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
#ifndef __linux__
|
||||
#include <xrnm.h>
|
||||
#include <qnet.h>
|
||||
|
|
@ -109,7 +110,7 @@ private:
|
|||
// Host only connection class
|
||||
static ServerConnection *s_serverConnection;
|
||||
|
||||
BYTE networkPlayerSmallId;
|
||||
std::uint8_t networkPlayerSmallId;
|
||||
public:
|
||||
C4JThread::Event* m_socketClosedEvent;
|
||||
|
||||
|
|
@ -133,5 +134,5 @@ public:
|
|||
bool isLocal() { return m_hostLocal; }
|
||||
|
||||
bool isClosing() { return m_endClosed[SOCKET_CLIENT_END] || m_endClosed[SOCKET_SERVER_END]; }
|
||||
BYTE getSmallId() { return networkPlayerSmallId; }
|
||||
std::uint8_t getSmallId() { return networkPlayerSmallId; }
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue