9797// ------------------------------------------------------------------------------------------------
9898static const RGBColor IllegalBuildColor = { 1.0 , 0.0 , 0.0 };
9999
100+ // ------------------------------------------------------------------------------------------------
101+ static UnicodeString formatMoneyValue (UnsignedInt amount)
102+ {
103+ UnicodeString result;
104+ if (amount >= 100000 )
105+ {
106+ result.format (L" %dk" , amount / 1000 );
107+ }
108+ else
109+ {
110+ result.format (L" %d" , amount);
111+ }
112+ return result;
113+ }
114+
115+ static UnicodeString formatIncomeValue (UnsignedInt cashPerMin)
116+ {
117+ UnicodeString result;
118+ if (cashPerMin >= 10000 )
119+ {
120+ result.format (L" %dk" , cashPerMin / 1000 );
121+ }
122+ else if (cashPerMin >= 1000 )
123+ {
124+ UnsignedInt k = cashPerMin / 100 ;
125+ result.format (L" %d.%dk" , k / 10 , k % 10 );
126+ }
127+ else
128+ {
129+ result.format (L" %d" , cashPerMin);
130+ }
131+ return result;
132+ }
133+
100134// -------------------------------------------------------------------------------------------------
101135// / The InGameUI singleton instance.
102136InGameUI *TheInGameUI = NULL ;
@@ -1893,6 +1927,7 @@ void InGameUI::update( void )
18931927 // update the player money window if the money amount has changed
18941928 // this seems like as good a place as any to do the power hide/show
18951929 static Int lastMoney = -1 ;
1930+ static Int lastIncome = -1 ;
18961931 static NameKeyType moneyWindowKey = TheNameKeyGenerator->nameToKey ( " ControlBar.wnd:MoneyDisplay" );
18971932 static NameKeyType powerWindowKey = TheNameKeyGenerator->nameToKey ( " ControlBar.wnd:PowerWindow" );
18981933
@@ -1908,15 +1943,38 @@ void InGameUI::update( void )
19081943 Player* moneyPlayer = TheControlBar->getCurrentlyViewedPlayer ();
19091944 if ( moneyPlayer)
19101945 {
1911- Int currentMoney = moneyPlayer->getMoney ()->countMoney ();
1912- if ( lastMoney != currentMoney )
1946+ Money *money = moneyPlayer->getMoney ();
1947+ Bool showIncome = TheGlobalData->m_showMoneyPerMinute ;
1948+ if (!showIncome)
19131949 {
1914- UnicodeString buffer;
1950+ Int currentMoney = money->countMoney ();
1951+ if ( lastMoney != currentMoney )
1952+ {
1953+ UnicodeString buffer;
19151954
1916- buffer.format ( TheGameText->fetch ( " GUI:ControlBarMoneyDisplay" ), currentMoney );
1917- GadgetStaticTextSetText ( moneyWin, buffer );
1918- lastMoney = currentMoney;
1955+ buffer.format (TheGameText->fetch ( " GUI:ControlBarMoneyDisplay" ), currentMoney );
1956+ GadgetStaticTextSetText ( moneyWin, buffer );
1957+ lastMoney = currentMoney;
19191958
1959+ }
1960+ }
1961+ else
1962+ {
1963+ // TheSuperHackers @feature L3-M 21/08/2025 player money per minute
1964+ money->updateIncomeBucket ();
1965+ UnsignedInt currentMoney = money->countMoney ();
1966+ UnsignedInt cashPerMin = money->getCashPerMinute ();
1967+ if (lastMoney != (Int)currentMoney || lastIncome != (Int)cashPerMin)
1968+ {
1969+ UnicodeString buffer;
1970+ UnicodeString moneyStr = formatMoneyValue (currentMoney);
1971+ UnicodeString incomeStr = formatIncomeValue (cashPerMin);
1972+
1973+ buffer.format (TheGameText->FETCH_OR_SUBSTITUTE_FORMAT (" GUI:ControlBarMoneyDisplayIncome" , L" $%ls +%ls/min" , moneyStr.str (), incomeStr.str ()));
1974+ GadgetStaticTextSetText (moneyWin, buffer);
1975+ lastMoney = currentMoney;
1976+ lastIncome = cashPerMin;
1977+ }
19201978 }
19211979 moneyWin->winHide (FALSE );
19221980 powerWin->winHide (FALSE );
0 commit comments