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 consumption needle at the power bar's head when nothing draws power

Olcay Seygan75cc50387331
diff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
index 8f5a581e2..871d1e428 100644
--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html
+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
@@ -17,7 +17,8 @@
{{promotion}} "ready" while the general has a promotion to spend
{{watching}} "watching" while the local player is an observer or out of the match
{{power.fill}} the power bar: production as a percent of the bar, on the bar's own
- {{power.needle}} logarithmic scale, consumption as the same, and {{power.state}} "green",
+ {{power.needle}} logarithmic scale, consumption as the same ({{power.consumes}} "hidden"
+ while it is nought), and {{power.state}} "green",
"yellow" or "red"; the watched player's while watching
data-each="powercells" the same production as 40 cells, each {{lit}} "lit" up to it, standing at
{{x}} pixels inside the frame's lip and {{w}} wide
@@ -308,7 +309,7 @@
</div>
<div class="piece groove solid stack {{powerframe.shown}}" style="left: {{powerframe.x}}px; top: {{powerframe.y}}px; width: {{powerframe.w}}px; height: {{powerframe.h}}px">
<div class="cells {{power.state}}" style="height: {{powerframe.inner}}px"><div class="cell {{lit}}" data-each="powercells" style="left: {{x}}px; width: {{w}}px; height: {{powerframe.inner}}px"><div class="seg" style="height: {{powerframe.inner}}px"></div></div></div>
- <div class="needle" style="left: {{power.needle}}%"></div>
+ <div class="needle {{power.consumes}}" style="left: {{power.needle}}%"></div>
<div class="lip"></div>
</div>
<div class="piece bezel solid stack moneyblock {{moneyblock.shown}}" style="left: {{moneyblock.x}}px; top: {{moneyblock.y}}px; width: {{moneyblock.w}}px; height: {{moneyblock.h}}px">
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 9092be492..880d26ee8 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -10216,6 +10216,8 @@ static void putPowerBar( HtmlValues &values, std::vector< HtmlValues > &cells )
const Real needle = consumption == 1 ? ONE_UNIT_NEEDLE_TENTHS / 10.0f : (Real)consumption;
values[ "power.fill" ] = std::to_string( REAL_TO_INT( fill * PERCENT ) );
values[ "power.needle" ] = std::to_string( REAL_TO_INT( powerBarShare( needle ) * PERCENT ) );
+ // with nothing drawing power the needle stood at nought, a white bar across the bar's head
+ values[ "power.consumes" ] = consumption > 0 ? "" : "hidden";
// each cell gets its place and width in the page's pixels, cut from the frame's inside so they
// add up to it exactly: floated at a percentage each the page rounded them up and the fortieth