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:
commit
c3d8607c8b
@ -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)
|
||||
|
@ -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) );
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user