1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-25 12:41:01 +00:00

Fix map insert return value mixup (Fixes #2192)

This commit is contained in:
scrawl 2014-12-06 17:24:05 +01:00
parent 9a1b7cbe52
commit 41542dedf7

View File

@ -859,16 +859,16 @@ namespace MWWorld
// Try to overwrite existing record // Try to overwrite existing record
if (!pathgrid.mCell.empty()) if (!pathgrid.mCell.empty())
{ {
std::pair<Interior::iterator, bool> found = mInt.insert(std::make_pair(pathgrid.mCell, pathgrid)); std::pair<Interior::iterator, bool> ret = mInt.insert(std::make_pair(pathgrid.mCell, pathgrid));
if (found.second) if (!ret.second)
found.first->second = pathgrid; ret.first->second = pathgrid;
} }
else else
{ {
std::pair<Exterior::iterator, bool> found = mExt.insert(std::make_pair(std::make_pair(pathgrid.mData.mX, pathgrid.mData.mY), std::pair<Exterior::iterator, bool> ret = mExt.insert(std::make_pair(std::make_pair(pathgrid.mData.mX, pathgrid.mData.mY),
pathgrid)); pathgrid));
if (found.second) if (!ret.second)
found.first->second = pathgrid; ret.first->second = pathgrid;
} }
} }
@ -953,9 +953,9 @@ namespace MWWorld
record.load(esm); record.load(esm);
// Try to overwrite existing record // Try to overwrite existing record
std::pair<typename Static::iterator, bool> found = mStatic.insert(std::make_pair(record.mIndex, record)); std::pair<typename Static::iterator, bool> ret = mStatic.insert(std::make_pair(record.mIndex, record));
if (found.second) if (!ret.second)
found.first->second = record; ret.first->second = record;
} }
int getSize() const { int getSize() const {