From 70919ba60ae596bab066e34bfb860ca5a4aa539e Mon Sep 17 00:00:00 2001 From: Jeffrey Haines Date: Thu, 3 Apr 2014 16:13:14 -0400 Subject: [PATCH] Removed witnesses and minor changes --- apps/openmw/mwmechanics/actors.cpp | 19 +++++++++------ apps/openmw/mwmechanics/creaturestats.cpp | 24 ++----------------- apps/openmw/mwmechanics/creaturestats.hpp | 9 ------- .../mwmechanics/mechanicsmanagerimp.cpp | 11 ++------- apps/openmw/mwworld/player.cpp | 11 --------- apps/openmw/mwworld/player.hpp | 6 ----- 6 files changed, 16 insertions(+), 64 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 6d9f23aa2..56f24a747 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -739,11 +739,12 @@ namespace MWMechanics { creatureStats.getAiSequence().stack(AiCombat(player)); creatureStats.setHostile(true); + creatureStats.setAlarmed(true); } } // if I was a witness to a crime - if (creatureStats.getCrimeId() != -1) + if (creatureStats.isAlarmed()) { if(player.getClass().getNpcStats(player).getBounty() == 0) { @@ -752,19 +753,23 @@ namespace MWMechanics if (ptr.getClass().isClass(ptr, "Guard")) creatureStats.getAiSequence().stopPersue(); creatureStats.getAiSequence().stopCombat(); - creatureStats.setCrimeId(-1); } - else if (creatureStats.isAlarmed()) + else if (!creatureStats.isHostile()) { - if (ptr.getClass().isClass(ptr, "Guard") && !creatureStats.isHostile()) + if (ptr.getClass().isClass(ptr, "Guard")) creatureStats.getAiSequence().stack(AiPersue(player.getClass().getId(player))); - else if (!creatureStats.isHostile()) - { + else creatureStats.getAiSequence().stack(AiCombat(player)); creatureStats.setHostile(true); - } } } + + // if I didn't report a crime was I attacked? + else if (creatureStats.getAttacked() && !creatureStats.isHostile()) + { + creatureStats.getAiSequence().stack(AiCombat(player)); + creatureStats.setHostile(true); + } } } diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index 17d36be79..feed8d182 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -14,8 +14,8 @@ namespace MWMechanics CreatureStats::CreatureStats() : mLevel (0), mDead (false), mDied (false), mFriendlyHits (0), mTalkedTo (false), mAlarmed (false), - mAttacked (false), mHostile (false), mAssaulted(false), - mAttackingOrSpell(false), mCrimeId(-1), + mAttacked (false), mHostile (false), + mAttackingOrSpell(false), mIsWerewolf(false), mFallHeight(0), mRecalcDynamicStats(false), mKnockdown(false), mHitRecovery(false), mBlock(false), mMovementFlags(0), mDrawState (DrawState_Nothing), mAttackStrength(0.f) @@ -316,26 +316,6 @@ namespace MWMechanics mHostile = hostile; } - bool CreatureStats::isAssaulted() const - { - return mAssaulted; - } - - void CreatureStats::setAssaulted (bool assaulted) - { - mAssaulted = assaulted; - } - - int CreatureStats::getCrimeId() const - { - return mCrimeId; - } - - void CreatureStats::setCrimeId (int id) - { - mCrimeId = id; - } - bool CreatureStats::getCreatureTargetted() const { std::string target; diff --git a/apps/openmw/mwmechanics/creaturestats.hpp b/apps/openmw/mwmechanics/creaturestats.hpp index 67afd9f25..97bcd719c 100644 --- a/apps/openmw/mwmechanics/creaturestats.hpp +++ b/apps/openmw/mwmechanics/creaturestats.hpp @@ -40,7 +40,6 @@ namespace MWMechanics bool mAttacked; bool mHostile; bool mAssaulted; - int mCrimeId; bool mAttackingOrSpell; bool mKnockdown; bool mHitRecovery; @@ -188,14 +187,6 @@ namespace MWMechanics void setHostile (bool hostile); - bool isAssaulted() const; - - void setAssaulted (bool assaulted); - - int getCrimeId() const; - - void setCrimeId (int id); - bool getCreatureTargetted() const; float getEvasion() const; diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 54622c0b4..9119b3ab6 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -839,9 +839,8 @@ namespace MWMechanics CreatureStats& creatureStats = MWWorld::Class::get(*it).getCreatureStats(*it); - // Was the crime seen or the victim assulted? - if ( ( MWBase::Environment::get().getWorld()->getLOS(ptr, *it) && awarenessCheck(ptr, *it) ) || - type == OT_Assault) + // Was the crime seen? + if ( MWBase::Environment::get().getWorld()->getLOS(ptr, *it) && awarenessCheck(ptr, *it) ) { // Say something! // TODO: Add more messages @@ -862,16 +861,10 @@ namespace MWMechanics // Will the witness be affected by the crime? CreatureStats& creatureStats1 = MWWorld::Class::get(*it1).getCreatureStats(*it1); if (creatureStats1.getAiSetting(CreatureStats::AI_Alarm).getBase() >= alarm) - { creatureStats1.setAlarmed(true); - creatureStats1.setCrimeId(player.getWitnessTotal()); - player.addWitness(); - } } break; // Someone saw the crime and everyone has been told } - else if (type == OT_Assault) - creatureStats.setAlarmed(true); } } if (reported) diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index 7c576960f..bfeca9653 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -30,7 +30,6 @@ namespace MWWorld mAutoMove(false), mForwardBackward(0), mTeleported(false), - mWitnessTotal(0), mMarkedCell(NULL) { mPlayer.mBase = player; @@ -66,16 +65,6 @@ namespace MWWorld return mSign; } - void Player::addWitness() - { - mWitnessTotal++; - } - - int Player::getWitnessTotal() const - { - return mWitnessTotal; - } - void Player::setDrawState (MWMechanics::DrawState_ state) { MWWorld::Ptr ptr = getPlayer(); diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 71c231481..9d3fbbeec 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -41,8 +41,6 @@ namespace MWWorld bool mAutoMove; int mForwardBackward; bool mTeleported; - - int mWitnessTotal; public: @@ -67,10 +65,6 @@ namespace MWWorld void setBirthSign(const std::string &sign); - void addWitness(); - - int getWitnessTotal() const; - const std::string &getBirthSign() const; void setDrawState (MWMechanics::DrawState_ state);