1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Rewritten battle obstacles. New file for lib: CObstacleInstance.cpp.

Now obstacles should be placed exactly like they were in OH3. 
All problems with displaying obstacles in battlefield should be gone. They should be now matched to the single pixel. 
If there are still some discrepancies, please report them.
This commit is contained in:
Michał W. Urbańczyk
2012-04-23 19:56:37 +00:00
parent 6d03e0bf23
commit 7dc0d6878e
16 changed files with 1606 additions and 300 deletions

View File

@@ -3884,17 +3884,16 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, BattleHex dest
case Spells::REMOVE_OBSTACLE:
{
ObstaclesRemoved obr;
for(int g=0; g<gs->curB->obstacles.size(); ++g)
BOOST_FOREACH(const CObstacleInstance &obstacle, battleGetAllObstacles())
{
std::vector<BattleHex> blockedHexes = VLC->heroh->obstacles[gs->curB->obstacles[g].ID].getBlocked(gs->curB->obstacles[g].pos);
if(vstd::contains(blockedHexes, destination)) //this obstacle covers given hex
{
obr.obstacles.insert(gs->curB->obstacles[g].uniqueID);
}
if(vstd::contains(obstacle.getBlocked(), destination))
obr.obstacles.insert(obstacle.uniqueID);
}
if(!obr.obstacles.empty())
sendAndApply(&obr);
else
complain("There's no obstacle to remove!");
break;
}
break;