Skip to content

Commit d060937

Browse files
committed
tweak(gui): Configure player money per minute in GameData
1 parent 8d675a8 commit d060937

File tree

6 files changed

+38
-26
lines changed

6 files changed

+38
-26
lines changed

Generals/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ class GlobalData : public SubsystemInterface
410410

411411
// TheSuperHackers @feature L3-M 21/08/2025 toggle the money per minute display, false shows only the original current money
412412
Bool m_showMoneyPerMinute;
413+
Bool m_enablePlayerMoneyPerMinute;
413414

414415
Real m_shakeSubtleIntensity; ///< Intensity for shaking a camera with SHAKE_SUBTLE
415416
Real m_shakeNormalIntensity; ///< Intensity for shaking a camera with SHAKE_NORMAL

Generals/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ GlobalData* GlobalData::m_theOriginal = NULL;
442442

443443
{ "CameraAudibleRadius", INI::parseReal, NULL, offsetof( GlobalData, m_cameraAudibleRadius ) },
444444
{ "GroupMoveClickToGatherAreaFactor", INI::parseReal, NULL, offsetof( GlobalData, m_groupMoveClickToGatherFactor ) },
445+
446+
{ "EnablePlayerMoneyPerMinute", INI::parseBool, NULL, offsetof( GlobalData, m_enablePlayerMoneyPerMinute ) },
447+
445448
{ "ShakeSubtleIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeSubtleIntensity ) },
446449
{ "ShakeNormalIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeNormalIntensity ) },
447450
{ "ShakeStrongIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeStrongIntensity ) },
@@ -943,6 +946,7 @@ GlobalData::GlobalData()
943946
m_gameTimeFontSize = 8;
944947

945948
m_showMoneyPerMinute = FALSE;
949+
m_enablePlayerMoneyPerMinute = FALSE;
946950

947951
m_debugShowGraphicalFramerate = FALSE;
948952

Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,34 +1881,35 @@ void InGameUI::update( void )
18811881
{
18821882
Money *money = moneyPlayer->getMoney();
18831883
Bool showIncome = TheGlobalData->m_showMoneyPerMinute;
1884-
if (!showIncome)
1884+
Bool canShowIncome = TheGlobalData->m_enablePlayerMoneyPerMinute || TheControlBar->isObserverControlBarOn();
1885+
if (showIncome && canShowIncome)
18851886
{
1887+
// TheSuperHackers @feature L3-M 21/08/2025 player money per minute
18861888
UnsignedInt currentMoney = money->countMoney();
1887-
if( lastMoney != currentMoney )
1889+
UnsignedInt cashPerMin = money->getCashPerMinute();
1890+
if ( lastMoney != currentMoney || lastIncome != cashPerMin )
18881891
{
18891892
UnicodeString buffer;
1893+
UnicodeString moneyStr = formatMoneyValue(currentMoney);
1894+
UnicodeString incomeStr = formatIncomeValue(cashPerMin);
18901895

1891-
buffer.format(TheGameText->fetch( "GUI:ControlBarMoneyDisplay" ), currentMoney );
1892-
GadgetStaticTextSetText( moneyWin, buffer );
1896+
buffer.format(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:ControlBarMoneyDisplayIncome", L"$ %ls +%ls/min", moneyStr.str(), incomeStr.str()));
1897+
GadgetStaticTextSetText(moneyWin, buffer);
18931898
lastMoney = currentMoney;
1894-
1899+
lastIncome = cashPerMin;
18951900
}
18961901
}
18971902
else
18981903
{
1899-
// TheSuperHackers @feature L3-M 21/08/2025 player money per minute
19001904
UnsignedInt currentMoney = money->countMoney();
1901-
UnsignedInt cashPerMin = money->getCashPerMinute();
1902-
if ( lastMoney != currentMoney || lastIncome != cashPerMin )
1905+
if( lastMoney != currentMoney )
19031906
{
19041907
UnicodeString buffer;
1905-
UnicodeString moneyStr = formatMoneyValue(currentMoney);
1906-
UnicodeString incomeStr = formatIncomeValue(cashPerMin);
19071908

1908-
buffer.format(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:ControlBarMoneyDisplayIncome", L"$ %ls +%ls/min", moneyStr.str(), incomeStr.str()));
1909-
GadgetStaticTextSetText(moneyWin, buffer);
1909+
buffer.format(TheGameText->fetch( "GUI:ControlBarMoneyDisplay" ), currentMoney );
1910+
GadgetStaticTextSetText( moneyWin, buffer );
19101911
lastMoney = currentMoney;
1911-
lastIncome = cashPerMin;
1912+
19121913
}
19131914
}
19141915
moneyWin->winHide(FALSE);

GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ class GlobalData : public SubsystemInterface
417417

418418
// TheSuperHackers @feature L3-M 21/08/2025 toggle the money per minute display, false shows only the original current money
419419
Bool m_showMoneyPerMinute;
420+
Bool m_enablePlayerMoneyPerMinute;
420421

421422
Real m_shakeSubtleIntensity; ///< Intensity for shaking a camera with SHAKE_SUBTLE
422423
Real m_shakeNormalIntensity; ///< Intensity for shaking a camera with SHAKE_NORMAL

GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ GlobalData* GlobalData::m_theOriginal = NULL;
442442

443443
{ "CameraAudibleRadius", INI::parseReal, NULL, offsetof( GlobalData, m_cameraAudibleRadius ) },
444444
{ "GroupMoveClickToGatherAreaFactor", INI::parseReal, NULL, offsetof( GlobalData, m_groupMoveClickToGatherFactor ) },
445+
446+
{ "EnablePlayerMoneyPerMinute", INI::parseBool, NULL, offsetof( GlobalData, m_enablePlayerMoneyPerMinute ) },
447+
445448
{ "ShakeSubtleIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeSubtleIntensity ) },
446449
{ "ShakeNormalIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeNormalIntensity ) },
447450
{ "ShakeStrongIntensity", INI::parseReal, NULL, offsetof( GlobalData, m_shakeStrongIntensity ) },
@@ -952,6 +955,7 @@ GlobalData::GlobalData()
952955
m_gameTimeFontSize = 8;
953956

954957
m_showMoneyPerMinute = FALSE;
958+
m_enablePlayerMoneyPerMinute = FALSE;
955959

956960
m_debugShowGraphicalFramerate = FALSE;
957961

GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,34 +1937,35 @@ void InGameUI::update( void )
19371937
{
19381938
Money *money = moneyPlayer->getMoney();
19391939
Bool showIncome = TheGlobalData->m_showMoneyPerMinute;
1940-
if (!showIncome)
1940+
Bool canShowIncome = TheGlobalData->m_enablePlayerMoneyPerMinute || TheControlBar->isObserverControlBarOn();
1941+
if (showIncome && canShowIncome)
19411942
{
1943+
// TheSuperHackers @feature L3-M 21/08/2025 player money per minute
19421944
UnsignedInt currentMoney = money->countMoney();
1943-
if( lastMoney != currentMoney )
1945+
UnsignedInt cashPerMin = money->getCashPerMinute();
1946+
if ( lastMoney != currentMoney || lastIncome != cashPerMin )
19441947
{
19451948
UnicodeString buffer;
1949+
UnicodeString moneyStr = formatMoneyValue(currentMoney);
1950+
UnicodeString incomeStr = formatIncomeValue(cashPerMin);
19461951

1947-
buffer.format(TheGameText->fetch( "GUI:ControlBarMoneyDisplay" ), currentMoney );
1948-
GadgetStaticTextSetText( moneyWin, buffer );
1952+
buffer.format(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:ControlBarMoneyDisplayIncome", L"$ %ls +%ls/min", moneyStr.str(), incomeStr.str()));
1953+
GadgetStaticTextSetText(moneyWin, buffer);
19491954
lastMoney = currentMoney;
1950-
1955+
lastIncome = cashPerMin;
19511956
}
19521957
}
19531958
else
19541959
{
1955-
// TheSuperHackers @feature L3-M 21/08/2025 player money per minute
19561960
UnsignedInt currentMoney = money->countMoney();
1957-
UnsignedInt cashPerMin = money->getCashPerMinute();
1958-
if ( lastMoney != currentMoney || lastIncome != cashPerMin )
1961+
if( lastMoney != currentMoney )
19591962
{
19601963
UnicodeString buffer;
1961-
UnicodeString moneyStr = formatMoneyValue(currentMoney);
1962-
UnicodeString incomeStr = formatIncomeValue(cashPerMin);
19631964

1964-
buffer.format(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:ControlBarMoneyDisplayIncome", L"$ %ls +%ls/min", moneyStr.str(), incomeStr.str()));
1965-
GadgetStaticTextSetText(moneyWin, buffer);
1965+
buffer.format(TheGameText->fetch( "GUI:ControlBarMoneyDisplay" ), currentMoney );
1966+
GadgetStaticTextSetText( moneyWin, buffer );
19661967
lastMoney = currentMoney;
1967-
lastIncome = cashPerMin;
1968+
19681969
}
19691970
}
19701971
moneyWin->winHide(FALSE);

0 commit comments

Comments
 (0)