1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fix large obstacles drawing in front of the stacks

This commit is contained in:
Vadim Markovtsev 2016-10-30 04:47:33 +01:00
parent 9651676452
commit 79c85be93f

View File

@ -3251,6 +3251,7 @@ void CBattleInterface::showBattlefieldObjects(SDL_Surface *to)
// NOTE: row-by-row blitting may be a better approach
for (auto &data : objects.hex)
showHexEntry(data);
// objects that must be blit *after* everything else - e.g. bottom tower or some spell effects
showHexEntry(objects.afterAll);
}
@ -3479,15 +3480,19 @@ BattleObjectsByHex CBattleInterface::sortObjectsByHex()
}
// Sort obstacles
for (auto & obstacle : curInt->cb->battleGetAllObstacles())
{
std::map<BattleHex, std::shared_ptr<const CObstacleInstance>> backgroundObstacles;
for (auto &obstacle : curInt->cb->battleGetAllObstacles()) {
if (obstacle->obstacleType != CObstacleInstance::ABSOLUTE_OBSTACLE
&& obstacle->obstacleType != CObstacleInstance::MOAT)
&& obstacle->obstacleType != CObstacleInstance::MOAT) {
backgroundObstacles[obstacle->pos] = obstacle;
}
}
for (auto &op : backgroundObstacles)
{
sorted.hex[obstacle->pos].obstacles.push_back(obstacle);
sorted.beforeAll.obstacles.push_back(op.second);
}
}
// Sort wall parts
if (siegeH)
{