From f733aa60f06a56c9b8fc0a98e3c62105e1fa51be Mon Sep 17 00:00:00 2001 From: Kamil Date: Sun, 8 Nov 2020 10:08:22 +0100 Subject: [PATCH] added a chunk sanity check removed unneccesary include --- src/NPCManager.cpp | 5 +++++ src/Player.hpp | 1 - src/TableData.cpp | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/NPCManager.cpp b/src/NPCManager.cpp index df52e0f..72a3f96 100644 --- a/src/NPCManager.cpp +++ b/src/NPCManager.cpp @@ -917,6 +917,11 @@ void NPCManager::eggPickup(CNSocket* sock, CNPacketData* data) { return; } + if (egg->chunkPos != ChunkManager::grabChunk(plr->x, plr->y, plr->instanceID)) { + std::cout << "[WARN] Player tried to open an egg from the other chunk?!" << std::endl; + return; + } + int typeId = egg->appearanceData.iNPCType; if (EggTypes.find(typeId) == EggTypes.end()) { if (egg->npcClass != NPCClass::NPC_EGG) { diff --git a/src/Player.hpp b/src/Player.hpp index 9962f83..714250b 100644 --- a/src/Player.hpp +++ b/src/Player.hpp @@ -2,7 +2,6 @@ #include #include -#include #include "CNProtocol.hpp" #include "CNStructs.hpp" diff --git a/src/TableData.cpp b/src/TableData.cpp index bc9e4e6..79e9a55 100644 --- a/src/TableData.cpp +++ b/src/TableData.cpp @@ -625,7 +625,6 @@ void TableData::loadGruntwork(int32_t *nextId) { NPCManager::Eggs[id] = addEgg; NPCManager::updateNPCPosition(id, egg["iX"], egg["iY"], egg["iZ"], egg["iMapNum"]); TableData::RunningEggs[id] = addEgg; - std::cout << id << " " << addEgg->currentChunks.size() << std::endl; }