From 700bace24cb7f52e13d571864adcc9966be51273 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Fri, 12 Nov 2021 11:53:21 +0100 Subject: [PATCH] do not emplace_back to our mLandTextures; instead use the heavy handed resize to be explicit about what we intend to do; resolves issue found here: https://github.com/OpenMW/openmw/pull/3220#issuecomment-964650167 --- apps/openmw/mwworld/esmstore.cpp | 2 +- apps/openmw/mwworld/store.hpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index bafdc8f37d..1284df694a 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -153,7 +153,7 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener) // Land texture loading needs to use a separate internal store for each plugin. // We set the number of plugins here so we can properly verify if valid plugin // indices are being passed to the LandTexture Store retrieval methods. - mLandTextures.addPlugin(); + mLandTextures.resize(esm.getIndex()+1); // Loop through all records while(esm.hasMoreRecs()) diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 17a37c23ea..22f36da690 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -222,8 +222,7 @@ namespace MWWorld const ESM::LandTexture *search(size_t index, size_t plugin) const; const ESM::LandTexture *find(size_t index, size_t plugin) const; - /// Resize the internal store to hold another plugin. - void addPlugin() { mStatic.emplace_back(); } + void resize(size_t num) { mStatic.resize(num); } size_t getSize() const override; size_t getSize(size_t plugin) const;