mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Merge pull request #2466 from IvanSavenko/battle_assertions_fix
(1.3.1) Fix assertion failures in battle
This commit is contained in:
@@ -445,6 +445,8 @@ void BattleInterface::spellCast(const BattleSpellCast * sc)
|
|||||||
stacksController->addNewAnim(new EffectAnimation(*this, side ? "SP07_B.DEF" : "SP07_A.DEF", rightHero));
|
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)
|
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)
|
void BattleStacksController::stackTeleported(const CStack *stack, std::vector<BattleHex> destHex, int distance)
|
||||||
{
|
{
|
||||||
assert(destHex.size() > 0);
|
assert(destHex.size() > 0);
|
||||||
owner.checkForAnimations();
|
//owner.checkForAnimations(); // NOTE: at this point spellcast animations were added, but not executed
|
||||||
|
|
||||||
owner.addToAnimationStage(EAnimationEvents::HIT, [=](){
|
owner.addToAnimationStage(EAnimationEvents::HIT, [=](){
|
||||||
addNewAnim( new ColorTransformAnimation(owner, stack, "teleportFadeOut", nullptr) );
|
addNewAnim( new ColorTransformAnimation(owner, stack, "teleportFadeOut", nullptr) );
|
||||||
|
@@ -31,8 +31,6 @@ namespace Cursor
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum class Combat {
|
enum class Combat {
|
||||||
INVALID = -1,
|
|
||||||
|
|
||||||
BLOCKED = 0,
|
BLOCKED = 0,
|
||||||
MOVE = 1,
|
MOVE = 1,
|
||||||
FLY = 2,
|
FLY = 2,
|
||||||
@@ -157,12 +155,16 @@ public:
|
|||||||
template<typename Index>
|
template<typename Index>
|
||||||
Index get()
|
Index get()
|
||||||
{
|
{
|
||||||
assert((std::is_same<Index, Cursor::Default>::value )|| type != Cursor::Type::DEFAULT );
|
bool typeValid = true;
|
||||||
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 );
|
|
||||||
|
|
||||||
|
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 static_cast<Index>(frame);
|
||||||
|
return Index::POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point getPivotOffsetDefault(size_t index);
|
Point getPivotOffsetDefault(size_t index);
|
||||||
|
Reference in New Issue
Block a user