diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index 143ce557b..079c888aa 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -63,10 +63,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y) result = mExteriors.insert (std::make_pair ( std::make_pair (x, y), Ptr::CellStore (cell))).first; - - result->second.load (mStore, mReader); } + if (result->second.mState!=Ptr::CellStore::State_Loaded) + result->second.load (mStore, mReader); + return &result->second; } @@ -79,10 +80,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getInterior (const std::string& name) const ESM::Cell *cell = mStore.cells.findInt (name); result = mInteriors.insert (std::make_pair (name, Ptr::CellStore (cell))).first; - - result->second.load (mStore, mReader); } + if (result->second.mState!=Ptr::CellStore::State_Loaded) + result->second.load (mStore, mReader); + return &result->second; }