Don't reset last hit object if the ID doesn't match

pull/3226/head
Evil Eye 2 years ago committed by psi29a
parent 2b83df09b6
commit c1d700f770

@ -108,6 +108,7 @@
Bug #6655: Constant effect absorb attribute causes the game to break
Bug #6670: Dialogue order is incorrect
Bug #6680: object.cpp handles nodetree unsafely, memory access with dangling pointer
Bug #6682: HitOnMe doesn't fire as intended
Feature #890: OpenMW-CS: Column filtering
Feature #1465: "Reset" argument for AI functions
Feature #2491: Ability to make OpenMW "portable"

@ -347,6 +347,11 @@ namespace MWMechanics
mLastHitObject = objectid;
}
void CreatureStats::clearLastHitObject()
{
mLastHitObject.clear();
}
const std::string &CreatureStats::getLastHitObject() const
{
return mLastHitObject;

@ -255,6 +255,7 @@ namespace MWMechanics
bool getStance (Stance flag) const;
void setLastHitObject(const std::string &objectid);
void clearLastHitObject();
const std::string &getLastHitObject() const;
void setLastHitAttemptObject(const std::string &objectid);
const std::string &getLastHitAttemptObject() const;

@ -977,9 +977,10 @@ namespace MWScript
runtime.pop();
MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
runtime.push(::Misc::StringUtils::ciEqual(objectID, stats.getLastHitObject()));
stats.setLastHitObject(std::string());
bool hit = ::Misc::StringUtils::ciEqual(objectID, stats.getLastHitObject());
runtime.push(hit);
if(hit)
stats.clearLastHitObject();
}
};

Loading…
Cancel
Save