1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

refactor logic to CBattleInfoCallback and leave UI in BattleFieldController, BattleActionsController

- move fromWhichHexAttack to CBattleInfoCallback
- add toWhichHexMove (unifying incoherent duplicates)
- add battleGetOccupiableHexes
- add battleCanAttackHex for spatial attack check
- add battleCanAttackUnit for non-spatial attack check
- add headDirection to Unit (removing destShiftDir from CStack)
- remove redundant game logic from selectAttackDirection
- remove redundant game logic from BattleFieldController and BattleActionsController
- fix no consideration for double-wide tail attack in BattleFlowProcessor
- fix #6302 wrong moat stopping condition
- throw exception on attacker nullptr in battleCanAttackHex, fromWhichHexAttack
- safer actionIsLegal on attack, move
- remove redundant canStackMoveHere from ui code
- throw exception on nullptr unit in battleGetOccupiableHexes
- ensure activeStack in redrawBackgroundWithHexes
- test point validity in selectAttackDirection
This commit is contained in:
Andrej Dudenhefner
2025-11-09 22:12:49 +01:00
parent 81db5c7cf4
commit e72dcce8ba
12 changed files with 251 additions and 328 deletions

View File

@@ -107,21 +107,6 @@ si32 CStack::magicResistance() const
return static_cast<si32>(100 - castChance);
}
BattleHex::EDir CStack::destShiftDir() const
{
if(doubleWide())
{
if(side == BattleSide::ATTACKER)
return BattleHex::EDir::RIGHT;
else
return BattleHex::EDir::LEFT;
}
else
{
return BattleHex::EDir::NONE;
}
}
std::vector<SpellID> CStack::activeSpells() const
{
std::vector<SpellID> ret;