aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-11-17 20:56:14 +0100
committerShauren <shauren.trinity@gmail.com>2023-11-17 20:56:14 +0100
commit54d969713b14057204cfe4a57f8db2d399939d2b (patch)
treed2f8d4e2aca7e632fa83dce6f3411c34bee5daa5 /src/tools
parentbc4d09d05662e8bc653a66095089328310b0be4a (diff)
Tools/Map extractor: Minor optimization in MCNK parsing loop - look up end iterator once
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/map_extractor/System.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index ee57b149825..431ccf3029e 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -22,6 +22,7 @@
#include "DB2Meta.h"
#include "DBFilesClientList.h"
#include "ExtractorDB2LoadInfo.h"
+#include "IteratorPair.h"
#include "MapDefines.h"
#include "StringFormat.h"
#include "adt.h"
@@ -494,9 +495,9 @@ bool ConvertADT(ChunkedFile& adt, std::string const& mapName, std::string const&
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;
@@ -541,7 +542,7 @@ bool ConvertADT(ChunkedFile& adt, std::string const& mapName, std::string const&
}
// 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
@@ -570,7 +571,7 @@ bool ConvertADT(ChunkedFile& adt, std::string const& mapName, std::string const&
// 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;