1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-29 00:41:38 +02:00

* fixed remaining parts of #760

* it's possible to switch active creature during tacts phase by clicking on stack
* a few minor fixes after handleHex rewrite
This commit is contained in:
Michał W. Urbańczyk
2012-04-02 23:23:14 +00:00
parent 584b761d37
commit c61f536d8b
6 changed files with 52 additions and 27 deletions

View File

@ -265,7 +265,7 @@ void BattleInfo::makeBFS(BattleHex start, bool *accessibility, BattleHex *predec
}
};
std::vector<BattleHex> BattleInfo::getAccessibility( const CStack * stack, bool addOccupiable, std::vector<BattleHex> * attackable ) const
std::vector<BattleHex> BattleInfo::getAccessibility( const CStack * stack, bool addOccupiable, std::vector<BattleHex> * attackable /*= NULL*/, bool forPassingBy /*= false*/ ) const
{
std::vector<BattleHex> ret;
bool ac[GameConstants::BFIELD_SIZE];
@ -314,7 +314,11 @@ std::vector<BattleHex> BattleInfo::getAccessibility( const CStack * stack, bool
{
bool rangeFits;
if (tacticDistance)
rangeFits = isInTacticRange(i);
{
rangeFits = pr[i] >= 0; //reachable in terms of obstacles
if(!forPassingBy) //only if we're passing through, we may step out of the tactic range -> otherwise check range
rangeFits = rangeFits && isInTacticRange(i);
}
else
rangeFits = dist[i] <= stack->Speed(0, true); //we can reach the stack
@ -1965,9 +1969,9 @@ ESpellCastProblem::ESpellCastProblem BattleInfo::battleCanCastThisSpellHere( int
if(spell->id == Spells::ANIMATE_DEAD && !stackUnder->hasBonusOfType(Bonus::UNDEAD))
return ESpellCastProblem::NO_APPROPRIATE_TARGET;
}
if(spell->getTargetType() == CSpell::CREATURE || spell->getTargetType() == CSpell::CREATURE_EXPERT_MASSIVE)
else if(spell->getTargetType() == CSpell::CREATURE || spell->getTargetType() == CSpell::CREATURE_EXPERT_MASSIVE)
{
if(!stackUnder)
if(!stackUnder || !stackUnder->alive())
return ESpellCastProblem::NO_APPROPRIATE_TARGET;
if(spell->isNegative() && stackUnder->owner == player)
return ESpellCastProblem::NO_APPROPRIATE_TARGET;