1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Merge pull request #2466 from IvanSavenko/battle_assertions_fix

(1.3.1) Fix assertion failures in battle
This commit is contained in:
Ivan Savenko 2023-08-05 23:50:18 +03:00 committed by GitHub
commit c3d8607c8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

@ -445,6 +445,8 @@ void BattleInterface::spellCast(const BattleSpellCast * sc)
stacksController->addNewAnim(new EffectAnimation(*this, side ? "SP07_B.DEF" : "SP07_A.DEF", rightHero));
});
}
// animations will be executed by spell effects
}
void BattleInterface::battleStacksEffectsSet(const SetStackEffect & sse)

View File

@ -499,7 +499,7 @@ void BattleStacksController::stacksAreAttacked(std::vector<StackAttackedInfo> at
void BattleStacksController::stackTeleported(const CStack *stack, std::vector<BattleHex> destHex, int distance)
{
assert(destHex.size() > 0);
owner.checkForAnimations();
//owner.checkForAnimations(); // NOTE: at this point spellcast animations were added, but not executed
owner.addToAnimationStage(EAnimationEvents::HIT, [=](){
addNewAnim( new ColorTransformAnimation(owner, stack, "teleportFadeOut", nullptr) );

View File

@ -31,8 +31,6 @@ namespace Cursor
};
enum class Combat {
INVALID = -1,
BLOCKED = 0,
MOVE = 1,
FLY = 2,
@ -157,12 +155,16 @@ public:
template<typename Index>
Index get()
{
assert((std::is_same<Index, Cursor::Default>::value )|| type != Cursor::Type::DEFAULT );
assert((std::is_same<Index, Cursor::Map>::value )|| type != Cursor::Type::ADVENTURE );
assert((std::is_same<Index, Cursor::Combat>::value )|| type != Cursor::Type::COMBAT );
assert((std::is_same<Index, Cursor::Spellcast>::value )|| type != Cursor::Type::SPELLBOOK );
bool typeValid = true;
return static_cast<Index>(frame);
typeValid &= (std::is_same<Index, Cursor::Default>::value )|| type != Cursor::Type::DEFAULT;
typeValid &= (std::is_same<Index, Cursor::Map>::value )|| type != Cursor::Type::ADVENTURE;
typeValid &= (std::is_same<Index, Cursor::Combat>::value )|| type != Cursor::Type::COMBAT;
typeValid &= (std::is_same<Index, Cursor::Spellcast>::value )|| type != Cursor::Type::SPELLBOOK;
if (typeValid)
return static_cast<Index>(frame);
return Index::POINTER;
}
Point getPivotOffsetDefault(size_t index);