mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 16:45:34 +00:00
Teleportation: Avoid marking searched cells as changed.
OMW Bug #1533 Only mark cells with the target marker / evidence chest as 'changed'.
This commit is contained in:
parent
6d1aec6970
commit
c21b59ecff
2 changed files with 19 additions and 25 deletions
|
@ -184,6 +184,11 @@ namespace MWWorld
|
||||||
throw std::runtime_error ("Storage for this type not exist in cells");
|
throw std::runtime_error ("Storage for this type not exist in cells");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CellRefList<T>& getReadOnly() {
|
||||||
|
throw std::runtime_error ("Read Only access not available for this type");
|
||||||
|
}
|
||||||
|
|
||||||
bool isPointConnected(const int start, const int end) const;
|
bool isPointConnected(const int start, const int end) const;
|
||||||
|
|
||||||
std::list<ESM::Pathgrid::Point> aStarSearch(const int start, const int end) const;
|
std::list<ESM::Pathgrid::Point> aStarSearch(const int start, const int end) const;
|
||||||
|
@ -357,6 +362,12 @@ namespace MWWorld
|
||||||
return mWeapons;
|
return mWeapons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline CellRefList<ESM::Door>& CellStore::getReadOnly<ESM::Door>()
|
||||||
|
{
|
||||||
|
return mDoors;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator== (const CellStore& left, const CellStore& right);
|
bool operator== (const CellStore& left, const CellStore& right);
|
||||||
bool operator!= (const CellStore& left, const CellStore& right);
|
bool operator!= (const CellStore& left, const CellStore& right);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2799,7 +2799,7 @@ namespace MWWorld
|
||||||
MWWorld::CellStore *next = getInterior( *i );
|
MWWorld::CellStore *next = getInterior( *i );
|
||||||
if ( !next ) continue;
|
if ( !next ) continue;
|
||||||
|
|
||||||
MWWorld::CellRefList<ESM::Door>& doors = next->get<ESM::Door>();
|
MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>();
|
||||||
CellRefList<ESM::Door>::List& refList = doors.mList;
|
CellRefList<ESM::Door>::List& refList = doors.mList;
|
||||||
|
|
||||||
// Check if any door in the cell leads to an exterior directly
|
// Check if any door in the cell leads to an exterior directly
|
||||||
|
@ -2838,6 +2838,8 @@ namespace MWWorld
|
||||||
std::set< std::string >checkedCells;
|
std::set< std::string >checkedCells;
|
||||||
std::set< std::string >currentCells;
|
std::set< std::string >currentCells;
|
||||||
std::set< std::string >nextCells;
|
std::set< std::string >nextCells;
|
||||||
|
MWWorld::Ptr closestMarker;
|
||||||
|
|
||||||
nextCells.insert( ptr.getCell()->getCell()->mName );
|
nextCells.insert( ptr.getCell()->getCell()->mName );
|
||||||
while ( !nextCells.empty() ) {
|
while ( !nextCells.empty() ) {
|
||||||
currentCells = nextCells;
|
currentCells = nextCells;
|
||||||
|
@ -2847,17 +2849,13 @@ namespace MWWorld
|
||||||
checkedCells.insert( *i );
|
checkedCells.insert( *i );
|
||||||
if ( !next ) continue;
|
if ( !next ) continue;
|
||||||
|
|
||||||
MWWorld::CellRefList<ESM::Static>& statics = next->get<ESM::Static>();
|
closestMarker = next->search( id );
|
||||||
CellRefList<ESM::Static>::List& staticList = statics.mList;
|
if ( !closestMarker.isEmpty() )
|
||||||
for (CellRefList<ESM::Static>::List::iterator it = staticList.begin(); it != staticList.end(); ++it)
|
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Static>& ref = *it;
|
return closestMarker;
|
||||||
if ( id == ref.mRef.getRefId() ) {
|
|
||||||
return MWWorld::Ptr( &ref, next );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::CellRefList<ESM::Door>& doors = next->get<ESM::Door>();
|
MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>();
|
||||||
CellRefList<ESM::Door>::List& doorList = doors.mList;
|
CellRefList<ESM::Door>::List& doorList = doors.mList;
|
||||||
|
|
||||||
// Check if any door in the cell leads to an exterior directly
|
// Check if any door in the cell leads to an exterior directly
|
||||||
|
@ -2865,10 +2863,6 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
|
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
|
||||||
|
|
||||||
if ( id == ref.mRef.getRefId() ) {
|
|
||||||
return MWWorld::Ptr( &ref, next );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ref.mRef.getTeleport()) continue;
|
if (!ref.mRef.getTeleport()) continue;
|
||||||
|
|
||||||
if (ref.mRef.getDestCell().empty())
|
if (ref.mRef.getDestCell().empty())
|
||||||
|
@ -3085,18 +3079,7 @@ namespace MWWorld
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr closestChest;
|
MWWorld::Ptr closestChest = prison->search( "stolen_goods" );
|
||||||
|
|
||||||
MWWorld::CellRefList<ESM::Container>& containers = prison->get<ESM::Container>();
|
|
||||||
CellRefList<ESM::Container>::List& refList = containers.mList;
|
|
||||||
for (CellRefList<ESM::Container>::List::iterator it = refList.begin(); it != refList.end(); ++it)
|
|
||||||
{
|
|
||||||
MWWorld::LiveCellRef<ESM::Container>& ref = *it;
|
|
||||||
if ( ref.mRef.getRefId() == "stolen_goods" ) {
|
|
||||||
closestChest = MWWorld::Ptr( &ref, prison );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!closestChest.isEmpty()) //Found a close chest
|
if (!closestChest.isEmpty()) //Found a close chest
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItems(ptr, closestChest);
|
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItems(ptr, closestChest);
|
||||||
|
|
Loading…
Reference in a new issue