mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 14:09:42 +00:00
Restore getNearbyDoor
This commit is contained in:
parent
f9dd549bff
commit
1875aa4a18
3 changed files with 8 additions and 9 deletions
|
@ -44,10 +44,9 @@ namespace MWMechanics
|
|||
return MWWorld::Ptr(); // check interior cells only
|
||||
|
||||
// Check all the doors in this cell
|
||||
/*
|
||||
MWWorld::CellRefList<ESM::Door>& doors = cell->get<ESM::Door>();
|
||||
MWWorld::CellRefList<ESM::Door>::List& refList = doors.mList;
|
||||
MWWorld::CellRefList<ESM::Door>::List::iterator it = refList.begin();
|
||||
const MWWorld::CellRefList<ESM::Door>& doors = cell->getReadOnlyDoors();
|
||||
const MWWorld::CellRefList<ESM::Door>::List& refList = doors.mList;
|
||||
MWWorld::CellRefList<ESM::Door>::List::const_iterator it = refList.begin();
|
||||
osg::Vec3f pos(actor.getRefData().getPosition().asVec3());
|
||||
|
||||
/// TODO: How to check whether the actor is facing a door? Below code is for
|
||||
|
@ -60,14 +59,14 @@ namespace MWMechanics
|
|||
/// opposite of the code in World::activateDoor() ::confused::
|
||||
for (; it != refList.end(); ++it)
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
|
||||
const MWWorld::LiveCellRef<ESM::Door>& ref = *it;
|
||||
if((pos - ref.mData.getPosition().asVec3()).length2() < minSqr
|
||||
&& ref.mData.getPosition().rot[2] == ref.mRef.getPosition().rot[2])
|
||||
{
|
||||
return MWWorld::Ptr(&ref, actor.getCell()); // found, stop searching
|
||||
// FIXME cast
|
||||
return MWWorld::Ptr(&const_cast<MWWorld::LiveCellRef<ESM::Door> &>(ref), actor.getCell()); // found, stop searching
|
||||
}
|
||||
}
|
||||
*/
|
||||
return MWWorld::Ptr(); // none found
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace MWWorld
|
|||
mPosition = pos;
|
||||
}
|
||||
|
||||
const ESM::Position& RefData::getPosition()
|
||||
const ESM::Position& RefData::getPosition() const
|
||||
{
|
||||
return mPosition;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace MWWorld
|
|||
void disable();
|
||||
|
||||
void setPosition (const ESM::Position& pos);
|
||||
const ESM::Position& getPosition();
|
||||
const ESM::Position& getPosition() const;
|
||||
|
||||
void setCustomData (CustomData *data);
|
||||
///< Set custom data (potentially replacing old custom data). The ownership of \a data is
|
||||
|
|
Loading…
Reference in a new issue