mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-26 15:36:48 +00:00
Support deleted CellRefs in groundcover (bug 6276)
This commit is contained in:
parent
29847655f6
commit
dce4cceb39
2 changed files with 16 additions and 9 deletions
|
@ -235,6 +235,7 @@
|
||||||
Bug #6043: Actor can have torch missing when torch animation is played
|
Bug #6043: Actor can have torch missing when torch animation is played
|
||||||
Bug #6047: Mouse bindings can be triggered during save loading
|
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 #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
|
Bug #6294: Game crashes with empty pathgrid
|
||||||
Feature #390: 3rd person look "over the shoulder"
|
Feature #390: 3rd person look "over the shoulder"
|
||||||
Feature #832: OpenMW-CS: Handle deleted references
|
Feature #832: OpenMW-CS: Handle deleted references
|
||||||
|
|
|
@ -181,6 +181,8 @@ namespace MWRender
|
||||||
|
|
||||||
void Groundcover::collectInstances(InstanceMap& instances, float size, const osg::Vec2f& center)
|
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();
|
const MWWorld::ESMStore& worldStore = MWBase::Environment::get().getWorld()->getStore();
|
||||||
osg::Vec2f minBound = (center - osg::Vec2f(size/2.f, size/2.f));
|
osg::Vec2f minBound = (center - osg::Vec2f(size/2.f, size/2.f));
|
||||||
osg::Vec2f maxBound = (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;
|
if (!cell) continue;
|
||||||
|
|
||||||
calculator.reset();
|
calculator.reset();
|
||||||
|
std::map<ESM::RefNum, ESM::CellRef> refs;
|
||||||
for (size_t i=0; i<cell->mContextList.size(); ++i)
|
for (size_t i=0; i<cell->mContextList.size(); ++i)
|
||||||
{
|
{
|
||||||
unsigned int index = cell->mContextList[i].index;
|
unsigned int index = cell->mContextList[i].index;
|
||||||
|
@ -206,18 +209,21 @@ namespace MWRender
|
||||||
bool deleted = false;
|
bool deleted = false;
|
||||||
while(cell->getNextRef(esm[index], ref, deleted))
|
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 (deleted) { refs.erase(ref.mRefNum); continue; }
|
||||||
if (!isInChunkBorders(ref, minBound, maxBound)) continue;
|
refs[ref.mRefNum] = std::move(ref);
|
||||||
|
|
||||||
std::string model = getGroundcoverModel(ref.mRefID, mGroundcoverStore, worldStore);
|
|
||||||
if (model.empty()) continue;
|
|
||||||
model = "meshes/" + model;
|
|
||||||
|
|
||||||
instances[model].emplace_back(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…
Reference in a new issue