Mercurial > hg > openttd
annotate src/company_gui.cpp @ 11504:898be4863fa6 draft
(svn r15865) -Codechange: New widgets for company finances windows
author | glx <glx@openttd.org> |
---|---|
date | Fri, 27 Mar 2009 22:59:43 +0000 |
parents | 9272c49b41d7 |
children | 06e6021a10f2 |
rev | line source |
---|---|
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
3 /** @file company_gui.cpp Company related GUIs. */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
4 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
5 #include "stdafx.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
6 #include "gui.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
7 #include "window_gui.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
8 #include "textbuf_gui.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
9 #include "viewport_func.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 #include "gfx_func.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 #include "company_func.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 #include "command_func.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 #include "network/network.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 #include "network/network_gui.h" |
10907
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
15 #include "network/network_func.h" |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
16 #include "roadveh.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
17 #include "train.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
18 #include "aircraft.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
19 #include "newgrf.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
20 #include "company_manager_face.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
21 #include "strings_func.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
22 #include "date_func.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 #include "string_func.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 #include "widgets/dropdown_type.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
25 #include "tilehighlight_func.h" |
10960
a4e5b5d2837c
(svn r15299) -Cleanup: remove many redundant includes
smatz <smatz@openttd.org>
parents:
10912
diff
changeset
|
26 #include "settings_type.h" |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
27 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
28 #include "table/strings.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
29 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
30 enum { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
31 FIRST_GUI_CALL = INT_MAX, ///< default value to specify thuis is the first call of the resizable gui |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
32 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
33 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
34 static void DoShowCompanyFinances(CompanyID company, bool show_small, bool show_stickied, int top = FIRST_GUI_CALL, int left = FIRST_GUI_CALL); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
35 static void DoSelectCompanyManagerFace(Window *parent, bool show_big, int top = FIRST_GUI_CALL, int left = FIRST_GUI_CALL); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
36 |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
37 /** Standard unsorted list of expenses. */ |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
38 static ExpensesType _expenses_list_1[] = { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
39 EXPENSES_CONSTRUCTION, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
40 EXPENSES_NEW_VEHICLES, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
41 EXPENSES_TRAIN_RUN, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
42 EXPENSES_ROADVEH_RUN, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
43 EXPENSES_AIRCRAFT_RUN, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
44 EXPENSES_SHIP_RUN, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
45 EXPENSES_PROPERTY, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
46 EXPENSES_TRAIN_INC, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
47 EXPENSES_ROADVEH_INC, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
48 EXPENSES_AIRCRAFT_INC, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
49 EXPENSES_SHIP_INC, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
50 EXPENSES_LOAN_INT, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
51 EXPENSES_OTHER, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
52 }; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
53 |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
54 /** Grouped list of expenses. */ |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
55 static ExpensesType _expenses_list_2[] = { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
56 EXPENSES_TRAIN_INC, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
57 EXPENSES_ROADVEH_INC, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
58 EXPENSES_AIRCRAFT_INC, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
59 EXPENSES_SHIP_INC, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
60 INVALID_EXPENSES, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
61 EXPENSES_TRAIN_RUN, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
62 EXPENSES_ROADVEH_RUN, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
63 EXPENSES_AIRCRAFT_RUN, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
64 EXPENSES_SHIP_RUN, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
65 EXPENSES_PROPERTY, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
66 EXPENSES_LOAN_INT, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
67 INVALID_EXPENSES, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
68 EXPENSES_CONSTRUCTION, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
69 EXPENSES_NEW_VEHICLES, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
70 EXPENSES_OTHER, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
71 INVALID_EXPENSES, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
72 }; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
73 |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
74 /** Expense list container. */ |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
75 struct ExpensesList { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
76 const ExpensesType *et; ///< Expenses items. |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
77 const int length; ///< Number of items in list. |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
78 const int height; ///< Height of list, 10 pixels per item, plus an additional 12 pixels per subtotal. */ |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
79 }; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
80 |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
81 static const ExpensesList _expenses_list_types[] = { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
82 { _expenses_list_1, lengthof(_expenses_list_1), lengthof(_expenses_list_1) * 10 }, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
83 { _expenses_list_2, lengthof(_expenses_list_2), lengthof(_expenses_list_2) * 10 + 3 * 12 }, |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
84 }; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
85 |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
86 /** Widgets of the company finances windows */ |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
87 enum CompanyFinancesWindowWidgets { |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
88 CFW_CLOSEBOX = 0, ///< Close the window |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
89 CFW_CAPTION, ///< Caption of the window |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
90 CFW_TOGGLE_SIZE, ///< Toggle windows size |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
91 CFW_STICKY, ///< Sticky button |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
92 CFW_EXPS_PANEL, ///< Panel for expenses |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
93 CFW_EXPS_CATEGORY, ///< Column for expenses category strings |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
94 CFW_EXPS_PRICE1, ///< Column for year Y-2 expenses |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
95 CFW_EXPS_PRICE2, ///< Column for year Y-1 expenses |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
96 CFW_EXPS_PRICE3, ///< Column for year Y expenses |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
97 CFW_TOTAL_PANEL, ///< Panel for totals |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
98 CFW_TOTAL_LABELS, ///< Column for totals labels |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
99 CFW_TOTAL_VALUES, ///< Column for totals values |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
100 CFW_TOTAL_MAXLOAN, ///< Column for max loan string |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
101 CFW_INCREASE_LOAN, ///< Increase loan |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
102 CFW_REPAY_LOAN, ///< Decrease loan |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
103 }; |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
104 |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
105 static void DrawCompanyEconomyStats(const Company *c, bool small, const Widget *widget) |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
106 { |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
107 int type = _settings_client.gui.expenses_layout; |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
108 int y; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
109 const Money (*tbl)[EXPENSES_END]; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
110 StringID str; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
111 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
112 if (!small) { // normal sized economics window |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
113 const Widget *w = &widget[CFW_EXPS_CATEGORY]; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
114 /* draw categories */ |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
115 DrawString(w->left, w->right, 15, STR_700F_EXPENDITURE_INCOME, TC_FROMSTRING, SA_CENTER, true); |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
116 |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
117 y = 27; |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
118 for (int i = 0; i < _expenses_list_types[type].length; i++) { |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
119 ExpensesType et = _expenses_list_types[type].et[i]; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
120 if (et == INVALID_EXPENSES) { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
121 y += 2; |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
122 DrawString(w->left + 2, w->right - 2, y, STR_7020_TOTAL, TC_FROMSTRING, SA_RIGHT); |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
123 y += 20; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
124 } else { |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
125 DrawString(w->left + 2, w->right - 2, y, STR_7011_CONSTRUCTION + et, TC_FROMSTRING); |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
126 y += 10; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
127 } |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
128 } |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
129 |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
130 DrawString(w->left + 2, w->right - 2, y + 2, STR_7020_TOTAL, TC_FROMSTRING, SA_RIGHT); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
131 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
132 /* draw the price columns */ |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
133 int year = _cur_year - 2; |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
134 int j = 3; |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
135 w++; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
136 tbl = c->yearly_expenses + 2; |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
137 |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
138 do { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
139 if (year >= c->inaugurated_year) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
140 SetDParam(0, year); |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
141 DrawString(w->left, w->right, 15, STR_7010, TC_FROMSTRING, SA_RIGHT, true); |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
142 |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
143 Money sum = 0; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
144 Money subtotal = 0; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
145 |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
146 int y = 27; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
147 |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
148 for (int i = 0; i < _expenses_list_types[type].length; i++) { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
149 ExpensesType et = _expenses_list_types[type].et[i]; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
150 Money cost; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
151 |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
152 if (et == INVALID_EXPENSES) { |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
153 GfxFillRect(w->left, y, w->right, y, 215); |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
154 cost = subtotal; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
155 subtotal = 0; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
156 y += 2; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
157 } else { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
158 cost = (*tbl)[et]; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
159 subtotal += cost; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
160 sum += cost; |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
161 } |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
162 |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
163 if (cost != 0 || et == INVALID_EXPENSES) { |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
164 str = STR_701E; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
165 if (cost < 0) { cost = -cost; str++; } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
166 SetDParam(0, cost); |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
167 DrawString(w->left, w->right, y, str, TC_FROMSTRING, SA_RIGHT); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
168 } |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
169 y += (et == INVALID_EXPENSES) ? 20 : 10; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
170 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
171 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
172 str = STR_701E; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
173 if (sum < 0) { sum = -sum; str++; } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
174 SetDParam(0, sum); |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
175 DrawString(w->left, w->right, y + 2, str, TC_FROMSTRING, SA_RIGHT); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
176 |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
177 GfxFillRect(w->left, y, w->right, y, 215); |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
178 w++; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
179 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
180 year++; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
181 tbl--; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
182 } while (--j != 0); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
183 |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
184 y += 14; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
185 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
186 /* draw max loan aligned to loan below (y += 10) */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
187 SetDParam(0, _economy.max_loan); |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
188 DrawString(widget[CFW_TOTAL_MAXLOAN].left, widget[CFW_TOTAL_MAXLOAN].right, y + 10, STR_MAX_LOAN, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
189 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
190 y = 15; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
191 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
192 |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
193 DrawString(widget[CFW_TOTAL_LABELS].left, widget[CFW_TOTAL_LABELS].right, y, STR_7026_BANK_BALANCE, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
194 SetDParam(0, c->money); |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
195 DrawString(widget[CFW_TOTAL_VALUES].left, widget[CFW_TOTAL_VALUES].right, y, STR_7028, TC_FROMSTRING, SA_RIGHT); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
196 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
197 y += 10; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
198 |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
199 DrawString(widget[CFW_TOTAL_LABELS].left, widget[CFW_TOTAL_LABELS].right, y, STR_7027_LOAN, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
200 SetDParam(0, c->current_loan); |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
201 DrawString(widget[CFW_TOTAL_VALUES].left, widget[CFW_TOTAL_VALUES].right, y, STR_7028, TC_FROMSTRING, SA_RIGHT); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
202 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
203 y += 12; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
204 |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
205 GfxFillRect(widget[CFW_TOTAL_VALUES].left, y - 2, widget[CFW_TOTAL_VALUES].right, y - 2, 215); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
206 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
207 SetDParam(0, c->money - c->current_loan); |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
208 DrawString(widget[CFW_TOTAL_VALUES].left, widget[CFW_TOTAL_VALUES].right, y, STR_7028, TC_FROMSTRING, SA_RIGHT); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
209 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
210 |
11504
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
211 static const NWidgetPart _nested_company_finances_widgets[] = { |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
212 NWidget(NWID_HORIZONTAL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
213 NWidget(WWT_CLOSEBOX, COLOUR_GREY, CFW_CLOSEBOX), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
214 NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetMinimalSize(369, 14), SetDataTip(STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
215 NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetMinimalSize(14, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_7075_TOGGLE_LARGE_SMALL_WINDOW), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
216 NWidget(WWT_STICKYBOX, COLOUR_GREY, CFW_STICKY), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
217 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
218 NWidget(WWT_PANEL, COLOUR_GREY, CFW_EXPS_PANEL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
219 NWidget(NWID_HORIZONTAL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
220 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_CATEGORY), SetMinimalSize(123, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
221 NWidget(NWID_SPACER), SetMinimalSize(7, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
222 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE1), SetMinimalSize(86, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
223 NWidget(NWID_SPACER), SetMinimalSize(9, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
224 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE2), SetMinimalSize(86, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
225 NWidget(NWID_SPACER), SetMinimalSize(9, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
226 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE3), SetMinimalSize(86, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
227 NWidget(NWID_SPACER), SetMinimalSize(1, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
228 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
229 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
230 NWidget(WWT_PANEL, COLOUR_GREY, CFW_TOTAL_PANEL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
231 NWidget(NWID_HORIZONTAL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
232 NWidget(NWID_SPACER), SetMinimalSize(2, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
233 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_LABELS), SetMinimalSize(95, 34), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
234 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_VALUES), SetMinimalSize(86, 34), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
235 NWidget(NWID_SPACER), SetMinimalSize(19, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
236 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_MAXLOAN), SetMinimalSize(205, 34), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
237 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
238 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
239 NWidget(NWID_HORIZONTAL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
240 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INCREASE_LOAN), SetMinimalSize(203, 12), SetDataTip(STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
241 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_REPAY_LOAN), SetMinimalSize(204, 12), SetDataTip(STR_702A_REPAY, STR_7036_REPAY_PART_OF_LOAN), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
242 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
243 }; |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
244 |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
245 static const Widget _company_finances_widgets[] = { |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
246 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // CFW_CLOSEBOX |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
247 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 380, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, // CFW_CAPTION |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
248 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 381, 394, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, // CFW_TOGGLE_SIZE |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
249 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_GREY, 395, 406, 0, 13, 0x0, STR_STICKY_BUTTON}, // CFW_STICKY |
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
250 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 406, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_PANEL |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
251 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 122, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_CATEGORY |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
252 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 130, 215, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_PRICE1 |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
253 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 225, 310, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_PRICE2 |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
254 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 320, 405, 14, 14, 0x0, STR_NULL}, // CFW_EXPS_PRICE3 |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
255 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 406, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_PANEL |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
256 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 2, 96, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_LABELS |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
257 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 97, 182, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_VALUES |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
258 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 202, 406, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_MAXLOAN |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
259 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 202, 48, 59, STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN}, // CFW_INCREASE_LOAN |
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
260 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 203, 406, 48, 59, STR_702A_REPAY, STR_7036_REPAY_PART_OF_LOAN}, // CFW_REPAY_LOAN |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
261 { WIDGETS_END}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
262 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
263 |
11504
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
264 static const NWidgetPart _nested_company_finances_small_widgets[] = { |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
265 NWidget(NWID_HORIZONTAL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
266 NWidget(WWT_CLOSEBOX, COLOUR_GREY, CFW_CLOSEBOX), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
267 NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetMinimalSize(243, 14), SetDataTip(STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
268 NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetMinimalSize(14, 14), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_7075_TOGGLE_LARGE_SMALL_WINDOW), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
269 NWidget(WWT_STICKYBOX, COLOUR_GREY, CFW_STICKY), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
270 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
271 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PANEL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
272 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_CATEGORY), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
273 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE1), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
274 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE2), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
275 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE3), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
276 NWidget(WWT_PANEL, COLOUR_GREY, CFW_TOTAL_PANEL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
277 NWidget(NWID_HORIZONTAL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
278 NWidget(NWID_SPACER), SetMinimalSize(2, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
279 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_LABELS), SetMinimalSize(95, 34), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
280 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_VALUES), SetMinimalSize(86, 34), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
281 NWidget(WWT_EMPTY, COLOUR_GREY, CFW_TOTAL_MAXLOAN), SetMinimalSize(97, 0), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
282 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
283 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
284 NWidget(NWID_HORIZONTAL), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
285 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INCREASE_LOAN), SetMinimalSize(140, 12), SetDataTip(STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
286 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_REPAY_LOAN), SetMinimalSize(140, 12), SetDataTip(STR_702A_REPAY, STR_7036_REPAY_PART_OF_LOAN), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
287 EndContainer(), |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
288 }; |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
289 |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
290 static const Widget _company_finances_small_widgets[] = { |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
291 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // CFW_CLOSEBOX |
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
292 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 253, 0, 13, STR_700E_FINANCES, STR_018C_WINDOW_TITLE_DRAG_THIS}, // CFW_CAPTION |
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
293 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 254, 267, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_7075_TOGGLE_LARGE_SMALL_WINDOW}, // CFW_TOGGLE_SIZE |
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
294 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_GREY, 268, 279, 0, 13, 0x0, STR_STICKY_BUTTON}, // CFW_STICKY |
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
295 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_PANEL |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
296 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_CATEGORY |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
297 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_PRICE1 |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
298 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_PRICE2 |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
299 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_EXPS_PRICE3 |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
300 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 279, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_PANEL |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
301 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 2, 96, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_LABELS |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
302 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 97, 182, 14, 47, 0x0, STR_NULL}, // CFW_TOTAL_VALUES |
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
303 { WWT_EMPTY, RESIZE_NONE, COLOUR_GREY, 0, 0, 0, 0, 0x0, STR_NULL}, // CFW_TOTAL_MAXLOAN |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
304 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 139, 48, 59, STR_7029_BORROW, STR_7035_INCREASE_SIZE_OF_LOAN}, // CFW_INCREASE_LOAN |
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
305 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 140, 279, 48, 59, STR_702A_REPAY, STR_7036_REPAY_PART_OF_LOAN}, // CFW_REPAY_LOAN |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
306 { WIDGETS_END}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
307 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
308 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
309 struct CompanyFinancesWindow : Window { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
310 bool small; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
311 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
312 CompanyFinancesWindow(const WindowDesc *desc, CompanyID company, bool show_small, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
313 bool show_stickied, int top, int left) : |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
314 Window(desc, company), |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
315 small(show_small) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
316 { |
11084
e07c7d3925c8
(svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents:
10998
diff
changeset
|
317 this->owner = (Owner)this->window_number; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
318 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
319 if (show_stickied) this->flags4 |= WF_STICKY; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
320 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
321 /* Check if repositioning from default is required */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
322 if (top != FIRST_GUI_CALL && left != FIRST_GUI_CALL) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
323 this->top = top; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
324 this->left = left; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
325 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
326 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
327 this->FindWindowPlacementAndResize(desc); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
328 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
329 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
330 virtual void OnPaint() |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
331 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
332 CompanyID company = (CompanyID)this->window_number; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
333 const Company *c = GetCompany(company); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
334 |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
335 if (!small) { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
336 int type = _settings_client.gui.expenses_layout; |
11504
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
337 if (this->widget[CFW_EXPS_PANEL].bottom < this->widget[CFW_EXPS_PANEL].top) { |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
338 this->widget[CFW_EXPS_PANEL].bottom = this->widget[CFW_EXPS_PANEL].top; |
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
339 } |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
340 int height = this->widget[CFW_EXPS_PANEL].bottom - this->widget[CFW_EXPS_PANEL].top + 1; |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
341 if (_expenses_list_types[type].height + 26 != height) { |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
342 this->SetDirty(); |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
343 ResizeWindowForWidget(this, CFW_EXPS_PANEL, 0, _expenses_list_types[type].height - height + 26); |
10962
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
344 this->SetDirty(); |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
345 return; |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
346 } |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
347 } |
bcb22b063237
(svn r15301) -Feature [FS#104]: Add option to group and subtotal expenses list in the company finance window. Concept from Zr40.
peter1138 <peter1138@openttd.org>
parents:
10960
diff
changeset
|
348 |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
349 /* Recheck the size of the window as it might need to be resized due to the local company changing */ |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
350 int new_height = this->widget[(company == _local_company) ? CFW_INCREASE_LOAN : CFW_TOTAL_PANEL].bottom + 1; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
351 if (this->height != new_height) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
352 /* Make window dirty before and after resizing */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
353 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
354 this->height = new_height; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
355 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
356 |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
357 this->SetWidgetHiddenState(CFW_INCREASE_LOAN, company != _local_company); |
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
358 this->SetWidgetHiddenState(CFW_REPAY_LOAN, company != _local_company); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
359 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
360 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
361 /* Borrow button only shows when there is any more money to loan */ |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
362 this->SetWidgetDisabledState(CFW_INCREASE_LOAN, c->current_loan == _economy.max_loan); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
363 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
364 /* Repay button only shows when there is any more money to repay */ |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
365 this->SetWidgetDisabledState(CFW_REPAY_LOAN, company != _local_company || c->current_loan == 0); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
366 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
367 SetDParam(0, c->index); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
368 SetDParam(1, c->index); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
369 SetDParam(2, LOAN_INTERVAL); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
370 this->DrawWidgets(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
371 |
11503
9272c49b41d7
(svn r15864) -Codechange: add some 'invisible' widgets on company finances window, and use them to determine where to draw strings instead using some magic values
glx <glx@openttd.org>
parents:
11494
diff
changeset
|
372 DrawCompanyEconomyStats(c, this->small, this->widget); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
373 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
374 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
375 virtual void OnClick(Point pt, int widget) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
376 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
377 switch (widget) { |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
378 case CFW_TOGGLE_SIZE: {// toggle size |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
379 bool new_mode = !this->small; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
380 bool stickied = !!(this->flags4 & WF_STICKY); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
381 int oldtop = this->top; ///< current top position of the window before closing it |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
382 int oldleft = this->left; ///< current left position of the window before closing it |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
383 CompanyID company = (CompanyID)this->window_number; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
384 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
385 delete this; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
386 /* Open up the (toggled size) Finance window at the same position as the previous */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
387 DoShowCompanyFinances(company, new_mode, stickied, oldtop, oldleft); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
388 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
389 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
390 |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
391 case CFW_INCREASE_LOAN: // increase loan |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
392 DoCommandP(0, 0, _ctrl_pressed, CMD_INCREASE_LOAN | CMD_MSG(STR_702C_CAN_T_BORROW_ANY_MORE_MONEY)); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
393 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
394 |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
395 case CFW_REPAY_LOAN: // repay loan |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
396 DoCommandP(0, 0, _ctrl_pressed, CMD_DECREASE_LOAN | CMD_MSG(STR_702F_CAN_T_REPAY_LOAN)); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
397 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
398 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
399 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
400 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
401 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
402 static const WindowDesc _company_finances_desc( |
11494
6af9e6523c41
(svn r15855) -Codechange: complete the company finances window widget enum and remove unneeded magic in large window definition
glx <glx@openttd.org>
parents:
11450
diff
changeset
|
403 WDP_AUTO, WDP_AUTO, 407, 60, 407, 60, |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
404 WC_FINANCES, WC_NONE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
405 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
11504
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
406 _company_finances_widgets, _nested_company_finances_widgets, lengthof(_nested_company_finances_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
407 ); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
408 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
409 static const WindowDesc _company_finances_small_desc( |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
410 WDP_AUTO, WDP_AUTO, 280, 60, 280, 60, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
411 WC_FINANCES, WC_NONE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
412 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
11504
898be4863fa6
(svn r15865) -Codechange: New widgets for company finances windows
glx <glx@openttd.org>
parents:
11503
diff
changeset
|
413 _company_finances_small_widgets, _nested_company_finances_small_widgets, lengthof(_nested_company_finances_small_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
414 ); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
415 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
416 /** |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
417 * Open the small/large finance window of the company |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
418 * |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
419 * @param company the company who's finances are requested to be seen |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
420 * @param show_small show large or small version opf the window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
421 * @param show_stickied previous "stickyness" of the window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
422 * @param top previous top position of the window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
423 * @param left previous left position of the window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
424 * |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
425 * @pre is company a valid company |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
426 */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
427 static void DoShowCompanyFinances(CompanyID company, bool show_small, bool show_stickied, int top, int left) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
428 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
429 if (!IsValidCompanyID(company)) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
430 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
431 if (BringWindowToFrontById(WC_FINANCES, company)) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
432 new CompanyFinancesWindow(show_small ? &_company_finances_small_desc : &_company_finances_desc, company, show_small, show_stickied, top, left); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
433 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
434 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
435 void ShowCompanyFinances(CompanyID company) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
436 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
437 DoShowCompanyFinances(company, false, false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
438 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
439 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
440 /* List of colours for the livery window */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
441 static const StringID _colour_dropdown[] = { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
442 STR_00D1_DARK_BLUE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
443 STR_00D2_PALE_GREEN, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
444 STR_00D3_PINK, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
445 STR_00D4_YELLOW, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
446 STR_00D5_RED, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
447 STR_00D6_LIGHT_BLUE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
448 STR_00D7_GREEN, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
449 STR_00D8_DARK_GREEN, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
450 STR_00D9_BLUE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
451 STR_00DA_CREAM, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
452 STR_00DB_MAUVE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
453 STR_00DC_PURPLE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
454 STR_00DD_ORANGE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
455 STR_00DE_BROWN, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
456 STR_00DF_GREY, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
457 STR_00E0_WHITE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
458 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
459 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
460 /* Association of liveries to livery classes */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
461 static const LiveryClass _livery_class[LS_END] = { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
462 LC_OTHER, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
463 LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
464 LC_ROAD, LC_ROAD, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
465 LC_SHIP, LC_SHIP, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
466 LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
467 LC_ROAD, LC_ROAD, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
468 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
469 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
470 class DropDownListColourItem : public DropDownListItem { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
471 public: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
472 DropDownListColourItem(int result, bool masked) : DropDownListItem(result, masked) {} |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
473 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
474 virtual ~DropDownListColourItem() {} |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
475 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
476 StringID String() const |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
477 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
478 return _colour_dropdown[this->result]; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
479 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
480 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
481 uint Height(uint width) const |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
482 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
483 return 14; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
484 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
485 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
486 bool Selectable() const |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
487 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
488 return true; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
489 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
490 |
11425
532a1c74074d
(svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents:
11373
diff
changeset
|
491 void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
492 { |
11425
532a1c74074d
(svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents:
11373
diff
changeset
|
493 DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + this->result, left + 16, top + 7); |
532a1c74074d
(svn r15783) -Codechange: make the dropdown draw code pass around the left/right instead of the x and width to make drawing text at offsets easier.
rubidium <rubidium@openttd.org>
parents:
11373
diff
changeset
|
494 DrawString(left + 32, right - 2, top + 3, this->String(), sel ? TC_WHITE : TC_BLACK); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
495 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
496 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
497 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
498 struct SelectCompanyLiveryWindow : public Window { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
499 private: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
500 uint32 sel; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
501 LiveryClass livery_class; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
502 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
503 enum SelectCompanyLiveryWindowWidgets { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
504 SCLW_WIDGET_CLOSE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
505 SCLW_WIDGET_CAPTION, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
506 SCLW_WIDGET_CLASS_GENERAL, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
507 SCLW_WIDGET_CLASS_RAIL, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
508 SCLW_WIDGET_CLASS_ROAD, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
509 SCLW_WIDGET_CLASS_SHIP, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
510 SCLW_WIDGET_CLASS_AIRCRAFT, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
511 SCLW_WIDGET_SPACER_CLASS, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
512 SCLW_WIDGET_SPACER_DROPDOWN, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
513 SCLW_WIDGET_PRI_COL_DROPDOWN, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
514 SCLW_WIDGET_SEC_COL_DROPDOWN, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
515 SCLW_WIDGET_MATRIX, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
516 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
517 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
518 void ShowColourDropDownMenu(uint32 widget) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
519 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
520 uint32 used_colours = 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
521 const Livery *livery; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
522 LiveryScheme scheme; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
523 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
524 /* Disallow other company colours for the primary colour */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
525 if (HasBit(this->sel, LS_DEFAULT) && widget == SCLW_WIDGET_PRI_COL_DROPDOWN) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
526 const Company *c; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
527 FOR_ALL_COMPANIES(c) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
528 if (c->index != _local_company) SetBit(used_colours, c->colour); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
529 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
530 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
531 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
532 /* Get the first selected livery to use as the default dropdown item */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
533 for (scheme = LS_BEGIN; scheme < LS_END; scheme++) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
534 if (HasBit(this->sel, scheme)) break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
535 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
536 if (scheme == LS_END) scheme = LS_DEFAULT; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
537 livery = &GetCompany((CompanyID)this->window_number)->livery[scheme]; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
538 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
539 DropDownList *list = new DropDownList(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
540 for (uint i = 0; i < lengthof(_colour_dropdown); i++) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
541 list->push_back(new DropDownListColourItem(i, HasBit(used_colours, i))); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
542 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
543 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
544 ShowDropDownList(this, list, widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? livery->colour1 : livery->colour2, widget); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
545 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
546 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
547 public: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
548 SelectCompanyLiveryWindow(const WindowDesc *desc, CompanyID company) : Window(desc, company) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
549 { |
11084
e07c7d3925c8
(svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents:
10998
diff
changeset
|
550 this->owner = company; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
551 this->livery_class = LC_OTHER; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
552 this->sel = 1; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
553 this->LowerWidget(SCLW_WIDGET_CLASS_GENERAL); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
554 this->OnInvalidateData(_loaded_newgrf_features.has_2CC); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
555 this->FindWindowPlacementAndResize(desc); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
556 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
557 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
558 virtual void OnPaint() |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
559 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
560 const Company *c = GetCompany((CompanyID)this->window_number); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
561 LiveryScheme scheme = LS_DEFAULT; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
562 int y = 51; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
563 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
564 /* Disable dropdown controls if no scheme is selected */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
565 this->SetWidgetDisabledState(SCLW_WIDGET_PRI_COL_DROPDOWN, this->sel == 0); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
566 this->SetWidgetDisabledState(SCLW_WIDGET_SEC_COL_DROPDOWN, this->sel == 0); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
567 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
568 if (this->sel != 0) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
569 for (scheme = LS_BEGIN; scheme < LS_END; scheme++) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
570 if (HasBit(this->sel, scheme)) break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
571 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
572 if (scheme == LS_END) scheme = LS_DEFAULT; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
573 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
574 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
575 SetDParam(0, STR_00D1_DARK_BLUE + c->livery[scheme].colour1); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
576 SetDParam(1, STR_00D1_DARK_BLUE + c->livery[scheme].colour2); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
577 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
578 this->DrawWidgets(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
579 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
580 for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
581 if (_livery_class[scheme] == this->livery_class) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
582 bool sel = HasBit(this->sel, scheme) != 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
583 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
584 if (scheme != LS_DEFAULT) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
585 DrawSprite(c->livery[scheme].in_use ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, 2, y); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
586 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
587 |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
588 DrawString(15, 165, y, STR_LIVERY_DEFAULT + scheme, sel ? TC_WHITE : TC_BLACK); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
589 |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
590 DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(c->livery[scheme].colour1), 152, y); |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
591 DrawString(165, 290, y, STR_00D1_DARK_BLUE + c->livery[scheme].colour1, sel ? TC_WHITE : TC_GOLD); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
592 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
593 if (!this->IsWidgetHidden(SCLW_WIDGET_SEC_COL_DROPDOWN)) { |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
594 DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(c->livery[scheme].colour2), 277, y); |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
595 DrawString(290, this->width, y, STR_00D1_DARK_BLUE + c->livery[scheme].colour2, sel ? TC_WHITE : TC_GOLD); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
596 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
597 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
598 y += 14; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
599 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
600 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
601 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
602 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
603 virtual void OnClick(Point pt, int widget) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
604 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
605 /* Number of liveries in each class, used to determine the height of the livery window */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
606 static const byte livery_height[] = { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
607 1, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
608 13, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
609 4, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
610 2, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
611 3, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
612 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
613 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
614 switch (widget) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
615 /* Livery Class buttons */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
616 case SCLW_WIDGET_CLASS_GENERAL: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
617 case SCLW_WIDGET_CLASS_RAIL: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
618 case SCLW_WIDGET_CLASS_ROAD: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
619 case SCLW_WIDGET_CLASS_SHIP: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
620 case SCLW_WIDGET_CLASS_AIRCRAFT: { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
621 LiveryScheme scheme; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
622 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
623 this->RaiseWidget(this->livery_class + SCLW_WIDGET_CLASS_GENERAL); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
624 this->livery_class = (LiveryClass)(widget - SCLW_WIDGET_CLASS_GENERAL); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
625 this->sel = 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
626 this->LowerWidget(this->livery_class + SCLW_WIDGET_CLASS_GENERAL); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
627 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
628 /* Select the first item in the list */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
629 for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
630 if (_livery_class[scheme] == this->livery_class) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
631 this->sel = 1 << scheme; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
632 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
633 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
634 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
635 this->height = 49 + livery_height[this->livery_class] * 14; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
636 this->widget[SCLW_WIDGET_MATRIX].bottom = this->height - 1; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
637 this->widget[SCLW_WIDGET_MATRIX].data = livery_height[this->livery_class] << 8 | 1; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
638 MarkWholeScreenDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
639 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
640 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
641 |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
642 case SCLW_WIDGET_PRI_COL_DROPDOWN: // First colour dropdown |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
643 ShowColourDropDownMenu(SCLW_WIDGET_PRI_COL_DROPDOWN); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
644 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
645 |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
646 case SCLW_WIDGET_SEC_COL_DROPDOWN: // Second colour dropdown |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
647 ShowColourDropDownMenu(SCLW_WIDGET_SEC_COL_DROPDOWN); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
648 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
649 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
650 case SCLW_WIDGET_MATRIX: { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
651 LiveryScheme scheme; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
652 LiveryScheme j = (LiveryScheme)((pt.y - 48) / 14); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
653 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
654 for (scheme = LS_BEGIN; scheme <= j; scheme++) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
655 if (_livery_class[scheme] != this->livery_class) j++; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
656 if (scheme >= LS_END) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
657 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
658 if (j >= LS_END) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
659 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
660 /* If clicking on the left edge, toggle using the livery */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
661 if (pt.x < 10) { |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
662 DoCommandP(0, j | (2 << 8), !GetCompany((CompanyID)this->window_number)->livery[j].in_use, CMD_SET_COMPANY_COLOUR); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
663 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
664 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
665 if (_ctrl_pressed) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
666 ToggleBit(this->sel, j); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
667 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
668 this->sel = 1 << j; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
669 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
670 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
671 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
672 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
673 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
674 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
675 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
676 virtual void OnDropdownSelect(int widget, int index) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
677 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
678 for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
679 if (HasBit(this->sel, scheme)) { |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
680 DoCommandP(0, scheme | (widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOUR); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
681 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
682 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
683 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
684 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
685 virtual void OnInvalidateData(int data = 0) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
686 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
687 static bool has2cc = true; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
688 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
689 if (has2cc == !!data) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
690 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
691 has2cc = !!data; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
692 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
693 int r = this->widget[has2cc ? SCLW_WIDGET_SEC_COL_DROPDOWN : SCLW_WIDGET_PRI_COL_DROPDOWN].right; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
694 this->SetWidgetHiddenState(SCLW_WIDGET_SEC_COL_DROPDOWN, !has2cc); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
695 this->widget[SCLW_WIDGET_CAPTION].right = r; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
696 this->widget[SCLW_WIDGET_SPACER_CLASS].right = r; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
697 this->widget[SCLW_WIDGET_MATRIX].right = r; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
698 this->width = r + 1; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
699 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
700 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
701 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
702 static const Widget _select_company_livery_widgets[] = { |
11086
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
703 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
704 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 399, 0, 13, STR_7007_NEW_COLOUR_SCHEME, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
705 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 0, 21, 14, 35, SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TIP }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
706 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 22, 43, 14, 35, SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TIP }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
707 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 44, 65, 14, 35, SPR_IMG_TRUCKLIST, STR_LIVERY_ROADVEH_TIP }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
708 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 66, 87, 14, 35, SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TIP }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
709 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 88, 109, 14, 35, SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TIP }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
710 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 110, 399, 14, 35, 0x0, STR_NULL }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
711 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 149, 36, 47, 0x0, STR_NULL }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
712 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_GREY, 150, 274, 36, 47, STR_02BD, STR_LIVERY_PRIMARY_TIP }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
713 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_GREY, 275, 399, 36, 47, STR_02E1, STR_LIVERY_SECONDARY_TIP }, |
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
714 { WWT_MATRIX, RESIZE_NONE, COLOUR_GREY, 0, 399, 48, 48 + 1 * 14, (1 << 8) | 1, STR_LIVERY_PANEL_TIP }, |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
715 { WIDGETS_END }, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
716 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
717 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
718 static const WindowDesc _select_company_livery_desc( |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
719 WDP_AUTO, WDP_AUTO, 400, 49 + 1 * 14, 400, 49 + 1 * 14, |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
720 WC_COMPANY_COLOUR, WC_NONE, |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
721 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
722 _select_company_livery_widgets |
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
723 ); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
724 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
725 /** |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
726 * Draws the face of a company manager's face. |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
727 * @param cmf the company manager's face |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
728 * @param colour the (background) colour of the gradient |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
729 * @param x x-position to draw the face |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
730 * @param y y-position to draw the face |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
731 */ |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
732 void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, int x, int y) |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
733 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
734 GenderEthnicity ge = (GenderEthnicity)GetCompanyManagerFaceBits(cmf, CMFV_GEN_ETHN, GE_WM); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
735 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
736 bool has_moustache = !HasBit(ge, GENDER_FEMALE) && GetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE, ge) != 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
737 bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetCompanyManagerFaceBits(cmf, CMFV_HAS_TIE_EARRING, ge) != 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
738 bool has_glasses = GetCompanyManagerFaceBits(cmf, CMFV_HAS_GLASSES, ge) != 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
739 SpriteID pal; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
740 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
741 /* Modify eye colour palette only if 2 or more valid values exist */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
742 if (_cmf_info[CMFV_EYE_COLOUR].valid_values[ge] < 2) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
743 pal = PAL_NONE; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
744 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
745 switch (GetCompanyManagerFaceBits(cmf, CMFV_EYE_COLOUR, ge)) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
746 default: NOT_REACHED(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
747 case 0: pal = PALETTE_TO_BROWN; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
748 case 1: pal = PALETTE_TO_BLUE; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
749 case 2: pal = PALETTE_TO_GREEN; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
750 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
751 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
752 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
753 /* Draw the gradient (background) */ |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
754 DrawSprite(SPR_GRADIENT, GENERAL_SPRITE_COLOUR(colour), x, y); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
755 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
756 for (CompanyManagerFaceVariable cmfv = CMFV_CHEEKS; cmfv < CMFV_END; cmfv++) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
757 switch (cmfv) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
758 case CMFV_MOUSTACHE: if (!has_moustache) continue; break; |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
759 case CMFV_LIPS: // FALL THROUGH |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
760 case CMFV_NOSE: if (has_moustache) continue; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
761 case CMFV_TIE_EARRING: if (!has_tie_earring) continue; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
762 case CMFV_GLASSES: if (!has_glasses) continue; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
763 default: break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
764 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
765 DrawSprite(GetCompanyManagerFaceSprite(cmf, cmfv, ge), (cmfv == CMFV_EYEBROWS) ? pal : PAL_NONE, x, y); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
766 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
767 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
768 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
769 /** Widget description for the normal/simple company manager face selection dialog */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
770 static const Widget _select_company_manager_face_widgets[] = { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
771 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // SCMFW_WIDGET_CLOSEBOX |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
772 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 174, 0, 13, STR_7043_FACE_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // SCMFW_WIDGET_CAPTION |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
773 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 189, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
774 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 189, 14, 150, 0x0, STR_NULL}, // SCMFW_WIDGET_SELECT_FACE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
775 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 94, 151, 162, STR_012E_CANCEL, STR_7047_CANCEL_NEW_FACE_SELECTION}, // SCMFW_WIDGET_CANCEL |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
776 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 189, 151, 162, STR_012F_OK, STR_7048_ACCEPT_NEW_FACE_SELECTION}, // SCMFW_WIDGET_ACCEPT |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
777 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 187, 75, 86, STR_7044_MALE, STR_7049_SELECT_MALE_FACES}, // SCMFW_WIDGET_MALE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
778 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 187, 87, 98, STR_7045_FEMALE, STR_704A_SELECT_FEMALE_FACES}, // SCMFW_WIDGET_FEMALE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
779 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 137, 148, STR_7046_NEW_FACE, STR_704B_GENERATE_RANDOM_NEW_FACE}, // SCMFW_WIDGET_RANDOM_NEW_FACE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
780 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 187, 16, 27, STR_FACE_ADVANCED, STR_FACE_ADVANCED_TIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
781 { WIDGETS_END}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
782 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
783 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
784 /** Widget description for the advanced company manager face selection dialog */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
785 static const Widget _select_company_manager_face_adv_widgets[] = { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
786 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // SCMFW_WIDGET_CLOSEBOX |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
787 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 204, 0, 13, STR_7043_FACE_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // SCMFW_WIDGET_CAPTION |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
788 { WWT_IMGBTN, RESIZE_NONE, COLOUR_GREY, 205, 219, 0, 13, SPR_LARGE_SMALL_WINDOW, STR_FACE_SIMPLE_TIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
789 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 219, 14, 207, 0x0, STR_NULL}, // SCMFW_WIDGET_SELECT_FACE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
790 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 94, 208, 219, STR_012E_CANCEL, STR_7047_CANCEL_NEW_FACE_SELECTION}, // SCMFW_WIDGET_CANCEL |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
791 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 219, 208, 219, STR_012F_OK, STR_7048_ACCEPT_NEW_FACE_SELECTION}, // SCMFW_WIDGET_ACCEPT |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
792 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 96, 156, 32, 43, STR_7044_MALE, STR_7049_SELECT_MALE_FACES}, // SCMFW_WIDGET_MALE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
793 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 157, 217, 32, 43, STR_7045_FEMALE, STR_704A_SELECT_FEMALE_FACES}, // SCMFW_WIDGET_FEMALE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
794 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 137, 148, STR_RANDOM, STR_704B_GENERATE_RANDOM_NEW_FACE}, // SCMFW_WIDGET_RANDOM_NEW_FACE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
795 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 95, 217, 16, 27, STR_FACE_SIMPLE, STR_FACE_SIMPLE_TIP}, // SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
796 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 158, 169, STR_FACE_LOAD, STR_FACE_LOAD_TIP}, // SCMFW_WIDGET_LOAD |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
797 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 170, 181, STR_FACE_FACECODE, STR_FACE_FACECODE_TIP}, // SCMFW_WIDGET_FACECODE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
798 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 2, 93, 182, 193, STR_FACE_SAVE, STR_FACE_SAVE_TIP}, // SCMFW_WIDGET_SAVE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
799 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 96, 156, 46, 57, STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN}, // SCMFW_WIDGET_ETHNICITY_EUR |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
800 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 157, 217, 46, 57, STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN}, // SCMFW_WIDGET_ETHNICITY_AFR |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
801 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 175, 217, 60, 71, STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TIP}, // SCMFW_WIDGET_HAS_MOUSTACHE_EARRING |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
802 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 175, 217, 72, 83, STR_EMPTY, STR_FACE_GLASSES_TIP}, // SCMFW_WIDGET_HAS_GLASSES |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
803 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 110, 121, SPR_ARROW_LEFT, STR_FACE_EYECOLOUR_TIP}, // SCMFW_WIDGET_EYECOLOUR_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
804 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 110, 121, STR_EMPTY, STR_FACE_EYECOLOUR_TIP}, // SCMFW_WIDGET_EYECOLOUR |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
805 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 110, 121, SPR_ARROW_RIGHT, STR_FACE_EYECOLOUR_TIP}, // SCMFW_WIDGET_EYECOLOUR_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
806 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 158, 169, SPR_ARROW_LEFT, STR_FACE_CHIN_TIP}, // SCMFW_WIDGET_CHIN_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
807 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 158, 169, STR_EMPTY, STR_FACE_CHIN_TIP}, // SCMFW_WIDGET_CHIN |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
808 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 158, 169, SPR_ARROW_RIGHT, STR_FACE_CHIN_TIP}, // SCMFW_WIDGET_CHIN_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
809 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 98, 109, SPR_ARROW_LEFT, STR_FACE_EYEBROWS_TIP}, // SCMFW_WIDGET_EYEBROWS_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
810 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 98, 109, STR_EMPTY, STR_FACE_EYEBROWS_TIP}, // SCMFW_WIDGET_EYEBROWS |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
811 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 98, 109, SPR_ARROW_RIGHT, STR_FACE_EYEBROWS_TIP}, // SCMFW_WIDGET_EYEBROWS_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
812 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 146, 157, SPR_ARROW_LEFT, STR_FACE_LIPS_MOUSTACHE_TIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
813 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 146, 157, STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
814 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 146, 157, SPR_ARROW_RIGHT, STR_FACE_LIPS_MOUSTACHE_TIP}, // SCMFW_WIDGET_LIPS_MOUSTACHE_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
815 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 134, 145, SPR_ARROW_LEFT, STR_FACE_NOSE_TIP}, // SCMFW_WIDGET_NOSE_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
816 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 134, 145, STR_EMPTY, STR_FACE_NOSE_TIP}, // SCMFW_WIDGET_NOSE |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
817 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 134, 145, SPR_ARROW_RIGHT, STR_FACE_NOSE_TIP}, // SCMFW_WIDGET_NOSE_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
818 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 86, 97, SPR_ARROW_LEFT, STR_FACE_HAIR_TIP}, // SCMFW_WIDGET_HAIR_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
819 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 86, 97, STR_EMPTY, STR_FACE_HAIR_TIP}, // SCMFW_WIDGET_HAIR |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
820 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 86, 97, SPR_ARROW_RIGHT, STR_FACE_HAIR_TIP}, // SCMFW_WIDGET_HAIR_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
821 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 170, 181, SPR_ARROW_LEFT, STR_FACE_JACKET_TIP}, // SCMFW_WIDGET_JACKET_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
822 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 170, 181, STR_EMPTY, STR_FACE_JACKET_TIP}, // SCMFW_WIDGET_JACKET |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
823 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 170, 181, SPR_ARROW_RIGHT, STR_FACE_JACKET_TIP}, // SCMFW_WIDGET_JACKET_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
824 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 182, 193, SPR_ARROW_LEFT, STR_FACE_COLLAR_TIP}, // SCMFW_WIDGET_COLLAR_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
825 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 182, 193, STR_EMPTY, STR_FACE_COLLAR_TIP}, // SCMFW_WIDGET_COLLAR |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
826 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 182, 193, SPR_ARROW_RIGHT, STR_FACE_COLLAR_TIP}, // SCMFW_WIDGET_COLLAR_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
827 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 194, 205, SPR_ARROW_LEFT, STR_FACE_TIE_EARRING_TIP}, // SCMFW_WIDGET_TIE_EARRING_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
828 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 194, 205, STR_EMPTY, STR_FACE_TIE_EARRING_TIP}, // SCMFW_WIDGET_TIE_EARRING |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
829 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 194, 205, SPR_ARROW_RIGHT, STR_FACE_TIE_EARRING_TIP}, // SCMFW_WIDGET_TIE_EARRING_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
830 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 175, 183, 122, 133, SPR_ARROW_LEFT, STR_FACE_GLASSES_TIP_2}, // SCMFW_WIDGET_GLASSES_L |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
831 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 184, 208, 122, 133, STR_EMPTY, STR_FACE_GLASSES_TIP_2}, // SCMFW_WIDGET_GLASSES |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
832 { WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_GREY, 209, 217, 122, 133, SPR_ARROW_RIGHT, STR_FACE_GLASSES_TIP_2}, // SCMFW_WIDGET_GLASSES_R |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
833 { WIDGETS_END}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
834 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
835 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
836 class SelectCompanyManagerFaceWindow : public Window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
837 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
838 CompanyManagerFace face; ///< company manager face bits |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
839 bool advanced; ///< advanced company manager face selection window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
840 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
841 GenderEthnicity ge; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
842 bool is_female; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
843 bool is_moust_male; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
844 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
845 /** |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
846 * Names of the widgets. Keep them in the same order as in the widget array. |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
847 * Do not change the order of the widgets from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
848 * this order is needed for the WE_CLICK event of DrawFaceStringLabel(). |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
849 */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
850 enum SelectCompanyManagerFaceWidgets { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
851 SCMFW_WIDGET_CLOSEBOX = 0, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
852 SCMFW_WIDGET_CAPTION, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
853 SCMFW_WIDGET_TOGGLE_LARGE_SMALL, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
854 SCMFW_WIDGET_SELECT_FACE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
855 SCMFW_WIDGET_CANCEL, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
856 SCMFW_WIDGET_ACCEPT, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
857 SCMFW_WIDGET_MALE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
858 SCMFW_WIDGET_FEMALE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
859 SCMFW_WIDGET_RANDOM_NEW_FACE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
860 SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
861 /* from here is the advanced company manager face selection window */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
862 SCMFW_WIDGET_LOAD, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
863 SCMFW_WIDGET_FACECODE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
864 SCMFW_WIDGET_SAVE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
865 SCMFW_WIDGET_ETHNICITY_EUR, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
866 SCMFW_WIDGET_ETHNICITY_AFR, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
867 SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
868 SCMFW_WIDGET_HAS_GLASSES, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
869 SCMFW_WIDGET_EYECOLOUR_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
870 SCMFW_WIDGET_EYECOLOUR, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
871 SCMFW_WIDGET_EYECOLOUR_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
872 SCMFW_WIDGET_CHIN_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
873 SCMFW_WIDGET_CHIN, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
874 SCMFW_WIDGET_CHIN_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
875 SCMFW_WIDGET_EYEBROWS_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
876 SCMFW_WIDGET_EYEBROWS, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
877 SCMFW_WIDGET_EYEBROWS_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
878 SCMFW_WIDGET_LIPS_MOUSTACHE_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
879 SCMFW_WIDGET_LIPS_MOUSTACHE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
880 SCMFW_WIDGET_LIPS_MOUSTACHE_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
881 SCMFW_WIDGET_NOSE_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
882 SCMFW_WIDGET_NOSE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
883 SCMFW_WIDGET_NOSE_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
884 SCMFW_WIDGET_HAIR_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
885 SCMFW_WIDGET_HAIR, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
886 SCMFW_WIDGET_HAIR_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
887 SCMFW_WIDGET_JACKET_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
888 SCMFW_WIDGET_JACKET, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
889 SCMFW_WIDGET_JACKET_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
890 SCMFW_WIDGET_COLLAR_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
891 SCMFW_WIDGET_COLLAR, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
892 SCMFW_WIDGET_COLLAR_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
893 SCMFW_WIDGET_TIE_EARRING_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
894 SCMFW_WIDGET_TIE_EARRING, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
895 SCMFW_WIDGET_TIE_EARRING_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
896 SCMFW_WIDGET_GLASSES_L, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
897 SCMFW_WIDGET_GLASSES, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
898 SCMFW_WIDGET_GLASSES_R, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
899 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
900 /** |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
901 * Draw dynamic a label to the left of the button and a value in the button |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
902 * |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
903 * @param widget_index index of this widget in the window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
904 * @param str the label which will be draw |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
905 * @param val the value which will be draw |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
906 * @param is_bool_widget is it a bool button |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
907 */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
908 void DrawFaceStringLabel(byte widget_index, StringID str, uint8 val, bool is_bool_widget) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
909 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
910 /* Write the label in gold (0x2) to the left of the button. */ |
11433
07857d65c41a
(svn r15791) -Codechange: remove the *RightAligned part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents:
11432
diff
changeset
|
911 DrawString(0, this->widget[widget_index].left - (is_bool_widget ? 5 : 14), this->widget[widget_index].top + 1, str, TC_GOLD, SA_RIGHT); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
912 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
913 if (!this->IsWidgetDisabled(widget_index)) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
914 if (is_bool_widget) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
915 /* if it a bool button write yes or no */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
916 str = (val != 0) ? STR_FACE_YES : STR_FACE_NO; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
917 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
918 /* else write the value + 1 */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
919 SetDParam(0, val + 1); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
920 str = STR_JUST_INT; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
921 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
922 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
923 /* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */ |
11432
a20dd0000d96
(svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents:
11425
diff
changeset
|
924 DrawString(this->widget[widget_index].left + this->IsWidgetLowered(widget_index), this->widget[widget_index].right - this->IsWidgetLowered(widget_index), |
a20dd0000d96
(svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents:
11425
diff
changeset
|
925 this->widget[widget_index].top + 1 + this->IsWidgetLowered(widget_index), str, TC_WHITE, SA_CENTER); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
926 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
927 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
928 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
929 void UpdateData() |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
930 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
931 this->ge = (GenderEthnicity)GB(this->face, _cmf_info[CMFV_GEN_ETHN].offset, _cmf_info[CMFV_GEN_ETHN].length); // get the gender and ethnicity |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
932 this->is_female = HasBit(this->ge, GENDER_FEMALE); // get the gender: 0 == male and 1 == female |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
933 this->is_moust_male = !is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE, this->ge) != 0; // is a male face with moustache |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
934 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
935 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
936 public: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
937 SelectCompanyManagerFaceWindow(const WindowDesc *desc, Window *parent, bool advanced, int top, int left) : Window(desc, parent->window_number) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
938 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
939 this->parent = parent; |
11084
e07c7d3925c8
(svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents:
10998
diff
changeset
|
940 this->owner = (Owner)this->window_number; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
941 this->face = GetCompany((CompanyID)this->window_number)->face; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
942 this->advanced = advanced; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
943 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
944 this->UpdateData(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
945 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
946 /* Check if repositioning from default is required */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
947 if (top != FIRST_GUI_CALL && left != FIRST_GUI_CALL) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
948 this->top = top; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
949 this->left = left; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
950 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
951 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
952 this->FindWindowPlacementAndResize(desc); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
953 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
954 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
955 virtual void OnPaint() |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
956 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
957 /* lower the non-selected gender button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
958 this->SetWidgetLoweredState(SCMFW_WIDGET_MALE, !this->is_female); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
959 this->SetWidgetLoweredState(SCMFW_WIDGET_FEMALE, this->is_female); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
960 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
961 /* advanced company manager face selection window */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
962 if (this->advanced) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
963 /* lower the non-selected ethnicity button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
964 this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_EUR, !HasBit(this->ge, ETHNICITY_BLACK)); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
965 this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_AFR, HasBit(this->ge, ETHNICITY_BLACK)); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
966 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
967 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
968 /* Disable dynamically the widgets which CompanyManagerFaceVariable has less than 2 options |
11361
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11086
diff
changeset
|
969 * (or in other words you haven't any choice). |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11086
diff
changeset
|
970 * If the widgets depend on a HAS-variable and this is false the widgets will be disabled, too. */ |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
971 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
972 /* Eye colour buttons */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
973 this->SetWidgetsDisabledState(_cmf_info[CMFV_EYE_COLOUR].valid_values[this->ge] < 2, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
974 SCMFW_WIDGET_EYECOLOUR, SCMFW_WIDGET_EYECOLOUR_L, SCMFW_WIDGET_EYECOLOUR_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
975 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
976 /* Chin buttons */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
977 this->SetWidgetsDisabledState(_cmf_info[CMFV_CHIN].valid_values[this->ge] < 2, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
978 SCMFW_WIDGET_CHIN, SCMFW_WIDGET_CHIN_L, SCMFW_WIDGET_CHIN_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
979 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
980 /* Eyebrows buttons */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
981 this->SetWidgetsDisabledState(_cmf_info[CMFV_EYEBROWS].valid_values[this->ge] < 2, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
982 SCMFW_WIDGET_EYEBROWS, SCMFW_WIDGET_EYEBROWS_L, SCMFW_WIDGET_EYEBROWS_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
983 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
984 /* Lips or (if it a male face with a moustache) moustache buttons */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
985 this->SetWidgetsDisabledState(_cmf_info[this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS].valid_values[this->ge] < 2, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
986 SCMFW_WIDGET_LIPS_MOUSTACHE, SCMFW_WIDGET_LIPS_MOUSTACHE_L, SCMFW_WIDGET_LIPS_MOUSTACHE_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
987 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
988 /* Nose buttons | male faces with moustache haven't any nose options */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
989 this->SetWidgetsDisabledState(_cmf_info[CMFV_NOSE].valid_values[this->ge] < 2 || this->is_moust_male, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
990 SCMFW_WIDGET_NOSE, SCMFW_WIDGET_NOSE_L, SCMFW_WIDGET_NOSE_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
991 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
992 /* Hair buttons */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
993 this->SetWidgetsDisabledState(_cmf_info[CMFV_HAIR].valid_values[this->ge] < 2, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
994 SCMFW_WIDGET_HAIR, SCMFW_WIDGET_HAIR_L, SCMFW_WIDGET_HAIR_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
995 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
996 /* Jacket buttons */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
997 this->SetWidgetsDisabledState(_cmf_info[CMFV_JACKET].valid_values[this->ge] < 2, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
998 SCMFW_WIDGET_JACKET, SCMFW_WIDGET_JACKET_L, SCMFW_WIDGET_JACKET_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
999 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1000 /* Collar buttons */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1001 this->SetWidgetsDisabledState(_cmf_info[CMFV_COLLAR].valid_values[this->ge] < 2, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1002 SCMFW_WIDGET_COLLAR, SCMFW_WIDGET_COLLAR_L, SCMFW_WIDGET_COLLAR_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1003 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1004 /* Tie/earring buttons | female faces without earring haven't any earring options */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1005 this->SetWidgetsDisabledState(_cmf_info[CMFV_TIE_EARRING].valid_values[this->ge] < 2 || |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1006 (this->is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge) == 0), |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1007 SCMFW_WIDGET_TIE_EARRING, SCMFW_WIDGET_TIE_EARRING_L, SCMFW_WIDGET_TIE_EARRING_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1008 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1009 /* Glasses buttons | faces without glasses haven't any glasses options */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1010 this->SetWidgetsDisabledState(_cmf_info[CMFV_GLASSES].valid_values[this->ge] < 2 || GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge) == 0, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1011 SCMFW_WIDGET_GLASSES, SCMFW_WIDGET_GLASSES_L, SCMFW_WIDGET_GLASSES_R, WIDGET_LIST_END); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1012 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1013 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1014 this->DrawWidgets(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1015 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1016 /* Draw dynamic button value and labels for the advanced company manager face selection window */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1017 if (this->advanced) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1018 if (this->is_female) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1019 /* Only for female faces */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1020 this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, STR_FACE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge), true ); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1021 this->DrawFaceStringLabel(SCMFW_WIDGET_TIE_EARRING, STR_FACE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1022 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1023 /* Only for male faces */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1024 this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, STR_FACE_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE, this->ge), true ); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1025 this->DrawFaceStringLabel(SCMFW_WIDGET_TIE_EARRING, STR_FACE_TIE, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1026 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1027 if (this->is_moust_male) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1028 /* Only for male faces with moustache */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1029 this->DrawFaceStringLabel(SCMFW_WIDGET_LIPS_MOUSTACHE, STR_FACE_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_MOUSTACHE, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1030 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1031 /* Only for female faces or male faces without moustache */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1032 this->DrawFaceStringLabel(SCMFW_WIDGET_LIPS_MOUSTACHE, STR_FACE_LIPS, GetCompanyManagerFaceBits(this->face, CMFV_LIPS, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1033 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1034 /* For all faces */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1035 this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_GLASSES, STR_FACE_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge), true ); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1036 this->DrawFaceStringLabel(SCMFW_WIDGET_HAIR, STR_FACE_HAIR, GetCompanyManagerFaceBits(this->face, CMFV_HAIR, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1037 this->DrawFaceStringLabel(SCMFW_WIDGET_EYEBROWS, STR_FACE_EYEBROWS, GetCompanyManagerFaceBits(this->face, CMFV_EYEBROWS, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1038 this->DrawFaceStringLabel(SCMFW_WIDGET_EYECOLOUR, STR_FACE_EYECOLOUR, GetCompanyManagerFaceBits(this->face, CMFV_EYE_COLOUR, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1039 this->DrawFaceStringLabel(SCMFW_WIDGET_GLASSES, STR_FACE_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_GLASSES, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1040 this->DrawFaceStringLabel(SCMFW_WIDGET_NOSE, STR_FACE_NOSE, GetCompanyManagerFaceBits(this->face, CMFV_NOSE, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1041 this->DrawFaceStringLabel(SCMFW_WIDGET_CHIN, STR_FACE_CHIN, GetCompanyManagerFaceBits(this->face, CMFV_CHIN, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1042 this->DrawFaceStringLabel(SCMFW_WIDGET_JACKET, STR_FACE_JACKET, GetCompanyManagerFaceBits(this->face, CMFV_JACKET, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1043 this->DrawFaceStringLabel(SCMFW_WIDGET_COLLAR, STR_FACE_COLLAR, GetCompanyManagerFaceBits(this->face, CMFV_COLLAR, this->ge), false); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1044 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1045 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1046 /* Draw the company manager face picture */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1047 DrawCompanyManagerFace(this->face, GetCompany((CompanyID)this->window_number)->colour, 2, 16); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1048 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1049 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1050 virtual void OnClick(Point pt, int widget) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1051 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1052 switch (widget) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1053 /* Toggle size, advanced/simple face selection */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1054 case SCMFW_WIDGET_TOGGLE_LARGE_SMALL: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1055 case SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON: { |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
1056 DoCommandP(0, 0, this->face, CMD_SET_COMPANY_MANAGER_FACE); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1057 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1058 /* Backup some data before deletion */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1059 int oldtop = this->top; ///< current top position of the window before closing it |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1060 int oldleft = this->left; ///< current top position of the window before closing it |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1061 bool adv = !this->advanced; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1062 Window *parent = this->parent; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1063 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1064 delete this; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1065 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1066 /* Open up the (toggled size) Face selection window at the same position as the previous */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1067 DoSelectCompanyManagerFace(parent, adv, oldtop, oldleft); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1068 } break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1069 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1070 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1071 /* OK button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1072 case SCMFW_WIDGET_ACCEPT: |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
1073 DoCommandP(0, 0, this->face, CMD_SET_COMPANY_MANAGER_FACE); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1074 /* Fall-Through */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1075 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1076 /* Cancel button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1077 case SCMFW_WIDGET_CANCEL: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1078 delete this; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1079 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1080 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1081 /* Load button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1082 case SCMFW_WIDGET_LOAD: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1083 this->face = _company_manager_face; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1084 ScaleAllCompanyManagerFaceBits(this->face); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1085 ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1086 this->UpdateData(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1087 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1088 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1089 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1090 /* 'Company manager face number' button, view and/or set company manager face number */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1091 case SCMFW_WIDGET_FACECODE: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1092 SetDParam(0, this->face); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1093 ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, 0, this, CS_NUMERAL, QSF_NONE); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1094 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1095 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1096 /* Save button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1097 case SCMFW_WIDGET_SAVE: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1098 _company_manager_face = this->face; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1099 ShowErrorMessage(INVALID_STRING_ID, STR_FACE_SAVE_DONE, 0, 0); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1100 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1101 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1102 /* Toggle gender (male/female) button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1103 case SCMFW_WIDGET_MALE: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1104 case SCMFW_WIDGET_FEMALE: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1105 SetCompanyManagerFaceBits(this->face, CMFV_GENDER, this->ge, widget - SCMFW_WIDGET_MALE); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1106 ScaleAllCompanyManagerFaceBits(this->face); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1107 this->UpdateData(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1108 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1109 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1110 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1111 /* Randomize face button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1112 case SCMFW_WIDGET_RANDOM_NEW_FACE: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1113 RandomCompanyManagerFaceBits(this->face, this->ge, this->advanced); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1114 this->UpdateData(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1115 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1116 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1117 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1118 /* Toggle ethnicity (european/african) button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1119 case SCMFW_WIDGET_ETHNICITY_EUR: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1120 case SCMFW_WIDGET_ETHNICITY_AFR: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1121 SetCompanyManagerFaceBits(this->face, CMFV_ETHNICITY, this->ge, widget - SCMFW_WIDGET_ETHNICITY_EUR); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1122 ScaleAllCompanyManagerFaceBits(this->face); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1123 this->UpdateData(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1124 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1125 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1126 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1127 default: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1128 /* For all buttons from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R is the same function. |
11361
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11086
diff
changeset
|
1129 * Therefor is this combined function. |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11086
diff
changeset
|
1130 * First it checks which CompanyManagerFaceVariable will be change and then |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11086
diff
changeset
|
1131 * a: invert the value for boolean variables |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11086
diff
changeset
|
1132 * or b: it checks inside of IncreaseCompanyManagerFaceBits() if a left (_L) butten is pressed and then decrease else increase the variable */ |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1133 if (this->advanced && widget >= SCMFW_WIDGET_HAS_MOUSTACHE_EARRING && widget <= SCMFW_WIDGET_GLASSES_R) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1134 CompanyManagerFaceVariable cmfv; // which CompanyManagerFaceVariable shall be edited |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1135 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1136 if (widget < SCMFW_WIDGET_EYECOLOUR_L) { // Bool buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1137 switch (widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1138 default: NOT_REACHED(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1139 case 0: cmfv = this->is_female ? CMFV_HAS_TIE_EARRING : CMFV_HAS_MOUSTACHE; break; // Has earring/moustache button |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1140 case 1: cmfv = CMFV_HAS_GLASSES; break; // Has glasses button |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1141 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1142 SetCompanyManagerFaceBits(this->face, cmfv, this->ge, !GetCompanyManagerFaceBits(this->face, cmfv, this->ge)); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1143 ScaleAllCompanyManagerFaceBits(this->face); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1144 } else { // Value buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1145 switch ((widget - SCMFW_WIDGET_EYECOLOUR_L) / 3) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1146 default: NOT_REACHED(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1147 case 0: cmfv = CMFV_EYE_COLOUR; break; // Eye colour buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1148 case 1: cmfv = CMFV_CHIN; break; // Chin buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1149 case 2: cmfv = CMFV_EYEBROWS; break; // Eyebrows buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1150 case 3: cmfv = this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS; break; // Moustache or lips buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1151 case 4: cmfv = CMFV_NOSE; break; // Nose buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1152 case 5: cmfv = CMFV_HAIR; break; // Hair buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1153 case 6: cmfv = CMFV_JACKET; break; // Jacket buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1154 case 7: cmfv = CMFV_COLLAR; break; // Collar buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1155 case 8: cmfv = CMFV_TIE_EARRING; break; // Tie/earring buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1156 case 9: cmfv = CMFV_GLASSES; break; // Glasses buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1157 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1158 /* 0 == left (_L), 1 == middle or 2 == right (_R) - button click */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1159 IncreaseCompanyManagerFaceBits(this->face, cmfv, this->ge, (((widget - SCMFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1160 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1161 this->UpdateData(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1162 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1163 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1164 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1165 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1166 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1167 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1168 virtual void OnQueryTextFinished(char *str) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1169 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1170 if (str == NULL) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1171 /* Set a new company manager face number */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1172 if (!StrEmpty(str)) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1173 this->face = strtoul(str, NULL, 10); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1174 ScaleAllCompanyManagerFaceBits(this->face); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1175 ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1176 this->UpdateData(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1177 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1178 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1179 ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1180 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1181 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1182 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1183 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1184 /** normal/simple company manager face selection window description */ |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1185 static const WindowDesc _select_company_manager_face_desc( |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1186 WDP_AUTO, WDP_AUTO, 190, 163, 190, 163, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1187 WC_COMPANY_MANAGER_FACE, WC_NONE, |
10998
a1d256bf72e0
(svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company.
rubidium <rubidium@openttd.org>
parents:
10962
diff
changeset
|
1188 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION, |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1189 _select_company_manager_face_widgets |
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1190 ); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1191 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1192 /** advanced company manager face selection window description */ |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1193 static const WindowDesc _select_company_manager_face_adv_desc( |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1194 WDP_AUTO, WDP_AUTO, 220, 220, 220, 220, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1195 WC_COMPANY_MANAGER_FACE, WC_NONE, |
10998
a1d256bf72e0
(svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company.
rubidium <rubidium@openttd.org>
parents:
10962
diff
changeset
|
1196 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION, |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1197 _select_company_manager_face_adv_widgets |
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1198 ); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1199 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1200 /** |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1201 * Open the simple/advanced company manager face selection window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1202 * |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1203 * @param parent the parent company window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1204 * @param adv simple or advanced face selection window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1205 * @param top previous top position of the window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1206 * @param left previous left position of the window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1207 */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1208 static void DoSelectCompanyManagerFace(Window *parent, bool adv, int top, int left) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1209 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1210 if (!IsValidCompanyID((CompanyID)parent->window_number)) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1211 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1212 if (BringWindowToFrontById(WC_COMPANY_MANAGER_FACE, parent->window_number)) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1213 new SelectCompanyManagerFaceWindow(adv ? &_select_company_manager_face_adv_desc : &_select_company_manager_face_desc, parent, adv, top, left); // simple or advanced window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1214 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1215 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1216 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1217 /* Names of the widgets. Keep them in the same order as in the widget array */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1218 enum CompanyWindowWidgets { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1219 CW_WIDGET_CLOSEBOX = 0, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1220 CW_WIDGET_CAPTION, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1221 CW_WIDGET_FACE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1222 CW_WIDGET_NEW_FACE, |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1223 CW_WIDGET_COLOUR_SCHEME, |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1224 CW_WIDGET_PRESIDENT_NAME, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1225 CW_WIDGET_COMPANY_NAME, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1226 CW_WIDGET_BUILD_VIEW_HQ, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1227 CW_WIDGET_RELOCATE_HQ, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1228 CW_WIDGET_BUY_SHARE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1229 CW_WIDGET_SELL_SHARE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1230 CW_WIDGET_COMPANY_PASSWORD, |
10907
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1231 CW_WIDGET_COMPANY_JOIN, |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1232 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1233 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1234 static const Widget _company_widgets[] = { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1235 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1236 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 359, 0, 13, STR_7001, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1237 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 359, 14, 157, 0x0, STR_NULL}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1238 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 89, 158, 169, STR_7004_NEW_FACE, STR_7030_SELECT_NEW_FACE_FOR_PRESIDENT}, |
11086
23adfa4f7d5a
(svn r15429) -Change: do r15428 also for the string names.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
1239 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 90, 179, 158, 169, STR_7005_COLOUR_SCHEME, STR_7031_CHANGE_THE_COMPANY_VEHICLE}, |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1240 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 180, 269, 158, 169, STR_7009_PRESIDENT_NAME, STR_7032_CHANGE_THE_PRESIDENT_S}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1241 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 270, 359, 158, 169, STR_7008_COMPANY_NAME, STR_7033_CHANGE_THE_COMPANY_NAME}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1242 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 18, 29, STR_7072_VIEW_HQ, STR_7070_BUILD_COMPANY_HEADQUARTERS}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1243 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 32, 43, STR_RELOCATE_HQ, STR_RELOCATE_COMPANY_HEADQUARTERS}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1244 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 179, 158, 169, STR_7077_BUY_25_SHARE_IN_COMPANY, STR_7079_BUY_25_SHARE_IN_THIS_COMPANY}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1245 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 180, 359, 158, 169, STR_7078_SELL_25_SHARE_IN_COMPANY, STR_707A_SELL_25_SHARE_IN_THIS_COMPANY}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1246 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 138, 149, STR_COMPANY_PASSWORD, STR_COMPANY_PASSWORD_TOOLTIP}, |
10912
338906f990f4
(svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents:
10907
diff
changeset
|
1247 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 266, 355, 138, 149, STR_COMPANY_JOIN, STR_COMPANY_JOIN_TIP}, |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1248 { WIDGETS_END}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1249 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1250 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1251 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1252 /** |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1253 * Draws text "Vehicles:" and number of all vehicle types, or "(none)" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1254 * @param company ID of company to print statistics of |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1255 */ |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1256 static void DrawCompanyVehiclesAmount(CompanyID company, int right) |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1257 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1258 const int x = 110; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1259 int y = 63; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1260 const Vehicle *v; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1261 uint train = 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1262 uint road = 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1263 uint air = 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1264 uint ship = 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1265 |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1266 DrawString(x, right, y, STR_7039_VEHICLES, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1267 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1268 FOR_ALL_VEHICLES(v) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1269 if (v->owner == company) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1270 switch (v->type) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1271 case VEH_TRAIN: if (IsFrontEngine(v)) train++; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1272 case VEH_ROAD: if (IsRoadVehFront(v)) road++; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1273 case VEH_AIRCRAFT: if (IsNormalAircraft(v)) air++; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1274 case VEH_SHIP: ship++; break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1275 default: break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1276 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1277 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1278 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1279 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1280 if (train + road + air + ship == 0) { |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1281 DrawString(x + 70, right, y, STR_7042_NONE, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1282 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1283 if (train != 0) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1284 SetDParam(0, train); |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1285 DrawString(x + 70, right, y, STR_TRAINS, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1286 y += 10; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1287 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1288 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1289 if (road != 0) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1290 SetDParam(0, road); |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1291 DrawString(x + 70, right, y, STR_ROAD_VEHICLES, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1292 y += 10; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1293 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1294 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1295 if (air != 0) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1296 SetDParam(0, air); |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1297 DrawString(x + 70, right, y, STR_AIRCRAFT, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1298 y += 10; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1299 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1300 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1301 if (ship != 0) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1302 SetDParam(0, ship); |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1303 DrawString(x + 70, right, y, STR_SHIPS, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1304 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1305 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1306 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1307 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1308 int GetAmountOwnedBy(const Company *c, Owner owner) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1309 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1310 return (c->share_owners[0] == owner) + |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1311 (c->share_owners[1] == owner) + |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1312 (c->share_owners[2] == owner) + |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1313 (c->share_owners[3] == owner); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1314 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1315 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1316 /** |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1317 * Draws list of all companies with shares |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1318 * @param c pointer to the Company structure |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1319 */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1320 static void DrawCompanyOwnerText(const Company *c) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1321 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1322 const Company *c2; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1323 uint num = 0; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1324 const byte height = GetCharacterHeight(FS_NORMAL); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1325 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1326 FOR_ALL_COMPANIES(c2) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1327 uint amt = GetAmountOwnedBy(c, c2->index); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1328 if (amt != 0) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1329 SetDParam(0, amt * 25); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1330 SetDParam(1, c2->index); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1331 |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1332 DrawString(120, 359, (num++) * height + 116, STR_707D_OWNED_BY, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1333 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1334 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1335 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1336 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1337 /** |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1338 * Window with general information about a company |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1339 */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1340 struct CompanyWindow : Window |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1341 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1342 CompanyWindowWidgets query_widget; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1343 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1344 CompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1345 { |
11084
e07c7d3925c8
(svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents:
10998
diff
changeset
|
1346 this->owner = (Owner)this->window_number; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1347 this->FindWindowPlacementAndResize(desc); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1348 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1349 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1350 virtual void OnPaint() |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1351 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1352 const Company *c = GetCompany((CompanyID)this->window_number); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1353 bool local = this->window_number == _local_company; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1354 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1355 this->SetWidgetHiddenState(CW_WIDGET_NEW_FACE, !local); |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1356 this->SetWidgetHiddenState(CW_WIDGET_COLOUR_SCHEME, !local); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1357 this->SetWidgetHiddenState(CW_WIDGET_PRESIDENT_NAME, !local); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1358 this->SetWidgetHiddenState(CW_WIDGET_COMPANY_NAME, !local); |
10555
315add01cf91
(svn r14812) -Codechange: use INVALID_TILE instead of 0 to mark company without HQ
smatz <smatz@openttd.org>
parents:
10500
diff
changeset
|
1359 this->widget[CW_WIDGET_BUILD_VIEW_HQ].data = (local && c->location_of_HQ == INVALID_TILE) ? STR_706F_BUILD_HQ : STR_7072_VIEW_HQ; |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1360 if (local && c->location_of_HQ != INVALID_TILE) this->widget[CW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; // HQ is already built. |
10555
315add01cf91
(svn r14812) -Codechange: use INVALID_TILE instead of 0 to mark company without HQ
smatz <smatz@openttd.org>
parents:
10500
diff
changeset
|
1361 this->SetWidgetDisabledState(CW_WIDGET_BUILD_VIEW_HQ, !local && c->location_of_HQ == INVALID_TILE); |
315add01cf91
(svn r14812) -Codechange: use INVALID_TILE instead of 0 to mark company without HQ
smatz <smatz@openttd.org>
parents:
10500
diff
changeset
|
1362 this->SetWidgetHiddenState(CW_WIDGET_RELOCATE_HQ, !local || c->location_of_HQ == INVALID_TILE); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1363 this->SetWidgetHiddenState(CW_WIDGET_BUY_SHARE, local); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1364 this->SetWidgetHiddenState(CW_WIDGET_SELL_SHARE, local); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1365 this->SetWidgetHiddenState(CW_WIDGET_COMPANY_PASSWORD, !local || !_networking); |
10907
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1366 this->SetWidgetHiddenState(CW_WIDGET_COMPANY_JOIN, local || !_networking); |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1367 this->SetWidgetDisabledState(CW_WIDGET_COMPANY_JOIN, !IsHumanCompany(c->index)); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1368 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1369 if (!local) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1370 if (_settings_game.economy.allow_shares) { // Shares are allowed |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1371 /* If all shares are owned by someone (none by nobody), disable buy button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1372 this->SetWidgetDisabledState(CW_WIDGET_BUY_SHARE, GetAmountOwnedBy(c, INVALID_OWNER) == 0 || |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1373 /* Only 25% left to buy. If the company is human, disable buying it up.. TODO issues! */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1374 (GetAmountOwnedBy(c, INVALID_OWNER) == 1 && !c->is_ai) || |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1375 /* Spectators cannot do anything of course */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1376 _local_company == COMPANY_SPECTATOR); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1377 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1378 /* If the company doesn't own any shares, disable sell button */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1379 this->SetWidgetDisabledState(CW_WIDGET_SELL_SHARE, (GetAmountOwnedBy(c, _local_company) == 0) || |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1380 /* Spectators cannot do anything of course */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1381 _local_company == COMPANY_SPECTATOR); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1382 } else { // Shares are not allowed, disable buy/sell buttons |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1383 this->DisableWidget(CW_WIDGET_BUY_SHARE); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1384 this->DisableWidget(CW_WIDGET_SELL_SHARE); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1385 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1386 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1387 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1388 SetDParam(0, c->index); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1389 SetDParam(1, c->index); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1390 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1391 this->DrawWidgets(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1392 |
10912
338906f990f4
(svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents:
10907
diff
changeset
|
1393 #ifdef ENABLE_NETWORK |
338906f990f4
(svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents:
10907
diff
changeset
|
1394 if (_networking && NetworkCompanyIsPassworded(c->index)) { |
338906f990f4
(svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents:
10907
diff
changeset
|
1395 DrawSprite(SPR_LOCK, PAL_NONE, this->widget[CW_WIDGET_COMPANY_JOIN].left - 10, this->widget[CW_WIDGET_COMPANY_JOIN].top + 2); |
338906f990f4
(svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents:
10907
diff
changeset
|
1396 } |
338906f990f4
(svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents:
10907
diff
changeset
|
1397 #endif /* ENABLE_NETWORK */ |
338906f990f4
(svn r15247) -Change: show a lock near the password/join button in the company window whenever the company is password protected
rubidium <rubidium@openttd.org>
parents:
10907
diff
changeset
|
1398 |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1399 /* Company manager's face */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1400 DrawCompanyManagerFace(c->face, c->colour, 2, 16); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1401 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1402 /* "xxx (Manager)" */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1403 SetDParam(0, c->index); |
11445
231379be7cf9
(svn r15803) -Codechange: use the new text drawing API for multicenter
rubidium <rubidium@openttd.org>
parents:
11433
diff
changeset
|
1404 DrawStringMultiLine(48 - MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 48 + MAX_LENGTH_PRESIDENT_NAME_PIXELS / 2, 135, 157, STR_7037_PRESIDENT, SA_CENTER); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1405 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1406 /* "Inaugurated:" */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1407 SetDParam(0, c->inaugurated_year); |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1408 DrawString(110, this->width, 23, STR_7038_INAUGURATED, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1409 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1410 /* "Colour scheme:" */ |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1411 DrawString(110, this->width, 43, STR_7006_COLOUR_SCHEME, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1412 /* Draw company-colour bus */ |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1413 DrawSprite(SPR_VEH_BUS_SW_VIEW, COMPANY_SPRITE_COLOUR(c->index), 215, 44); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1414 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1415 /* "Vehicles:" */ |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1416 DrawCompanyVehiclesAmount((CompanyID)this->window_number, this->width); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1417 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1418 /* "Company value:" */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1419 SetDParam(0, CalculateCompanyValue(c)); |
11450
4557701373cc
(svn r15808) -Codechange: use the new DrawString API in a number of GUIs
rubidium <rubidium@openttd.org>
parents:
11445
diff
changeset
|
1420 DrawString(110, this->width, 106, STR_7076_COMPANY_VALUE, TC_FROMSTRING); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1421 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1422 /* Shares list */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1423 DrawCompanyOwnerText(c); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1424 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1425 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1426 virtual void OnClick(Point pt, int widget) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1427 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1428 switch (widget) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1429 case CW_WIDGET_NEW_FACE: DoSelectCompanyManagerFace(this, false); break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1430 |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1431 case CW_WIDGET_COLOUR_SCHEME: |
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1432 if (BringWindowToFrontById(WC_COMPANY_COLOUR, this->window_number)) break; |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1433 new SelectCompanyLiveryWindow(&_select_company_livery_desc, (CompanyID)this->window_number); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1434 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1435 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1436 case CW_WIDGET_PRESIDENT_NAME: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1437 this->query_widget = CW_WIDGET_PRESIDENT_NAME; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1438 SetDParam(0, this->window_number); |
10209
e5c7b57fa344
(svn r14423) -Codechange: also do r14221 for the strings.
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
1439 ShowQueryString(STR_PRESIDENT_NAME, STR_700B_PRESIDENT_S_NAME, MAX_LENGTH_PRESIDENT_NAME_BYTES, MAX_LENGTH_PRESIDENT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1440 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1441 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1442 case CW_WIDGET_COMPANY_NAME: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1443 this->query_widget = CW_WIDGET_COMPANY_NAME; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1444 SetDParam(0, this->window_number); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1445 ShowQueryString(STR_COMPANY_NAME, STR_700A_COMPANY_NAME, MAX_LENGTH_COMPANY_NAME_BYTES, MAX_LENGTH_COMPANY_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1446 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1447 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1448 case CW_WIDGET_BUILD_VIEW_HQ: { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1449 TileIndex tile = GetCompany((CompanyID)this->window_number)->location_of_HQ; |
10555
315add01cf91
(svn r14812) -Codechange: use INVALID_TILE instead of 0 to mark company without HQ
smatz <smatz@openttd.org>
parents:
10500
diff
changeset
|
1450 if (tile == INVALID_TILE) { |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1451 if ((byte)this->window_number != _local_company) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1452 SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, this); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1453 SetTileSelectSize(2, 2); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1454 this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1455 this->InvalidateWidget(CW_WIDGET_BUILD_VIEW_HQ); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1456 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1457 if (_ctrl_pressed) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1458 ShowExtraViewPortWindow(tile); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1459 } else { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1460 ScrollMainWindowToTile(tile); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1461 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1462 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1463 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1464 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1465 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1466 case CW_WIDGET_RELOCATE_HQ: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1467 SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, this); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1468 SetTileSelectSize(2, 2); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1469 this->LowerWidget(CW_WIDGET_RELOCATE_HQ); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1470 this->InvalidateWidget(CW_WIDGET_RELOCATE_HQ); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1471 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1472 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1473 case CW_WIDGET_BUY_SHARE: |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
1474 DoCommandP(0, this->window_number, 0, CMD_BUY_SHARE_IN_COMPANY | CMD_MSG(STR_707B_CAN_T_BUY_25_SHARE_IN_THIS)); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1475 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1476 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1477 case CW_WIDGET_SELL_SHARE: |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
1478 DoCommandP(0, this->window_number, 0, CMD_SELL_SHARE_IN_COMPANY | CMD_MSG(STR_707C_CAN_T_SELL_25_SHARE_IN)); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1479 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1480 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1481 #ifdef ENABLE_NETWORK |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1482 case CW_WIDGET_COMPANY_PASSWORD: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1483 if (this->window_number == _local_company) ShowNetworkCompanyPasswordWindow(this); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1484 break; |
10907
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1485 |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1486 case CW_WIDGET_COMPANY_JOIN: { |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1487 this->query_widget = CW_WIDGET_COMPANY_JOIN; |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1488 CompanyID company = (CompanyID)this->window_number; |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1489 if (_network_server) { |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1490 NetworkServerDoMove(CLIENT_ID_SERVER, company); |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1491 MarkWholeScreenDirty(); |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1492 } else if (NetworkCompanyIsPassworded(company)) { |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1493 /* ask for the password */ |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1494 ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION, 20, 180, this, CS_ALPHANUMERAL, QSF_NONE); |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1495 } else { |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1496 /* just send the join command */ |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1497 NetworkClientRequestMove(company); |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1498 } |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1499 break; |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1500 } |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1501 #endif /* ENABLE_NETWORK */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1502 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1503 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1504 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1505 virtual void OnHundredthTick() |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1506 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1507 /* redraw the window every now and then */ |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1508 this->SetDirty(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1509 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1510 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1511 virtual void OnPlaceObject(Point pt, TileIndex tile) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1512 { |
10606
4b69f32abb9d
(svn r14895) -Change: move CMD_NO_WATER from all DoCommandPs to the command table
rubidium <rubidium@openttd.org>
parents:
10558
diff
changeset
|
1513 if (DoCommandP(tile, 0, 0, CMD_BUILD_COMPANY_HQ | CMD_MSG(STR_7071_CAN_T_BUILD_COMPANY_HEADQUARTERS))) |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1514 ResetObjectToPlace(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1515 this->widget[CW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; // this button can now behave as a normal push button |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1516 this->RaiseButtons(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1517 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1518 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1519 virtual void OnPlaceObjectAbort() |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1520 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1521 this->RaiseButtons(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1522 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1523 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1524 virtual void OnQueryTextFinished(char *str) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1525 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1526 if (str == NULL) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1527 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1528 switch (this->query_widget) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1529 default: NOT_REACHED(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1530 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1531 case CW_WIDGET_PRESIDENT_NAME: |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
1532 DoCommandP(0, 0, 0, CMD_RENAME_PRESIDENT | CMD_MSG(STR_700D_CAN_T_CHANGE_PRESIDENT), NULL, str); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1533 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1534 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1535 case CW_WIDGET_COMPANY_NAME: |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
1536 DoCommandP(0, 0, 0, CMD_RENAME_COMPANY | CMD_MSG(STR_700C_CAN_T_CHANGE_COMPANY_NAME), NULL, str); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1537 break; |
10907
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1538 |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1539 #ifdef ENABLE_NETWORK |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1540 case CW_WIDGET_COMPANY_JOIN: |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1541 NetworkClientRequestMove((CompanyID)this->window_number, str); |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1542 break; |
96ac514d4239
(svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral)
rubidium <rubidium@openttd.org>
parents:
10606
diff
changeset
|
1543 #endif /* ENABLE_NETWORK */ |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1544 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1545 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1546 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1547 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1548 static const WindowDesc _company_desc( |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1549 WDP_AUTO, WDP_AUTO, 360, 170, 360, 170, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1550 WC_COMPANY, WC_NONE, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1551 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1552 _company_widgets |
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1553 ); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1554 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1555 void ShowCompany(CompanyID company) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1556 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1557 if (!IsValidCompanyID(company)) return; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1558 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1559 AllocateWindowDescFront<CompanyWindow>(&_company_desc, company); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1560 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1561 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1562 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1563 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1564 struct BuyCompanyWindow : Window { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1565 BuyCompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1566 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1567 this->FindWindowPlacementAndResize(desc); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1568 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1569 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1570 virtual void OnPaint() |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1571 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1572 Company *c = GetCompany((CompanyID)this->window_number); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1573 SetDParam(0, STR_COMPANY_NAME); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1574 SetDParam(1, c->index); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1575 this->DrawWidgets(); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1576 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1577 DrawCompanyManagerFace(c->face, c->colour, 2, 16); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1578 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1579 SetDParam(0, c->index); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1580 SetDParam(1, c->bankrupt_value); |
11445
231379be7cf9
(svn r15803) -Codechange: use the new text drawing API for multicenter
rubidium <rubidium@openttd.org>
parents:
11433
diff
changeset
|
1581 DrawStringMultiLine(95, 333, 26, 116, STR_705B_WE_ARE_LOOKING_FOR_A_TRANSPORT, SA_CENTER); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1582 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1583 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1584 virtual void OnClick(Point pt, int widget) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1585 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1586 switch (widget) { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1587 case 3: |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1588 delete this; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1589 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1590 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1591 case 4: |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10209
diff
changeset
|
1592 DoCommandP(0, this->window_number, 0, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY)); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1593 break; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1594 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1595 } |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1596 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1597 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1598 static const Widget _buy_company_widgets[] = { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1599 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1600 { WWT_CAPTION, RESIZE_NONE, COLOUR_LIGHT_BLUE, 11, 333, 0, 13, STR_00B3_MESSAGE_FROM, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1601 { WWT_PANEL, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 333, 14, 136, 0x0, STR_NULL}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1602 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 148, 207, 117, 128, STR_00C9_NO, STR_NULL}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1603 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 218, 277, 117, 128, STR_00C8_YES, STR_NULL}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1604 { WIDGETS_END}, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1605 }; |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1606 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1607 static const WindowDesc _buy_company_desc( |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1608 153, 171, 334, 137, 334, 137, |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1609 WC_BUY_COMPANY, WC_NONE, |
10998
a1d256bf72e0
(svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company.
rubidium <rubidium@openttd.org>
parents:
10962
diff
changeset
|
1610 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION, |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1611 _buy_company_widgets |
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1612 ); |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1613 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1614 |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1615 void ShowBuyCompanyDialog(CompanyID company) |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1616 { |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1617 AllocateWindowDescFront<BuyCompanyWindow>(&_buy_company_desc, company); |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1618 } |