1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Fix counter-attack counting

This commit is contained in:
Ivan Savenko
2025-01-08 16:06:31 +00:00
parent 9fe8ee9380
commit e27ca391b1
2 changed files with 15 additions and 0 deletions

View File

@ -359,6 +359,8 @@ CUnitState & CUnitState::operator=(const CUnitState & other)
waiting = other.waiting;
waitedThisTurn = other.waitedThisTurn;
casts = other.casts;
counterAttacks = other.counterAttacks;
shots = other.shots;
health = other.health;
cloneID = other.cloneID;
position = other.position;

View File

@ -34,6 +34,19 @@ protected:
{
std::atomic<int64_t> version = 0;
std::atomic<int64_t> value = 0;
BonusCacheEntry() = default;
BonusCacheEntry(const BonusCacheEntry & other)
: version(other.version.load())
, value(other.value.load())
{
}
BonusCacheEntry & operator =(const BonusCacheEntry & other)
{
version = other.version.load();
value = other.value.load();
return *this;
}
};
int getBonusValueImpl(BonusCacheEntry & currentValue, const CSelector & selector, BonusCacheMode) const;