1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

vcmi: specialize native terrain entity

Specialize native terrain entity for all object that have
native terrain. Allow creatures to take global bonuses into
account when checking for native terrain.
This commit is contained in:
Konstantin
2023-04-05 18:56:28 +03:00
parent 6d9859932b
commit 0f5f4c69ec
14 changed files with 122 additions and 8 deletions

View File

@ -78,7 +78,7 @@ void CStack::localInit(BattleInfo * battleInfo)
attachTo(*army);
attachTo(const_cast<CCreature&>(*type));
}
nativeTerrain = type->getNativeTerrain(); //save nativeTerrain in the variable on the battle start to avoid dead lock
nativeTerrain = getNativeTerrain(); //save nativeTerrain in the variable on the battle start to avoid dead lock
CUnitState::localInit(this); //it causes execution of the CStack::isOnNativeTerrain where nativeTerrain will be considered
position = initialPosition;
}
@ -338,6 +338,11 @@ int32_t CStack::unitBaseAmount() const
return baseAmount;
}
const IBonusBearer* CStack::getBonusBearer() const
{
return this;
}
bool CStack::unitHasAmmoCart(const battle::Unit * unit) const
{
for(const CStack * st : battle->stacks)