Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameclient): no health bar on a booby trap

Olcay Seygane4fad5542b1f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 95089c23b..927abd11b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -523,6 +523,7 @@ found and fixed — EA's own, not port damage.**
- A vehicle's load stays private.
- What you have selected wears a white frame just outside its bar, so a selection is still readable in a crowd where every unit carries a bar - and the bar itself keeps its owner colour all the way round.
- Lamps, barrels, rocks and bushes no longer wear health bars.
+- Nor does a booby trap. It cannot be shot and has one hit point, so its bar was a full green line that never moved, hanging over something that is meant to be hidden.
- Bridges no longer float a health bar over the middle of the river. There was never anything under it: the span is part of the terrain, and the bar belonged to an invisible marker standing in the water.
- The bar is part of the unit now: click it and you select whoever it belongs to. Zoomed out, an infantryman is a few pixels of helmet under a bar that is far easier to hit, and a unit half behind a building still has its bar in the clear. It only answers clicks that would have missed everything anyway, so it never takes a click away from the unit you were actually pointing at, and right-clicking bare ground under a bar still orders a move. And it stands down the moment you have something selected: with a force in hand your clicks are aimed at the ground, and a bar hanging over that ground used to cost you the whole selection and hand you back a single passer-by.
- The city itself stops wearing them too. A building nobody owns shows a bar only if there is something to do about it - troops can go inside, or it can be taken. A row of houses does not, and neither does the concrete apron each of them stands on, which is a separate two-thousand-point object that was drawing a second bar down at street level.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
index 083f75360..78d2f7973 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
@@ -4184,6 +4184,7 @@ void Drawable::drawCaptureProgress( void )
// ------------------------------------------------------------------------------------------------
/** Draw health bar information for drawable */
// ------------------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------------------
void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
{
if (!healthBarRegion)
@@ -4217,7 +4218,10 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
// building is worth capturing, bridges are STRUCTURE too - and so does anything that can
// move.
//
+ // A booby trap has one hit point and cannot be shot, so its bar was a full green line
+ // forever, over something that is meant to be hidden.
if( obj->isKindOf( KINDOF_PROJECTILE ) ||
+ obj->isKindOf( KINDOF_BOOBY_TRAP ) ||
obj->isKindOf( KINDOF_INERT ) ||
obj->isKindOf( KINDOF_CLEANUP_HAZARD ) ||
obj->isKindOf( KINDOF_UNATTACKABLE ) ||