mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Fix bug: LandMine is not exploding to enemies. (#630)
* The reason is, the mine has attribute hidden=true; when enemy unit moves, the code in BattleInfo.cpp MoveUnit() (line 817) will update the revealed to true; then in the CGameHandler.cpp handleDamageFromObstacle() (line 4846) is checking , and the condition battleIsObstacleVisibleForSide() will return true, so the effect will not be triggerred. Resolution: 1. Remove the "revealed=true" in moveUnit(), and in handleDamageFromObstacle, remove the "const" restrict for obstacle, and then update revealed to true; 2. After the takeDamage function, add a pack "BattleObstaclesChanged" to update the obstacle to be "revealed=true".
This commit is contained in:
@@ -1535,6 +1535,9 @@ DLL_LINKAGE void BattleObstaclesChanged::applyBattle(IBattleState * battleState)
|
||||
case BattleChanges::EOperation::ADD:
|
||||
battleState->addObstacle(change);
|
||||
break;
|
||||
case BattleChanges::EOperation::UPDATE:
|
||||
battleState->updateObstacle(change);
|
||||
break;
|
||||
default:
|
||||
logNetwork->error("Unknown obstacle operation %d", (int)change.operation);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user