Skip to content

Commit 05e890d

Browse files
committed
Experimenting with extra monthly info.
1 parent 33a1db7 commit 05e890d

4 files changed

Lines changed: 50 additions & 25 deletions

File tree

‎src/Basescape/MonthlyCostsState.cpp‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ MonthlyCostsState::MonthlyCostsState(Base *base) : _base(base)
4848
_txtCost = new Text(80, 9, 115, 32);
4949
_txtQuantity = new Text(55, 9, 195, 32);
5050
_txtTotal = new Text(60, 9, 249, 32);
51-
_txtRental = new Text(150, 9, 10, 48);
51+
_txtRental = new Text(150, 9, 10, 40);
5252
_txtSalaries = new Text(150, 9, 10, 80);
53-
_txtIncome = new Text(150, 9, 10, 136);
54-
_lstCrafts = new TextList(288, 24, 10, 56);
55-
_lstSalaries = new TextList(300, 30, 10, 88);
56-
_lstMaintenance = new TextList(300, 9, 10, 120);
57-
_lstTotal = new TextList(100, 9, 205, 136);
53+
_txtIncome = new Text(150, 9, 10, 146);
54+
_txtMaintenance = new Text(150, 9, 10, 154);
55+
_lstCrafts = new TextList(288, 32, 10, 48);
56+
_lstSalaries = new TextList(300, 40, 10, 88);
57+
_lstMaintenance = new TextList(300, 9, 10, 128);
58+
_lstTotal = new TextList(100, 9, 205, 150);
5859

5960
// Set palette
6061
setPalette("PAL_BASESCAPE", _game->getRuleset()->getInterface("costsInfo")->getElement("palette")->color);
@@ -71,6 +72,7 @@ MonthlyCostsState::MonthlyCostsState(Base *base) : _base(base)
7172
add(_lstSalaries, "list", "costsInfo");
7273
add(_lstMaintenance, "text1", "costsInfo");
7374
add(_txtIncome, "list", "costsInfo");
75+
add(_txtMaintenance, "list", "costsInfo");
7476
add(_lstTotal, "text2", "costsInfo");
7577

7678
centerAllSurfaces();
@@ -101,6 +103,10 @@ MonthlyCostsState::MonthlyCostsState(Base *base) : _base(base)
101103
ss << tr("STR_INCOME") << L"=" << Text::formatFunding(_game->getSavedGame()->getCountryFunding());
102104
_txtIncome->setText(ss.str());
103105

106+
std::wostringstream ss2;
107+
ss2 << tr("STR_MAINTENANCE") << L"=" << Text::formatFunding(_game->getSavedGame()->getBaseMaintenance());
108+
_txtMaintenance->setText(ss2.str());
109+
104110
_lstCrafts->setColumns(4, 125, 70, 44, 60);
105111
_lstCrafts->setDot(true);
106112

@@ -110,9 +116,9 @@ MonthlyCostsState::MonthlyCostsState(Base *base) : _base(base)
110116
RuleCraft *craft = _game->getRuleset()->getCraft(*i);
111117
if (craft->getRentCost() != 0 && _game->getSavedGame()->isResearched(craft->getRequirements()))
112118
{
113-
std::wostringstream ss2;
114-
ss2 << _base->getCraftCount((*i));
115-
_lstCrafts->addRow(4, tr(*i).c_str(), Text::formatFunding(craft->getRentCost()).c_str(), ss2.str().c_str(), Text::formatFunding(_base->getCraftCount(*i) * craft->getRentCost()).c_str());
119+
std::wostringstream ss3;
120+
ss3 << _base->getCraftCount((*i));
121+
_lstCrafts->addRow(4, tr(*i).c_str(), Text::formatFunding(craft->getRentCost()).c_str(), ss3.str().c_str(), Text::formatFunding(_base->getCraftCount(*i) * craft->getRentCost()).c_str());
116122
}
117123
}
118124

‎src/Basescape/MonthlyCostsState.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MonthlyCostsState : public State
4141

