mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
* Possibly fixed #870
* Fixed crash after catapult successfully destroyed one of turrets (stack queue wasn't properly updated)
This commit is contained in:
parent
37d3bea0a9
commit
3546c7841a
@ -1558,6 +1558,8 @@ void CBattleInterface::stackRemoved(int stackID)
|
|||||||
delete creAnims[stackID];
|
delete creAnims[stackID];
|
||||||
creAnims.erase(stackID);
|
creAnims.erase(stackID);
|
||||||
creDir.erase(stackID);
|
creDir.erase(stackID);
|
||||||
|
|
||||||
|
queue->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBattleInterface::stackActivated(const CStack * stack) //TODO: check it all before game state is changed due to abilities
|
void CBattleInterface::stackActivated(const CStack * stack) //TODO: check it all before game state is changed due to abilities
|
||||||
|
@ -59,7 +59,11 @@ std::vector<int> CBattleInfoCallback::battleGetDistances(const CStack * stack, B
|
|||||||
if(!hex.isValid())
|
if(!hex.isValid())
|
||||||
hex = stack->position;
|
hex = stack->position;
|
||||||
|
|
||||||
std::vector<int> ret;
|
std::vector<int> ret(GameConstants::BFIELD_SIZE, -1); //fill initial ret with -1's
|
||||||
|
|
||||||
|
if(!hex.isValid()) //stack has bad position? probably castle turret, return initial values (they can't move)
|
||||||
|
return ret;
|
||||||
|
|
||||||
bool ac[GameConstants::BFIELD_SIZE] = {0};
|
bool ac[GameConstants::BFIELD_SIZE] = {0};
|
||||||
std::set<BattleHex> occupyable;
|
std::set<BattleHex> occupyable;
|
||||||
gs->curB->getAccessibilityMap(ac, stack->doubleWide(), stack->attackerOwned, false, occupyable, stack->hasBonusOfType(Bonus::FLYING), stack);
|
gs->curB->getAccessibilityMap(ac, stack->doubleWide(), stack->attackerOwned, false, occupyable, stack->hasBonusOfType(Bonus::FLYING), stack);
|
||||||
@ -69,10 +73,8 @@ std::vector<int> CBattleInfoCallback::battleGetDistances(const CStack * stack, B
|
|||||||
|
|
||||||
for(int i=0; i<GameConstants::BFIELD_SIZE; ++i)
|
for(int i=0; i<GameConstants::BFIELD_SIZE; ++i)
|
||||||
{
|
{
|
||||||
if(pr[i] == -1)
|
if(pr[i] != -1)
|
||||||
ret.push_back(-1);
|
ret[i] = dist[i];
|
||||||
else
|
|
||||||
ret.push_back(dist[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(predecessors)
|
if(predecessors)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user