1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-26 06:40:22 +00:00

Merge branch 'try_and_hit_me' into 'master'

Bring HitAttemptOnMe in line with HitOnMe

See merge request OpenMW/openmw!1816
This commit is contained in:
psi29a 2022-04-30 18:26:30 +00:00
commit dccbd3e980
3 changed files with 10 additions and 3 deletions

View File

@ -362,6 +362,11 @@ namespace MWMechanics
mLastHitAttemptObject = objectid; mLastHitAttemptObject = objectid;
} }
void CreatureStats::clearLastHitAttemptObject()
{
mLastHitAttemptObject.clear();
}
const std::string &CreatureStats::getLastHitAttemptObject() const const std::string &CreatureStats::getLastHitAttemptObject() const
{ {
return mLastHitAttemptObject; return mLastHitAttemptObject;

View File

@ -258,6 +258,7 @@ namespace MWMechanics
void clearLastHitObject(); void clearLastHitObject();
const std::string &getLastHitObject() const; const std::string &getLastHitObject() const;
void setLastHitAttemptObject(const std::string &objectid); void setLastHitAttemptObject(const std::string &objectid);
void clearLastHitAttemptObject();
const std::string &getLastHitAttemptObject() const; const std::string &getLastHitAttemptObject() const;
void setHitAttemptActorId(const int actorId); void setHitAttemptActorId(const int actorId);
int getHitAttemptActorId() const; int getHitAttemptActorId() const;

View File

@ -997,9 +997,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.getLastHitAttemptObject())); bool hit = ::Misc::StringUtils::ciEqual(objectID, stats.getLastHitAttemptObject());
runtime.push(hit);
stats.setLastHitAttemptObject(std::string()); if(hit)
stats.clearLastHitAttemptObject();
} }
}; };