1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-05-05 09:11:25 +00:00

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

This commit is contained in:
Evil Eye 2022-03-28 11:40:46 +00:00 committed by psi29a
parent 2b83df09b6
commit c1d700f770
4 changed files with 11 additions and 3 deletions

View file

@ -108,6 +108,7 @@
Bug #6655: Constant effect absorb attribute causes the game to break Bug #6655: Constant effect absorb attribute causes the game to break
Bug #6670: Dialogue order is incorrect Bug #6670: Dialogue order is incorrect
Bug #6680: object.cpp handles nodetree unsafely, memory access with dangling pointer 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 #890: OpenMW-CS: Column filtering
Feature #1465: "Reset" argument for AI functions Feature #1465: "Reset" argument for AI functions
Feature #2491: Ability to make OpenMW "portable" Feature #2491: Ability to make OpenMW "portable"

View file

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

View file

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

View file

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