diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-07 21:56:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:56:03 +0700 |
| commit | a9be52c41a02d207233199e98898fe7483d7e817 (patch) | |
| tree | 71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.World/AddPlayerPacket.cpp | |
| parent | 1be5faaea781402e7de06b263eeca4c688b7712c (diff) | |
Project modernization (#630)
* Fixed boats falling and a TP glitch #266
* Replaced every C-style cast with C++ ones
* Replaced every C-style cast with C++ ones
* Fixed boats falling and a TP glitch #266
* Updated NULL to nullptr and fixing some type issues
* Modernized and fixed a few bugs
- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.
* Fixing more conflicts
* Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.World/AddPlayerPacket.cpp')
| -rw-r--r-- | Minecraft.World/AddPlayerPacket.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Minecraft.World/AddPlayerPacket.cpp b/Minecraft.World/AddPlayerPacket.cpp index 93984367..fbee1fc5 100644 --- a/Minecraft.World/AddPlayerPacket.cpp +++ b/Minecraft.World/AddPlayerPacket.cpp @@ -24,12 +24,12 @@ AddPlayerPacket::AddPlayerPacket() m_capeId = 0; m_uiGamePrivileges = 0; entityData = nullptr; - unpack = NULL; + unpack = nullptr; } AddPlayerPacket::~AddPlayerPacket() { - if(unpack != NULL) delete unpack; + if(unpack != nullptr) delete unpack; } AddPlayerPacket::AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp) @@ -51,17 +51,17 @@ AddPlayerPacket::AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, Play //printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot); shared_ptr<ItemInstance> itemInstance = player->inventory->getSelected(); - carriedItem = itemInstance == NULL ? 0 : itemInstance->id; + carriedItem = itemInstance == nullptr ? 0 : itemInstance->id; this->xuid = xuid; this->OnlineXuid = OnlineXuid; - m_playerIndex = (BYTE)player->getPlayerIndex(); + m_playerIndex = static_cast<BYTE>(player->getPlayerIndex()); m_skinId = player->getCustomSkin(); m_capeId = player->getCustomCape(); m_uiGamePrivileges = player->getAllPlayerGamePrivileges(); entityData = player->getEntityData(); - unpack = NULL; + unpack = nullptr; } void AddPlayerPacket::read(DataInputStream *dis) //throws IOException @@ -119,11 +119,11 @@ int AddPlayerPacket::getEstimatedSize() { int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) + sizeof(byte); - if( entityData != NULL ) + if( entityData != nullptr ) { iSize += entityData->getSizeInBytes(); } - else if( unpack != NULL ) + else if( unpack != nullptr ) { // 4J Stu - This is an incoming value which we aren't currently analysing //iSize += unpack->get @@ -134,7 +134,7 @@ int AddPlayerPacket::getEstimatedSize() vector<shared_ptr<SynchedEntityData::DataItem> > *AddPlayerPacket::getUnpackedData() { - if (unpack == NULL) + if (unpack == nullptr) { unpack = entityData->getAll(); } |
