Tools/Map extractor: Minor optimization in MCNK parsing loop - look up end iterator once

This commit is contained in:
Shauren authored and Ovahlord committed 2026-03-09 22:43:34 +01:00
1 parent 2e19198ced
commit e7a52305cd
1 file changed
+5 -4
+5 -4
View File
@@ -28,6 +28,7 @@
#include "Common.h"
#include "MapDefines.h"
#include "IteratorPair.h"
#include "StringFormat.h"
#include "Util.h"
#ifdef PLATFORM_WINDOWS
@@ -484,9 +485,9 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
bool hasHoles = false;
bool hasFlightBox = false;
for (std::multimap<std::string, FileChunk*>::const_iterator itr = adt.chunks.lower_bound("MCNK"); itr != adt.chunks.upper_bound("MCNK"); ++itr)
for (auto const& [_, rawChunk] : Trinity::Containers::MapEqualRange(adt.chunks, "MCNK"))
{
adt_MCNK* mcnk = itr->second->As<adt_MCNK>();
adt_MCNK* mcnk = rawChunk->As<adt_MCNK>();
// Area data
area_ids[mcnk->iy][mcnk->ix] = mcnk->areaid;
@@ -531,7 +532,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
}
// Get custom height
if (FileChunk* chunk = itr->second->GetSubChunk("MCVT"))
if (FileChunk* chunk = rawChunk->GetSubChunk("MCVT"))
{
adt_MCVT* mcvt = chunk->As<adt_MCVT>();
// get V9 height map
@@ -560,7 +561,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
// Liquid data
if (mcnk->sizeMCLQ > 8)
{
if (FileChunk* chunk = itr->second->GetSubChunk("MCLQ"))
if (FileChunk* chunk = rawChunk->GetSubChunk("MCLQ"))
{
adt_MCLQ* liquid = chunk->As<adt_MCLQ>();
int count = 0;