From 93169dd880f43a9465a867256eafaf0c3dca95ee Mon Sep 17 00:00:00 2001 From: L3-M <100478094+L3-M@users.noreply.github.com> Date: Wed, 20 May 2026 20:08:51 +0300 Subject: [PATCH] tweak(gui): Show Money Per Minute in Player Info List --- .../Code/GameEngine/Include/GameClient/InGameUI.h | 2 ++ .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 14 ++++++++++++-- .../Code/GameEngine/Include/GameClient/InGameUI.h | 2 ++ .../Code/GameEngine/Source/GameClient/InGameUI.cpp | 14 ++++++++++++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h index 3397af27993..e4e6cd2271b 100644 --- a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h @@ -789,6 +789,7 @@ friend class Drawable; // for selection/deselection transactions { LabelType_Team, LabelType_Money, + LabelType_MoneyPerMinute, LabelType_Rank, LabelType_Xp, @@ -799,6 +800,7 @@ friend class Drawable; // for selection/deselection transactions { ValueType_Team, ValueType_Money, + ValueType_MoneyPerMinute, ValueType_Rank, ValueType_Xp, ValueType_Name, diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index ab1f26a767b..bdd1702ac27 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -978,6 +978,7 @@ void InGameUI::PlayerInfoList::init(const AsciiString &fontName, Int pointSize, labels[LabelType_Team]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelTeam", L"T")); labels[LabelType_Money]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelMoney", L"$")); + labels[LabelType_MoneyPerMinute]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelMoneyPerMinute", L"$/min")); labels[LabelType_Rank]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelRank", L"*")); labels[LabelType_Xp]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelXp", L"XP")); } @@ -6125,6 +6126,7 @@ void InGameUI::drawPlayerInfoList() Int maxValueWidths[PlayerInfoList::LabelType_Count] = {0}; Color rowColors[MAX_PLAYER_COUNT] = {0}; Int nameValueWidth[MAX_PLAYER_COUNT] = {0}; + const Bool showMoneyPerMinute = TheGlobalData->m_showMoneyPerMinute; Int column; for (Int slotIndex = 0; slotIndex < MAX_SLOTS && rowCount < MAX_PLAYER_COUNT; ++slotIndex) @@ -6139,12 +6141,14 @@ void InGameUI::drawPlayerInfoList() const Int row = rowCount++; const UnsignedInt teamValue = (slot && slot->getTeamNumber() >= 0) ? static_cast(slot->getTeamNumber() + 1) : 0; - const UnsignedInt moneyValue = player->getMoney()->countMoney(); + const Money *money = player->getMoney(); + const UnsignedInt moneyValue = money->countMoney(); + const UnsignedInt moneyPerMinuteValue = money->getCashPerMinute(); const UnsignedInt rankValue = static_cast(player->getRankLevel()); const UnsignedInt xpValue = static_cast(player->getSkillPoints()); const UnicodeString nameValue = player->getPlayerDisplayName(); - const UnsignedInt currentValues[] = {teamValue, moneyValue, rankValue, xpValue}; + const UnsignedInt currentValues[] = {teamValue, moneyValue, moneyPerMinuteValue, rankValue, xpValue}; for (column = 0; column < ARRAY_SIZE(currentValues); ++column) { UnsignedInt &lastValue = m_playerInfoList.lastValues.values[column][row]; @@ -6177,6 +6181,9 @@ void InGameUI::drawPlayerInfoList() Int labelX = baseX; for (column = 0; column < PlayerInfoList::LabelType_Count; ++column) { + if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute) + continue; + labelWidths[column] = m_playerInfoList.labels[column]->getWidth(); columnLabelX[column] = labelX; labelX += labelWidths[column] + maxValueWidths[column] + columnGap; @@ -6189,6 +6196,9 @@ void InGameUI::drawPlayerInfoList() for (column = 0; column < PlayerInfoList::LabelType_Count; ++column) { + if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute) + continue; + m_playerInfoList.labels[column]->draw(columnLabelX[column], drawY, m_playerInfoListLabelColor, m_playerInfoListDropColor); m_playerInfoList.values[column][row]->draw(columnLabelX[column] + labelWidths[column], drawY, m_playerInfoListValueColor, m_playerInfoListDropColor); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h index 21a5b2d292d..d07abef6f1d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h @@ -811,6 +811,7 @@ friend class Drawable; // for selection/deselection transactions { LabelType_Team, LabelType_Money, + LabelType_MoneyPerMinute, LabelType_Rank, LabelType_Xp, @@ -821,6 +822,7 @@ friend class Drawable; // for selection/deselection transactions { ValueType_Team, ValueType_Money, + ValueType_MoneyPerMinute, ValueType_Rank, ValueType_Xp, ValueType_Name, diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 5f3a8b18b27..651c89f203a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -1007,6 +1007,7 @@ void InGameUI::PlayerInfoList::init(const AsciiString &fontName, Int pointSize, labels[LabelType_Team]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelTeam", L"T")); labels[LabelType_Money]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelMoney", L"$")); + labels[LabelType_MoneyPerMinute]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelMoneyPerMinute", L"$/min")); labels[LabelType_Rank]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelRank", L"*")); labels[LabelType_Xp]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelXp", L"XP")); } @@ -6298,6 +6299,7 @@ void InGameUI::drawPlayerInfoList() Int maxValueWidths[PlayerInfoList::LabelType_Count] = {0}; Color rowColors[MAX_PLAYER_COUNT] = {0}; Int nameValueWidth[MAX_PLAYER_COUNT] = {0}; + const Bool showMoneyPerMinute = TheGlobalData->m_showMoneyPerMinute; Int column; for (Int slotIndex = 0; slotIndex < MAX_SLOTS && rowCount < MAX_PLAYER_COUNT; ++slotIndex) @@ -6312,12 +6314,14 @@ void InGameUI::drawPlayerInfoList() const Int row = rowCount++; const UnsignedInt teamValue = (slot && slot->getTeamNumber() >= 0) ? static_cast(slot->getTeamNumber() + 1) : 0; - const UnsignedInt moneyValue = player->getMoney()->countMoney(); + const Money *money = player->getMoney(); + const UnsignedInt moneyValue = money->countMoney(); + const UnsignedInt moneyPerMinuteValue = money->getCashPerMinute(); const UnsignedInt rankValue = static_cast(player->getRankLevel()); const UnsignedInt xpValue = static_cast(player->getSkillPoints()); const UnicodeString nameValue = player->getPlayerDisplayName(); - const UnsignedInt currentValues[] = {teamValue, moneyValue, rankValue, xpValue}; + const UnsignedInt currentValues[] = {teamValue, moneyValue, moneyPerMinuteValue, rankValue, xpValue}; for (column = 0; column < ARRAY_SIZE(currentValues); ++column) { UnsignedInt &lastValue = m_playerInfoList.lastValues.values[column][row]; @@ -6350,6 +6354,9 @@ void InGameUI::drawPlayerInfoList() Int labelX = baseX; for (column = 0; column < PlayerInfoList::LabelType_Count; ++column) { + if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute) + continue; + labelWidths[column] = m_playerInfoList.labels[column]->getWidth(); columnLabelX[column] = labelX; labelX += labelWidths[column] + maxValueWidths[column] + columnGap; @@ -6362,6 +6369,9 @@ void InGameUI::drawPlayerInfoList() for (column = 0; column < PlayerInfoList::LabelType_Count; ++column) { + if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute) + continue; + m_playerInfoList.labels[column]->draw(columnLabelX[column], drawY, m_playerInfoListLabelColor, m_playerInfoListDropColor); m_playerInfoList.values[column][row]->draw(columnLabelX[column] + labelWidths[column], drawY, m_playerInfoListValueColor, m_playerInfoListDropColor); }