Change projectiles to use actorIds

This commit is contained in:
scrawl 2014-05-14 09:48:16 +02:00
parent 61187c2fef
commit 1141c1f3f2
2 changed files with 7 additions and 7 deletions

View file

@ -2223,7 +2223,7 @@ namespace MWWorld
const Ogre::Vector3& worldPos, const Ogre::Quaternion& orient, MWWorld::Ptr bow, float speed) const Ogre::Vector3& worldPos, const Ogre::Quaternion& orient, MWWorld::Ptr bow, float speed)
{ {
ProjectileState state; ProjectileState state;
state.mActorHandle = actor.getRefData().getHandle(); state.mActorId = actor.getClass().getCreatureStats(actor).getActorId();
state.mBow = bow; state.mBow = bow;
state.mVelocity = orient.yAxis() * speed; state.mVelocity = orient.yAxis() * speed;
@ -2310,7 +2310,7 @@ namespace MWWorld
MagicBoltState state; MagicBoltState state;
state.mSourceName = sourceName; state.mSourceName = sourceName;
state.mId = id; state.mId = id;
state.mActorHandle = actor.getRefData().getHandle(); state.mActorId = actor.getClass().getCreatureStats(actor).getActorId();
state.mSpeed = speed; state.mSpeed = speed;
state.mStack = stack; state.mStack = stack;
@ -2374,7 +2374,7 @@ namespace MWWorld
if (obstacle == ptr) if (obstacle == ptr)
continue; continue;
MWWorld::Ptr caster = searchPtrViaHandle(it->second.mActorHandle); MWWorld::Ptr caster = searchPtrViaActorId(it->second.mActorId);
// Arrow intersects with player immediately after shooting :/ // Arrow intersects with player immediately after shooting :/
if (obstacle == caster) if (obstacle == caster)
@ -2460,7 +2460,7 @@ namespace MWWorld
if (obstacle == ptr) if (obstacle == ptr)
continue; continue;
MWWorld::Ptr caster = searchPtrViaHandle(it->second.mActorHandle); MWWorld::Ptr caster = searchPtrViaActorId(it->second.mActorId);
if (caster.isEmpty()) if (caster.isEmpty())
caster = obstacle; caster = obstacle;
@ -2483,7 +2483,7 @@ namespace MWWorld
if (explode) if (explode)
{ {
MWWorld::Ptr caster = searchPtrViaHandle(it->second.mActorHandle); MWWorld::Ptr caster = searchPtrViaActorId(it->second.mActorId);
explodeSpell(Ogre::Vector3(ptr.getRefData().getPosition().pos), ptr, it->second.mEffects, caster, it->second.mId, it->second.mSourceName); explodeSpell(Ogre::Vector3(ptr.getRefData().getPosition().pos), ptr, it->second.mEffects, caster, it->second.mId, it->second.mSourceName);
deleteObject(ptr); deleteObject(ptr);

View file

@ -96,7 +96,7 @@ namespace MWWorld
std::string mId; std::string mId;
// Actor who casted this projectile // Actor who casted this projectile
std::string mActorHandle; int mActorId;
// Name of item to display as effect source in magic menu (in case we casted an enchantment) // Name of item to display as effect source in magic menu (in case we casted an enchantment)
std::string mSourceName; std::string mSourceName;
@ -111,7 +111,7 @@ namespace MWWorld
struct ProjectileState struct ProjectileState
{ {
// Actor who shot this projectile // Actor who shot this projectile
std::string mActorHandle; int mActorId;
MWWorld::Ptr mBow; // bow or crossbow the projectile was fired from MWWorld::Ptr mBow; // bow or crossbow the projectile was fired from