author | skidd13 |
Tue, 20 Nov 2007 14:11:19 +0000 | |
changeset 7932 | 6c3d71e8a129 |
parent 7931 | b0a46cd92225 |
child 7934 | c1b897797d7a |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
3 |
/** @file player_gui.cpp */ |
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1875
diff
changeset
|
6 |
#include "openttd.h" |
1363
775a7ee52369
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1323
diff
changeset
|
7 |
#include "table/sprites.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
200
diff
changeset
|
8 |
#include "table/strings.h" |
7266
b16e67e992b4
(svn r10587) -Codechange: move the string/dparam related stuff from variables.h to strings.h
rubidium
parents:
7141
diff
changeset
|
9 |
#include "strings.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
10 |
#include "functions.h" |
0 | 11 |
#include "window.h" |
12 |
#include "gui.h" |
|
13 |
#include "viewport.h" |
|
14 |
#include "gfx.h" |
|
15 |
#include "player.h" |
|
16 |
#include "command.h" |
|
17 |
#include "vehicle.h" |
|
186
d6fde0ea62f0
(svn r187) -Feature: [1024044] Show max loan in finances window. (ledow)
darkvater
parents:
176
diff
changeset
|
18 |
#include "economy.h" |
5469
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5431
diff
changeset
|
19 |
#include "network/network.h" |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2064
diff
changeset
|
20 |
#include "variables.h" |
6857
60130753e595
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
6769
diff
changeset
|
21 |
#include "roadveh.h" |
2676
59b65b4fb480
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
bjarni
parents:
2642
diff
changeset
|
22 |
#include "train.h" |
5854
9eee280920f0
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Darkvater
parents:
5668
diff
changeset
|
23 |
#include "aircraft.h" |
4261
28670f743746
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
4171
diff
changeset
|
24 |
#include "date.h" |
4742
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
25 |
#include "newgrf.h" |
5469
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5431
diff
changeset
|
26 |
#include "network/network_data.h" |
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5431
diff
changeset
|
27 |
#include "network/network_client.h" |
6190
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
28 |
#include "player_face.h" |
0 | 29 |
|
2475 | 30 |
static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied); |
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
31 |
static void DoSelectPlayerFace(PlayerID player, bool show_big); |
0 | 32 |
|
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2246
diff
changeset
|
33 |
static void DrawPlayerEconomyStats(const Player *p, byte mode) |
0 | 34 |
{ |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
35 |
int x, y, i, j, year; |
6990
136a08baf0ed
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
6952
diff
changeset
|
36 |
const Money (*tbl)[13]; |
136a08baf0ed
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
6952
diff
changeset
|
37 |
Money sum, cost; |
0 | 38 |
StringID str; |
39 |
||
186
d6fde0ea62f0
(svn r187) -Feature: [1024044] Show max loan in finances window. (ledow)
darkvater
parents:
176
diff
changeset
|
40 |
if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status |
0 | 41 |
/* draw categories */ |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
42 |
DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, TC_FROMSTRING); |
2952 | 43 |
for (i = 0; i != 13; i++) |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
44 |
DrawString(2, 27 + i * 10, STR_7011_CONSTRUCTION + i, TC_FROMSTRING); |
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
45 |
DrawStringRightAligned(111, 27 + 10 * 13 + 2, STR_7020_TOTAL, TC_FROMSTRING); |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
46 |
|
0 | 47 |
/* draw the price columns */ |
48 |
year = _cur_year - 2; |
|
49 |
j = 3; |
|
50 |
x = 215; |
|
51 |
tbl = p->yearly_expenses + 2; |
|
52 |
do { |
|
4329
0e6e689f66e7
(svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant.
rubidium
parents:
4314
diff
changeset
|
53 |
if (year >= p->inaugurated_year) { |
4293
4b7006c1b5eb
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
54 |
SetDParam(0, year); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
55 |
DrawStringRightAlignedUnderline(x, 15, STR_7010, TC_FROMSTRING); |
0 | 56 |
sum = 0; |
2952 | 57 |
for (i = 0; i != 13; i++) { |
0 | 58 |
/* draw one row in the price column */ |
59 |
cost = (*tbl)[i]; |
|
60 |
if (cost != 0) { |
|
61 |
sum += cost; |
|
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
62 |
|
0 | 63 |
str = STR_701E; |
64 |
if (cost < 0) { cost = -cost; str++; } |
|
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
65 |
SetDParam(0, cost); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
66 |
DrawStringRightAligned(x, 27 + i * 10, str, TC_FROMSTRING); |
0 | 67 |
} |
68 |
} |
|
69 |
||
70 |
str = STR_701E; |
|
71 |
if (sum < 0) { sum = -sum; str++; } |
|
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
72 |
SetDParam(0, sum); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
73 |
DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, TC_FROMSTRING); |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
74 |
|
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
75 |
GfxFillRect(x - 75, 27 + 10 * 13, x, 27 + 10 * 13, 215); |
0 | 76 |
x += 95; |
77 |
} |
|
78 |
year++; |
|
79 |
tbl--; |
|
80 |
} while (--j != 0); |
|
81 |
||
82 |
y = 171; |
|
186
d6fde0ea62f0
(svn r187) -Feature: [1024044] Show max loan in finances window. (ledow)
darkvater
parents:
176
diff
changeset
|
83 |
|
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
84 |
/* draw max loan aligned to loan below (y += 10) */ |
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
85 |
SetDParam(0, _economy.max_loan); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
86 |
DrawString(202, y + 10, STR_MAX_LOAN, TC_FROMSTRING); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4000
diff
changeset
|
87 |
} else { |
0 | 88 |
y = 15; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4000
diff
changeset
|
89 |
} |
0 | 90 |
|
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
91 |
DrawString(2, y, STR_7026_BANK_BALANCE, TC_FROMSTRING); |
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
92 |
SetDParam(0, p->player_money); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
93 |
DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); |
0 | 94 |
|
95 |
y += 10; |
|
96 |
||
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
97 |
DrawString(2, y, STR_7027_LOAN, TC_FROMSTRING); |
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
98 |
SetDParam(0, p->current_loan); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
99 |
DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); |
0 | 100 |
|
101 |
y += 12; |
|
102 |
||
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
103 |
GfxFillRect(182 - 75, y - 2, 182, y - 2, 215); |
0 | 104 |
|
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
105 |
SetDParam(0, p->player_money - p->current_loan); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
106 |
DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING); |
0 | 107 |
} |
108 |
||
109 |
static const Widget _player_finances_widgets[] = { |
|
4937
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
110 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
111 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 379, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
112 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 380, 394, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
113 |
{ WWT_STICKYBOX, RESIZE_NONE, 14, 395, 406, 0, 13, 0x0, STR_STICKY_BUTTON}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
114 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 406, 14, 169, 0x0, STR_NULL}, |
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
115 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 406, 170, 203, 0x0, STR_NULL}, |
4937
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
116 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 202, 204, 215, STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
117 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 203, 406, 204, 215, STR_702A_REPAY, STR_7036_REPAY_PART_OF_LOAN}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
150
diff
changeset
|
118 |
{ WIDGETS_END}, |
0 | 119 |
}; |
120 |
||
121 |
static const Widget _player_finances_small_widgets[] = { |
|
4937
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
122 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
123 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 253, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
124 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 254, 267, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
125 |
{ WWT_STICKYBOX, RESIZE_NONE, 14, 268, 279, 0, 13, 0x0, STR_STICKY_BUTTON}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
126 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
127 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 279, 14, 47, STR_NULL, STR_NULL}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
128 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 139, 48, 59, STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
129 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 140, 279, 48, 59, STR_702A_REPAY, STR_7036_REPAY_PART_OF_LOAN}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
150
diff
changeset
|
130 |
{ WIDGETS_END}, |
0 | 131 |
}; |
132 |
||
133 |
||
134 |
static void PlayerFinancesWndProc(Window *w, WindowEvent *e) |
|
135 |
{ |
|
2952 | 136 |
switch (e->event) { |
0 | 137 |
case WE_PAINT: { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
138 |
PlayerID player = (PlayerID)w->window_number; |
4171 | 139 |
const Player *p = GetPlayer(player); |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
140 |
|
7513
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
141 |
/* Recheck the size of the window as it might need to be resized due to the local player changing */ |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
142 |
int new_height = ((player != _local_player) ? 0 : 12) + ((WP(w, def_d).data_1 != 0) ? 48 : 204); |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
143 |
if (w->height != new_height) { |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
144 |
/* Make window dirty before and after resizing */ |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
145 |
SetWindowDirty(w); |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
146 |
w->height = new_height; |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
147 |
SetWindowDirty(w); |
6909
5cb622b3d46a
(svn r10158) -Codechange: port some changes from NoAI and FS#872 to make the loan commands a little better readable.
rubidium
parents:
6857
diff
changeset
|
148 |
|
7513
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
149 |
SetWindowWidgetHiddenState(w, 6, player != _local_player); |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
150 |
SetWindowWidgetHiddenState(w, 7, player != _local_player); |
4805
51a7aedb94a8
(svn r6727) -Fix r6619: don't disable inexistant widget
glx
parents:
4746
diff
changeset
|
151 |
} |
0 | 152 |
|
7513
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
153 |
/* Borrow button only shows when there is any more money to loan */ |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
154 |
SetWindowWidgetDisabledState(w, 6, p->current_loan == _economy.max_loan); |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
155 |
|
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
156 |
/* Repay button only shows when there is any more money to repay */ |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
157 |
SetWindowWidgetDisabledState(w, 7, player != _local_player || p->current_loan == 0); |
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
158 |
|
7058
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
159 |
SetDParam(0, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
160 |
SetDParam(1, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
161 |
SetDParam(2, LOAN_INTERVAL); |
0 | 162 |
DrawWindowWidgets(w); |
163 |
||
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
164 |
DrawPlayerEconomyStats(p, (byte)WP(w, def_d).data_1); |
0 | 165 |
} break; |
166 |
||
167 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4605
diff
changeset
|
168 |
switch (e->we.click.widget) { |
0 | 169 |
case 2: {/* toggle size */ |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
170 |
byte mode = (byte)WP(w, def_d).data_1; |
888
a299cab0927e
(svn r1374) -Feature: Add sticky item to finances window; sticky remains when requesting big/small window
darkvater
parents:
867
diff
changeset
|
171 |
bool stickied = !!(w->flags4 & WF_STICKY); |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
172 |
PlayerID player = (PlayerID)w->window_number; |
0 | 173 |
DeleteWindow(w); |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
174 |
DoShowPlayerFinances(player, !HasBit(mode, 0), stickied); |
0 | 175 |
} break; |
176 |
||
888
a299cab0927e
(svn r1374) -Feature: Add sticky item to finances window; sticky remains when requesting big/small window
darkvater
parents:
867
diff
changeset
|
177 |
case 6: /* increase loan */ |
1767
cda2e9ac430a
(svn r2271) CMD_SET_PLAYER_FACE, CMD_SET_PLAYER_COLOR, CMD_INCREASE_LOAN, CMD_DECREASE_LOAN only make sense for the current player, so don't explicitly pass a player number
tron
parents:
1739
diff
changeset
|
178 |
DoCommandP(0, 0, _ctrl_pressed, NULL, CMD_INCREASE_LOAN | CMD_MSG(STR_702C_CAN_T_BORROW_ANY_MORE_MONEY)); |
0 | 179 |
break; |
180 |
||
888
a299cab0927e
(svn r1374) -Feature: Add sticky item to finances window; sticky remains when requesting big/small window
darkvater
parents:
867
diff
changeset
|
181 |
case 7: /* repay loan */ |
1767
cda2e9ac430a
(svn r2271) CMD_SET_PLAYER_FACE, CMD_SET_PLAYER_COLOR, CMD_INCREASE_LOAN, CMD_DECREASE_LOAN only make sense for the current player, so don't explicitly pass a player number
tron
parents:
1739
diff
changeset
|
182 |
DoCommandP(0, 0, _ctrl_pressed, NULL, CMD_DECREASE_LOAN | CMD_MSG(STR_702F_CAN_T_REPAY_LOAN)); |
0 | 183 |
break; |
184 |
} |
|
185 |
break; |
|
186 |
} |
|
187 |
} |
|
188 |
||
189 |
static const WindowDesc _player_finances_desc = { |
|
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7266
diff
changeset
|
190 |
WDP_AUTO, WDP_AUTO, 407, 216, 407, 216, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
191 |
WC_FINANCES, WC_NONE, |
2064
e6a2b42d0b15
(svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents:
2055
diff
changeset
|
192 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
0 | 193 |
_player_finances_widgets, |
194 |
PlayerFinancesWndProc |
|
195 |
}; |
|
196 |
||
197 |
static const WindowDesc _player_finances_small_desc = { |
|
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7266
diff
changeset
|
198 |
WDP_AUTO, WDP_AUTO, 280, 60, 280, 60, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
199 |
WC_FINANCES, WC_NONE, |
2064
e6a2b42d0b15
(svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents:
2055
diff
changeset
|
200 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
0 | 201 |
_player_finances_small_widgets, |
202 |
PlayerFinancesWndProc |
|
203 |
}; |
|
204 |
||
2475 | 205 |
static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied) |
0 | 206 |
{ |
5005
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4998
diff
changeset
|
207 |
if (!IsValidPlayer(player)) return; |
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4998
diff
changeset
|
208 |
|
7513
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
209 |
Window *w = AllocateWindowDescFront(show_small ? &_player_finances_small_desc : &_player_finances_desc, player); |
2549 | 210 |
if (w != NULL) { |
0 | 211 |
w->caption_color = w->window_number; |
7513
4be1c3af32b7
(svn r11028) -Fix [FS#1177]: crash when having the Finance window opened of the player you are cheating to.
rubidium
parents:
7341
diff
changeset
|
212 |
WP(w, def_d).data_1 = show_small; |
5005
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4998
diff
changeset
|
213 |
if (show_stickied) w->flags4 |= WF_STICKY; |
0 | 214 |
} |
215 |
} |
|
216 |
||
2475 | 217 |
void ShowPlayerFinances(PlayerID player) |
0 | 218 |
{ |
888
a299cab0927e
(svn r1374) -Feature: Add sticky item to finances window; sticky remains when requesting big/small window
darkvater
parents:
867
diff
changeset
|
219 |
DoShowPlayerFinances(player, false, false); |
0 | 220 |
} |
221 |
||
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
222 |
/* List of colours for the livery window */ |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
223 |
static const StringID _colour_dropdown[] = { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
224 |
STR_00D1_DARK_BLUE, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
225 |
STR_00D2_PALE_GREEN, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
226 |
STR_00D3_PINK, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
227 |
STR_00D4_YELLOW, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
228 |
STR_00D5_RED, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
229 |
STR_00D6_LIGHT_BLUE, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
230 |
STR_00D7_GREEN, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
231 |
STR_00D8_DARK_GREEN, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
232 |
STR_00D9_BLUE, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
233 |
STR_00DA_CREAM, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
234 |
STR_00DB_MAUVE, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
235 |
STR_00DC_PURPLE, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
236 |
STR_00DD_ORANGE, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
237 |
STR_00DE_BROWN, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
238 |
STR_00DF_GREY, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
239 |
STR_00E0_WHITE, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
240 |
INVALID_STRING_ID |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
241 |
}; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
242 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
243 |
/* Association of liveries to livery classes */ |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
244 |
static const LiveryClass livery_class[LS_END] = { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
245 |
LC_OTHER, |
4604
50d4768623b0
(svn r6456) - Replace single colour scheme for passenger wagons with separate schemes for each of steam, diesel or electric engines. Savegames from the previous revision will not load.
peter1138
parents:
4603
diff
changeset
|
246 |
LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
247 |
LC_ROAD, LC_ROAD, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
248 |
LC_SHIP, LC_SHIP, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
249 |
LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT, |
6724
4f404dfe9752
(svn r9956) -Codechange: Add tram livery schemes
peter1138
parents:
6491
diff
changeset
|
250 |
LC_ROAD, LC_ROAD, |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
251 |
}; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
252 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
253 |
/* Number of liveries in each class, used to determine the height of the livery window */ |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
254 |
static const byte livery_height[] = { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
255 |
1, |
4604
50d4768623b0
(svn r6456) - Replace single colour scheme for passenger wagons with separate schemes for each of steam, diesel or electric engines. Savegames from the previous revision will not load.
peter1138
parents:
4603
diff
changeset
|
256 |
11, |
6724
4f404dfe9752
(svn r9956) -Codechange: Add tram livery schemes
peter1138
parents:
6491
diff
changeset
|
257 |
4, |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
258 |
2, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
259 |
3, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
260 |
}; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
261 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
262 |
struct livery_d { |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
263 |
uint32 sel; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
264 |
LiveryClass livery_class; |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
265 |
}; |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
266 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(livery_d)); |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
267 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
268 |
static void ShowColourDropDownMenu(Window *w, uint32 widget) |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
269 |
{ |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
270 |
uint32 used_colours = 0; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
271 |
const Livery *livery; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
272 |
LiveryScheme scheme; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
273 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
274 |
/* Disallow other player colours for the primary colour */ |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
275 |
if (HasBit(WP(w, livery_d).sel, LS_DEFAULT) && widget == 10) { |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
276 |
const Player *p; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
277 |
FOR_ALL_PLAYERS(p) { |
7931
b0a46cd92225
(svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
skidd13
parents:
7928
diff
changeset
|
278 |
if (p->is_active && p->index != _local_player) SetBit(used_colours, p->player_color); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
279 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
280 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
281 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
282 |
/* Get the first selected livery to use as the default dropdown item */ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
283 |
for (scheme = LS_BEGIN; scheme < LS_END; scheme++) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
284 |
if (HasBit(WP(w, livery_d).sel, scheme)) break; |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
285 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
286 |
if (scheme == LS_END) scheme = LS_DEFAULT; |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
287 |
livery = &GetPlayer((PlayerID)w->window_number)->livery[scheme]; |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
288 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
289 |
ShowDropDownMenu(w, _colour_dropdown, widget == 10 ? livery->colour1 : livery->colour2, widget, used_colours, 0); |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
290 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
291 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
292 |
static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e) |
0 | 293 |
{ |
2952 | 294 |
switch (e->event) { |
4742
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
295 |
case WE_CREATE: |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
296 |
LowerWindowWidget(w, WP(w, livery_d).livery_class + 2); |
6914
6219e65dd7bf
(svn r10167) -Codechange: Change the flagging system of grf loaded feature from a bitset to a bool evaluation.
belugas
parents:
6909
diff
changeset
|
297 |
if (!_loaded_newgrf_features.has_2CC) { |
4742
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
298 |
HideWindowWidget(w, 11); |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
299 |
HideWindowWidget(w, 12); |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
300 |
} |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
301 |
break; |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
302 |
|
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
303 |
case WE_PAINT: { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
304 |
const Player *p = GetPlayer((PlayerID)w->window_number); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
305 |
LiveryScheme scheme = LS_DEFAULT; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
306 |
int y = 51; |
0 | 307 |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
308 |
/* Disable dropdown controls if no scheme is selected */ |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
309 |
SetWindowWidgetDisabledState(w, 9, (WP(w, livery_d).sel == 0)); |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
310 |
SetWindowWidgetDisabledState(w, 10, (WP(w, livery_d).sel == 0)); |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
311 |
SetWindowWidgetDisabledState(w, 11, (WP(w, livery_d).sel == 0)); |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
312 |
SetWindowWidgetDisabledState(w, 12, (WP(w, livery_d).sel == 0)); |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
313 |
|
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
314 |
if (!(WP(w, livery_d).sel == 0)) { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
315 |
for (scheme = LS_BEGIN; scheme < LS_END; scheme++) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
316 |
if (HasBit(WP(w, livery_d).sel, scheme)) break; |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
317 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
318 |
if (scheme == LS_END) scheme = LS_DEFAULT; |
0 | 319 |
} |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
320 |
|
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
321 |
SetDParam(0, STR_00D1_DARK_BLUE + p->livery[scheme].colour1); |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
322 |
SetDParam(1, STR_00D1_DARK_BLUE + p->livery[scheme].colour2); |
0 | 323 |
|
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
324 |
DrawWindowWidgets(w); |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
325 |
|
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
326 |
for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
327 |
if (livery_class[scheme] == WP(w, livery_d).livery_class) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
328 |
bool sel = HasBit(WP(w, livery_d).sel, scheme) != 0; |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
329 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
330 |
if (scheme != LS_DEFAULT) { |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
331 |
DrawSprite(p->livery[scheme].in_use ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, 2, y); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
332 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
333 |
|
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
334 |
DrawString(15, y, STR_LIVERY_DEFAULT + scheme, sel ? TC_WHITE : TC_BLACK); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
335 |
|
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
336 |
DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour1), 152, y); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
337 |
DrawString(165, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour1, sel ? TC_WHITE : TC_GOLD); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
338 |
|
6914
6219e65dd7bf
(svn r10167) -Codechange: Change the flagging system of grf loaded feature from a bitset to a bool evaluation.
belugas
parents:
6909
diff
changeset
|
339 |
if (_loaded_newgrf_features.has_2CC) { |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
340 |
DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(p->livery[scheme].colour2), 277, y); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
341 |
DrawString(290, y, STR_00D1_DARK_BLUE + p->livery[scheme].colour2, sel ? TC_WHITE : TC_GOLD); |
4742
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
342 |
} |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
343 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
344 |
y += 14; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
345 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
346 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
347 |
break; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
348 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
349 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
350 |
case WE_CLICK: { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4605
diff
changeset
|
351 |
switch (e->we.click.widget) { |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
352 |
/* Livery Class buttons */ |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
353 |
case 2: |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
354 |
case 3: |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
355 |
case 4: |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
356 |
case 5: |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
357 |
case 6: { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
358 |
LiveryScheme scheme; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
359 |
|
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
360 |
RaiseWindowWidget(w, WP(w, livery_d).livery_class + 2); |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
361 |
WP(w, livery_d).livery_class = (LiveryClass)(e->we.click.widget - 2); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
362 |
WP(w, livery_d).sel = 0; |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
363 |
LowerWindowWidget(w, WP(w, livery_d).livery_class + 2); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
364 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
365 |
/* Select the first item in the list */ |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
366 |
for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
367 |
if (livery_class[scheme] == WP(w, livery_d).livery_class) { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
368 |
WP(w, livery_d).sel = 1 << scheme; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
369 |
break; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
370 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
371 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
372 |
w->height = 49 + livery_height[WP(w, livery_d).livery_class] * 14; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
373 |
w->widget[13].bottom = w->height - 1; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
374 |
w->widget[13].data = livery_height[WP(w, livery_d).livery_class] << 8 | 1; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
375 |
MarkWholeScreenDirty(); |
0 | 376 |
break; |
377 |
} |
|
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
378 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
379 |
case 9: |
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
380 |
case 10: /* First colour dropdown */ |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
381 |
ShowColourDropDownMenu(w, 10); |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
382 |
break; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
383 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
384 |
case 11: |
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
385 |
case 12: /* Second colour dropdown */ |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
386 |
ShowColourDropDownMenu(w, 12); |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
387 |
break; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
388 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
389 |
case 13: { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
390 |
LiveryScheme scheme; |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
391 |
LiveryScheme j = (LiveryScheme)((e->we.click.pt.y - 48) / 14); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
392 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
393 |
for (scheme = LS_BEGIN; scheme <= j; scheme++) { |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
394 |
if (livery_class[scheme] != WP(w, livery_d).livery_class) j++; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
395 |
if (scheme >= LS_END) return; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
396 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
397 |
if (j >= LS_END) return; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
398 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
399 |
/* If clicking on the left edge, toggle using the livery */ |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4605
diff
changeset
|
400 |
if (e->we.click.pt.x < 10) { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
401 |
DoCommandP(0, j | (2 << 8), !GetPlayer((PlayerID)w->window_number)->livery[j].in_use, NULL, CMD_SET_PLAYER_COLOR); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
402 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
403 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
404 |
if (_ctrl_pressed) { |
7932
6c3d71e8a129
(svn r11485) -Codechange: Remove the doubled function ToggleBitT and rename the remaining to fit with the naming style
skidd13
parents:
7931
diff
changeset
|
405 |
ToggleBit(WP(w, livery_d).sel, j); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
406 |
} else { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
407 |
WP(w, livery_d).sel = 1 << j; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
408 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
409 |
SetWindowDirty(w); |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
410 |
break; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
411 |
} |
0 | 412 |
} |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
413 |
break; |
0 | 414 |
} |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
415 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
416 |
case WE_DROPDOWN_SELECT: { |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
417 |
LiveryScheme scheme; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
418 |
|
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
419 |
for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) { |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
420 |
if (HasBit(WP(w, livery_d).sel, scheme)) { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4605
diff
changeset
|
421 |
DoCommandP(0, scheme | (e->we.dropdown.button == 10 ? 0 : 256), e->we.dropdown.index, NULL, CMD_SET_PLAYER_COLOR); |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
422 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
423 |
} |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
424 |
break; |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
425 |
} |
0 | 426 |
} |
427 |
} |
|
428 |
||
4742
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
429 |
static const Widget _select_player_livery_2cc_widgets[] = { |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
430 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
431 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 399, 0, 13, STR_7007_NEW_COLOR_SCHEME, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
4647
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
432 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 21, 14, 35, SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TIP }, |
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
433 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 22, 43, 14, 35, SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TIP }, |
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
434 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 44, 65, 14, 35, SPR_IMG_TRUCKLIST, STR_LIVERY_ROADVEH_TIP }, |
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
435 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 66, 87, 14, 35, SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TIP }, |
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
436 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 88, 109, 14, 35, SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TIP }, |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
437 |
{ WWT_PANEL, RESIZE_NONE, 14, 110, 399, 14, 35, 0x0, STR_NULL }, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
438 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 149, 36, 47, 0x0, STR_NULL }, |
4647
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
439 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 150, 262, 36, 47, STR_02BD, STR_LIVERY_PRIMARY_TIP }, |
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
440 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 263, 274, 36, 47, STR_0225, STR_LIVERY_PRIMARY_TIP }, |
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
441 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 275, 387, 36, 47, STR_02E1, STR_LIVERY_SECONDARY_TIP }, |
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
442 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 388, 399, 36, 47, STR_0225, STR_LIVERY_SECONDARY_TIP }, |
b047726d5a8b
(svn r6523) - 'Feature'/'Fix': Add tooltips to the new company colour window
peter1138
parents:
4634
diff
changeset
|
443 |
{ WWT_MATRIX, RESIZE_NONE, 14, 0, 399, 48, 48 + 1 * 14, (1 << 8) | 1, STR_LIVERY_PANEL_TIP }, |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
444 |
{ WIDGETS_END }, |
0 | 445 |
}; |
446 |
||
4742
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
447 |
static const WindowDesc _select_player_livery_2cc_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7266
diff
changeset
|
448 |
WDP_AUTO, WDP_AUTO, 400, 49 + 1 * 14, 400, 49 + 1 * 14, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
449 |
WC_PLAYER_COLOR, WC_NONE, |
4742
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
450 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
451 |
_select_player_livery_2cc_widgets, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
452 |
SelectPlayerLiveryWndProc |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
453 |
}; |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
454 |
|
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
455 |
|
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
456 |
static const Widget _select_player_livery_widgets[] = { |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
457 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
458 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 274, 0, 13, STR_7007_NEW_COLOR_SCHEME, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
459 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 21, 14, 35, SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
460 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 22, 43, 14, 35, SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
461 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 44, 65, 14, 35, SPR_IMG_TRUCKLIST, STR_LIVERY_ROADVEH_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
462 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 66, 87, 14, 35, SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
463 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 88, 109, 14, 35, SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
464 |
{ WWT_PANEL, RESIZE_NONE, 14, 110, 274, 14, 35, 0x0, STR_NULL }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
465 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 149, 36, 47, 0x0, STR_NULL }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
466 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 150, 262, 36, 47, STR_02BD, STR_LIVERY_PRIMARY_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
467 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 263, 274, 36, 47, STR_0225, STR_LIVERY_PRIMARY_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
468 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 275, 275, 36, 47, STR_02E1, STR_LIVERY_SECONDARY_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
469 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 275, 275, 36, 47, STR_0225, STR_LIVERY_SECONDARY_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
470 |
{ WWT_MATRIX, RESIZE_NONE, 14, 0, 274, 48, 48 + 1 * 14, (1 << 8) | 1, STR_LIVERY_PANEL_TIP }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
471 |
{ WIDGETS_END }, |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
472 |
}; |
d915db693186
(svn r6654) - Codechange: If no 2cc vehicles are available, hide the secondary colour choice.
peter1138
parents:
4719
diff
changeset
|
473 |
|
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
474 |
static const WindowDesc _select_player_livery_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7266
diff
changeset
|
475 |
WDP_AUTO, WDP_AUTO, 275, 49 + 1 * 14, 275, 49 + 1 * 14, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
476 |
WC_PLAYER_COLOR, WC_NONE, |
0 | 477 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
4603
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
478 |
_select_player_livery_widgets, |
20c816f664de
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4344
diff
changeset
|
479 |
SelectPlayerLiveryWndProc |
0 | 480 |
}; |
481 |
||
6190
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
482 |
/** |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
483 |
* Draws the face of a player. |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
484 |
* @param pf the player's face |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
485 |
* @param color the (background) color of the gradient |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
486 |
* @param x x-position to draw the face |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
487 |
* @param y y-position to draw the face |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
488 |
*/ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
489 |
void DrawPlayerFace(PlayerFace pf, int color, int x, int y) |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
490 |
{ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
491 |
GenderEthnicity ge = (GenderEthnicity)GetPlayerFaceBits(pf, PFV_GEN_ETHN, GE_WM); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
492 |
|
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
493 |
bool has_moustache = !HasBit(ge, GENDER_FEMALE) && GetPlayerFaceBits(pf, PFV_HAS_MOUSTACHE, ge) != 0; |
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
494 |
bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetPlayerFaceBits(pf, PFV_HAS_TIE_EARRING, ge) != 0; |
6190
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
495 |
bool has_glasses = GetPlayerFaceBits(pf, PFV_HAS_GLASSES, ge) != 0; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
496 |
SpriteID pal; |
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
497 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
498 |
/* Modify eye colour palette only if 2 or more valid values exist */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
499 |
if (_pf_info[PFV_EYE_COLOUR].valid_values[ge] < 2) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
500 |
pal = PAL_NONE; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
501 |
} else { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
502 |
switch (GetPlayerFaceBits(pf, PFV_EYE_COLOUR, ge)) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
503 |
default: NOT_REACHED(); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
504 |
case 0: pal = PALETTE_TO_BROWN; break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
505 |
case 1: pal = PALETTE_TO_BLUE; break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
506 |
case 2: pal = PALETTE_TO_GREEN; break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
507 |
} |
6190
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
508 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
509 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
510 |
/* Draw the gradient (background) */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
511 |
DrawSprite(SPR_GRADIENT, GENERAL_SPRITE_COLOR(color), x, y); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
512 |
|
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
513 |
for (PlayerFaceVariable pfv = PFV_CHEEKS; pfv < PFV_END; pfv++) { |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
514 |
switch (pfv) { |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
515 |
case PFV_MOUSTACHE: if (!has_moustache) continue; break; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
516 |
case PFV_LIPS: /* FALL THROUGH */ |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
517 |
case PFV_NOSE: if (has_moustache) continue; break; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
518 |
case PFV_TIE_EARRING: if (!has_tie_earring) continue; break; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
519 |
case PFV_GLASSES: if (!has_glasses) continue; break; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
520 |
default: break; |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
521 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
522 |
DrawSprite(GetPlayerFaceSprite(pf, pfv, ge), (pfv == PFV_EYEBROWS) ? pal : PAL_NONE, x, y); |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
523 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
524 |
} |
01a2b579b668
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
5893
diff
changeset
|
525 |
|
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
526 |
/** |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
527 |
* Names of the widgets. Keep them in the same order as in the widget array. |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
528 |
* Do not change the order of the widgets from PFW_WIDGET_HAS_MOUSTACHE_EARRING to PFW_WIDGET_GLASSES_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
529 |
* this order is needed for the WE_CLICK event of DrawFaceStringLabel(). |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
530 |
*/ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
531 |
enum PlayerFaceWindowWidgets { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
532 |
PFW_WIDGET_CLOSEBOX = 0, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
533 |
PFW_WIDGET_CAPTION, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
534 |
PFW_WIDGET_TOGGLE_LARGE_SMALL, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
535 |
PFW_WIDGET_SELECT_FACE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
536 |
PFW_WIDGET_CANCEL, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
537 |
PFW_WIDGET_ACCEPT, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
538 |
PFW_WIDGET_MALE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
539 |
PFW_WIDGET_FEMALE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
540 |
PFW_WIDGET_RANDOM_NEW_FACE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
541 |
PFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
542 |
/* from here is the advanced player face selection window */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
543 |
PFW_WIDGET_LOAD, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
544 |
PFW_WIDGET_FACECODE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
545 |
PFW_WIDGET_SAVE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
546 |
PFW_WIDGET_ETHNICITY_EUR, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
547 |
PFW_WIDGET_ETHNICITY_AFR, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
548 |
PFW_WIDGET_HAS_MOUSTACHE_EARRING, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
549 |
PFW_WIDGET_HAS_GLASSES, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
550 |
PFW_WIDGET_EYECOLOUR_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
551 |
PFW_WIDGET_EYECOLOUR, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
552 |
PFW_WIDGET_EYECOLOUR_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
553 |
PFW_WIDGET_CHIN_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
554 |
PFW_WIDGET_CHIN, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
555 |
PFW_WIDGET_CHIN_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
556 |
PFW_WIDGET_EYEBROWS_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
557 |
PFW_WIDGET_EYEBROWS, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
558 |
PFW_WIDGET_EYEBROWS_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
559 |
PFW_WIDGET_LIPS_MOUSTACHE_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
560 |
PFW_WIDGET_LIPS_MOUSTACHE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
561 |
PFW_WIDGET_LIPS_MOUSTACHE_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
562 |
PFW_WIDGET_NOSE_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
563 |
PFW_WIDGET_NOSE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
564 |
PFW_WIDGET_NOSE_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
565 |
PFW_WIDGET_HAIR_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
566 |
PFW_WIDGET_HAIR, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
567 |
PFW_WIDGET_HAIR_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
568 |
PFW_WIDGET_JACKET_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
569 |
PFW_WIDGET_JACKET, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
570 |
PFW_WIDGET_JACKET_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
571 |
PFW_WIDGET_COLLAR_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
572 |
PFW_WIDGET_COLLAR, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
573 |
PFW_WIDGET_COLLAR_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
574 |
PFW_WIDGET_TIE_EARRING_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
575 |
PFW_WIDGET_TIE_EARRING, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
576 |
PFW_WIDGET_TIE_EARRING_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
577 |
PFW_WIDGET_GLASSES_L, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
578 |
PFW_WIDGET_GLASSES, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
579 |
PFW_WIDGET_GLASSES_R, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
580 |
}; |
0 | 581 |
|
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
582 |
/** Widget description for the normal/simple player face selection dialog */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
583 |
static const Widget _select_player_face_widgets[] = { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
584 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // PFW_WIDGET_CLOSEBOX |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
585 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 174, 0, 13, STR_7043_FACE_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // PFW_WIDGET_CAPTION |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
586 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 175, 189, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TIP}, // PFW_WIDGET_TOGGLE_LARGE_SMALL |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
587 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 189, 14, 150, 0x0, STR_NULL}, // PFW_WIDGET_SELECT_FACE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
588 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 94, 151, 162, STR_012E_CANCEL, STR_7047_CANCEL_NEW_FACE_SELECTION}, // PFW_WIDGET_CANCEL |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
589 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 95, 189, 151, 162, STR_012F_OK, STR_7048_ACCEPT_NEW_FACE_SELECTION}, // PFW_WIDGET_ACCEPT |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
590 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 95, 187, 75, 86, STR_7044_MALE, STR_7049_SELECT_MALE_FACES}, // PFW_WIDGET_MALE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
591 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 95, 187, 87, 98, STR_7045_FEMALE, STR_704A_SELECT_FEMALE_FACES}, // PFW_WIDGET_FEMALE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
592 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 2, 93, 137, 148, STR_7046_NEW_FACE, STR_704B_GENERATE_RANDOM_NEW_FACE}, // PFW_WIDGET_RANDOM_NEW_FACE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
593 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 95, 187, 16, 27, STR_FACE_ADVANCED, STR_FACE_ADVANCED_TIP}, // PFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
594 |
{ WIDGETS_END}, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
595 |
}; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
596 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
597 |
/** Widget description for the advanced player face selection dialog */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
598 |
static const Widget _select_player_face_adv_widgets[] = { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
599 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // PFW_WIDGET_CLOSEBOX |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
600 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 204, 0, 13, STR_7043_FACE_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // PFW_WIDGET_CAPTION |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
601 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 205, 219, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_FACE_SIMPLE_TIP}, // PFW_WIDGET_TOGGLE_LARGE_SMALL |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
602 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 219, 14, 207, 0x0, STR_NULL}, // PFW_WIDGET_SELECT_FACE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
603 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 94, 208, 219, STR_012E_CANCEL, STR_7047_CANCEL_NEW_FACE_SELECTION}, // PFW_WIDGET_CANCEL |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
604 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 95, 219, 208, 219, STR_012F_OK, STR_7048_ACCEPT_NEW_FACE_SELECTION}, // PFW_WIDGET_ACCEPT |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
605 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 96, 156, 32, 43, STR_7044_MALE, STR_7049_SELECT_MALE_FACES}, // PFW_WIDGET_MALE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
606 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 157, 217, 32, 43, STR_7045_FEMALE, STR_704A_SELECT_FEMALE_FACES}, // PFW_WIDGET_FEMALE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
607 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 2, 93, 137, 148, STR_RANDOM, STR_704B_GENERATE_RANDOM_NEW_FACE}, // PFW_WIDGET_RANDOM_NEW_FACE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
608 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 95, 217, 16, 27, STR_FACE_SIMPLE, STR_FACE_SIMPLE_TIP}, // PFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
609 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 2, 93, 158, 169, STR_FACE_LOAD, STR_FACE_LOAD_TIP}, // PFW_WIDGET_LOAD |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
610 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 2, 93, 170, 181, STR_FACE_FACECODE, STR_FACE_FACECODE_TIP}, // PFW_WIDGET_FACECODE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
611 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 2, 93, 182, 193, STR_FACE_SAVE, STR_FACE_SAVE_TIP}, // PFW_WIDGET_SAVE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
612 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 96, 156, 46, 57, STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN}, // PFW_WIDGET_ETHNICITY_EUR |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
613 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 157, 217, 46, 57, STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN}, // PFW_WIDGET_ETHNICITY_AFR |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
614 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 175, 217, 60, 71, STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TIP}, // PFW_WIDGET_HAS_MOUSTACHE_EARRING |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
615 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 175, 217, 72, 83, STR_EMPTY, STR_FACE_GLASSES_TIP}, // PFW_WIDGET_HAS_GLASSES |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
616 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 110, 121, SPR_ARROW_LEFT, STR_FACE_EYECOLOUR_TIP}, // PFW_WIDGET_EYECOLOUR_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
617 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 110, 121, STR_EMPTY, STR_FACE_EYECOLOUR_TIP}, // PFW_WIDGET_EYECOLOUR |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
618 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 110, 121, SPR_ARROW_RIGHT, STR_FACE_EYECOLOUR_TIP}, // PFW_WIDGET_EYECOLOUR_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
619 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 158, 169, SPR_ARROW_LEFT, STR_FACE_CHIN_TIP}, // PFW_WIDGET_CHIN_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
620 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 158, 169, STR_EMPTY, STR_FACE_CHIN_TIP}, // PFW_WIDGET_CHIN |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
621 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 158, 169, SPR_ARROW_RIGHT, STR_FACE_CHIN_TIP}, // PFW_WIDGET_CHIN_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
622 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 98, 109, SPR_ARROW_LEFT, STR_FACE_EYEBROWS_TIP}, // PFW_WIDGET_EYEBROWS_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
623 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 98, 109, STR_EMPTY, STR_FACE_EYEBROWS_TIP}, // PFW_WIDGET_EYEBROWS |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
624 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 98, 109, SPR_ARROW_RIGHT, STR_FACE_EYEBROWS_TIP}, // PFW_WIDGET_EYEBROWS_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
625 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 146, 157, SPR_ARROW_LEFT, STR_FACE_LIPS_MOUSTACHE_TIP}, // PFW_WIDGET_LIPS_MOUSTACHE_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
626 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 146, 157, STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TIP}, // PFW_WIDGET_LIPS_MOUSTACHE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
627 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 146, 157, SPR_ARROW_RIGHT, STR_FACE_LIPS_MOUSTACHE_TIP}, // PFW_WIDGET_LIPS_MOUSTACHE_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
628 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 134, 145, SPR_ARROW_LEFT, STR_FACE_NOSE_TIP}, // PFW_WIDGET_NOSE_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
629 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 134, 145, STR_EMPTY, STR_FACE_NOSE_TIP}, // PFW_WIDGET_NOSE |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
630 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 134, 145, SPR_ARROW_RIGHT, STR_FACE_NOSE_TIP}, // PFW_WIDGET_NOSE_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
631 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 86, 97, SPR_ARROW_LEFT, STR_FACE_HAIR_TIP}, // PFW_WIDGET_HAIR_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
632 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 86, 97, STR_EMPTY, STR_FACE_HAIR_TIP}, // PFW_WIDGET_HAIR |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
633 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 86, 97, SPR_ARROW_RIGHT, STR_FACE_HAIR_TIP}, // PFW_WIDGET_HAIR_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
634 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 170, 181, SPR_ARROW_LEFT, STR_FACE_JACKET_TIP}, // PFW_WIDGET_JACKET_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
635 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 170, 181, STR_EMPTY, STR_FACE_JACKET_TIP}, // PFW_WIDGET_JACKET |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
636 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 170, 181, SPR_ARROW_RIGHT, STR_FACE_JACKET_TIP}, // PFW_WIDGET_JACKET_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
637 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 182, 193, SPR_ARROW_LEFT, STR_FACE_COLLAR_TIP}, // PFW_WIDGET_COLLAR_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
638 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 182, 193, STR_EMPTY, STR_FACE_COLLAR_TIP}, // PFW_WIDGET_COLLAR |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
639 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 182, 193, SPR_ARROW_RIGHT, STR_FACE_COLLAR_TIP}, // PFW_WIDGET_COLLAR_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
640 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 194, 205, SPR_ARROW_LEFT, STR_FACE_TIE_EARRING_TIP}, // PFW_WIDGET_TIE_EARRING_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
641 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 194, 205, STR_EMPTY, STR_FACE_TIE_EARRING_TIP}, // PFW_WIDGET_TIE_EARRING |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
642 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 194, 205, SPR_ARROW_RIGHT, STR_FACE_TIE_EARRING_TIP}, // PFW_WIDGET_TIE_EARRING_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
643 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 175, 183, 122, 133, SPR_ARROW_LEFT, STR_FACE_GLASSES_TIP_2}, // PFW_WIDGET_GLASSES_L |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
644 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 184, 208, 122, 133, STR_EMPTY, STR_FACE_GLASSES_TIP_2}, // PFW_WIDGET_GLASSES |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
645 |
{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 209, 217, 122, 133, SPR_ARROW_RIGHT, STR_FACE_GLASSES_TIP_2}, // PFW_WIDGET_GLASSES_R |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
646 |
{ WIDGETS_END}, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
647 |
}; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
648 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
649 |
/** |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
650 |
* Draw dynamic a label to the left of the button and a value in the button |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
651 |
* |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
652 |
* @param w Window on which the widget is located |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
653 |
* @param widget_index index of this widget in the window |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
654 |
* @param str the label which will be draw |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
655 |
* @param val the value which will be draw |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
656 |
* @param is_bool_widget is it a bool button |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
657 |
*/ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
658 |
void DrawFaceStringLabel(const Window *w, byte widget_index, StringID str, uint8 val, bool is_bool_widget) |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
659 |
{ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
660 |
/* Write the label in gold (0x2) to the left of the button. */ |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
661 |
DrawStringRightAligned(w->widget[widget_index].left - (is_bool_widget ? 5 : 14), w->widget[widget_index].top + 1, str, TC_GOLD); |
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
662 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
663 |
if (!IsWindowWidgetDisabled(w, widget_index)) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
664 |
if (is_bool_widget) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
665 |
/* if it a bool button write yes or no */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
666 |
str = (val != 0) ? STR_FACE_YES : STR_FACE_NO; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
667 |
} else { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
668 |
/* else write the value + 1 */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
669 |
SetDParam(0, val + 1); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
670 |
str = STR_JUST_INT; |
0 | 671 |
} |
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
672 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
673 |
/* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
674 |
DrawStringCentered(w->widget[widget_index].left + (w->widget[widget_index].right - w->widget[widget_index].left) / 2 + |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
675 |
IsWindowWidgetLowered(w, widget_index), w->widget[widget_index].top + 1 + IsWindowWidgetLowered(w, widget_index), str, TC_WHITE); |
0 | 676 |
} |
677 |
} |
|
678 |
||
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
679 |
/** |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
680 |
* Player face selection window event definition |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
681 |
* |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
682 |
* @param w window pointer |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
683 |
* @param e event been triggered |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
684 |
*/ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
685 |
static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e) |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
686 |
{ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
687 |
PlayerFace *pf = &WP(w, facesel_d).face; // pointer to the player face bits |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
688 |
GenderEthnicity ge = (GenderEthnicity)GB(*pf, _pf_info[PFV_GEN_ETHN].offset, _pf_info[PFV_GEN_ETHN].length); // get the gender and ethnicity |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
689 |
bool is_female = HasBit(ge, GENDER_FEMALE); // get the gender: 0 == male and 1 == female |
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
690 |
bool is_moust_male = !is_female && GetPlayerFaceBits(*pf, PFV_HAS_MOUSTACHE, ge) != 0; // is a male face with moustache |
0 | 691 |
|
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
692 |
switch (e->event) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
693 |
case WE_PAINT: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
694 |
/* lower the non-selected gender button */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
695 |
SetWindowWidgetLoweredState(w, PFW_WIDGET_MALE, !is_female); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
696 |
SetWindowWidgetLoweredState(w, PFW_WIDGET_FEMALE, is_female); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
697 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
698 |
/* advanced player face selection window */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
699 |
if (WP(w, facesel_d).advanced) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
700 |
/* lower the non-selected ethnicity button */ |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
701 |
SetWindowWidgetLoweredState(w, PFW_WIDGET_ETHNICITY_EUR, !HasBit(ge, ETHNICITY_BLACK)); |
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7889
diff
changeset
|
702 |
SetWindowWidgetLoweredState(w, PFW_WIDGET_ETHNICITY_AFR, HasBit(ge, ETHNICITY_BLACK)); |
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
703 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
704 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
705 |
/* Disable dynamically the widgets which PlayerFaceVariable has less than 2 options |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
706 |
* (or in other words you haven't any choice). |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
707 |
* If the widgets depend on a HAS-variable and this is false the widgets will be disabled, too. */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
708 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
709 |
/* Eye colour buttons */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
710 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_EYE_COLOUR].valid_values[ge] < 2, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
711 |
PFW_WIDGET_EYECOLOUR, PFW_WIDGET_EYECOLOUR_L, PFW_WIDGET_EYECOLOUR_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
712 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
713 |
/* Chin buttons */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
714 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_CHIN].valid_values[ge] < 2, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
715 |
PFW_WIDGET_CHIN, PFW_WIDGET_CHIN_L, PFW_WIDGET_CHIN_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
716 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
717 |
/* Eyebrows buttons */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
718 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_EYEBROWS].valid_values[ge] < 2, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
719 |
PFW_WIDGET_EYEBROWS, PFW_WIDGET_EYEBROWS_L, PFW_WIDGET_EYEBROWS_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
720 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
721 |
/* Lips or (if it a male face with a moustache) moustache buttons */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
722 |
SetWindowWidgetsDisabledState(w, _pf_info[is_moust_male ? PFV_MOUSTACHE : PFV_LIPS].valid_values[ge] < 2, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
723 |
PFW_WIDGET_LIPS_MOUSTACHE, PFW_WIDGET_LIPS_MOUSTACHE_L, PFW_WIDGET_LIPS_MOUSTACHE_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
724 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
725 |
/* Nose buttons | male faces with moustache haven't any nose options */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
726 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_NOSE].valid_values[ge] < 2 || is_moust_male, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
727 |
PFW_WIDGET_NOSE, PFW_WIDGET_NOSE_L, PFW_WIDGET_NOSE_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
728 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
729 |
/* Hair buttons */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
730 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_HAIR].valid_values[ge] < 2, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
731 |
PFW_WIDGET_HAIR, PFW_WIDGET_HAIR_L, PFW_WIDGET_HAIR_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
732 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
733 |
/* Jacket buttons */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
734 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_JACKET].valid_values[ge] < 2, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
735 |
PFW_WIDGET_JACKET, PFW_WIDGET_JACKET_L, PFW_WIDGET_JACKET_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
736 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
737 |
/* Collar buttons */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
738 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_COLLAR].valid_values[ge] < 2, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
739 |
PFW_WIDGET_COLLAR, PFW_WIDGET_COLLAR_L, PFW_WIDGET_COLLAR_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
740 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
741 |
/* Tie/earring buttons | female faces without earring haven't any earring options */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
742 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_TIE_EARRING].valid_values[ge] < 2 || |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
743 |
(is_female && GetPlayerFaceBits(*pf, PFV_HAS_TIE_EARRING, ge) == 0), |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
744 |
PFW_WIDGET_TIE_EARRING, PFW_WIDGET_TIE_EARRING_L, PFW_WIDGET_TIE_EARRING_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
745 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
746 |
/* Glasses buttons | faces without glasses haven't any glasses options */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
747 |
SetWindowWidgetsDisabledState(w, _pf_info[PFV_GLASSES].valid_values[ge] < 2 || GetPlayerFaceBits(*pf, PFV_HAS_GLASSES, ge) == 0, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
748 |
PFW_WIDGET_GLASSES, PFW_WIDGET_GLASSES_L, PFW_WIDGET_GLASSES_R, WIDGET_LIST_END); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
749 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
750 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
751 |
DrawWindowWidgets(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
752 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
753 |
/* Draw dynamic button value and labels for the advanced player face selection window */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
754 |
if (WP(w, facesel_d).advanced) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
755 |
if (is_female) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
756 |
/* Only for female faces */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
757 |
DrawFaceStringLabel(w, PFW_WIDGET_HAS_MOUSTACHE_EARRING, STR_FACE_EARRING, GetPlayerFaceBits(*pf, PFV_HAS_TIE_EARRING, ge), true ); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
758 |
DrawFaceStringLabel(w, PFW_WIDGET_TIE_EARRING, STR_FACE_EARRING, GetPlayerFaceBits(*pf, PFV_TIE_EARRING, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
759 |
} else { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
760 |
/* Only for male faces */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
761 |
DrawFaceStringLabel(w, PFW_WIDGET_HAS_MOUSTACHE_EARRING, STR_FACE_MOUSTACHE, GetPlayerFaceBits(*pf, PFV_HAS_MOUSTACHE, ge), true ); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
762 |
DrawFaceStringLabel(w, PFW_WIDGET_TIE_EARRING, STR_FACE_TIE, GetPlayerFaceBits(*pf, PFV_TIE_EARRING, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
763 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
764 |
if (is_moust_male) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
765 |
/* Only for male faces with moustache */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
766 |
DrawFaceStringLabel(w, PFW_WIDGET_LIPS_MOUSTACHE, STR_FACE_MOUSTACHE, GetPlayerFaceBits(*pf, PFV_MOUSTACHE, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
767 |
} else { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
768 |
/* Only for female faces or male faces without moustache */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
769 |
DrawFaceStringLabel(w, PFW_WIDGET_LIPS_MOUSTACHE, STR_FACE_LIPS, GetPlayerFaceBits(*pf, PFV_LIPS, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
770 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
771 |
/* For all faces */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
772 |
DrawFaceStringLabel(w, PFW_WIDGET_HAS_GLASSES, STR_FACE_GLASSES, GetPlayerFaceBits(*pf, PFV_HAS_GLASSES, ge), true ); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
773 |
DrawFaceStringLabel(w, PFW_WIDGET_HAIR, STR_FACE_HAIR, GetPlayerFaceBits(*pf, PFV_HAIR, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
774 |
DrawFaceStringLabel(w, PFW_WIDGET_EYEBROWS, STR_FACE_EYEBROWS, GetPlayerFaceBits(*pf, PFV_EYEBROWS, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
775 |
DrawFaceStringLabel(w, PFW_WIDGET_EYECOLOUR, STR_FACE_EYECOLOUR, GetPlayerFaceBits(*pf, PFV_EYE_COLOUR, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
776 |
DrawFaceStringLabel(w, PFW_WIDGET_GLASSES, STR_FACE_GLASSES, GetPlayerFaceBits(*pf, PFV_GLASSES, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
777 |
DrawFaceStringLabel(w, PFW_WIDGET_NOSE, STR_FACE_NOSE, GetPlayerFaceBits(*pf, PFV_NOSE, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
778 |
DrawFaceStringLabel(w, PFW_WIDGET_CHIN, STR_FACE_CHIN, GetPlayerFaceBits(*pf, PFV_CHIN, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
779 |
DrawFaceStringLabel(w, PFW_WIDGET_JACKET, STR_FACE_JACKET, GetPlayerFaceBits(*pf, PFV_JACKET, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
780 |
DrawFaceStringLabel(w, PFW_WIDGET_COLLAR, STR_FACE_COLLAR, GetPlayerFaceBits(*pf, PFV_COLLAR, ge), false); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
781 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
782 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
783 |
/* Draw the player face picture */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
784 |
DrawPlayerFace(*pf, GetPlayer((PlayerID)w->window_number)->player_color, 2, 16); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
785 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
786 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
787 |
case WE_CLICK: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
788 |
switch (e->we.click.widget) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
789 |
/* Toggle size, advanced/simple face selection */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
790 |
case PFW_WIDGET_TOGGLE_LARGE_SMALL: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
791 |
case PFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
792 |
DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
793 |
DeleteWindow(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
794 |
DoSelectPlayerFace((PlayerID)w->window_number, !WP(w, facesel_d).advanced); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
795 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
796 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
797 |
/* Cancel button */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
798 |
case PFW_WIDGET_CANCEL: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
799 |
DeleteWindow(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
800 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
801 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
802 |
/* OK button */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
803 |
case PFW_WIDGET_ACCEPT: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
804 |
DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
805 |
DeleteWindow(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
806 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
807 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
808 |
/* Load button */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
809 |
case PFW_WIDGET_LOAD: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
810 |
*pf = _player_face; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
811 |
ScaleAllPlayerFaceBits(*pf); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
812 |
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
813 |
SetWindowDirty(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
814 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
815 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
816 |
/* 'Player face number' button, view and/or set player face number */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
817 |
case PFW_WIDGET_FACECODE: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
818 |
SetDParam(0, *pf); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
819 |
ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, 0, w, CS_NUMERAL); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
820 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
821 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
822 |
/* Save button */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
823 |
case PFW_WIDGET_SAVE: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
824 |
_player_face = *pf; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
825 |
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_SAVE_DONE, 0, 0); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
826 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
827 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
828 |
/* Toggle gender (male/female) button */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
829 |
case PFW_WIDGET_MALE: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
830 |
case PFW_WIDGET_FEMALE: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
831 |
SetPlayerFaceBits(*pf, PFV_GENDER, ge, e->we.click.widget - PFW_WIDGET_MALE); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
832 |
ScaleAllPlayerFaceBits(*pf); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
833 |
SetWindowDirty(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
834 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
835 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
836 |
/* Randomize face button */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
837 |
case PFW_WIDGET_RANDOM_NEW_FACE: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
838 |
RandomPlayerFaceBits(*pf, ge, WP(w, facesel_d).advanced); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
839 |
SetWindowDirty(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
840 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
841 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
842 |
/* Toggle ethnicity (european/african) button */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
843 |
case PFW_WIDGET_ETHNICITY_EUR: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
844 |
case PFW_WIDGET_ETHNICITY_AFR: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
845 |
SetPlayerFaceBits(*pf, PFV_ETHNICITY, ge, e->we.click.widget - PFW_WIDGET_ETHNICITY_EUR); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
846 |
ScaleAllPlayerFaceBits(*pf); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
847 |
SetWindowDirty(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
848 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
849 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
850 |
default: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
851 |
/* For all buttons from PFW_WIDGET_HAS_MOUSTACHE_EARRING to PFW_WIDGET_GLASSES_R is the same function. |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
852 |
* Therefor is this combined function. |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
853 |
* First it checks which PlayerFaceVariable will be change and then |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
854 |
* a: invert the value for boolean variables |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
855 |
* or b: it checks inside of IncreasePlayerFaceBits() if a left (_L) butten is pressed and then decrease else increase the variable */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
856 |
if (WP(w, facesel_d).advanced && e->we.click.widget >= PFW_WIDGET_HAS_MOUSTACHE_EARRING && e->we.click.widget <= PFW_WIDGET_GLASSES_R) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
857 |
PlayerFaceVariable pfv; // which PlayerFaceVariable shall be edited |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
858 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
859 |
if (e->we.click.widget < PFW_WIDGET_EYECOLOUR_L) { // Bool buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
860 |
switch (e->we.click.widget - PFW_WIDGET_HAS_MOUSTACHE_EARRING) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
861 |
default: NOT_REACHED(); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
862 |
case 0: pfv = is_female ? PFV_HAS_TIE_EARRING : PFV_HAS_MOUSTACHE; break; // Has earring/moustache button |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
863 |
case 1: pfv = PFV_HAS_GLASSES; break; // Has glasses button |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
864 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
865 |
SetPlayerFaceBits(*pf, pfv, ge, !GetPlayerFaceBits(*pf, pfv, ge)); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
866 |
ScaleAllPlayerFaceBits(*pf); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
867 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
868 |
} else { // Value buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
869 |
switch ((e->we.click.widget - PFW_WIDGET_EYECOLOUR_L) / 3) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
870 |
default: NOT_REACHED(); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
871 |
case 0: pfv = PFV_EYE_COLOUR; break; // Eye colour buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
872 |
case 1: pfv = PFV_CHIN; break; // Chin buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
873 |
case 2: pfv = PFV_EYEBROWS; break; // Eyebrows buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
874 |
case 3: pfv = is_moust_male ? PFV_MOUSTACHE : PFV_LIPS; break; // Moustache or lips buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
875 |
case 4: pfv = PFV_NOSE; break; // Nose buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
876 |
case 5: pfv = PFV_HAIR; break; // Hair buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
877 |
case 6: pfv = PFV_JACKET; break; // Jacket buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
878 |
case 7: pfv = PFV_COLLAR; break; // Collar buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
879 |
case 8: pfv = PFV_TIE_EARRING; break; // Tie/earring buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
880 |
case 9: pfv = PFV_GLASSES; break; // Glasses buttons |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
881 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
882 |
/* 0 == left (_L), 1 == middle or 2 == right (_R) - button click */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
883 |
IncreasePlayerFaceBits(*pf, pfv, ge, (((e->we.click.widget - PFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
884 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
885 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
886 |
SetWindowDirty(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
887 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
888 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
889 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
890 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
891 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
892 |
case WE_ON_EDIT_TEXT: |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
893 |
/* Set a new player face number */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
894 |
if (!StrEmpty(e->we.edittext.str)) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
895 |
*pf = strtoul(e->we.edittext.str, NULL, 10); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
896 |
ScaleAllPlayerFaceBits(*pf); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
897 |
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
898 |
SetWindowDirty(w); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
899 |
} else { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
900 |
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0); |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
901 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
902 |
break; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
903 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
904 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
905 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
906 |
/** normal/simple player face selection window description */ |
0 | 907 |
static const WindowDesc _select_player_face_desc = { |
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
908 |
WDP_AUTO, WDP_AUTO, 190, 163, 190, 163, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
909 |
WC_PLAYER_FACE, WC_NONE, |
0 | 910 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
911 |
_select_player_face_widgets, |
|
912 |
SelectPlayerFaceWndProc |
|
913 |
}; |
|
914 |
||
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
915 |
/** advanced player face selection window description */ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
916 |
static const WindowDesc _select_player_face_adv_desc = { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
917 |
WDP_AUTO, WDP_AUTO, 220, 220, 220, 220, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
918 |
WC_PLAYER_FACE, WC_NONE, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
919 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
920 |
_select_player_face_adv_widgets, |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
921 |
SelectPlayerFaceWndProc |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
922 |
}; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
923 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
924 |
/** |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
925 |
* Open the simple/advanced player face selection window |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
926 |
* |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
927 |
* @param player the player which face shall be edited |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
928 |
* @param adv simple or advanced player face selection window |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
929 |
* |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
930 |
* @pre is player a valid player |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
931 |
*/ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
932 |
static void DoSelectPlayerFace(PlayerID player, bool adv) |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
933 |
{ |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
934 |
if (!IsValidPlayer(player)) return; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
935 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
936 |
Window *w = AllocateWindowDescFront(adv ? &_select_player_face_adv_desc : &_select_player_face_desc, player); // simple or advanced window |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
937 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
938 |
if (w != NULL) { |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
939 |
w->caption_color = w->window_number; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
940 |
WP(w, facesel_d).face = GetPlayer((PlayerID)w->window_number)->face; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
941 |
WP(w, facesel_d).advanced = adv; |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
942 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
943 |
} |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
944 |
|
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
945 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
946 |
/* Names of the widgets. Keep them in the same order as in the widget array */ |
5273
d9f707aa36a6
(svn r7415) -Codechange: Don't use typedef enum for simple widget enumerators when we will never use
Darkvater
parents:
5070
diff
changeset
|
947 |
enum PlayerCompanyWindowWidgets { |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
948 |
PCW_WIDGET_CLOSEBOX = 0, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
949 |
PCW_WIDGET_CAPTION, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
950 |
PCW_WIDGET_FACE, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
951 |
PCW_WIDGET_NEW_FACE, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
952 |
PCW_WIDGET_COLOR_SCHEME, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
953 |
PCW_WIDGET_PRESIDENT_NAME, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
954 |
PCW_WIDGET_COMPANY_NAME, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
955 |
PCW_WIDGET_BUILD_VIEW_HQ, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
956 |
PCW_WIDGET_RELOCATE_HQ, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
957 |
PCW_WIDGET_BUY_SHARE, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
958 |
PCW_WIDGET_SELL_SHARE, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
959 |
PCW_WIDGET_COMPANY_PASSWORD, |
5273
d9f707aa36a6
(svn r7415) -Codechange: Don't use typedef enum for simple widget enumerators when we will never use
Darkvater
parents:
5070
diff
changeset
|
960 |
}; |
0 | 961 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
962 |
static const Widget _player_company_widgets[] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
963 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
964 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 359, 0, 13, STR_7001, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
965 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 359, 14, 157, 0x0, STR_NULL}, |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
966 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 89, 158, 169, STR_7004_NEW_FACE, STR_7030_SELECT_NEW_FACE_FOR_PRESIDENT}, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
967 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 90, 179, 158, 169, STR_7005_COLOR_SCHEME, STR_7031_CHANGE_THE_COMPANY_VEHICLE}, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
968 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 180, 269, 158, 169, STR_7009_PRESIDENT_NAME, STR_7032_CHANGE_THE_PRESIDENT_S}, |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
969 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 270, 359, 158, 169, STR_7008_COMPANY_NAME, STR_7033_CHANGE_THE_COMPANY_NAME}, |
4808
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
970 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 266, 355, 18, 29, STR_7072_VIEW_HQ, STR_7070_BUILD_COMPANY_HEADQUARTERS}, |
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
971 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 266, 355, 32, 43, STR_RELOCATE_HQ, STR_RELOCATE_COMPANY_HEADQUARTERS}, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
972 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 179, 158, 169, STR_7077_BUY_25_SHARE_IN_COMPANY, STR_7079_BUY_25_SHARE_IN_THIS_COMPANY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
973 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 180, 359, 158, 169, STR_7078_SELL_25_SHARE_IN_COMPANY, STR_707A_SELL_25_SHARE_IN_THIS_COMPANY}, |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
974 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 266, 355, 138, 149, STR_COMPANY_PASSWORD, STR_COMPANY_PASSWORD_TOOLTIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
150
diff
changeset
|
975 |
{ WIDGETS_END}, |
0 | 976 |
}; |
977 |
||
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2246
diff
changeset
|
978 |
static void DrawPlayerVehiclesAmount(PlayerID player) |
0 | 979 |
{ |
980 |
const int x = 110; |
|
981 |
int y = 72; |
|
4171 | 982 |
const Vehicle *v; |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
983 |
uint train = 0; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
984 |
uint road = 0; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
985 |
uint air = 0; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
986 |
uint ship = 0; |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
987 |
|
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
988 |
DrawString(x, y, STR_7039_VEHICLES, TC_FROMSTRING); |
0 | 989 |
|
990 |
FOR_ALL_VEHICLES(v) { |
|
991 |
if (v->owner == player) { |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
992 |
switch (v->type) { |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6248
diff
changeset
|
993 |
case VEH_TRAIN: if (IsFrontEngine(v)) train++; break; |
6857
60130753e595
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
6769
diff
changeset
|
994 |
case VEH_ROAD: if (IsRoadVehFront(v)) road++; break; |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6248
diff
changeset
|
995 |
case VEH_AIRCRAFT: if (IsNormalAircraft(v)) air++; break; |
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6248
diff
changeset
|
996 |
case VEH_SHIP: ship++; break; |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2630
diff
changeset
|
997 |
default: break; |
0 | 998 |
} |
999 |
} |
|
1000 |
} |
|
1001 |
||
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
1002 |
if (train + road + air + ship == 0) { |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1003 |
DrawString(x + 70, y, STR_7042_NONE, TC_FROMSTRING); |
0 | 1004 |
} else { |
1005 |
if (train != 0) { |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1006 |
SetDParam(0, train); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1007 |
DrawString(x + 70, y, STR_TRAINS, TC_FROMSTRING); |
0 | 1008 |
y += 10; |
1009 |
} |
|
1010 |
||
1011 |
if (road != 0) { |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1012 |
SetDParam(0, road); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1013 |
DrawString(x + 70, y, STR_ROAD_VEHICLES, TC_FROMSTRING); |
0 | 1014 |
y += 10; |
1015 |
} |
|
1016 |
||
1017 |
if (air != 0) { |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1018 |
SetDParam(0, air); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1019 |
DrawString(x + 70, y, STR_AIRCRAFT, TC_FROMSTRING); |
0 | 1020 |
y += 10; |
1021 |
} |
|
1022 |
||
1023 |
if (ship != 0) { |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1024 |
SetDParam(0, ship); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1025 |
DrawString(x + 70, y, STR_SHIPS, TC_FROMSTRING); |
0 | 1026 |
} |
1027 |
} |
|
1028 |
} |
|
1029 |
||
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2246
diff
changeset
|
1030 |
int GetAmountOwnedBy(const Player *p, PlayerID owner) |
0 | 1031 |
{ |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
1032 |
return (p->share_owners[0] == owner) + |
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
1033 |
(p->share_owners[1] == owner) + |
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
1034 |
(p->share_owners[2] == owner) + |
0 | 1035 |
(p->share_owners[3] == owner); |
1036 |
} |
|
1037 |
||
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2246
diff
changeset
|
1038 |
static void DrawCompanyOwnerText(const Player *p) |
0 | 1039 |
{ |
4171 | 1040 |
const Player *p2; |
7884
46547eab1ac8
(svn r11435) -Codechange: show all players who have shares, not just the first two. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
1041 |
uint num = 0; |
46547eab1ac8
(svn r11435) -Codechange: show all players who have shares, not just the first two. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
1042 |
const byte height = GetCharacterHeight(FS_NORMAL); |
0 | 1043 |
|
1044 |
FOR_ALL_PLAYERS(p2) { |
|
2549 | 1045 |
uint amt = GetAmountOwnedBy(p, p2->index); |
1046 |
if (amt != 0) { |
|
7884
46547eab1ac8
(svn r11435) -Codechange: show all players who have shares, not just the first two. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
1047 |
SetDParam(0, amt * 25); |
46547eab1ac8
(svn r11435) -Codechange: show all players who have shares, not just the first two. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
1048 |
SetDParam(1, p2->index); |
0 | 1049 |
|
7884
46547eab1ac8
(svn r11435) -Codechange: show all players who have shares, not just the first two. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
1050 |
DrawString(120, (num++) * height + 116, STR_707D_OWNED_BY, TC_FROMSTRING); |
0 | 1051 |
} |
1052 |
} |
|
1053 |
} |
|
1054 |
||
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
1055 |
/** |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
1056 |
* Player company window event definition |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
1057 |
* |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
1058 |
* @param w window pointer |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
1059 |
* @param e event been triggered |
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
1060 |
*/ |
0 | 1061 |
static void PlayerCompanyWndProc(Window *w, WindowEvent *e) |
1062 |
{ |
|
2549 | 1063 |
switch (e->event) { |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1064 |
case WE_PAINT: { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1065 |
const Player *p = GetPlayer((PlayerID)w->window_number); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1066 |
bool local = w->window_number == _local_player; |
1811
d5fa1c37e192
(svn r2315) - Fix: [ 1187613 ] No HQ present for competitor, disable 'View HQ' button, inspired by lucaspiller
Darkvater
parents:
1793
diff
changeset
|
1067 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1068 |
SetWindowWidgetHiddenState(w, PCW_WIDGET_NEW_FACE, !local); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1069 |
SetWindowWidgetHiddenState(w, PCW_WIDGET_COLOR_SCHEME, !local); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1070 |
SetWindowWidgetHiddenState(w, PCW_WIDGET_PRESIDENT_NAME, !local); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1071 |
SetWindowWidgetHiddenState(w, PCW_WIDGET_COMPANY_NAME, !local); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1072 |
w->widget[PCW_WIDGET_BUILD_VIEW_HQ].data = (local && p->location_of_house == 0) ? STR_706F_BUILD_HQ : STR_7072_VIEW_HQ; |
4808
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1073 |
if (local && p->location_of_house != 0) w->widget[PCW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; //HQ is already built. |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1074 |
SetWindowWidgetDisabledState(w, PCW_WIDGET_BUILD_VIEW_HQ, !local && p->location_of_house == 0); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1075 |
SetWindowWidgetHiddenState(w, PCW_WIDGET_RELOCATE_HQ, !local || p->location_of_house == 0); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1076 |
SetWindowWidgetHiddenState(w, PCW_WIDGET_BUY_SHARE, local); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1077 |
SetWindowWidgetHiddenState(w, PCW_WIDGET_SELL_SHARE, local); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1078 |
SetWindowWidgetHiddenState(w, PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking); |
930
ab42e283749d
(svn r1418) -Feature: [1098254] (dis)Allow Shares. Add patch options to allow buying/selling of shares (Hackykid)
darkvater
parents:
917
diff
changeset
|
1079 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1080 |
if (!local) { |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1081 |
if (_patches.allow_shares) { // Shares are allowed |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1082 |
/* If all shares are owned by someone (none by nobody), disable buy button */ |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
1083 |
SetWindowWidgetDisabledState(w, PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 || |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1084 |
/* Only 25% left to buy. If the player is human, disable buying it up.. TODO issues! */ |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
1085 |
(GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 1 && !p->is_ai) || |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1086 |
/* Spectators cannot do anything of course */ |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
1087 |
_local_player == PLAYER_SPECTATOR); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1088 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1089 |
/* If the player doesn't own any shares, disable sell button */ |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1090 |
SetWindowWidgetDisabledState(w, PCW_WIDGET_SELL_SHARE, (GetAmountOwnedBy(p, _local_player) == 0) || |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1091 |
/* Spectators cannot do anything of course */ |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
1092 |
_local_player == PLAYER_SPECTATOR); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1093 |
} else { // Shares are not allowed, disable buy/sell buttons |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1094 |
DisableWindowWidget(w, PCW_WIDGET_BUY_SHARE); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1095 |
DisableWindowWidget(w, PCW_WIDGET_SELL_SHARE); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1096 |
} |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4000
diff
changeset
|
1097 |
} |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1098 |
|
7058
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1099 |
SetDParam(0, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1100 |
SetDParam(1, p->index); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1101 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1102 |
DrawWindowWidgets(w); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1103 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1104 |
SetDParam(0, p->inaugurated_year); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1105 |
DrawString(110, 25, STR_7038_INAUGURATED, TC_FROMSTRING); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1106 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1107 |
DrawPlayerVehiclesAmount((PlayerID)w->window_number); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1108 |
|
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1109 |
DrawString(110, 48, STR_7006_COLOR_SCHEME, TC_FROMSTRING); |
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
1110 |
/* Draw company-colour bus */ |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
1111 |
DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 49); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1112 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1113 |
DrawPlayerFace(p->face, p->player_color, 2, 16); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1114 |
|
7058
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1115 |
SetDParam(0, p->index); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1116 |
DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, 94); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1117 |
|
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
1118 |
SetDParam(0, CalculateCompanyValue(p)); |
7884
46547eab1ac8
(svn r11435) -Codechange: show all players who have shares, not just the first two. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
1119 |
DrawString(110, 106, STR_7076_COMPANY_VALUE, TC_FROMSTRING); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1120 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1121 |
DrawCompanyOwnerText(p); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1122 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1123 |
break; |
773
a376cebd3dc0
(svn r1239) -Feature: Added gui option of setting company password. It can be found in the 'company information' window
darkvater
parents:
669
diff
changeset
|
1124 |
} |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
1125 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1126 |
case WE_CLICK: |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1127 |
switch (e->we.click.widget) { |
7734
627817106768
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
7521
diff
changeset
|
1128 |
case PCW_WIDGET_NEW_FACE: DoSelectPlayerFace((PlayerID)w->window_number, false); break; |
0 | 1129 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1130 |
case PCW_WIDGET_COLOR_SCHEME: { |
6914
6219e65dd7bf
(svn r10167) -Codechange: Change the flagging system of grf loaded feature from a bitset to a bool evaluation.
belugas
parents:
6909
diff
changeset
|
1131 |
Window *wf = AllocateWindowDescFront(_loaded_newgrf_features.has_2CC ? &_select_player_livery_2cc_desc : &_select_player_livery_desc, w->window_number); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1132 |
if (wf != NULL) { |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1133 |
wf->caption_color = wf->window_number; |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
1134 |
WP(wf, livery_d).livery_class = LC_OTHER; |
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
1135 |
WP(wf, livery_d).sel = 1; |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1136 |
LowerWindowWidget(wf, 2); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1137 |
} |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1138 |
break; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1139 |
} |
0 | 1140 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1141 |
case PCW_WIDGET_PRESIDENT_NAME: { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1142 |
const Player *p = GetPlayer((PlayerID)w->window_number); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1143 |
WP(w, def_d).byte_1 = 0; |
7058
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1144 |
SetDParam(0, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1145 |
ShowQueryString(STR_PLAYER_NAME, STR_700B_PRESIDENT_S_NAME, 31, 94, w, CS_ALPHANUMERAL); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1146 |
break; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1147 |
} |
0 | 1148 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1149 |
case PCW_WIDGET_COMPANY_NAME: { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1150 |
Player *p = GetPlayer((PlayerID)w->window_number); |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
1151 |
WP(w, def_d).byte_1 = 1; |
7058
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1152 |
SetDParam(0, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1153 |
ShowQueryString(STR_COMPANY_NAME, STR_700A_COMPANY_NAME, 31, 150, w, CS_ALPHANUMERAL); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1154 |
break; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1155 |
} |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1156 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1157 |
case PCW_WIDGET_BUILD_VIEW_HQ: { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1158 |
TileIndex tile = GetPlayer((PlayerID)w->window_number)->location_of_house; |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1159 |
if (tile == 0) { |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1160 |
if ((byte)w->window_number != _local_player) |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1161 |
return; |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7884
diff
changeset
|
1162 |
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, w); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1163 |
SetTileSelectSize(2, 2); |
4808
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1164 |
LowerWindowWidget(w, PCW_WIDGET_BUILD_VIEW_HQ); |
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1165 |
InvalidateWidget(w, PCW_WIDGET_BUILD_VIEW_HQ); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1166 |
} else { |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1167 |
ScrollMainWindowToTile(tile); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1168 |
} |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1169 |
break; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1170 |
} |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1171 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1172 |
case PCW_WIDGET_RELOCATE_HQ: |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7884
diff
changeset
|
1173 |
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, w); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1174 |
SetTileSelectSize(2, 2); |
4808
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1175 |
LowerWindowWidget(w, PCW_WIDGET_RELOCATE_HQ); |
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1176 |
InvalidateWidget(w, PCW_WIDGET_RELOCATE_HQ); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1177 |
break; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1178 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1179 |
case PCW_WIDGET_BUY_SHARE: |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1180 |
DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_SHARE_IN_COMPANY | CMD_MSG(STR_707B_CAN_T_BUY_25_SHARE_IN_THIS)); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1181 |
break; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1182 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1183 |
case PCW_WIDGET_SELL_SHARE: |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1184 |
DoCommandP(0, w->window_number, 0, NULL, CMD_SELL_SHARE_IN_COMPANY | CMD_MSG(STR_707C_CAN_T_SELL_25_SHARE_IN)); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1185 |
break; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1186 |
|
4830
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4808
diff
changeset
|
1187 |
#ifdef ENABLE_NETWORK |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1188 |
case PCW_WIDGET_COMPANY_PASSWORD: |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1189 |
if (w->window_number == _local_player) { |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
1190 |
WP(w, def_d).byte_1 = 2; |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1191 |
ShowQueryString(BindCString(_network_player_info[_local_player].password), |
5431
6e56b4f13dd7
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5273
diff
changeset
|
1192 |
STR_SET_COMPANY_PASSWORD, sizeof(_network_player_info[_local_player].password), 250, w, CS_ALPHANUMERAL); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1193 |
} |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1194 |
break; |
4830
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4808
diff
changeset
|
1195 |
#endif /* ENABLE_NETWORK */ |
200
03b8104d1479
(svn r201) -Fix: [1025836] Company values bigger dan int32 were put to negative
truelight
parents:
186
diff
changeset
|
1196 |
} |
917
f30b62dce860
(svn r1404) -Fix: Company password no longer shares a widget with buying shares
darkvater
parents:
914
diff
changeset
|
1197 |
break; |
f30b62dce860
(svn r1404) -Fix: Company password no longer shares a widget with buying shares
darkvater
parents:
914
diff
changeset
|
1198 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1199 |
case WE_MOUSELOOP: |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1200 |
/* redraw the window every now and then */ |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1201 |
if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); |
917
f30b62dce860
(svn r1404) -Fix: Company password no longer shares a widget with buying shares
darkvater
parents:
914
diff
changeset
|
1202 |
break; |
147
d0c8100d18cf
(svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater
parents:
16
diff
changeset
|
1203 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1204 |
case WE_PLACE_OBJ: |
7521
0da1e91510e4
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7513
diff
changeset
|
1205 |
if (DoCommandP(e->we.place.tile, 0, 0, NULL, CMD_BUILD_COMPANY_HQ | CMD_NO_WATER | CMD_MSG(STR_7071_CAN_T_BUILD_COMPANY_HEADQUARTERS))) |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1206 |
ResetObjectToPlace(); |
4808
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1207 |
w->widget[PCW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; // this button can now behave as a normal push button |
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1208 |
RaiseWindowButtons(w); |
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1209 |
break; |
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1210 |
|
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1211 |
case WE_ABORT_PLACE_OBJ: |
07bc43331422
(svn r6730) Fix: Make Build HQ and Relocate HQ buttons of Player window behave as normal placement buttons, and not as push buttons.
belugas
parents:
4805
diff
changeset
|
1212 |
RaiseWindowButtons(w); |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1213 |
break; |
773
a376cebd3dc0
(svn r1239) -Feature: Added gui option of setting company password. It can be found in the 'company information' window
darkvater
parents:
669
diff
changeset
|
1214 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1215 |
case WE_DESTROY: |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1216 |
DeleteWindowById(WC_PLAYER_FACE, w->window_number); |
773
a376cebd3dc0
(svn r1239) -Feature: Added gui option of setting company password. It can be found in the 'company information' window
darkvater
parents:
669
diff
changeset
|
1217 |
break; |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1218 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1219 |
case WE_ON_EDIT_TEXT: { |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1220 |
char *b = e->we.edittext.str; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1221 |
|
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
1222 |
/* empty string is allowed for password */ |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
1223 |
if (*b == '\0' && WP(w, def_d).byte_1 != 2) return; |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1224 |
|
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1225 |
_cmd_text = b; |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6352
diff
changeset
|
1226 |
switch (WP(w, def_d).byte_1) { |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1227 |
case 0: /* Change president name */ |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1228 |
DoCommandP(0, 0, 0, NULL, CMD_CHANGE_PRESIDENT_NAME | CMD_MSG(STR_700D_CAN_T_CHANGE_PRESIDENT)); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1229 |
break; |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1230 |
case 1: /* Change company name */ |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1231 |
DoCommandP(0, 0, 0, NULL, CMD_CHANGE_COMPANY_NAME | CMD_MSG(STR_700C_CAN_T_CHANGE_COMPANY_NAME)); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1232 |
break; |
4830
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4808
diff
changeset
|
1233 |
#ifdef ENABLE_NETWORK |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1234 |
case 2: /* Change company password */ |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1235 |
if (*b == '\0') *b = '*'; // empty password is a '*' because of console argument |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1236 |
NetworkChangeCompanyPassword(1, &b); |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1237 |
break; |
4830
668bcb0a30b2
(svn r6754) -Codechange: Remove some #idef ENABLE_NETWORK specific defines. With networking
Darkvater
parents:
4808
diff
changeset
|
1238 |
#endif /* ENABLE_NETWORK */ |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1239 |
} |
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1240 |
break; |
0 | 1241 |
} |
1242 |
} |
|
1243 |
} |
|
1244 |
||
1245 |
||
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1246 |
static const WindowDesc _player_company_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7266
diff
changeset
|
1247 |
WDP_AUTO, WDP_AUTO, 360, 170, 360, 170, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
1248 |
WC_COMPANY, WC_NONE, |
0 | 1249 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1250 |
_player_company_widgets, |
0 | 1251 |
PlayerCompanyWndProc |
1252 |
}; |
|
1253 |
||
2475 | 1254 |
void ShowPlayerCompany(PlayerID player) |
0 | 1255 |
{ |
4171 | 1256 |
Window *w; |
2639 | 1257 |
|
5005
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4998
diff
changeset
|
1258 |
if (!IsValidPlayer(player)) return; |
f5086bd3945a
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4998
diff
changeset
|
1259 |
|
4746
2951243a88de
(svn r6658) -CodeChange: cleaned up the PlayerCompanyWindow code
glx
parents:
4744
diff
changeset
|
1260 |
w = AllocateWindowDescFront(&_player_company_desc, player); |
2639 | 1261 |
if (w != NULL) w->caption_color = w->window_number; |
0 | 1262 |
} |
1263 |
||
1264 |
||
1265 |
||
1266 |
static void BuyCompanyWndProc(Window *w, WindowEvent *e) |
|
1267 |
{ |
|
2952 | 1268 |
switch (e->event) { |
0 | 1269 |
case WE_PAINT: { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1270 |
Player *p = GetPlayer((PlayerID)w->window_number); |
7141
39823e423a72
(svn r10415) -Revert (r10403), Fix (r10323): 'message from company' test must use {STRING1}, so pass it the correct params
glx
parents:
7058
diff
changeset
|
1271 |
SetDParam(0, STR_COMPANY_NAME); |
39823e423a72
(svn r10415) -Revert (r10403), Fix (r10323): 'message from company' test must use {STRING1}, so pass it the correct params
glx
parents:
7058
diff
changeset
|
1272 |
SetDParam(1, p->index); |
0 | 1273 |
DrawWindowWidgets(w); |
1274 |
||
1275 |
DrawPlayerFace(p->face, p->player_color, 2, 16); |
|
1276 |
||
7058
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1277 |
SetDParam(0, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1278 |
SetDParam(1, p->bankrupt_value); |
0 | 1279 |
DrawStringMultiCenter(214, 65, STR_705B_WE_ARE_LOOKING_FOR_A_TRANSPORT, 238); |
1280 |
break; |
|
1281 |
} |
|
1282 |
||
1283 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4605
diff
changeset
|
1284 |
switch (e->we.click.widget) { |
0 | 1285 |
case 3: |
1286 |
DeleteWindow(w); |
|
1287 |
break; |
|
1288 |
case 4: { |
|
1289 |
DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY)); |
|
1290 |
break; |
|
1291 |
} |
|
1292 |
} |
|
1293 |
break; |
|
1294 |
} |
|
1295 |
} |
|
1296 |
||
1297 |
static const Widget _buy_company_widgets[] = { |
|
3326
00cf690a7fe1
(svn r4092) CodeChange : Named sprites instead of magic numbers plus create/use helper macro/enum for recoloring scheme
belugas
parents:
2952
diff
changeset
|
1298 |
{ WWT_CLOSEBOX, RESIZE_NONE, 5, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
00cf690a7fe1
(svn r4092) CodeChange : Named sprites instead of magic numbers plus create/use helper macro/enum for recoloring scheme
belugas
parents:
2952
diff
changeset
|
1299 |
{ WWT_CAPTION, RESIZE_NONE, 5, 11, 333, 0, 13, STR_00B3_MESSAGE_FROM, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
1300 |
{ WWT_PANEL, RESIZE_NONE, 5, 0, 333, 14, 136, 0x0, STR_NULL}, |
3326
00cf690a7fe1
(svn r4092) CodeChange : Named sprites instead of magic numbers plus create/use helper macro/enum for recoloring scheme
belugas
parents:
2952
diff
changeset
|
1301 |
{ WWT_TEXTBTN, RESIZE_NONE, 5, 148, 207, 117, 128, STR_00C9_NO, STR_NULL}, |
00cf690a7fe1
(svn r4092) CodeChange : Named sprites instead of magic numbers plus create/use helper macro/enum for recoloring scheme
belugas
parents:
2952
diff
changeset
|
1302 |
{ WWT_TEXTBTN, RESIZE_NONE, 5, 218, 277, 117, 128, STR_00C8_YES, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
150
diff
changeset
|
1303 |
{ WIDGETS_END}, |
0 | 1304 |
}; |
1305 |
||
1306 |
static const WindowDesc _buy_company_desc = { |
|
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7266
diff
changeset
|
1307 |
153, 171, 334, 137, 334, 137, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
1308 |
WC_BUY_COMPANY, WC_NONE, |
0 | 1309 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1310 |
_buy_company_widgets, |
|
1311 |
BuyCompanyWndProc |
|
1312 |
}; |
|
1313 |
||
1314 |
||
1315 |
void ShowBuyCompanyDialog(uint player) |
|
1316 |
{ |
|
1317 |
AllocateWindowDescFront(&_buy_company_desc, player); |
|
1318 |
} |
|
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1319 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1320 |
/********** HIGHSCORE and ENDGAME windows */ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1321 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1322 |
/* Always draw a maximized window and within there the centered background */ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1323 |
static void SetupHighScoreEndWindow(Window *w, uint *x, uint *y) |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1324 |
{ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1325 |
uint i; |
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
1326 |
/* resize window to "full-screen" */ |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1327 |
w->width = _screen.width; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1328 |
w->height = _screen.height; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1329 |
w->widget[0].right = w->width - 1; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1330 |
w->widget[0].bottom = w->height - 1; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1331 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1332 |
DrawWindowWidgets(w); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1333 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1334 |
/* Center Highscore/Endscreen background */ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1335 |
*x = max(0, (_screen.width / 2) - (640 / 2)); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1336 |
*y = max(0, (_screen.height / 2) - (480 / 2)); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1337 |
for (i = 0; i < 10; i++) // the image is split into 10 50px high parts |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5587
diff
changeset
|
1338 |
DrawSprite(WP(w, highscore_d).background_img + i, PAL_NONE, *x, *y + (i * 50)); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1339 |
} |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1340 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1341 |
extern StringID EndGameGetPerformanceTitleFromValue(uint value); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1342 |
|
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
1343 |
/** End game window shown at the end of the game */ |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1344 |
static void EndGameWndProc(Window *w, WindowEvent *e) |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1345 |
{ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1346 |
switch (e->event) { |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1347 |
case WE_PAINT: { |
4998
4aac6506e2ae
(svn r7008) -Fix [FS#369]: Crash at game end when server company is bankrupt
Darkvater
parents:
4938
diff
changeset
|
1348 |
const Player *p; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1349 |
uint x, y; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1350 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1351 |
SetupHighScoreEndWindow(w, &x, &y); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1352 |
|
4998
4aac6506e2ae
(svn r7008) -Fix [FS#369]: Crash at game end when server company is bankrupt
Darkvater
parents:
4938
diff
changeset
|
1353 |
if (!IsValidPlayer(_local_player)) break; |
4aac6506e2ae
(svn r7008) -Fix [FS#369]: Crash at game end when server company is bankrupt
Darkvater
parents:
4938
diff
changeset
|
1354 |
|
4aac6506e2ae
(svn r7008) -Fix [FS#369]: Crash at game end when server company is bankrupt
Darkvater
parents:
4938
diff
changeset
|
1355 |
p = GetPlayer(_local_player); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1356 |
/* We need to get performance from last year because the image is shown |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1357 |
* at the start of the new year when these things have already been copied */ |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1358 |
if (WP(w, highscore_d).background_img == SPR_TYCOON_IMG2_BEGIN) { // Tycoon of the century \o/ |
7058
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1359 |
SetDParam(0, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1360 |
SetDParam(1, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1361 |
SetDParam(2, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history)); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1362 |
DrawStringMultiCenter(x + (640 / 2), y + 107, STR_021C_OF_ACHIEVES_STATUS, 640); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1363 |
} else { |
7058
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1364 |
SetDParam(0, p->index); |
8105bb13ce3d
(svn r10323) -Codechange: reference company name, number and player (president) name
peter1138
parents:
7002
diff
changeset
|
1365 |
SetDParam(1, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history)); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1366 |
DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1367 |
} |
1017
b09bae77a850
(svn r1518) -Fix: server issue where some company names were wrong
darkvater
parents:
1016
diff
changeset
|
1368 |
} break; |
1839
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1369 |
case WE_CLICK: /* Close the window (and show the highscore window) */ |
1016
75b12fe9c4e1
(svn r1516) -Cheating players do not get their names added to the highscore table/file
darkvater
parents:
1007
diff
changeset
|
1370 |
DeleteWindow(w); |
1875
f7155c837fa2
(svn r2381) - Fix: [ 1210610 ] Endgame window on easy difficulty results in infinite loop. Oops. Seperated the window classes of endgame and highscreen.
Darkvater
parents:
1839
diff
changeset
|
1371 |
break; |
1839
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1372 |
case WE_DESTROY: /* Show the highscore window when this one is closed */ |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1373 |
if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1374 |
ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank); |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1375 |
break; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1376 |
} |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1377 |
} |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1378 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1379 |
static void HighScoreWndProc(Window *w, WindowEvent *e) |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1380 |
{ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1381 |
switch (e->event) { |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1382 |
case WE_PAINT: { |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1383 |
const HighScore *hs = _highscore_table[w->window_number]; |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1384 |
uint x, y; |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1385 |
uint8 i; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1386 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1387 |
SetupHighScoreEndWindow(w, &x, &y); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1388 |
|
4285
19cb745c694e
(svn r5915) -Cleanup: some variables were named *_date while they were only holding years; rename these variables to match this.
rubidium
parents:
4261
diff
changeset
|
1389 |
SetDParam(0, _patches.ending_year); |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1390 |
SetDParam(1, w->window_number + STR_6801_EASY); |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1391 |
DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1392 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1393 |
/* Draw Highscore peepz */ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1394 |
for (i = 0; i < lengthof(_highscore_table[0]); i++) { |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1395 |
SetDParam(0, i + 1); |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1396 |
DrawString(x + 40, y + 140 + (i * 55), STR_0212, TC_BLACK); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1397 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1398 |
if (hs[i].company[0] != '\0') { |
7824
5a63d41b59ea
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
7734
diff
changeset
|
1399 |
TextColour colour = (WP(w, highscore_d).rank == (int8)i) ? TC_RED : TC_BLACK; // draw new highscore in red |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1400 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1401 |
DoDrawString(hs[i].company, x + 71, y + 140 + (i * 55), colour); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1402 |
SetDParam(0, hs[i].title); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1403 |
SetDParam(1, hs[i].score); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1404 |
DrawString(x + 71, y + 160 + (i * 55), STR_HIGHSCORE_STATS, colour); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1405 |
} |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1406 |
} |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1017
diff
changeset
|
1407 |
} break; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1408 |
|
1839
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1409 |
case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */ |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1410 |
DeleteWindow(w); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1411 |
break; |
1839
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1412 |
|
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1413 |
case WE_DESTROY: /* Get back all the hidden windows */ |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1414 |
if (_game_mode != GM_MENU) ShowVitalWindows(); |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1415 |
|
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1416 |
if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1417 |
break; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1418 |
} |
1839
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1419 |
} |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1420 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1421 |
static const Widget _highscore_widgets[] = { |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1422 |
{ WWT_PANEL, RESIZE_NONE, 16, 0, 640, 0, 480, 0x0, STR_NULL}, |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1423 |
{ WIDGETS_END}, |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1424 |
}; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1425 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1426 |
static const WindowDesc _highscore_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7266
diff
changeset
|
1427 |
0, 0, 641, 481, 641, 481, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
1428 |
WC_HIGHSCORE, WC_NONE, |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1429 |
0, |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1430 |
_highscore_widgets, |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1431 |
HighScoreWndProc |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1432 |
}; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1433 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1434 |
static const WindowDesc _endgame_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7266
diff
changeset
|
1435 |
0, 0, 641, 481, 641, 481, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5854
diff
changeset
|
1436 |
WC_ENDSCREEN, WC_NONE, |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1437 |
0, |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1438 |
_highscore_widgets, |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1439 |
EndGameWndProc |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1440 |
}; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1441 |
|
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
1442 |
/** Show the highscore table for a given difficulty. When called from |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1443 |
* endgame ranking is set to the top5 element that was newly added |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1444 |
* and is thus highlighted */ |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1445 |
void ShowHighscoreTable(int difficulty, int8 ranking) |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1446 |
{ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1447 |
Window *w; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1448 |
|
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
1449 |
/* pause game to show the chart */ |
1839
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1450 |
if (!_networking) DoCommandP(0, 1, 0, NULL, CMD_PAUSE); |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1451 |
|
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1452 |
/* Close all always on-top windows to get a clean screen */ |
2639 | 1453 |
if (_game_mode != GM_MENU) HideVitalWindows(); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1454 |
|
1875
f7155c837fa2
(svn r2381) - Fix: [ 1210610 ] Endgame window on easy difficulty results in infinite loop. Oops. Seperated the window classes of endgame and highscreen.
Darkvater
parents:
1839
diff
changeset
|
1455 |
DeleteWindowByClass(WC_HIGHSCORE); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1456 |
w = AllocateWindowDesc(&_highscore_desc); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1457 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1458 |
if (w != NULL) { |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1459 |
MarkWholeScreenDirty(); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1460 |
w->window_number = difficulty; // show highscore chart for difficulty... |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1461 |
WP(w, highscore_d).background_img = SPR_HIGHSCORE_CHART_BEGIN; // which background to show |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1462 |
WP(w, highscore_d).rank = ranking; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1463 |
} |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1464 |
} |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1465 |
|
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
1466 |
/** Show the endgame victory screen in 2050. Update the new highscore |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1467 |
* if it was high enough */ |
6247 | 1468 |
void ShowEndGameChart() |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1469 |
{ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1470 |
Window *w; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1471 |
|
1839
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1472 |
/* Dedicated server doesn't need the highscore window */ |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1473 |
if (_network_dedicated) return; |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1474 |
/* Pause in single-player to have a look at the highscore at your own leisure */ |
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1475 |
if (!_networking) DoCommandP(0, 1, 0, NULL, CMD_PAUSE); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1476 |
|
1839
f64935a60abb
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
Darkvater
parents:
1824
diff
changeset
|
1477 |
HideVitalWindows(); |
1875
f7155c837fa2
(svn r2381) - Fix: [ 1210610 ] Endgame window on easy difficulty results in infinite loop. Oops. Seperated the window classes of endgame and highscreen.
Darkvater
parents:
1839
diff
changeset
|
1478 |
DeleteWindowByClass(WC_ENDSCREEN); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1479 |
w = AllocateWindowDesc(&_endgame_desc); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1480 |
|
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1481 |
if (w != NULL) { |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1482 |
MarkWholeScreenDirty(); |
1077
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1483 |
|
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1484 |
WP(w, highscore_d).background_img = SPR_TYCOON_IMG1_BEGIN; |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1485 |
|
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4830
diff
changeset
|
1486 |
if (_local_player != PLAYER_SPECTATOR) { |
1962
8254df1b359b
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1914
diff
changeset
|
1487 |
const Player *p = GetPlayer(_local_player); |
1077
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1488 |
if (p->old_economy[0].performance_history == SCORE_MAX) |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1489 |
WP(w, highscore_d).background_img = SPR_TYCOON_IMG2_BEGIN; |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1490 |
} |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1491 |
|
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
1492 |
/* In a network game show the endscores of the custom difficulty 'network' which is the last one |
1077
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1493 |
* as well as generate a TOP5 of that game, and not an all-time top5. */ |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1494 |
if (_networking) { |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1495 |
w->window_number = lengthof(_highscore_table) - 1; |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1496 |
WP(w, highscore_d).rank = SaveHighScoreValueNetwork(); |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1497 |
} else { |
6352
938ab8f48e5d
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6259
diff
changeset
|
1498 |
/* in single player _local player is always valid */ |
1962
8254df1b359b
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1914
diff
changeset
|
1499 |
const Player *p = GetPlayer(_local_player); |
1077
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1500 |
w->window_number = _opt.diff_level; |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1501 |
WP(w, highscore_d).rank = SaveHighScoreValue(p); |
7da1f53526cd
(svn r1578) -Fix: [1102454] dedicated server crashes after some hours (highscore problems for dedicated...should be really solved now)
darkvater
parents:
1067
diff
changeset
|
1502 |
} |
1109
ecb98f43ba2c
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1077
diff
changeset
|
1503 |
} |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
930
diff
changeset
|
1504 |
} |