From 192de453af96329e53981341a65d34c040e51333 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Sat, 28 Apr 2012 15:18:21 +0000 Subject: [PATCH] - Fixed Remove Obstacle spell - Fixed freeze at Chain Lightning --- client/BattleInterface/CBattleInterface.cpp | 13 ++++++++----- lib/CSpellHandler.cpp | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/BattleInterface/CBattleInterface.cpp b/client/BattleInterface/CBattleInterface.cpp index a41917b6f..d61827ce5 100644 --- a/client/BattleInterface/CBattleInterface.cpp +++ b/client/BattleInterface/CBattleInterface.cpp @@ -697,7 +697,7 @@ void CBattleInterface::show(SDL_Surface * to) activate(); //activation of next stack - if(pendingAnims.size() == 0 && stackToActivate != NULL) + if(pendingAnims.size() == 0 && stackToActivate != NULL) //FIXME: Faerie Dragon's Chain Lightning doesn't have animation ATM { activateStack(); } @@ -1601,6 +1601,8 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc ) case Spells::SUMMON_WATER_ELEMENTAL: case Spells::SUMMON_AIR_ELEMENTAL: case Spells::CLONE: //TODO: make it smarter? + case Spells::REMOVE_OBSTACLE: + case Spells::CHAIN_LIGHTNING: addNewAnim(new CDummyAnimation(this, 2)); break; } //switch(sc->id) @@ -1836,8 +1838,8 @@ void CBattleInterface::castThisSpell(int spellID) if(sp->getTargetType() == CSpell::OBSTACLE) { spellSelMode = OBSTACLE; - } - if(sp->range[ castingHero->getSpellSchoolLevel(sp) ] == "X") //spell has no range + } //FIXME: Remove Obstacle has range X, unfortunatelly :( + else if(sp->range[ castingHero->getSpellSchoolLevel(sp) ] == "X") //spell has no range { spellSelMode = NO_LOCATION; } @@ -2756,7 +2758,8 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType) } break; case OBSTACLE: - legalAction = false; //TODO + if (isCastingPossibleHere (sactive, shere, myNumber)) + legalAction = true; //TODO break; case TELEPORT: { @@ -2913,7 +2916,7 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType) case OBSTACLE: consoleMsg = CGI->generaltexth->allTexts[550]; isCastingPossible = true; - break;; + break; case HEAL: cursorFrame = ECursor::COMBAT_HEAL; consoleMsg = (boost::format(CGI->generaltexth->allTexts[419]) % shere->getName()).str(); //Apply first aid to the %s diff --git a/lib/CSpellHandler.cpp b/lib/CSpellHandler.cpp index c154aabf4..2d364b4e4 100644 --- a/lib/CSpellHandler.cpp +++ b/lib/CSpellHandler.cpp @@ -190,7 +190,7 @@ std::set CSpell::rangeInHexes(unsigned int centralHex, ui8 schoolLvl ) con return ret; } -CSpell::ETargetType CSpell::getTargetType() const +CSpell::ETargetType CSpell::getTargetType() const //TODO: parse these at game launch { if(attributes.find("CREATURE_TARGET_1") != std::string::npos || attributes.find("CREATURE_TARGET_2") != std::string::npos)