Skip to content

Commit 41474dd

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

4 files changed

Lines changed: 44 additions & 6 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: 20 additions & 3 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"+"));
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,18 +6141,27 @@ 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];
61516155
if (lastValue != currentValues[column])
61526156
{
6153-
playerInfoListValue.format(L"%u", currentValues[column]);
6157+
if (column == PlayerInfoList::ValueType_MoneyPerMinute)
6158+
{
6159+
playerInfoListValue = formatIncomeValue(currentValues[column]);
6160+
}
6161+
else
6162+
{
6163+
playerInfoListValue.format(L"%u", currentValues[column]);
6164+
}
61546165
m_playerInfoList.values[column][row]->setText(playerInfoListValue);
61556166
lastValue = currentValues[column];
61566167
}
@@ -6177,6 +6188,9 @@ void InGameUI::drawPlayerInfoList()
61776188
Int labelX = baseX;
61786189
for (column = 0; column < PlayerInfoList::LabelType_Count; ++column)
61796190
{
6191+
if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute)
6192+
continue;
6193+
61806194
labelWidths[column] = m_playerInfoList.labels[column]->getWidth();
61816195
columnLabelX[column] = labelX;
61826196
labelX += labelWidths[column] + maxValueWidths[column] + columnGap;
@@ -6189,6 +6203,9 @@ void InGameUI::drawPlayerInfoList()
61896203

61906204
for (column = 0; column < PlayerInfoList::LabelType_Count; ++column)
61916205
{
6206+
if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute)
6207+
continue;
6208+
61926209
m_playerInfoList.labels[column]->draw(columnLabelX[column], drawY, m_playerInfoListLabelColor, m_playerInfoListDropColor);
61936210
m_playerInfoList.values[column][row]->draw(columnLabelX[column] + labelWidths[column], drawY, m_playerInfoListValueColor, m_playerInfoListDropColor);
61946211
}

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: 20 additions & 3 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"+"));
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,18 +6314,27 @@ 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];
63246328
if (lastValue != currentValues[column])
63256329
{
6326-
playerInfoListValue.format(L"%u", currentValues[column]);
6330+
if (column == PlayerInfoList::ValueType_MoneyPerMinute)
6331+
{
6332+
playerInfoListValue = formatIncomeValue(currentValues[column]);
6333+
}
6334+
else
6335+
{
6336+
playerInfoListValue.format(L"%u", currentValues[column]);
6337+
}
63276338
m_playerInfoList.values[column][row]->setText(playerInfoListValue);
63286339
lastValue = currentValues[column];
63296340
}
@@ -6350,6 +6361,9 @@ void InGameUI::drawPlayerInfoList()
63506361
Int labelX = baseX;
63516362
for (column = 0; column < PlayerInfoList::LabelType_Count; ++column)
63526363
{
6364+
if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute)
6365+
continue;
6366+
63536367
labelWidths[column] = m_playerInfoList.labels[column]->getWidth();
63546368
columnLabelX[column] = labelX;
63556369
labelX += labelWidths[column] + maxValueWidths[column] + columnGap;
@@ -6362,6 +6376,9 @@ void InGameUI::drawPlayerInfoList()
63626376

63636377
for (column = 0; column < PlayerInfoList::LabelType_Count; ++column)
63646378
{
6379+
if (!showMoneyPerMinute && column == PlayerInfoList::LabelType_MoneyPerMinute)
6380+
continue;
6381+
63656382
m_playerInfoList.labels[column]->draw(columnLabelX[column], drawY, m_playerInfoListLabelColor, m_playerInfoListDropColor);
63666383
m_playerInfoList.values[column][row]->draw(columnLabelX[column] + labelWidths[column], drawY, m_playerInfoListValueColor, m_playerInfoListDropColor);
63676384
}

0 commit comments

Comments
 (0)