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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user