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