From 2d54b31b1789f71f9196fa4f8dcaccb9b696f0d1 Mon Sep 17 00:00:00 2001 From: mateuszb Date: Wed, 23 Sep 2009 13:22:40 +0000 Subject: [PATCH] * fixed bug with lightning bolt --- client/CBattleInterface.cpp | 34 +++++++++++++++++++++++++--------- config/AC_desc.txt | 2 +- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/client/CBattleInterface.cpp b/client/CBattleInterface.cpp index 88b0154af..0954430a5 100644 --- a/client/CBattleInterface.cpp +++ b/client/CBattleInterface.cpp @@ -146,6 +146,11 @@ bool CSpellEffectAnim::init() } } } + else //there is nothing to play + { + endAnim(); + return false; + } } else // Effects targeted at a specific creature/hex. { @@ -161,6 +166,8 @@ bool CSpellEffectAnim::init() be.anim = CDefHandler::giveDef(graphics->battleACToDef[effect][0]); be.frame = 0; be.maxFrame = be.anim->ourImages.size(); + if(effect == 1) + be.maxFrame = 3; switch (effect) { @@ -188,6 +195,11 @@ bool CSpellEffectAnim::init() owner->battleEffects.push_back(be); } + else //there is nothing to play + { + endAnim(); + return false; + } } //battleEffects return true; @@ -197,18 +209,22 @@ void CSpellEffectAnim::nextFrame() { for(std::list::iterator it = owner->battleEffects.begin(); it != owner->battleEffects.end(); ++it) { - ++(it->frame); + if(it->effectID == ID) + { + ++(it->frame); - if(it->frame == it->maxFrame) - { - endAnim(); + if(it->frame == it->maxFrame) + { + endAnim(); + break; + } + else + { + it->x += dx; + it->y += dy; + } break; } - else - { - it->x += dx; - it->y += dy; - } } } diff --git a/config/AC_desc.txt b/config/AC_desc.txt index 715871856..80569edb3 100644 --- a/config/AC_desc.txt +++ b/config/AC_desc.txt @@ -37,7 +37,7 @@ 35 2 C01SPF.DEF C01SPF0.DEF 36 2 C01SPW.DEF C01SPW0.DEF 37 0 -38 0 +38 1 C11SPA1.DEF 39 2 C03SPW.DEF C03SPW0.DEF 40 2 C04SPW.DEF C04SPW0.DEF 41 2 C05SPW.DEF C05SPW0.DEF