4242
TextButton *_btnOk;
4343
Window *_window;
44-
Text *_txtTitle, *_txtCost, *_txtQuantity, *_txtTotal, *_txtRental, *_txtSalaries, *_txtIncome;
44+
Text *_txtTitle, *_txtCost, *_txtQuantity, *_txtTotal, *_txtRental, *_txtSalaries, *_txtIncome, *_txtMaintenance;
4545
TextList *_lstCrafts, *_lstSalaries, *_lstMaintenance, *_lstTotal;
4646
public:
4747
/// Creates the Monthly Costs state.

‎src/Geoscape/MonthlyReportState.cpp‎

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ MonthlyReportState::MonthlyReportState(bool psi, Globe *globe) : _psi(psi), _gam
5656
_btnOk = new TextButton(50, 12, 135, 180);
5757
_btnBigOk = new TextButton(120, 18, 100, 174);
5858
_txtTitle = new Text(300, 17, 16, 8);
59-
_txtMonth = new Text(110, 9, 16, 24);
60-
_txtRating = new Text(180, 9, 125, 24);
61-
_txtChange = new Text(300, 9, 16, 32);
62-
_txtDesc = new Text(280, 140, 16, 40);
59+
_txtMonth = new Text(160, 9, 16, 24);
60+
_txtRating = new Text(160, 9, 166, 24);
61+
_txtIncome = new Text(160, 9, 16, 32);
62+
_txtMaintenance = new Text(160, 9, 166, 32);
63+
_txtChange = new Text(160, 9, 16, 40);
64+
_txtBalance = new Text(160, 9, 166, 40);
65+
_txtDesc = new Text(280, 132, 16, 48);
6366
_txtFailure = new Text(290, 160, 15, 10);
6467

6568
// Set palette
@@ -71,7 +74,10 @@ MonthlyReportState::MonthlyReportState(bool psi, Globe *globe) : _psi(psi), _gam
7174
add(_txtTitle, "text1", "monthlyReport");
7275
add(_txtMonth, "text1", "monthlyReport");
7376
add(_txtRating, "text1", "monthlyReport");
77+
add(_txtIncome, "text1", "monthlyReport");
78+
add(_txtMaintenance, "text1", "monthlyReport");
7479
add(_txtChange, "text1", "monthlyReport");
80+
add(_txtBalance, "text1", "monthlyReport");
7581
add(_txtDesc, "text2", "monthlyReport");
7682
add(_txtFailure, "text2", "monthlyReport");
7783

@@ -151,17 +157,28 @@ MonthlyReportState::MonthlyReportState(bool psi, Globe *globe) : _psi(psi), _gam
151157

152158
_txtRating->setText(tr("STR_MONTHLY_RATING").arg(_ratingTotal).arg(rating));
153159

160+
std::wostringstream ss;
161+
ss << tr("STR_INCOME") << L"> \x01" << Text::formatFunding(_game->getSavedGame()->getCountryFunding());
162+
_txtIncome->setText(ss.str());
163+
164+
std::wostringstream ss2;
165+
ss2 << tr("STR_MAINTENANCE") << L"> \x01" << Text::formatFunding(-_game->getSavedGame()->getBaseMaintenance());
166+
_txtMaintenance->setText(ss2.str());
167+
154168
std::wostringstream ss3;
155169
if (_fundingDiff > 0)
156170
ss3 << '+';
157171
ss3 << Text::formatFunding(_fundingDiff);
158-
159172
_txtChange->setText(tr("STR_FUNDING_CHANGE").arg(ss3.str()));
160173

174+
std::wostringstream ss4;
175+
ss4 << tr("STR_BALANCE") << L"> \x01" << Text::formatFunding(_game->getSavedGame()->getFunds());
176+
_txtBalance->setText(ss4.str());
177+
161178
_txtDesc->setWordWrap(true);
162179

