Scan all chunks in instance instead of in view for escort missions

This commit is contained in:
gsemaj
2021-05-06 11:41:24 -04:00
committed by Gent Semaj
parent a90ba9ea08
commit eb8ec85746
3 changed files with 5 additions and 2 deletions

View File

@@ -361,7 +361,8 @@ static void taskStart(CNSocket* sock, CNPacketData* data) {
// if escort task, assign matching paths to all nearby NPCs
if (task["m_iHTaskType"] == 6) {
for(Chunk* chunk : plr->viewableChunks) // check all NPCs in view
for (ChunkPos chunkPos : Chunking::getChunksInMap(plr->instanceID)) { // check all NPCs in the instance
Chunk* chunk = Chunking::chunks[chunkPos];
for (EntityRef ref : chunk->entities) {
if (ref.type != EntityType::PLAYER) {
BaseNPC* npc = (BaseNPC*)ref.getEntity();
@@ -372,6 +373,7 @@ static void taskStart(CNSocket* sock, CNPacketData* data) {
}
}
}
}
}
}