|
|
@ -54,7 +54,6 @@
|
|
|
|
#include "player.hpp"
|
|
|
|
#include "player.hpp"
|
|
|
|
#include "manualref.hpp"
|
|
|
|
#include "manualref.hpp"
|
|
|
|
#include "cellstore.hpp"
|
|
|
|
#include "cellstore.hpp"
|
|
|
|
#include "cellfunctors.hpp"
|
|
|
|
|
|
|
|
#include "containerstore.hpp"
|
|
|
|
#include "containerstore.hpp"
|
|
|
|
#include "inventorystore.hpp"
|
|
|
|
#include "inventorystore.hpp"
|
|
|
|
#include "actionteleport.hpp"
|
|
|
|
#include "actionteleport.hpp"
|
|
|
@ -690,12 +689,12 @@ namespace MWWorld
|
|
|
|
return mWorldScene->searchPtrViaActorId (actorId);
|
|
|
|
return mWorldScene->searchPtrViaActorId (actorId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct FindContainerFunctor
|
|
|
|
struct FindContainerVisitor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Ptr mContainedPtr;
|
|
|
|
Ptr mContainedPtr;
|
|
|
|
Ptr mResult;
|
|
|
|
Ptr mResult;
|
|
|
|
|
|
|
|
|
|
|
|
FindContainerFunctor(const Ptr& containedPtr) : mContainedPtr(containedPtr) {}
|
|
|
|
FindContainerVisitor(const Ptr& containedPtr) : mContainedPtr(containedPtr) {}
|
|
|
|
|
|
|
|
|
|
|
|
bool operator() (Ptr ptr)
|
|
|
|
bool operator() (Ptr ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -721,11 +720,15 @@ namespace MWWorld
|
|
|
|
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
|
|
|
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
|
|
|
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
|
|
|
|
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FindContainerFunctor functor(ptr);
|
|
|
|
FindContainerVisitor visitor(ptr);
|
|
|
|
(*cellIt)->forEachContainer(functor);
|
|
|
|
(*cellIt)->forEachType<ESM::Container>(visitor);
|
|
|
|
|
|
|
|
if (visitor.mResult.isEmpty())
|
|
|
|
|
|
|
|
(*cellIt)->forEachType<ESM::Creature>(visitor);
|
|
|
|
|
|
|
|
if (visitor.mResult.isEmpty())
|
|
|
|
|
|
|
|
(*cellIt)->forEachType<ESM::NPC>(visitor);
|
|
|
|
|
|
|
|
|
|
|
|
if (!functor.mResult.isEmpty())
|
|
|
|
if (!visitor.mResult.isEmpty())
|
|
|
|
return functor.mResult;
|
|
|
|
return visitor.mResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Ptr();
|
|
|
|
return Ptr();
|
|
|
@ -1149,7 +1152,7 @@ namespace MWWorld
|
|
|
|
bool newCellActive = mWorldScene->isCellActive(*newCell);
|
|
|
|
bool newCellActive = mWorldScene->isCellActive(*newCell);
|
|
|
|
if (!currCellActive && newCellActive)
|
|
|
|
if (!currCellActive && newCellActive)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
newPtr = ptr.getClass().copyToCell(ptr, *newCell, pos);
|
|
|
|
newPtr = currCell->moveTo(ptr, newCell);
|
|
|
|
mWorldScene->addObjectToScene(newPtr);
|
|
|
|
mWorldScene->addObjectToScene(newPtr);
|
|
|
|
|
|
|
|
|
|
|
|
std::string script = newPtr.getClass().getScript(newPtr);
|
|
|
|
std::string script = newPtr.getClass().getScript(newPtr);
|
|
|
@ -1165,17 +1168,16 @@ namespace MWWorld
|
|
|
|
removeContainerScripts (ptr);
|
|
|
|
removeContainerScripts (ptr);
|
|
|
|
haveToMove = false;
|
|
|
|
haveToMove = false;
|
|
|
|
|
|
|
|
|
|
|
|
newPtr = ptr.getClass().copyToCell(ptr, *newCell);
|
|
|
|
newPtr = currCell->moveTo(ptr, newCell);
|
|
|
|
newPtr.getRefData().setBaseNode(0);
|
|
|
|
newPtr.getRefData().setBaseNode(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!currCellActive && !newCellActive)
|
|
|
|
else if (!currCellActive && !newCellActive)
|
|
|
|
newPtr = ptr.getClass().copyToCell(ptr, *newCell);
|
|
|
|
newPtr = currCell->moveTo(ptr, newCell);
|
|
|
|
else // both cells active
|
|
|
|
else // both cells active
|
|
|
|
{
|
|
|
|
{
|
|
|
|
newPtr = ptr.getClass().copyToCell(ptr, *newCell, pos);
|
|
|
|
newPtr = currCell->moveTo(ptr, newCell);
|
|
|
|
|
|
|
|
|
|
|
|
mRendering->updatePtr(ptr, newPtr);
|
|
|
|
mRendering->updatePtr(ptr, newPtr);
|
|
|
|
ptr.getRefData().setBaseNode(NULL);
|
|
|
|
|
|
|
|
MWBase::Environment::get().getSoundManager()->updatePtr (ptr, newPtr);
|
|
|
|
MWBase::Environment::get().getSoundManager()->updatePtr (ptr, newPtr);
|
|
|
|
mPhysics->updatePtr(ptr, newPtr);
|
|
|
|
mPhysics->updatePtr(ptr, newPtr);
|
|
|
|
|
|
|
|
|
|
|
@ -1192,7 +1194,6 @@ namespace MWWorld
|
|
|
|
addContainerScripts (newPtr, newCell);
|
|
|
|
addContainerScripts (newPtr, newCell);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ptr.getRefData().setCount(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (haveToMove && newPtr.getRefData().getBaseNode())
|
|
|
|
if (haveToMove && newPtr.getRefData().getBaseNode())
|
|
|
@ -1708,27 +1709,32 @@ namespace MWWorld
|
|
|
|
|
|
|
|
|
|
|
|
osg::Vec2f World::getNorthVector (CellStore* cell)
|
|
|
|
osg::Vec2f World::getNorthVector (CellStore* cell)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::CellRefList<ESM::Static>& statics = cell->get<ESM::Static>();
|
|
|
|
MWWorld::Ptr northmarker = cell->search("northmarker");
|
|
|
|
MWWorld::LiveCellRef<ESM::Static>* ref = statics.find("northmarker");
|
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
if (northmarker.isEmpty())
|
|
|
|
return osg::Vec2f(0, 1);
|
|
|
|
return osg::Vec2f(0, 1);
|
|
|
|
|
|
|
|
|
|
|
|
osg::Quat orient (-ref->mData.getPosition().rot[2], osg::Vec3f(0,0,1));
|
|
|
|
osg::Quat orient (-northmarker.getRefData().getPosition().rot[2], osg::Vec3f(0,0,1));
|
|
|
|
osg::Vec3f dir = orient * osg::Vec3f(0,1,0);
|
|
|
|
osg::Vec3f dir = orient * osg::Vec3f(0,1,0);
|
|
|
|
osg::Vec2f d (dir.x(), dir.y());
|
|
|
|
osg::Vec2f d (dir.x(), dir.y());
|
|
|
|
return d;
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void World::getDoorMarkers (CellStore* cell, std::vector<World::DoorMarker>& out)
|
|
|
|
struct GetDoorMarkerVisitor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::CellRefList<ESM::Door>& doors = cell->get<ESM::Door>();
|
|
|
|
GetDoorMarkerVisitor(std::vector<World::DoorMarker>& out)
|
|
|
|
CellRefList<ESM::Door>::List& refList = doors.mList;
|
|
|
|
: mOut(out)
|
|
|
|
for (CellRefList<ESM::Door>::List::iterator it = refList.begin(); it != refList.end(); ++it)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!ref.mData.isEnabled())
|
|
|
|
std::vector<World::DoorMarker>& mOut;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
bool operator()(const MWWorld::Ptr& ptr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MWWorld::LiveCellRef<ESM::Door>& ref = *static_cast<MWWorld::LiveCellRef<ESM::Door>* >(ptr.getBase());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ref.mData.isEnabled() || ref.mData.isDeleted())
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
if (ref.mRef.getTeleport())
|
|
|
|
if (ref.mRef.getTeleport())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1744,7 +1750,7 @@ namespace MWWorld
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cellid.mPaged = true;
|
|
|
|
cellid.mPaged = true;
|
|
|
|
positionToIndex(
|
|
|
|
MWBase::Environment::get().getWorld()->positionToIndex(
|
|
|
|
ref.mRef.getDoorDest().pos[0],
|
|
|
|
ref.mRef.getDoorDest().pos[0],
|
|
|
|
ref.mRef.getDoorDest().pos[1],
|
|
|
|
ref.mRef.getDoorDest().pos[1],
|
|
|
|
cellid.mIndex.mX,
|
|
|
|
cellid.mIndex.mX,
|
|
|
@ -1756,9 +1762,16 @@ namespace MWWorld
|
|
|
|
|
|
|
|
|
|
|
|
newMarker.x = pos.pos[0];
|
|
|
|
newMarker.x = pos.pos[0];
|
|
|
|
newMarker.y = pos.pos[1];
|
|
|
|
newMarker.y = pos.pos[1];
|
|
|
|
out.push_back(newMarker);
|
|
|
|
mOut.push_back(newMarker);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void World::getDoorMarkers (CellStore* cell, std::vector<World::DoorMarker>& out)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GetDoorMarkerVisitor visitor(out);
|
|
|
|
|
|
|
|
cell->forEachType<ESM::Door>(visitor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void World::setWaterHeight(const float height)
|
|
|
|
void World::setWaterHeight(const float height)
|
|
|
@ -2253,25 +2266,40 @@ namespace MWWorld
|
|
|
|
return osg::Vec3f(0,1,0);
|
|
|
|
return osg::Vec3f(0,1,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void World::getContainersOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out)
|
|
|
|
struct GetContainersOwnedByVisitor
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GetContainersOwnedByVisitor(const MWWorld::Ptr& owner, std::vector<MWWorld::Ptr>& out)
|
|
|
|
|
|
|
|
: mOwner(owner)
|
|
|
|
|
|
|
|
, mOut(out)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr mOwner;
|
|
|
|
|
|
|
|
std::vector<MWWorld::Ptr>& mOut;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool operator()(const MWWorld::Ptr& ptr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (ptr.getRefData().isDeleted())
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Misc::StringUtils::ciEqual(ptr.getCellRef().getOwner(), mOwner.getCellRef().getRefId()))
|
|
|
|
|
|
|
|
mOut.push_back(ptr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void World::getContainersOwnedBy (const MWWorld::Ptr& owner, std::vector<MWWorld::Ptr>& out)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
|
|
|
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
|
|
|
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
|
|
|
|
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::CellRefList<ESM::Container>& containers = (*cellIt)->get<ESM::Container>();
|
|
|
|
GetContainersOwnedByVisitor visitor (owner, out);
|
|
|
|
CellRefList<ESM::Container>::List& refList = containers.mList;
|
|
|
|
(*cellIt)->forEachType<ESM::Container>(visitor);
|
|
|
|
for (CellRefList<ESM::Container>::List::iterator container = refList.begin(); container != refList.end(); ++container)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr (&*container, *cellIt);
|
|
|
|
|
|
|
|
if (ptr.getRefData().isDeleted())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (Misc::StringUtils::ciEqual(ptr.getCellRef().getOwner(), npc.getCellRef().getRefId()))
|
|
|
|
|
|
|
|
out.push_back(ptr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ListObjectsFunctor
|
|
|
|
struct ListObjectsVisitor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::vector<MWWorld::Ptr> mObjects;
|
|
|
|
std::vector<MWWorld::Ptr> mObjects;
|
|
|
|
|
|
|
|
|
|
|
@ -2288,10 +2316,10 @@ namespace MWWorld
|
|
|
|
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
|
|
|
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
|
|
|
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
|
|
|
|
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ListObjectsFunctor functor;
|
|
|
|
ListObjectsVisitor visitor;
|
|
|
|
(*cellIt)->forEach<ListObjectsFunctor>(functor);
|
|
|
|
(*cellIt)->forEach(visitor);
|
|
|
|
|
|
|
|
|
|
|
|
for (std::vector<MWWorld::Ptr>::iterator it = functor.mObjects.begin(); it != functor.mObjects.end(); ++it)
|
|
|
|
for (std::vector<MWWorld::Ptr>::iterator it = visitor.mObjects.begin(); it != visitor.mObjects.end(); ++it)
|
|
|
|
if (Misc::StringUtils::ciEqual(it->getCellRef().getOwner(), npc.getCellRef().getRefId()))
|
|
|
|
if (Misc::StringUtils::ciEqual(it->getCellRef().getOwner(), npc.getCellRef().getRefId()))
|
|
|
|
out.push_back(*it);
|
|
|
|
out.push_back(*it);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2342,7 +2370,8 @@ namespace MWWorld
|
|
|
|
if (0 == cellStore) {
|
|
|
|
if (0 == cellStore) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const DoorList &doors = cellStore->get<ESM::Door>().mList;
|
|
|
|
|
|
|
|
|
|
|
|
const DoorList &doors = cellStore->getReadOnlyDoors().mList;
|
|
|
|
for (DoorList::const_iterator it = doors.begin(); it != doors.end(); ++it) {
|
|
|
|
for (DoorList::const_iterator it = doors.begin(); it != doors.end(); ++it) {
|
|
|
|
if (!it->mRef.getTeleport()) {
|
|
|
|
if (!it->mRef.getTeleport()) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -2364,7 +2393,7 @@ namespace MWWorld
|
|
|
|
if (0 != source) {
|
|
|
|
if (0 != source) {
|
|
|
|
// Find door leading to our current teleport door
|
|
|
|
// Find door leading to our current teleport door
|
|
|
|
// and use it destination to position inside cell.
|
|
|
|
// and use it destination to position inside cell.
|
|
|
|
const DoorList &doors = source->get<ESM::Door>().mList;
|
|
|
|
const DoorList &doors = source->getReadOnlyDoors().mList;
|
|
|
|
for (DoorList::const_iterator jt = doors.begin(); jt != doors.end(); ++jt) {
|
|
|
|
for (DoorList::const_iterator jt = doors.begin(); jt != doors.end(); ++jt) {
|
|
|
|
if (it->mRef.getTeleport() &&
|
|
|
|
if (it->mRef.getTeleport() &&
|
|
|
|
Misc::StringUtils::ciEqual(name, jt->mRef.getDestCell()))
|
|
|
|
Misc::StringUtils::ciEqual(name, jt->mRef.getDestCell()))
|
|
|
@ -2378,7 +2407,7 @@ namespace MWWorld
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Fall back to the first static location.
|
|
|
|
// Fall back to the first static location.
|
|
|
|
const StaticList &statics = cellStore->get<ESM::Static>().mList;
|
|
|
|
const StaticList &statics = cellStore->getReadOnlyStatics().mList;
|
|
|
|
if ( statics.begin() != statics.end() ) {
|
|
|
|
if ( statics.begin() != statics.end() ) {
|
|
|
|
pos = statics.begin()->mRef.getPosition();
|
|
|
|
pos = statics.begin()->mRef.getPosition();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -2747,7 +2776,7 @@ namespace MWWorld
|
|
|
|
MWWorld::CellStore *next = getInterior( *i );
|
|
|
|
MWWorld::CellStore *next = getInterior( *i );
|
|
|
|
if ( !next ) continue;
|
|
|
|
if ( !next ) continue;
|
|
|
|
|
|
|
|
|
|
|
|
const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>();
|
|
|
|
const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnlyDoors();
|
|
|
|
const 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
|
|
|
@ -2807,7 +2836,7 @@ namespace MWWorld
|
|
|
|
return closestMarker;
|
|
|
|
return closestMarker;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>();
|
|
|
|
const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnlyDoors();
|
|
|
|
const 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
|
|
|
@ -2831,7 +2860,6 @@ namespace MWWorld
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return MWWorld::Ptr();
|
|
|
|
return MWWorld::Ptr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2888,9 +2916,9 @@ namespace MWWorld
|
|
|
|
mWeatherManager->update(duration, paused);
|
|
|
|
mWeatherManager->update(duration, paused);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct AddDetectedReference
|
|
|
|
struct AddDetectedReferenceVisitor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AddDetectedReference(std::vector<Ptr>& out, Ptr detector, World::DetectionType type, float squaredDist)
|
|
|
|
AddDetectedReferenceVisitor(std::vector<Ptr>& out, Ptr detector, World::DetectionType type, float squaredDist)
|
|
|
|
: mOut(out), mDetector(detector), mSquaredDist(squaredDist), mType(type)
|
|
|
|
: mOut(out), mDetector(detector), mSquaredDist(squaredDist), mType(type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2899,7 +2927,7 @@ namespace MWWorld
|
|
|
|
Ptr mDetector;
|
|
|
|
Ptr mDetector;
|
|
|
|
float mSquaredDist;
|
|
|
|
float mSquaredDist;
|
|
|
|
World::DetectionType mType;
|
|
|
|
World::DetectionType mType;
|
|
|
|
bool operator() (MWWorld::Ptr ptr)
|
|
|
|
bool operator() (const MWWorld::Ptr& ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((ptr.getRefData().getPosition().asVec3() - mDetector.getRefData().getPosition().asVec3()).length2() >= mSquaredDist)
|
|
|
|
if ((ptr.getRefData().getPosition().asVec3() - mDetector.getRefData().getPosition().asVec3()).length2() >= mSquaredDist)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -2930,7 +2958,7 @@ namespace MWWorld
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool needToAdd (MWWorld::Ptr ptr, MWWorld::Ptr detector)
|
|
|
|
bool needToAdd (const MWWorld::Ptr& ptr, const MWWorld::Ptr& detector)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mType == World::Detect_Creature)
|
|
|
|
if (mType == World::Detect_Creature)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2970,13 +2998,13 @@ namespace MWWorld
|
|
|
|
|
|
|
|
|
|
|
|
dist = feetToGameUnits(dist);
|
|
|
|
dist = feetToGameUnits(dist);
|
|
|
|
|
|
|
|
|
|
|
|
AddDetectedReference functor (out, ptr, type, dist*dist);
|
|
|
|
AddDetectedReferenceVisitor visitor (out, ptr, type, dist*dist);
|
|
|
|
|
|
|
|
|
|
|
|
const Scene::CellStoreCollection& active = mWorldScene->getActiveCells();
|
|
|
|
const Scene::CellStoreCollection& active = mWorldScene->getActiveCells();
|
|
|
|
for (Scene::CellStoreCollection::const_iterator it = active.begin(); it != active.end(); ++it)
|
|
|
|
for (Scene::CellStoreCollection::const_iterator it = active.begin(); it != active.end(); ++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWWorld::CellStore* cellStore = *it;
|
|
|
|
MWWorld::CellStore* cellStore = *it;
|
|
|
|
cellStore->forEach(functor);
|
|
|
|
cellStore->forEach(visitor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3232,7 +3260,7 @@ namespace MWWorld
|
|
|
|
interpreterContext.executeActivation(object, actor);
|
|
|
|
interpreterContext.executeActivation(object, actor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ResetActorsFunctor
|
|
|
|
struct ResetActorsVisitor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool operator() (Ptr ptr)
|
|
|
|
bool operator() (Ptr ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -3254,8 +3282,8 @@ namespace MWWorld
|
|
|
|
iter!=mWorldScene->getActiveCells().end(); ++iter)
|
|
|
|
iter!=mWorldScene->getActiveCells().end(); ++iter)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CellStore* cellstore = *iter;
|
|
|
|
CellStore* cellstore = *iter;
|
|
|
|
ResetActorsFunctor functor;
|
|
|
|
ResetActorsVisitor visitor;
|
|
|
|
cellstore->forEach(functor);
|
|
|
|
cellstore->forEach(visitor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|