1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-24 18:41:34 +00:00

Merge remote-tracking branch 'scrawl/master'

This commit is contained in:
Marc Zinnschlag 2015-05-31 11:05:43 +02:00
commit 9f0ccdc37a
8 changed files with 39 additions and 17 deletions

View file

@ -147,7 +147,7 @@ namespace MWClass
if (ptr.getCellRef().getTeleport()) if (ptr.getCellRef().getTeleport())
{ {
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest())); boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest(), true));
action->setSound(openSound); action->setSound(openSound);

View file

@ -183,7 +183,7 @@ namespace MWGui
MWBase::Environment::get().getDialogueManager()->goodbyeSelected(); MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
// Teleports any followers, too. // Teleports any followers, too.
MWWorld::ActionTeleport action(interior ? cellname : "", pos); MWWorld::ActionTeleport action(interior ? cellname : "", pos, true);
action.execute(player); action.execute(player);
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0); MWBase::Environment::get().getWindowManager()->fadeScreenOut(0);

View file

@ -679,7 +679,7 @@ namespace MWMechanics
if (markedCell) if (markedCell)
{ {
MWWorld::ActionTeleport action(markedCell->isExterior() ? "" : markedCell->getCell()->mName, MWWorld::ActionTeleport action(markedCell->isExterior() ? "" : markedCell->getCell()->mName,
markedPosition); markedPosition, false);
action.execute(target); action.execute(target);
} }
} }

View file

@ -196,7 +196,11 @@ const NpcAnimation::PartBoneMap NpcAnimation::sPartList = createPartListMap();
NpcAnimation::~NpcAnimation() NpcAnimation::~NpcAnimation()
{ {
if (!mListenerDisabled) if (!mListenerDisabled
// No need to getInventoryStore() to reset, if none exists
// This is to avoid triggering the listener via ensureCustomData()->autoEquip()->fireEquipmentChanged()
// all from within this destructor. ouch!
&& mPtr.getRefData().getCustomData())
mPtr.getClass().getInventoryStore(mPtr).setListener(NULL, mPtr); mPtr.getClass().getInventoryStore(mPtr).setListener(NULL, mPtr);
} }

View file

@ -25,12 +25,14 @@ namespace
namespace MWWorld namespace MWWorld
{ {
ActionTeleport::ActionTeleport (const std::string& cellName, ActionTeleport::ActionTeleport (const std::string& cellName,
const ESM::Position& position) const ESM::Position& position, bool teleportFollowers)
: Action (true), mCellName (cellName), mPosition (position) : Action (true), mCellName (cellName), mPosition (position), mTeleportFollowers(teleportFollowers)
{ {
} }
void ActionTeleport::executeImp (const Ptr& actor) void ActionTeleport::executeImp (const Ptr& actor)
{
if (mTeleportFollowers)
{ {
//find any NPC that is following the actor and teleport him too //find any NPC that is following the actor and teleport him too
std::set<MWWorld::Ptr> followers; std::set<MWWorld::Ptr> followers;
@ -43,6 +45,7 @@ namespace MWWorld
<= 800*800) <= 800*800)
teleport(*it); teleport(*it);
} }
}
teleport(actor); teleport(actor);
} }

View file

@ -13,6 +13,7 @@ namespace MWWorld
{ {
std::string mCellName; std::string mCellName;
ESM::Position mPosition; ESM::Position mPosition;
bool mTeleportFollowers;
/// Teleports this actor and also teleports anyone following that actor. /// Teleports this actor and also teleports anyone following that actor.
virtual void executeImp (const Ptr& actor); virtual void executeImp (const Ptr& actor);
@ -22,8 +23,9 @@ namespace MWWorld
public: public:
ActionTeleport (const std::string& cellName, const ESM::Position& position); ActionTeleport (const std::string& cellName, const ESM::Position& position, bool teleportFollowers);
///< If cellName is empty, an exterior cell is assumed. ///< If cellName is empty, an exterior cell is assumed.
/// @param teleportFollowers Whether to teleport any following actors of the target actor as well.
}; };
} }

View file

@ -366,6 +366,19 @@ namespace MWWorld
inserted.first->second = scpt; inserted.first->second = scpt;
} }
template <>
inline void Store<ESM::StartScript>::load(ESM::ESMReader &esm, const std::string &id)
{
ESM::StartScript s;
s.load(esm);
s.mId = Misc::StringUtils::toLower(s.mId);
std::pair<typename Static::iterator, bool> inserted = mStatic.insert(std::make_pair(s.mId, s));
if (inserted.second)
mShared.push_back(&inserted.first->second);
else
inserted.first->second = s;
}
template <> template <>
class Store<ESM::LandTexture> : public StoreBase class Store<ESM::LandTexture> : public StoreBase
{ {

View file

@ -2919,7 +2919,7 @@ namespace MWWorld
if ( !closestMarker.mCell->isExterior() ) if ( !closestMarker.mCell->isExterior() )
cellName = closestMarker.mCell->getCell()->mName; cellName = closestMarker.mCell->getCell()->mName;
MWWorld::ActionTeleport action(cellName, closestMarker.getRefData().getPosition()); MWWorld::ActionTeleport action(cellName, closestMarker.getRefData().getPosition(), false);
action.execute(ptr); action.execute(ptr);
} }