added a chunk sanity check

removed unneccesary include
This commit is contained in:
Kamil 2020-11-08 10:08:22 +01:00 committed by Gent
parent d102fabc2f
commit f733aa60f0
3 changed files with 5 additions and 2 deletions

View File

@ -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) {

View File

@ -2,7 +2,6 @@
#include <string>
#include <cstring>
#include <unordered_map>
#include "CNProtocol.hpp"
#include "CNStructs.hpp"

View File

@ -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;
}