37 Money sum, cost; |
37 Money sum, cost; |
38 StringID str; |
38 StringID str; |
39 |
39 |
40 if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status |
40 if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status |
41 /* draw categories */ |
41 /* draw categories */ |
42 DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0); |
42 DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, TC_FROMSTRING); |
43 for (i = 0; i != 13; i++) |
43 for (i = 0; i != 13; i++) |
44 DrawString(2, 27 + i * 10, STR_7011_CONSTRUCTION + i, 0); |
44 DrawString(2, 27 + i * 10, STR_7011_CONSTRUCTION + i, TC_FROMSTRING); |
45 DrawStringRightAligned(111, 27 + 10 * 13 + 2, STR_7020_TOTAL, 0); |
45 DrawStringRightAligned(111, 27 + 10 * 13 + 2, STR_7020_TOTAL, TC_FROMSTRING); |
46 |
46 |
47 /* draw the price columns */ |
47 /* draw the price columns */ |
48 year = _cur_year - 2; |
48 year = _cur_year - 2; |
49 j = 3; |
49 j = 3; |
50 x = 215; |
50 x = 215; |
51 tbl = p->yearly_expenses + 2; |
51 tbl = p->yearly_expenses + 2; |
52 do { |
52 do { |
53 if (year >= p->inaugurated_year) { |
53 if (year >= p->inaugurated_year) { |
54 SetDParam(0, year); |
54 SetDParam(0, year); |
55 DrawStringRightAlignedUnderline(x, 15, STR_7010, 0); |
55 DrawStringRightAlignedUnderline(x, 15, STR_7010, TC_FROMSTRING); |
56 sum = 0; |
56 sum = 0; |
57 for (i = 0; i != 13; i++) { |
57 for (i = 0; i != 13; i++) { |
58 /* draw one row in the price column */ |
58 /* draw one row in the price column */ |
59 cost = (*tbl)[i]; |
59 cost = (*tbl)[i]; |
60 if (cost != 0) { |
60 if (cost != 0) { |
61 sum += cost; |
61 sum += cost; |
62 |
62 |
63 str = STR_701E; |
63 str = STR_701E; |
64 if (cost < 0) { cost = -cost; str++; } |
64 if (cost < 0) { cost = -cost; str++; } |
65 SetDParam(0, cost); |
65 SetDParam(0, cost); |
66 DrawStringRightAligned(x, 27 + i * 10, str, 0); |
66 DrawStringRightAligned(x, 27 + i * 10, str, TC_FROMSTRING); |
67 } |
67 } |
68 } |
68 } |
69 |
69 |
70 str = STR_701E; |
70 str = STR_701E; |
71 if (sum < 0) { sum = -sum; str++; } |
71 if (sum < 0) { sum = -sum; str++; } |
72 SetDParam(0, sum); |
72 SetDParam(0, sum); |
73 DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, 0); |
73 DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, TC_FROMSTRING); |
74 |
74 |
75 GfxFillRect(x - 75, 27 + 10 * 13, x, 27 + 10 * 13, 215); |
75 GfxFillRect(x - 75, 27 + 10 * 13, x, 27 + 10 * 13, 215); |
76 x += 95; |
76 x += 95; |
77 } |
77 } |
78 year++; |
78 year++; |
81 |
81 |
82 y = 171; |
82 y = 171; |
83 |
83 |
84 /* draw max loan aligned to loan below (y += 10) */ |
84 /* draw max loan aligned to loan below (y += 10) */ |
85 SetDParam(0, _economy.max_loan); |
85 SetDParam(0, _economy.max_loan); |
86 DrawString(202, y + 10, STR_MAX_LOAN, 0); |
86 DrawString(202, y + 10, STR_MAX_LOAN, TC_FROMSTRING); |
87 } else { |
87 } else { |
88 y = 15; |
88 y = 15; |
89 } |
89 } |
90 |
90 |
91 DrawString(2, y, STR_7026_BANK_BALANCE, 0); |
91 DrawString(2, y, STR_7026_BANK_BALANCE, TC_FROMSTRING); |
92 SetDParam(0, p->player_money); |
92 SetDParam(0, p->player_money); |
93 DrawStringRightAligned(182, y, STR_7028, 0); |
93 DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); |
94 |
94 |
95 y += 10; |
95 y += 10; |
96 |
96 |
97 DrawString(2, y, STR_7027_LOAN, 0); |
97 DrawString(2, y, STR_7027_LOAN, TC_FROMSTRING); |
98 SetDParam(0, p->current_loan); |
98 SetDParam(0, p->current_loan); |
99 DrawStringRightAligned(182, y, STR_7028, 0); |
99 DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); |
100 |
100 |
101 y += 12; |
101 y += 12; |
102 |
102 |
103 GfxFillRect(182 - 75, y - 2, 182, y - 2, 215); |
103 GfxFillRect(182 - 75, y - 2, 182, y - 2, 215); |
104 |
104 |
105 SetDParam(0, p->player_money - p->current_loan); |
105 SetDParam(0, p->player_money - p->current_loan); |
106 DrawStringRightAligned(182, y, STR_7028, 0); |
106 DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); |
107 } |
107 } |
108 |
108 |
109 static const Widget _player_finances_widgets[] = { |
109 static const Widget _player_finances_widgets[] = { |
110 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
110 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
111 { WWT_CAPTION, RESIZE_NONE, 14, 11, 379, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
111 { WWT_CAPTION, RESIZE_NONE, 14, 11, 379, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
329 |
329 |
330 if (scheme != LS_DEFAULT) { |
330 if (scheme != LS_DEFAULT) { |
331 DrawSprite(p->livery[scheme].in_use ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, 2, y); |
331 DrawSprite(p->livery[scheme].in_use ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, 2, y); |
332 } |
332 } |
333 |
333 |
334 DrawString(15, y, STR_LIVERY_DEFAULT + scheme, sel ? 0xC : 0x10); |
334 DrawString(15, y, STR_LIVERY_DEFAULT + scheme, sel ? TC_WHITE : TC_BLACK); |
335 |
335 |
336 DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour1), 152, y); |
336 DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour1), 152, y); |
337 DrawString(165, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour1, sel ? 0xC : 2); |
337 DrawString(165, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour1, sel ? TC_WHITE : TC_GOLD); |
338 |
338 |
339 if (_loaded_newgrf_features.has_2CC) { |
339 if (_loaded_newgrf_features.has_2CC) { |
340 DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour2), 277, y); |
340 DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour2), 277, y); |
341 DrawString(290, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour2, sel ? 0xC : 2); |
341 DrawString(290, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour2, sel ? TC_WHITE : TC_GOLD); |
342 } |
342 } |
343 |
343 |
344 y += 14; |
344 y += 14; |
345 } |
345 } |
346 } |
346 } |
656 * @param is_bool_widget is it a bool button |
656 * @param is_bool_widget is it a bool button |
657 */ |
657 */ |
658 void DrawFaceStringLabel(const Window *w, byte widget_index, StringID str, uint8 val, bool is_bool_widget) |
658 void DrawFaceStringLabel(const Window *w, byte widget_index, StringID str, uint8 val, bool is_bool_widget) |
659 { |
659 { |
660 /* Write the label in gold (0x2) to the left of the button. */ |
660 /* Write the label in gold (0x2) to the left of the button. */ |
661 DrawStringRightAligned(w->widget[widget_index].left - (is_bool_widget ? 5 : 14), w->widget[widget_index].top + 1, str, 0x2); |
661 DrawStringRightAligned(w->widget[widget_index].left - (is_bool_widget ? 5 : 14), w->widget[widget_index].top + 1, str, TC_GOLD); |
662 |
662 |
663 if (!IsWindowWidgetDisabled(w, widget_index)) { |
663 if (!IsWindowWidgetDisabled(w, widget_index)) { |
664 if (is_bool_widget) { |
664 if (is_bool_widget) { |
665 /* if it a bool button write yes or no */ |
665 /* if it a bool button write yes or no */ |
666 str = (val != 0) ? STR_FACE_YES : STR_FACE_NO; |
666 str = (val != 0) ? STR_FACE_YES : STR_FACE_NO; |
670 str = STR_JUST_INT; |
670 str = STR_JUST_INT; |
671 } |
671 } |
672 |
672 |
673 /* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */ |
673 /* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */ |
674 DrawStringCentered(w->widget[widget_index].left + (w->widget[widget_index].right - w->widget[widget_index].left) / 2 + |
674 DrawStringCentered(w->widget[widget_index].left + (w->widget[widget_index].right - w->widget[widget_index].left) / 2 + |
675 IsWindowWidgetLowered(w, widget_index), w->widget[widget_index].top + 1 + IsWindowWidgetLowered(w, widget_index), str, 0xC); |
675 IsWindowWidgetLowered(w, widget_index), w->widget[widget_index].top + 1 + IsWindowWidgetLowered(w, widget_index), str, TC_WHITE); |
676 } |
676 } |
677 } |
677 } |
678 |
678 |
679 /** |
679 /** |
680 * Player face selection window event definition |
680 * Player face selection window event definition |
998 } |
998 } |
999 } |
999 } |
1000 } |
1000 } |
1001 |
1001 |
1002 if (train + road + air + ship == 0) { |
1002 if (train + road + air + ship == 0) { |
1003 DrawString(x + 70, y, STR_7042_NONE, 0); |
1003 DrawString(x + 70, y, STR_7042_NONE, TC_FROMSTRING); |
1004 } else { |
1004 } else { |
1005 if (train != 0) { |
1005 if (train != 0) { |
1006 SetDParam(0, train); |
1006 SetDParam(0, train); |
1007 DrawString(x + 70, y, STR_TRAINS, 0); |
1007 DrawString(x + 70, y, STR_TRAINS, TC_FROMSTRING); |
1008 y += 10; |
1008 y += 10; |
1009 } |
1009 } |
1010 |
1010 |
1011 if (road != 0) { |
1011 if (road != 0) { |
1012 SetDParam(0, road); |
1012 SetDParam(0, road); |
1013 DrawString(x + 70, y, STR_ROAD_VEHICLES, 0); |
1013 DrawString(x + 70, y, STR_ROAD_VEHICLES, TC_FROMSTRING); |
1014 y += 10; |
1014 y += 10; |
1015 } |
1015 } |
1016 |
1016 |
1017 if (air != 0) { |
1017 if (air != 0) { |
1018 SetDParam(0, air); |
1018 SetDParam(0, air); |
1019 DrawString(x + 70, y, STR_AIRCRAFT, 0); |
1019 DrawString(x + 70, y, STR_AIRCRAFT, TC_FROMSTRING); |
1020 y += 10; |
1020 y += 10; |
1021 } |
1021 } |
1022 |
1022 |
1023 if (ship != 0) { |
1023 if (ship != 0) { |
1024 SetDParam(0, ship); |
1024 SetDParam(0, ship); |
1025 DrawString(x + 70, y, STR_SHIPS, 0); |
1025 DrawString(x + 70, y, STR_SHIPS, TC_FROMSTRING); |
1026 } |
1026 } |
1027 } |
1027 } |
1028 } |
1028 } |
1029 |
1029 |
1030 int GetAmountOwnedBy(const Player *p, PlayerID owner) |
1030 int GetAmountOwnedBy(const Player *p, PlayerID owner) |
1103 SetDParam(1, p->index); |
1103 SetDParam(1, p->index); |
1104 |
1104 |
1105 DrawWindowWidgets(w); |
1105 DrawWindowWidgets(w); |
1106 |
1106 |
1107 SetDParam(0, p->inaugurated_year); |
1107 SetDParam(0, p->inaugurated_year); |
1108 DrawString(110, 25, STR_7038_INAUGURATED, 0); |
1108 DrawString(110, 25, STR_7038_INAUGURATED, TC_FROMSTRING); |
1109 |
1109 |
1110 DrawPlayerVehiclesAmount((PlayerID)w->window_number); |
1110 DrawPlayerVehiclesAmount((PlayerID)w->window_number); |
1111 |
1111 |
1112 DrawString(110, 48, STR_7006_COLOR_SCHEME, 0); |
1112 DrawString(110, 48, STR_7006_COLOR_SCHEME, TC_FROMSTRING); |
1113 /* Draw company-colour bus */ |
1113 /* Draw company-colour bus */ |
1114 DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 49); |
1114 DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 49); |
1115 |
1115 |
1116 DrawPlayerFace(p->face, p->player_color, 2, 16); |
1116 DrawPlayerFace(p->face, p->player_color, 2, 16); |
1117 |
1117 |
1118 SetDParam(0, p->index); |
1118 SetDParam(0, p->index); |
1119 DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94); |
1119 DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94); |
1120 |
1120 |
1121 SetDParam(0, CalculateCompanyValue(p)); |
1121 SetDParam(0, CalculateCompanyValue(p)); |
1122 DrawString(110, 114, STR_7076_COMPANY_VALUE, 0); |
1122 DrawString(110, 114, STR_7076_COMPANY_VALUE, TC_FROMSTRING); |
1123 |
1123 |
1124 DrawCompanyOwnerText(p); |
1124 DrawCompanyOwnerText(p); |
1125 |
1125 |
1126 break; |
1126 break; |
1127 } |
1127 } |
1394 DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500); |
1394 DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500); |
1395 |
1395 |
1396 /* Draw Highscore peepz */ |
1396 /* Draw Highscore peepz */ |
1397 for (i = 0; i < lengthof(_highscore_table[0]); i++) { |
1397 for (i = 0; i < lengthof(_highscore_table[0]); i++) { |
1398 SetDParam(0, i + 1); |
1398 SetDParam(0, i + 1); |
1399 DrawString(x + 40, y + 140 + (i * 55), STR_0212, 0x10); |
1399 DrawString(x + 40, y + 140 + (i * 55), STR_0212, TC_BLACK); |
1400 |
1400 |
1401 if (hs[i].company[0] != '\0') { |
1401 if (hs[i].company[0] != '\0') { |
1402 uint16 colour = (WP(w, highscore_d).rank == (int8)i) ? 0x3 : 0x10; // draw new highscore in red |
1402 TextColour colour = (WP(w, highscore_d).rank == (int8)i) ? TC_RED : TC_BLACK; // draw new highscore in red |
1403 |
1403 |
1404 DoDrawString(hs[i].company, x + 71, y + 140 + (i * 55), colour); |
1404 DoDrawString(hs[i].company, x + 71, y + 140 + (i * 55), colour); |
1405 SetDParam(0, hs[i].title); |
1405 SetDParam(0, hs[i].title); |
1406 SetDParam(1, hs[i].score); |
1406 SetDParam(1, hs[i].score); |
1407 DrawString(x + 71, y + 160 + (i * 55), STR_HIGHSCORE_STATS, colour); |
1407 DrawString(x + 71, y + 160 + (i * 55), STR_HIGHSCORE_STATS, colour); |