1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Cleanup: Add const to read-only CellRefList access.

OMW Bug #1533
This commit is contained in:
Jordan Ayers 2015-02-22 12:25:10 -06:00
parent 399259a95c
commit 5edafc2a4c
2 changed files with 10 additions and 10 deletions

View File

@ -187,7 +187,7 @@ namespace MWWorld
} }
template <class T> template <class T>
CellRefList<T>& getReadOnly() { const CellRefList<T>& getReadOnly() {
throw std::runtime_error ("Read Only CellRefList access not available for type " + std::string(typeid(T).name()) ); throw std::runtime_error ("Read Only CellRefList access not available for type " + std::string(typeid(T).name()) );
} }
@ -365,7 +365,7 @@ namespace MWWorld
} }
template<> template<>
inline CellRefList<ESM::Door>& CellStore::getReadOnly<ESM::Door>() inline const CellRefList<ESM::Door>& CellStore::getReadOnly<ESM::Door>()
{ {
return mDoors; return mDoors;
} }

View File

@ -2799,13 +2799,13 @@ namespace MWWorld
MWWorld::CellStore *next = getInterior( *i ); MWWorld::CellStore *next = getInterior( *i );
if ( !next ) continue; if ( !next ) continue;
MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>(); const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>();
CellRefList<ESM::Door>::List& refList = doors.mList; const 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
for (CellRefList<ESM::Door>::List::iterator it = refList.begin(); it != refList.end(); ++it) for (CellRefList<ESM::Door>::List::const_iterator it = refList.begin(); it != refList.end(); ++it)
{ {
MWWorld::LiveCellRef<ESM::Door>& ref = *it; const MWWorld::LiveCellRef<ESM::Door>& ref = *it;
if (!ref.mRef.getTeleport()) continue; if (!ref.mRef.getTeleport()) continue;
if (ref.mRef.getDestCell().empty()) if (ref.mRef.getDestCell().empty())
@ -2855,13 +2855,13 @@ namespace MWWorld
return closestMarker; return closestMarker;
} }
MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>(); const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>();
CellRefList<ESM::Door>::List& doorList = doors.mList; const 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
for (CellRefList<ESM::Door>::List::iterator it = doorList.begin(); it != doorList.end(); ++it) for (CellRefList<ESM::Door>::List::const_iterator it = doorList.begin(); it != doorList.end(); ++it)
{ {
MWWorld::LiveCellRef<ESM::Door>& ref = *it; const MWWorld::LiveCellRef<ESM::Door>& ref = *it;
if (!ref.mRef.getTeleport()) continue; if (!ref.mRef.getTeleport()) continue;