1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-05 18:45:34 +00:00

Issue #277: containers in cells were not filled up on cell load when the cell was preloaded before

This commit is contained in:
Marc Zinnschlag 2012-05-25 17:55:00 +02:00
parent 7f6835f59f
commit 6fe53aa320

View file

@ -78,8 +78,6 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
std::map<std::pair<int, int>, Ptr::CellStore>::iterator result = std::map<std::pair<int, int>, Ptr::CellStore>::iterator result =
mExteriors.find (std::make_pair (x, y)); mExteriors.find (std::make_pair (x, y));
bool fill = false;
if (result==mExteriors.end()) if (result==mExteriors.end())
{ {
const ESM::Cell *cell = mStore.cells.searchExt (x, y); const ESM::Cell *cell = mStore.cells.searchExt (x, y);
@ -100,15 +98,13 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
result = mExteriors.insert (std::make_pair ( result = mExteriors.insert (std::make_pair (
std::make_pair (x, y), Ptr::CellStore (cell))).first; std::make_pair (x, y), Ptr::CellStore (cell))).first;
fill = true;
} }
if (result->second.mState!=Ptr::CellStore::State_Loaded) if (result->second.mState!=Ptr::CellStore::State_Loaded)
{
result->second.load (mStore, mReader); result->second.load (mStore, mReader);
if (fill)
fillContainers (result->second); fillContainers (result->second);
}
return &result->second; return &result->second;
} }
@ -117,22 +113,18 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getInterior (const std::string& name)
{ {
std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (name); std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (name);
bool fill = false;
if (result==mInteriors.end()) if (result==mInteriors.end())
{ {
const ESM::Cell *cell = mStore.cells.findInt (name); const ESM::Cell *cell = mStore.cells.findInt (name);
result = mInteriors.insert (std::make_pair (name, Ptr::CellStore (cell))).first; result = mInteriors.insert (std::make_pair (name, Ptr::CellStore (cell))).first;
fill = true;
} }
if (result->second.mState!=Ptr::CellStore::State_Loaded) if (result->second.mState!=Ptr::CellStore::State_Loaded)
{
result->second.load (mStore, mReader); result->second.load (mStore, mReader);
if (fill)
fillContainers (result->second); fillContainers (result->second);
}
return &result->second; return &result->second;
} }