163180
// calculate satisfaction
164-
std::wostringstream ss4;
181+
std::wostringstream ss5;
165182
std::wstring satisFactionString = tr("STR_COUNCIL_IS_DISSATISFIED");
166183
bool resetWarning = true;
167184
if (_ratingTotal > difficulty_threshold)
@@ -180,24 +197,24 @@ MonthlyReportState::MonthlyReportState(bool psi, Globe *globe) : _psi(psi), _gam
180197
_sadList.erase(_sadList.begin(), _sadList.end());
181198
_gameOver = true;
182199
}
183-
ss4 << satisFactionString;
200+
ss5 << satisFactionString;
184201

185202
if (!_gameOver)
186203
{
187204
if (_game->getSavedGame()->getFunds() <= -1000000)
188205
{
189206
if (_game->getSavedGame()->getWarned())
190207
{
191-
ss4.str(L"");
192-
ss4 << tr("STR_YOU_HAVE_NOT_SUCCEEDED");
208+
ss5.str(L"");
209+
ss5 << tr("STR_YOU_HAVE_NOT_SUCCEEDED");
193210
_pactList.erase(_pactList.begin(), _pactList.end());
194211
_happyList.erase(_happyList.begin(), _happyList.end());
195212
_sadList.erase(_sadList.begin(), _sadList.end());
196213
_gameOver = true;
197214
}
198215
else
199216
{
200-
ss4 << "\n\n" << tr("STR_COUNCIL_REDUCE_DEBTS");
217+
ss5 << "\n\n" << tr("STR_COUNCIL_REDUCE_DEBTS");
201218
_game->getSavedGame()->setWarned(true);
202219
resetWarning = false;
203220
}
@@ -207,11 +224,11 @@ MonthlyReportState::MonthlyReportState(bool psi, Globe *globe) : _psi(psi), _gam
207224
if (resetWarning && _game->getSavedGame()->getWarned())
208225
_game->getSavedGame()->setWarned(false);
209226

210-
ss4 << countryList(_happyList, "STR_COUNTRY_IS_PARTICULARLY_PLEASED", "STR_COUNTRIES_ARE_PARTICULARLY_HAPPY");
211-
ss4 << countryList(_sadList, "STR_COUNTRY_IS_UNHAPPY_WITH_YOUR_ABILITY", "STR_COUNTRIES_ARE_UNHAPPY_WITH_YOUR_ABILITY");
212-
ss4 << countryList(_pactList, "STR_COUNTRY_HAS_SIGNED_A_SECRET_PACT", "STR_COUNTRIES_HAVE_SIGNED_A_SECRET_PACT");
227+
ss5 << countryList(_happyList, "STR_COUNTRY_IS_PARTICULARLY_PLEASED", "STR_COUNTRIES_ARE_PARTICULARLY_HAPPY");
228+
ss5 << countryList(_sadList, "STR_COUNTRY_IS_UNHAPPY_WITH_YOUR_ABILITY", "STR_COUNTRIES_ARE_UNHAPPY_WITH_YOUR_ABILITY");
229+
ss5 << countryList(_pactList, "STR_COUNTRY_HAS_SIGNED_A_SECRET_PACT", "STR_COUNTRIES_HAVE_SIGNED_A_SECRET_PACT");
213230

214-
_txtDesc->setText(ss4.str());
231+
_txtDesc->setText(ss5.str());
215232
}
216233

217234

‎src/Geoscape/MonthlyReportState.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class MonthlyReportState : public State
3939
private:
4040
TextButton *_btnOk, *_btnBigOk;
4141
Window *_window;
42-
Text *_txtTitle, *_txtMonth, *_txtRating, *_txtChange, *_txtDesc, *_txtFailure;
42+
Text *_txtTitle, *_txtMonth, *_txtRating;
43+
Text *_txtIncome, *_txtMaintenance, *_txtChange, *_txtBalance;
44+
Text *_txtDesc, *_txtFailure;
4345
bool _psi, _gameOver;
4446
int _ratingTotal, _fundingDiff, _lastMonthsRating;
4547
std::vector<std::string> _happyList, _sadList, _pactList;

0 commit comments

Comments
 (0)