Fix potentially expensive copying of ChunkPos in escort path assignment

This commit is contained in:
gsemaj 2021-05-09 08:36:17 -04:00
parent 5c1bb0acc9
commit e5d9e7217e

View File

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