Merge pull request #11653 from Mailaender/damagedbyterrain-div0
Fixed a division through zero in DamagedByTerrain.
This commit is contained in:
@@ -62,6 +62,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
safeTiles++;
|
safeTiles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (totalTiles == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
damageThreshold = (Info.DamageThreshold * health.MaxHP + (100 - Info.DamageThreshold) * safeTiles * health.MaxHP / totalTiles) / 100;
|
damageThreshold = (Info.DamageThreshold * health.MaxHP + (100 - Info.DamageThreshold) * safeTiles * health.MaxHP / totalTiles) / 100;
|
||||||
|
|
||||||
// Actors start with maximum damage applied
|
// Actors start with maximum damage applied
|
||||||
|
|||||||
Reference in New Issue
Block a user