mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-18 13:12:50 +00:00
Support deleted CellRefs in groundcover (bug 6276)
This commit is contained in:
parent
29847655f6
commit
dce4cceb39
@ -235,6 +235,7 @@
|
||||
Bug #6043: Actor can have torch missing when torch animation is played
|
||||
Bug #6047: Mouse bindings can be triggered during save loading
|
||||
Bug #6136: Game freezes when NPCs try to open doors that are about to be closed
|
||||
Bug #6276: Deleted groundcover instances are not deleted in game
|
||||
Bug #6294: Game crashes with empty pathgrid
|
||||
Feature #390: 3rd person look "over the shoulder"
|
||||
Feature #832: OpenMW-CS: Handle deleted references
|
||||
|
@ -181,6 +181,8 @@ namespace MWRender
|
||||
|
||||
void Groundcover::collectInstances(InstanceMap& instances, float size, const osg::Vec2f& center)
|
||||
{
|
||||
if (mDensity <=0.f) return;
|
||||
|
||||
const MWWorld::ESMStore& worldStore = MWBase::Environment::get().getWorld()->getStore();
|
||||
osg::Vec2f minBound = (center - osg::Vec2f(size/2.f, size/2.f));
|
||||
osg::Vec2f maxBound = (center + osg::Vec2f(size/2.f, size/2.f));
|
||||
@ -195,6 +197,7 @@ namespace MWRender
|
||||
if (!cell) continue;
|
||||
|
||||
calculator.reset();
|
||||
std::map<ESM::RefNum, ESM::CellRef> refs;
|
||||
for (size_t i=0; i<cell->mContextList.size(); ++i)
|
||||
{
|
||||
unsigned int index = cell->mContextList[i].index;
|
||||
@ -206,18 +209,21 @@ namespace MWRender
|
||||
bool deleted = false;
|
||||
while(cell->getNextRef(esm[index], ref, deleted))
|
||||
{
|
||||
if (deleted) continue;
|
||||
if (!deleted && refs.find(ref.mRefNum) == refs.end() && !calculator.isInstanceEnabled()) deleted = true;
|
||||
if (!deleted && !isInChunkBorders(ref, minBound, maxBound)) deleted = true;
|
||||
|
||||
if (!calculator.isInstanceEnabled()) continue;
|
||||
if (!isInChunkBorders(ref, minBound, maxBound)) continue;
|
||||
|
||||
std::string model = getGroundcoverModel(ref.mRefID, mGroundcoverStore, worldStore);
|
||||
if (model.empty()) continue;
|
||||
model = "meshes/" + model;
|
||||
|
||||
instances[model].emplace_back(std::move(ref));
|
||||
if (deleted) { refs.erase(ref.mRefNum); continue; }
|
||||
refs[ref.mRefNum] = std::move(ref);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& pair : refs)
|
||||
{
|
||||
ESM::CellRef& ref = pair.second;
|
||||
const std::string& model = getGroundcoverModel(ref.mRefID, mGroundcoverStore, worldStore);
|
||||
if (!model.empty())
|
||||
instances["meshes\\" + model].emplace_back(std::move(ref));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user