Skip to content

Commit 93169dd

Browse files
committed
tweak(gui): Show Money Per Minute in Player Info List
1 parent 5852010 commit 93169dd

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

Generals/Code/GameEngine/Include/GameClient/InGameUI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ friend class Drawable; // for selection/deselection transactions
789789
{
790790
LabelType_Team,
791791
LabelType_Money,
792+
LabelType_MoneyPerMinute,
792793
LabelType_Rank,
793794
LabelType_Xp,
794795

@@ -799,6 +800,7 @@ friend class Drawable; // for selection/deselection transactions
799800
{
800801
ValueType_Team,
801802
ValueType_Money,
803+
ValueType_MoneyPerMinute,
802804
ValueType_Rank,
803805
ValueType_Xp,
804806
ValueType_Name,

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,7 @@ void InGameUI::PlayerInfoList::init(const AsciiString &fontName, Int pointSize,
978978

979979
labels[LabelType_Team]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelTeam", L"T"));
980980
labels[LabelType_Money]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelMoney", L"$"));
981+
labels[LabelType_MoneyPerMinute]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelMoneyPerMinute", L"$/min"));
981982
labels[LabelType_Rank]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelRank", L"*"));
982983
labels[LabelType_Xp]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelXp", L"XP"));
983984
}
@@ -6125,6 +6126,7 @@ void InGameUI::drawPlayerInfoList()
61256126
Int maxValueWidths[PlayerInfoList::LabelType_Count] = {0};
61266127
Color rowColors[MAX_PLAYER_COUNT] = {0};
61276128
Int nameValueWidth[MAX_PLAYER_COUNT] = {0};
6129+
const Bool showMoneyPerMinute = TheGlobalData->m_showMoneyPerMinute;
61286130
Int column;
61296131

61306132
for (Int slotIndex = 0; slotIndex < MAX_SLOTS && rowCount < MAX_PLAYER_COUNT; ++slotIndex)
@@ -6139,12 +6141,14 @@ void InGameUI::drawPlayerInfoList()
61396141

61406142
const Int row = rowCount++;
61416143
const UnsignedInt teamValue = (slot && slot->getTeamNumber() >= 0) ? static_cast<UnsignedInt>(slot->getTeamNumber() + 1) : 0;
6142-
const UnsignedInt moneyValue = player->getMoney()->countMoney();
6144+
const Money *money = player->getMoney();
6145+
const UnsignedInt moneyValue = money->countMoney();
6146+
const UnsignedInt moneyPerMinuteValue = money->getCashPerMinute();
61436147
const UnsignedInt rankValue = static_cast<UnsignedInt>(player->getRankLevel());
61446148
const UnsignedInt xpValue = static_cast<UnsignedInt>(player->getSkillPoints());
61456149
const UnicodeString nameValue = player->getPlayerDisplayName();
61466150

6147-
const UnsignedInt currentValues[] = {teamValue, moneyValue, rankValue, xpValue};
6151+
const UnsignedInt currentValues[] = {teamValue, moneyValue, moneyPerMinuteValue, rankValue, xpValue};
61486152
for (column = 0; column < ARRAY_SIZE(currentValues); ++column)
61496153
{
61506154
UnsignedInt &lastValue = m_playerInfoList.lastValues.values[column][row];
@@ -6177,6 +6181,9 @@ void InGameUI::drawPlayerInfoList()
61776181
Int labelX = baseX;
61786182
for (column = 0; column < PlayerInfoList::LabelType_Count; ++column)
61796183
{
6184+
if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute)
6185+
continue;
6186+
61806187
labelWidths[column] = m_playerInfoList.labels[column]->getWidth();
61816188
columnLabelX[column] = labelX;
61826189
labelX += labelWidths[column] + maxValueWidths[column] + columnGap;
@@ -6189,6 +6196,9 @@ void InGameUI::drawPlayerInfoList()
61896196

61906197
for (column = 0; column < PlayerInfoList::LabelType_Count; ++column)
61916198
{
6199+
if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute)
6200+
continue;
6201+
61926202
m_playerInfoList.labels[column]->draw(columnLabelX[column], drawY, m_playerInfoListLabelColor, m_playerInfoListDropColor);
61936203
m_playerInfoList.values[column][row]->draw(columnLabelX[column] + labelWidths[column], drawY, m_playerInfoListValueColor, m_playerInfoListDropColor);
61946204
}

GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,7 @@ friend class Drawable; // for selection/deselection transactions
811811
{
812812
LabelType_Team,
813813
LabelType_Money,
814+
LabelType_MoneyPerMinute,
814815
LabelType_Rank,
815816
LabelType_Xp,
816817

@@ -821,6 +822,7 @@ friend class Drawable; // for selection/deselection transactions
821822
{
822823
ValueType_Team,
823824
ValueType_Money,
825+
ValueType_MoneyPerMinute,
824826
ValueType_Rank,
825827
ValueType_Xp,
826828
ValueType_Name,

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ void InGameUI::PlayerInfoList::init(const AsciiString &fontName, Int pointSize,
10071007

10081008
labels[LabelType_Team]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelTeam", L"T"));
10091009
labels[LabelType_Money]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelMoney", L"$"));
1010+
labels[LabelType_MoneyPerMinute]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelMoneyPerMinute", L"$/min"));
10101011
labels[LabelType_Rank]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelRank", L"*"));
10111012
labels[LabelType_Xp]->setText(TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:PlayerInfoListLabelXp", L"XP"));
10121013
}
@@ -6298,6 +6299,7 @@ void InGameUI::drawPlayerInfoList()
62986299
Int maxValueWidths[PlayerInfoList::LabelType_Count] = {0};
62996300
Color rowColors[MAX_PLAYER_COUNT] = {0};
63006301
Int nameValueWidth[MAX_PLAYER_COUNT] = {0};
6302+
const Bool showMoneyPerMinute = TheGlobalData->m_showMoneyPerMinute;
63016303
Int column;
63026304

63036305
for (Int slotIndex = 0; slotIndex < MAX_SLOTS && rowCount < MAX_PLAYER_COUNT; ++slotIndex)
@@ -6312,12 +6314,14 @@ void InGameUI::drawPlayerInfoList()
63126314

63136315
const Int row = rowCount++;
63146316
const UnsignedInt teamValue = (slot && slot->getTeamNumber() >= 0) ? static_cast<UnsignedInt>(slot->getTeamNumber() + 1) : 0;
6315-
const UnsignedInt moneyValue = player->getMoney()->countMoney();
6317+
const Money *money = player->getMoney();
6318+
const UnsignedInt moneyValue = money->countMoney();
6319+
const UnsignedInt moneyPerMinuteValue = money->getCashPerMinute();
63166320
const UnsignedInt rankValue = static_cast<UnsignedInt>(player->getRankLevel());
63176321
const UnsignedInt xpValue = static_cast<UnsignedInt>(player->getSkillPoints());
63186322
const UnicodeString nameValue = player->getPlayerDisplayName();
63196323

6320-
const UnsignedInt currentValues[] = {teamValue, moneyValue, rankValue, xpValue};
6324+
const UnsignedInt currentValues[] = {teamValue, moneyValue, moneyPerMinuteValue, rankValue, xpValue};
63216325
for (column = 0; column < ARRAY_SIZE(currentValues); ++column)
63226326
{
63236327
UnsignedInt &lastValue = m_playerInfoList.lastValues.values[column][row];
@@ -6350,6 +6354,9 @@ void InGameUI::drawPlayerInfoList()
63506354
Int labelX = baseX;
63516355
for (column = 0; column < PlayerInfoList::LabelType_Count; ++column)
63526356
{
6357+
if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute)
6358+
continue;
6359+
63536360
labelWidths[column] = m_playerInfoList.labels[column]->getWidth();
63546361
columnLabelX[column] = labelX;
63556362
labelX += labelWidths[column] + maxValueWidths[column] + columnGap;
@@ -6362,6 +6369,9 @@ void InGameUI::drawPlayerInfoList()
63626369

63636370
for (column = 0; column < PlayerInfoList::LabelType_Count; ++column)
63646371
{
6372+
if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute)
6373+
continue;
6374+
63656375
m_playerInfoList.labels[column]->draw(columnLabelX[column], drawY, m_playerInfoListLabelColor, m_playerInfoListDropColor);
63666376
m_playerInfoList.values[column][row]->draw(columnLabelX[column] + labelWidths[column], drawY, m_playerInfoListValueColor, m_playerInfoListDropColor);
63676377
}

0 commit comments

Comments
 (0)