mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Get rid of "player" string checks (Fixes #2216)
This commit is contained in:
parent
68de876051
commit
3879ce6ac1
15 changed files with 59 additions and 58 deletions
|
@ -355,7 +355,7 @@ namespace MWClass
|
|||
if(!object.isEmpty())
|
||||
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
||||
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript;
|
||||
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
||||
|
|
|
@ -507,7 +507,7 @@ namespace MWClass
|
|||
if(otherstats.isDead()) // Can't hit dead actors
|
||||
return;
|
||||
|
||||
if(ptr.getRefData().getHandle() == "player")
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||
|
||||
int weapskill = ESM::Skill::HandToHand;
|
||||
|
@ -549,7 +549,7 @@ namespace MWClass
|
|||
{
|
||||
MWMechanics::getHandToHandDamage(ptr, victim, damage, healthdmg);
|
||||
}
|
||||
if(ptr.getRefData().getHandle() == "player")
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
skillUsageSucceeded(ptr, weapskill, 0);
|
||||
|
||||
|
@ -625,7 +625,7 @@ namespace MWClass
|
|||
if(!object.isEmpty())
|
||||
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
||||
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
const std::string &script = ptr.getClass().getScript(ptr);
|
||||
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
||||
|
@ -708,7 +708,7 @@ namespace MWClass
|
|||
if (armorhealth == 0)
|
||||
armor = *inv.unequipItem(armor, ptr);
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
|
||||
|
||||
switch(armor.getClass().getEquipmentSkill(armor))
|
||||
|
@ -724,7 +724,7 @@ namespace MWClass
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if(ptr.getRefData().getHandle() == "player")
|
||||
else if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
|
||||
}
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ namespace MWClass
|
|||
if(damage > 0.0f)
|
||||
{
|
||||
sndMgr->playSound3D(ptr, "Health Damage", 1.0f, 1.0f);
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay();
|
||||
}
|
||||
float health = getCreatureStats(ptr).getHealth().getCurrent() - damage;
|
||||
|
@ -815,7 +815,7 @@ namespace MWClass
|
|||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
// player got activated by another NPC
|
||||
if(ptr.getRefData().getHandle() == "player")
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
|
||||
|
||||
// Werewolfs can't activate NPCs
|
||||
|
|
|
@ -99,7 +99,7 @@ bool disintegrateSlot (MWWorld::Ptr ptr, int slot, float disintegrate)
|
|||
if (charge == 0)
|
||||
{
|
||||
// Will unequip the broken item and try to find a replacement
|
||||
if (ptr.getRefData().getHandle() != "player")
|
||||
if (ptr != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
inv.autoEquip(ptr);
|
||||
else
|
||||
inv.unequipItem(*item, ptr);
|
||||
|
@ -154,6 +154,7 @@ void adjustCommandedActor (const MWWorld::Ptr& actor)
|
|||
|
||||
if (check.mCommanded && !hasCommandPackage)
|
||||
{
|
||||
// FIXME: don't use refid string
|
||||
MWMechanics::AiFollow package("player", true);
|
||||
stats.getAiSequence().stack(package, actor);
|
||||
}
|
||||
|
@ -244,7 +245,7 @@ namespace MWMechanics
|
|||
gem->getContainerStore()->unstack(*gem, caster);
|
||||
gem->getCellRef().setSoul(mCreature.getCellRef().getRefId());
|
||||
|
||||
if (caster.getRefData().getHandle() == "player")
|
||||
if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sSoultrapSuccess}");
|
||||
|
||||
const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>()
|
||||
|
@ -433,7 +434,7 @@ namespace MWMechanics
|
|||
int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getModified();
|
||||
|
||||
float base = 1.f;
|
||||
if (ptr.getCellRef().getRefId() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fPCbaseMagickaMult")->getFloat();
|
||||
else
|
||||
base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCbaseMagickaMult")->getFloat();
|
||||
|
@ -543,7 +544,7 @@ namespace MWMechanics
|
|||
{
|
||||
spells.worsenCorprus(it->first);
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicCorprusWorsens}");
|
||||
}
|
||||
}
|
||||
|
@ -665,7 +666,7 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
if (receivedMagicDamage && ptr.getRefData().getHandle() == "player")
|
||||
if (receivedMagicDamage && ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
|
||||
|
||||
creatureStats.setHealth(health);
|
||||
|
@ -848,7 +849,7 @@ namespace MWMechanics
|
|||
|
||||
void Actors::updateEquippedLight (const MWWorld::Ptr& ptr, float duration)
|
||||
{
|
||||
bool isPlayer = ptr.getRefData().getHandle()=="player";
|
||||
bool isPlayer = (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
MWWorld::InventoryStore &inventoryStore = ptr.getClass().getInventoryStore(ptr);
|
||||
MWWorld::ContainerStoreIterator heldIter =
|
||||
|
@ -1157,7 +1158,7 @@ namespace MWMechanics
|
|||
|
||||
// Handle player last, in case a cell transition occurs by casting a teleportation spell
|
||||
// (would invalidate the iterator)
|
||||
if (iter->first.getCellRef().getRefId() == "player")
|
||||
if (iter->first == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
playerCharacter = iter->second->getCharacterController();
|
||||
continue;
|
||||
|
|
|
@ -1010,7 +1010,7 @@ bool CharacterController::updateWeaponState()
|
|||
// For the player, set the spell we want to cast
|
||||
// This has to be done at the start of the casting animation,
|
||||
// *not* when selecting a spell in the GUI (otherwise you could change the spell mid-animation)
|
||||
if (mPtr.getRefData().getHandle() == "player")
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
std::string selectedSpell = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
|
||||
stats.getSpells().setSelectedSpell(selectedSpell);
|
||||
|
@ -1094,7 +1094,7 @@ bool CharacterController::updateWeaponState()
|
|||
mAttackType = "shoot";
|
||||
else
|
||||
{
|
||||
if(isWeapon && mPtr.getRefData().getHandle() == "player" &&
|
||||
if(isWeapon && mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
|
||||
Settings::Manager::getBool("best attack", "Game"))
|
||||
{
|
||||
MWWorld::ContainerStoreIterator weapon = mPtr.getClass().getInventoryStore(mPtr).getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
|
@ -1421,7 +1421,7 @@ void CharacterController::update(float duration)
|
|||
|
||||
|
||||
// advance athletics
|
||||
if(mHasMovedInXY && mPtr.getRefData().getHandle() == "player")
|
||||
if(mHasMovedInXY && mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
if(inwater)
|
||||
{
|
||||
|
@ -1521,7 +1521,7 @@ void CharacterController::update(float duration)
|
|||
}
|
||||
|
||||
// advance acrobatics
|
||||
if (mPtr.getRefData().getHandle() == "player")
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
|
||||
|
||||
// decrease fatigue
|
||||
|
@ -1564,7 +1564,7 @@ void CharacterController::update(float duration)
|
|||
else
|
||||
{
|
||||
// report acrobatics progression
|
||||
if (mPtr.getRefData().getHandle() == "player")
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1797,7 +1797,7 @@ bool CharacterController::kill()
|
|||
{
|
||||
if( isDead() )
|
||||
{
|
||||
if( mPtr.getRefData().getHandle()=="player" && !isAnimPlaying(mCurrentDeath) )
|
||||
if( mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr() && !isAnimPlaying(mCurrentDeath) )
|
||||
{
|
||||
//player's death animation is over
|
||||
MWBase::Environment::get().getStateManager()->askLoadRecent();
|
||||
|
@ -1813,7 +1813,7 @@ bool CharacterController::kill()
|
|||
mCurrentIdle.clear();
|
||||
|
||||
// Play Death Music if it was the player dying
|
||||
if(mPtr.getRefData().getHandle()=="player")
|
||||
if(mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getSoundManager()->streamMusic("Special/MW_Death.mp3");
|
||||
|
||||
return true;
|
||||
|
@ -1854,7 +1854,7 @@ void CharacterController::updateMagicEffects()
|
|||
float alpha = 1.f;
|
||||
if (mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude())
|
||||
{
|
||||
if (mPtr.getRefData().getHandle() == "player")
|
||||
if (mPtr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
alpha = 0.4f;
|
||||
else
|
||||
alpha = 0.f;
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace MWMechanics
|
|||
|
||||
blockerStats.setBlock(true);
|
||||
|
||||
if (blocker.getCellRef().getRefId() == "player")
|
||||
if (blocker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
blocker.getClass().skillUsageSucceeded(blocker, ESM::Skill::Block, 0);
|
||||
|
||||
return true;
|
||||
|
@ -157,7 +157,7 @@ namespace MWMechanics
|
|||
&& actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
|
||||
damage *= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fWereWolfSilverWeaponDamageMult")->getFloat();
|
||||
|
||||
if (damage == 0 && attacker.getRefData().getHandle() == "player")
|
||||
if (damage == 0 && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResistsWeapons}");
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ namespace MWMechanics
|
|||
return;
|
||||
}
|
||||
|
||||
if(attacker.getRefData().getHandle() == "player")
|
||||
if(attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||
|
||||
int weapskill = ESM::Skill::Marksman;
|
||||
|
@ -211,7 +211,7 @@ namespace MWMechanics
|
|||
adjustWeaponDamage(damage, weapon);
|
||||
reduceWeaponCondition(damage, true, weapon, attacker);
|
||||
|
||||
if(attacker.getRefData().getHandle() == "player")
|
||||
if(attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
attacker.getClass().skillUsageSucceeded(attacker, weapskill, 0);
|
||||
|
||||
if (victim.getClass().getCreatureStats(victim).getKnockedDown())
|
||||
|
|
|
@ -180,7 +180,7 @@ namespace MWMechanics
|
|||
int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||
|
||||
float castChance = (lowestSkill - spell->mData.mCost + castBonus + 0.2f * actorWillpower + 0.1f * actorLuck) * stats.getFatigueTerm();
|
||||
if (MWBase::Environment::get().getWorld()->getGodModeState() && actor.getRefData().getHandle() == "player")
|
||||
if (MWBase::Environment::get().getWorld()->getGodModeState() && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
castChance = 100;
|
||||
|
||||
if (!cap)
|
||||
|
@ -387,7 +387,7 @@ namespace MWMechanics
|
|||
if (roll <= x)
|
||||
{
|
||||
// Fully resisted, show message
|
||||
if (target.getRefData().getHandle() == "player")
|
||||
if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}");
|
||||
return;
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ namespace MWMechanics
|
|||
if (target.getClass().isActor())
|
||||
targetEffects += target.getClass().getCreatureStats(target).getMagicEffects();
|
||||
|
||||
bool castByPlayer = (!caster.isEmpty() && caster.getRefData().getHandle() == "player");
|
||||
bool castByPlayer = (!caster.isEmpty() && caster == MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
// Try absorbing if it's a spell
|
||||
// NOTE: Vanilla does this once per effect source instead of adding the % from all sources together, not sure
|
||||
|
@ -482,7 +482,7 @@ namespace MWMechanics
|
|||
if (magnitudeMult == 0)
|
||||
{
|
||||
// Fully resisted, show message
|
||||
if (target.getRefData().getHandle() == "player")
|
||||
if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicPCResisted}");
|
||||
else if (castByPlayer)
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResisted}");
|
||||
|
@ -611,7 +611,7 @@ namespace MWMechanics
|
|||
{
|
||||
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
|
||||
{
|
||||
if (caster.getRefData().getHandle() == "player")
|
||||
if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicLockSuccess}");
|
||||
target.getCellRef().setLockLevel(static_cast<int>(magnitude));
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ namespace MWMechanics
|
|||
if (!caster.isEmpty() && caster.getClass().isActor())
|
||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(caster, target);
|
||||
|
||||
if (caster.getRefData().getHandle() == "player")
|
||||
if (caster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicOpenSuccess}");
|
||||
}
|
||||
target.getCellRef().setLockLevel(-abs(target.getCellRef().getLockLevel()));
|
||||
|
@ -652,7 +652,7 @@ namespace MWMechanics
|
|||
else if (effectId == ESM::MagicEffect::RemoveCurse)
|
||||
target.getClass().getCreatureStats(target).getSpells().purgeCurses();
|
||||
|
||||
if (target.getRefData().getHandle() != "player")
|
||||
if (target != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
return;
|
||||
if (!MWBase::Environment::get().getWorld()->isTeleportingEnabled())
|
||||
return;
|
||||
|
@ -728,7 +728,7 @@ namespace MWMechanics
|
|||
|
||||
if (item.getCellRef().getEnchantmentCharge() < castCost)
|
||||
{
|
||||
if (mCaster.getRefData().getHandle() == "player")
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicInsufficientCharge}");
|
||||
|
||||
// Failure sound
|
||||
|
@ -752,14 +752,14 @@ namespace MWMechanics
|
|||
|
||||
if (enchantment->mData.mType == ESM::Enchantment::WhenUsed)
|
||||
{
|
||||
if (mCaster.getRefData().getHandle() == "player")
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 1);
|
||||
}
|
||||
if (enchantment->mData.mType == ESM::Enchantment::CastOnce)
|
||||
item.getContainerStore()->remove(item, 1, mCaster);
|
||||
else if (enchantment->mData.mType != ESM::Enchantment::WhenStrikes)
|
||||
{
|
||||
if (mCaster.getRefData().getHandle() == "player")
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
mCaster.getClass().skillUsageSucceeded (mCaster, ESM::Skill::Enchant, 3);
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ namespace MWMechanics
|
|||
int roll = static_cast<int>(std::rand() / (static_cast<double> (RAND_MAX)+1) * 100); // [0, 99]
|
||||
if (!fail && roll >= successChance)
|
||||
{
|
||||
if (mCaster.getRefData().getHandle() == "player")
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}");
|
||||
fail = true;
|
||||
}
|
||||
|
@ -845,7 +845,7 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
if (mCaster.getRefData().getHandle() == "player" && spellIncreasesSkill(spell))
|
||||
if (mCaster == MWBase::Environment::get().getWorld()->getPlayerPtr() && spellIncreasesSkill(spell))
|
||||
mCaster.getClass().skillUsageSucceeded(mCaster,
|
||||
spellSchoolToSkill(school), 0);
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ void RenderingManager::updatePlayerPtr(const MWWorld::Ptr &ptr)
|
|||
void RenderingManager::rebuildPtr(const MWWorld::Ptr &ptr)
|
||||
{
|
||||
NpcAnimation *anim = NULL;
|
||||
if(ptr.getRefData().getHandle() == "player")
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
anim = mPlayerAnimation;
|
||||
else if(ptr.getClass().isActor())
|
||||
anim = dynamic_cast<NpcAnimation*>(mActors->getAnimation(ptr));
|
||||
|
@ -955,7 +955,7 @@ Animation* RenderingManager::getAnimation(const MWWorld::Ptr &ptr)
|
|||
{
|
||||
Animation *anim = mActors->getAnimation(ptr);
|
||||
|
||||
if(!anim && ptr.getRefData().getHandle() == "player")
|
||||
if(!anim && ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
anim = mPlayerAnimation;
|
||||
|
||||
if (!anim)
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace MWScript
|
|||
MWWorld::ActionEquip action (*it);
|
||||
action.execute(ptr);
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player" && !ptr.getClass().getScript(ptr).empty())
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr() && !ptr.getClass().getScript(ptr).empty())
|
||||
ptr.getRefData().getLocals().setVarByInt(ptr.getClass().getScript(ptr), "onpcequip", 1);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -212,7 +212,7 @@ namespace MWScript
|
|||
if (!ptr.isInCell())
|
||||
return;
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ namespace MWScript
|
|||
if (ptr.getContainerStore())
|
||||
return;
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ namespace MWScript
|
|||
if (!ptr.isInCell())
|
||||
return;
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setTeleported(true);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ namespace MWScript
|
|||
// another morrowind oddity: player will be moved to the exterior cell at this location,
|
||||
// non-player actors will move within the cell they are in.
|
||||
MWWorld::Ptr updated;
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptr,cell,x,y,z);
|
||||
|
|
|
@ -477,7 +477,7 @@ namespace MWSound
|
|||
while(snditer != mActiveSounds.end())
|
||||
{
|
||||
if(snditer->second.first != MWWorld::Ptr() &&
|
||||
snditer->second.first.getCellRef().getRefId() != "player" &&
|
||||
snditer->second.first != MWBase::Environment::get().getWorld()->getPlayerPtr() &&
|
||||
snditer->second.first.getCell() == cell)
|
||||
{
|
||||
snditer->first->stop();
|
||||
|
|
|
@ -20,7 +20,7 @@ void MWWorld::Action::execute (const Ptr& actor)
|
|||
{
|
||||
if (!mSoundId.empty())
|
||||
{
|
||||
if (mKeepSound && actor.getRefData().getHandle()=="player")
|
||||
if (mKeepSound && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0,
|
||||
MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Normal,mSoundOffset);
|
||||
else
|
||||
|
|
|
@ -210,7 +210,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add(const std::string &
|
|||
{
|
||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), id, count);
|
||||
// a bit pointless to set owner for the player
|
||||
if (actorPtr.getRefData().getHandle() != "player")
|
||||
if (actorPtr != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
return add(ref.getPtr(), count, actorPtr, true);
|
||||
else
|
||||
return add(ref.getPtr(), count, actorPtr, false);
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MWWorld
|
|||
|
||||
void FailedAction::executeImp(const Ptr &actor)
|
||||
{
|
||||
if(actor.getRefData().getHandle() == "player" && !mMessage.empty())
|
||||
if(actor == MWBase::Environment::get().getWorld()->getPlayerPtr() && !mMessage.empty())
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(mMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::add(const Ptr& itemPtr,
|
|||
const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, count, actorPtr, setOwner);
|
||||
|
||||
// Auto-equip items if an armor/clothing or weapon item is added, but not for the player nor werewolves
|
||||
if (actorPtr.getRefData().getHandle() != "player"
|
||||
if (actorPtr != MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||
&& !(actorPtr.getClass().isNpc() && actorPtr.getClass().getNpcStats(actorPtr).isWerewolf()))
|
||||
{
|
||||
std::string type = itemPtr.getTypeName();
|
||||
|
@ -503,7 +503,7 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
|
|||
|
||||
// If an armor/clothing item is removed, try to find a replacement,
|
||||
// but not for the player nor werewolves.
|
||||
if ((actor.getRefData().getHandle() != "player")
|
||||
if ((actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
&& !(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()))
|
||||
{
|
||||
std::string type = item.getTypeName();
|
||||
|
@ -535,7 +535,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipSlot(int slot, c
|
|||
{
|
||||
retval = restack(*it);
|
||||
|
||||
if (actor.getRefData().getHandle() == "player")
|
||||
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
// Unset OnPCEquip Variable on item's script, if it has a script with that variable declared
|
||||
const std::string& script = it->getClass().getScript(*it);
|
||||
|
|
|
@ -1406,7 +1406,7 @@ namespace MWWorld
|
|||
PtrVelocityList::const_iterator player(results.end());
|
||||
for(PtrVelocityList::const_iterator iter(results.begin());iter != results.end();++iter)
|
||||
{
|
||||
if(iter->first.getRefData().getHandle() == "player")
|
||||
if(iter->first == getPlayerPtr())
|
||||
{
|
||||
/* Handle player last, in case a cell transition occurs */
|
||||
player = iter;
|
||||
|
@ -2228,7 +2228,7 @@ namespace MWWorld
|
|||
|
||||
if (healthPerSecond > 0.0f)
|
||||
{
|
||||
if (actor.getRefData().getHandle() == "player")
|
||||
if (actor == getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
|
||||
|
||||
if (!MWBase::Environment::get().getSoundManager()->getSoundPlaying(actor, "Health Damage"))
|
||||
|
@ -2259,7 +2259,7 @@ namespace MWWorld
|
|||
|
||||
if (healthPerSecond > 0.0f)
|
||||
{
|
||||
if (actor.getRefData().getHandle() == "player")
|
||||
if (actor == getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
|
||||
|
||||
if (!MWBase::Environment::get().getSoundManager()->getSoundPlaying(actor, "Health Damage"))
|
||||
|
@ -2516,7 +2516,7 @@ namespace MWWorld
|
|||
// the following is just for reattaching the camera properly.
|
||||
mRendering->rebuildPtr(actor);
|
||||
|
||||
if(actor.getRefData().getHandle() == "player")
|
||||
if(actor == getPlayerPtr())
|
||||
{
|
||||
// Update the GUI only when called on the player
|
||||
MWBase::WindowManager* windowManager = MWBase::Environment::get().getWindowManager();
|
||||
|
@ -3167,7 +3167,7 @@ namespace MWWorld
|
|||
|
||||
void World::spawnBloodEffect(const Ptr &ptr, const Vector3 &worldPosition)
|
||||
{
|
||||
if (ptr.getRefData().getHandle() == "player" && Settings::Manager::getBool("hit fader", "GUI"))
|
||||
if (ptr == getPlayerPtr() && Settings::Manager::getBool("hit fader", "GUI"))
|
||||
return;
|
||||
|
||||
int type = ptr.getClass().getBloodTexture(ptr);
|
||||
|
|
Loading…
Reference in a new issue