From 758d989a036d613ae1e33206a999aa59ad568ab7 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 21 Aug 2013 17:24:24 +0200 Subject: [PATCH] If multiple plugins have land data for the same cell, the last plugin should win --- apps/openmw/mwworld/store.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 2c10e3edc..2ee23dbd6 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -466,6 +466,18 @@ namespace MWWorld ESM::Land *ptr = new ESM::Land(); ptr->load(esm); + // Same area defined in multiple plugins? -> last plugin wins + // Can't use search() because we aren't sorted yet - is there any other way to speed this up? + for (std::vector::iterator it = mStatic.begin(); it != mStatic.end(); ++it) + { + if ((*it)->mX == ptr->mX && (*it)->mY == ptr->mY) + { + delete *it; + mStatic.erase(it); + break; + } + } + mStatic.push_back(ptr); }