author | maedhros |
Sun, 21 Jan 2007 12:35:35 +0000 | |
changeset 6002 | 0cc302eda282 |
parent 6001 | 1e4c5406cd1a |
child 6012 | 90bc90e17509 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1575
diff
changeset
|
4 |
#include "openttd.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
410
diff
changeset
|
5 |
#include "table/strings.h" |
2187
2a51f8925eeb
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
6 |
#include "table/sprites.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
7 |
#include "functions.h" |
0 | 8 |
#include "window.h" |
9 |
#include "gui.h" |
|
10 |
#include "gfx.h" |
|
11 |
#include "player.h" |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
12 |
#include "economy.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2135
diff
changeset
|
13 |
#include "variables.h" |
4261
2ec8f5a9747b
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
3801
diff
changeset
|
14 |
#include "date.h" |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
15 |
#include "helpers.hpp" |
0 | 16 |
|
5291
5e4d9ab3cc0f
(svn r7444) -Codechange: Use one (global) cargo-colours array for drawing cargo-colours. Change Food
Darkvater
parents:
5247
diff
changeset
|
17 |
const byte _cargo_colours[NUM_CARGO] = {152, 32, 15, 174, 208, 194, 191, 84, 184, 10, 202, 48}; |
5e4d9ab3cc0f
(svn r7444) -Codechange: Use one (global) cargo-colours array for drawing cargo-colours. Change Food
Darkvater
parents:
5247
diff
changeset
|
18 |
|
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
19 |
static uint _legend_excludebits; |
0 | 20 |
static uint _legend_cargobits; |
21 |
||
22 |
/************************/ |
|
23 |
/* GENERIC GRAPH DRAWER */ |
|
24 |
/************************/ |
|
25 |
||
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
26 |
enum {GRAPH_NUM = 16}; |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
27 |
|
0 | 28 |
typedef struct GraphDrawer { |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
29 |
uint sel; // bitmask of the players *excluded* (e.g. 11111111 means that no players are shown) |
0 | 30 |
byte num_dataset; |
31 |
byte num_on_x_axis; |
|
32 |
byte month; |
|
4293
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
33 |
Year year; |
0 | 34 |
bool include_neg; |
35 |
byte num_vert_lines; |
|
36 |
uint16 unk61A; |
|
37 |
uint16 unk61C; |
|
38 |
int left, top; |
|
39 |
uint height; |
|
40 |
StringID format_str_y_axis; |
|
41 |
byte color_3, color_2, bg_line_color; |
|
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
42 |
byte colors[GRAPH_NUM]; |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
43 |
uint64 cost[GRAPH_NUM][24]; // last 2 years |
0 | 44 |
} GraphDrawer; |
45 |
||
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
46 |
#define INVALID_VALUE 0x80000000 |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
47 |
|
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2261
diff
changeset
|
48 |
static void DrawGraph(const GraphDrawer *gw) |
0 | 49 |
{ |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
50 |
|
0 | 51 |
int i,j,k; |
1130
236aa7efbe7a
(svn r1631) A couple of fixes for the signed/unsigned warnings. Only train_cmd.c remains to need fixing...
dominik
parents:
1093
diff
changeset
|
52 |
uint x,y,old_x,old_y; |
0 | 53 |
int color; |
54 |
int right, bottom; |
|
55 |
int num_x, num_dataset; |
|
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2261
diff
changeset
|
56 |
const uint64 *row_ptr, *col_ptr; |
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
57 |
int64 mx; |
0 | 58 |
int adj_height; |
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
59 |
uint64 y_scaling, tmp; |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
60 |
int64 value; |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
61 |
int64 cur_val; |
0 | 62 |
uint sel; |
63 |
||
240 | 64 |
/* the colors and cost array of GraphDrawer must accomodate |
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
65 |
* both values for cargo and players. So if any are higher, quit */ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
66 |
assert(GRAPH_NUM >= (int)NUM_CARGO && GRAPH_NUM >= (int)MAX_PLAYERS); |
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
67 |
|
4444
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4365
diff
changeset
|
68 |
color = _colour_gradient[gw->bg_line_color][4]; |
0 | 69 |
|
70 |
/* draw the vertical lines */ |
|
71 |
i = gw->num_vert_lines; assert(i > 0); |
|
72 |
x = gw->left + 66; |
|
73 |
bottom = gw->top + gw->height - 1; |
|
74 |
do { |
|
75 |
GfxFillRect(x, gw->top, x, bottom, color); |
|
76 |
x += 22; |
|
77 |
} while (--i); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
78 |
|
0 | 79 |
/* draw the horizontal lines */ |
80 |
i = 9; |
|
81 |
x = gw->left + 44; |
|
82 |
y = gw->height + gw->top; |
|
83 |
right = gw->left + 44 + gw->num_vert_lines*22-1; |
|
84 |
||
85 |
do { |
|
86 |
GfxFillRect(x, y, right, y, color); |
|
87 |
y -= gw->height >> 3; |
|
88 |
} while (--i); |
|
89 |
||
90 |
/* draw vertical edge line */ |
|
91 |
GfxFillRect(x, gw->top, x, bottom, gw->color_2); |
|
92 |
||
93 |
adj_height = gw->height; |
|
94 |
if (gw->include_neg) adj_height >>= 1; |
|
95 |
||
96 |
/* draw horiz edge line */ |
|
97 |
y = adj_height + gw->top; |
|
98 |
GfxFillRect(x, y, right, y, gw->color_2); |
|
99 |
||
100 |
/* find the max element */ |
|
101 |
if (gw->num_on_x_axis == 0) |
|
102 |
return; |
|
103 |
||
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
104 |
num_dataset = gw->num_dataset; |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
105 |
assert(num_dataset > 0); |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
106 |
|
0 | 107 |
row_ptr = gw->cost[0]; |
108 |
mx = 0; |
|
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
109 |
/* bit selection for the showing of various players, base max element |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
110 |
* on to-be shown player-information. This way the graph can scale */ |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
111 |
sel = gw->sel; |
0 | 112 |
do { |
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
113 |
if (!(sel&1)) { |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
114 |
num_x = gw->num_on_x_axis; |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
115 |
assert(num_x > 0); |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
116 |
col_ptr = row_ptr; |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
117 |
do { |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
118 |
if (*col_ptr != INVALID_VALUE) { |
5852
cb3f71b16e1a
(svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
celestar
parents:
5838
diff
changeset
|
119 |
mx = max((uint64)mx, *col_ptr); |
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
120 |
} |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
121 |
} while (col_ptr++, --num_x); |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
122 |
} |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
123 |
} while (sel>>=1, row_ptr+=24, --num_dataset); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
124 |
|
0 | 125 |
/* setup scaling */ |
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
126 |
y_scaling = INVALID_VALUE; |
0 | 127 |
value = adj_height * 2; |
128 |
||
129 |
if (mx > value) { |
|
130 |
mx = (mx + 7) & ~7; |
|
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
131 |
y_scaling = (((uint64) (value>>1) << 32) / mx); |
0 | 132 |
value = mx; |
133 |
} |
|
134 |
||
135 |
/* draw text strings on the y axis */ |
|
136 |
tmp = value; |
|
137 |
if (gw->include_neg) tmp >>= 1; |
|
138 |
x = gw->left + 45; |
|
139 |
y = gw->top - 3; |
|
140 |
i = 9; |
|
141 |
do { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
142 |
SetDParam(0, gw->format_str_y_axis); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
143 |
SetDParam64(1, (int64)tmp); |
0 | 144 |
tmp -= (value >> 3); |
145 |
DrawStringRightAligned(x, y, STR_0170, gw->color_3); |
|
146 |
y += gw->height >> 3; |
|
147 |
} while (--i); |
|
148 |
||
149 |
/* draw strings on the x axis */ |
|
150 |
if (gw->month != 0xFF) { |
|
151 |
x = gw->left + 44; |
|
152 |
y = gw->top + gw->height + 1; |
|
153 |
j = gw->month; |
|
4293
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4286
diff
changeset
|
154 |
k = gw->year; |
0 | 155 |
i = gw->num_on_x_axis;assert(i>0); |
156 |
do { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
157 |
SetDParam(2, k); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
158 |
SetDParam(0, j + STR_0162_JAN); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
159 |
SetDParam(1, j + STR_0162_JAN + 2); |
0 | 160 |
DrawString(x, y, j == 0 ? STR_016F : STR_016E, gw->color_3); |
161 |
||
162 |
j += 3; |
|
163 |
if (j >= 12) { |
|
164 |
j = 0; |
|
165 |
k++; |
|
166 |
} |
|
167 |
x += 22; |
|
168 |
} while (--i); |
|
169 |
} else { |
|
170 |
x = gw->left + 52; |
|
171 |
y = gw->top + gw->height + 1; |
|
172 |
j = gw->unk61A; |
|
173 |
i = gw->num_on_x_axis;assert(i>0); |
|
174 |
do { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
175 |
SetDParam(0, j); |
0 | 176 |
DrawString(x, y, STR_01CB, gw->color_3); |
177 |
j += gw->unk61C; |
|
178 |
x += 22; |
|
179 |
} while (--i); |
|
180 |
} |
|
181 |
||
182 |
/* draw lines and dots */ |
|
183 |
i = 0; |
|
184 |
row_ptr = gw->cost[0]; |
|
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
185 |
sel = gw->sel; // show only selected lines. GraphDrawer qw->sel set in Graph-Legend (_legend_excludebits) |
0 | 186 |
do { |
187 |
if (!(sel & 1)) { |
|
188 |
x = gw->left + 55; |
|
189 |
j = gw->num_on_x_axis;assert(j>0); |
|
190 |
col_ptr = row_ptr; |
|
191 |
color = gw->colors[i]; |
|
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
192 |
old_y = old_x = INVALID_VALUE; |
0 | 193 |
do { |
194 |
cur_val = *col_ptr++; |
|
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
195 |
if (cur_val != INVALID_VALUE) { |
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
196 |
y = adj_height - BIGMULSS64(cur_val, y_scaling >> 1, 31) + gw->top; |
0 | 197 |
|
198 |
GfxFillRect(x-1, y-1, x+1, y+1, color); |
|
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
199 |
if (old_x != INVALID_VALUE) |
0 | 200 |
GfxDrawLine(old_x, old_y, x, y, color); |
201 |
||
202 |
old_x = x; |
|
203 |
old_y = y; |
|
204 |
} else { |
|
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
205 |
old_x = INVALID_VALUE; |
0 | 206 |
} |
207 |
} while (x+=22,--j); |
|
208 |
} |
|
209 |
} while (sel>>=1,row_ptr+=24, ++i < gw->num_dataset); |
|
210 |
} |
|
211 |
||
212 |
/****************/ |
|
213 |
/* GRAPH LEGEND */ |
|
214 |
/****************/ |
|
215 |
||
216 |
static void GraphLegendWndProc(Window *w, WindowEvent *e) |
|
217 |
{ |
|
2475 | 218 |
const Player* p; |
0 | 219 |
|
2952 | 220 |
switch (e->event) { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
221 |
case WE_CREATE: { |
5235
3c309f43f0a6
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5070
diff
changeset
|
222 |
uint i; |
3c309f43f0a6
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5070
diff
changeset
|
223 |
for (i = 3; i < w->widget_count; i++) { |
3c309f43f0a6
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5070
diff
changeset
|
224 |
if (!HASBIT(_legend_excludebits, i - 3)) LowerWindowWidget(w, i); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
225 |
} |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
226 |
break; |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
227 |
} |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
228 |
|
0 | 229 |
case WE_PAINT: |
230 |
FOR_ALL_PLAYERS(p) { |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
231 |
if (!p->is_active) { |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
232 |
SETBIT(_legend_excludebits, p->index); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
233 |
RaiseWindowWidget(w, p->index + 3); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
234 |
} |
0 | 235 |
} |
236 |
DrawWindowWidgets(w); |
|
237 |
||
238 |
FOR_ALL_PLAYERS(p) { |
|
2639 | 239 |
if (!p->is_active) continue; |
0 | 240 |
|
241 |
DrawPlayerIcon(p->index, 4, 18+p->index*12); |
|
242 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
243 |
SetDParam(0, p->name_1); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
244 |
SetDParam(1, p->name_2); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
245 |
SetDParam(2, GetPlayerNameString(p->index, 3)); |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
246 |
DrawString(21,17+p->index*12,STR_7021,HASBIT(_legend_excludebits, p->index) ? 0x10 : 0xC); |
0 | 247 |
} |
248 |
break; |
|
249 |
||
250 |
case WE_CLICK: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
251 |
if (IS_INT_INSIDE(e->we.click.widget, 3, 11)) { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
252 |
_legend_excludebits ^= (1 << (e->we.click.widget - 3)); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
253 |
ToggleWidgetLoweredState(w, e->we.click.widget); |
0 | 254 |
SetWindowDirty(w); |
255 |
InvalidateWindow(WC_INCOME_GRAPH, 0); |
|
256 |
InvalidateWindow(WC_OPERATING_PROFIT, 0); |
|
257 |
InvalidateWindow(WC_DELIVERED_CARGO, 0); |
|
258 |
InvalidateWindow(WC_PERFORMANCE_HISTORY, 0); |
|
140
b00ce8503044
(svn r141) -Fix: Company-value was not updated immediatly if legend was changed
truelight
parents:
116
diff
changeset
|
259 |
InvalidateWindow(WC_COMPANY_VALUE, 0); |
0 | 260 |
} |
261 |
break; |
|
262 |
} |
|
263 |
} |
|
264 |
||
265 |
static const Widget _graph_legend_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
266 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
267 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 249, 0, 13, STR_704E_KEY_TO_COMPANY_GRAPHS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
268 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 113, 0x0, STR_NULL}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
269 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 247, 16, 27, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
270 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 247, 28, 39, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
271 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 247, 40, 51, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
272 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 247, 52, 63, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
273 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 247, 64, 75, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
274 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 247, 76, 87, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
275 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 247, 88, 99, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
276 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 247, 100, 111, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
165
diff
changeset
|
277 |
{ WIDGETS_END}, |
0 | 278 |
}; |
279 |
||
280 |
static const WindowDesc _graph_legend_desc = { |
|
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
281 |
WDP_AUTO, WDP_AUTO, 250, 114, |
0 | 282 |
WC_GRAPH_LEGEND,0, |
283 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
284 |
_graph_legend_widgets, |
|
285 |
GraphLegendWndProc |
|
286 |
}; |
|
287 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
288 |
static void ShowGraphLegend(void) |
0 | 289 |
{ |
290 |
AllocateWindowDescFront(&_graph_legend_desc, 0); |
|
291 |
} |
|
292 |
||
293 |
/********************/ |
|
294 |
/* OPERATING PROFIT */ |
|
295 |
/********************/ |
|
296 |
||
297 |
static void SetupGraphDrawerForPlayers(GraphDrawer *gd) |
|
298 |
{ |
|
2475 | 299 |
const Player* p; |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
300 |
uint excludebits = _legend_excludebits; |
5852
cb3f71b16e1a
(svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
celestar
parents:
5838
diff
changeset
|
301 |
byte nums; |
0 | 302 |
int mo,yr; |
303 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
304 |
// Exclude the players which aren't valid |
0 | 305 |
FOR_ALL_PLAYERS(p) { |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
306 |
if (!p->is_active) SETBIT(excludebits,p->index); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
307 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
308 |
gd->sel = excludebits; |
0 | 309 |
gd->num_vert_lines = 24; |
310 |
||
311 |
nums = 0; |
|
312 |
FOR_ALL_PLAYERS(p) { |
|
313 |
if (p->is_active) nums = max(nums,p->num_valid_stat_ent); |
|
314 |
} |
|
315 |
gd->num_on_x_axis = min(nums,24); |
|
316 |
||
317 |
mo = (_cur_month/3-nums)*3; |
|
318 |
yr = _cur_year; |
|
319 |
while (mo < 0) { |
|
320 |
yr--; |
|
321 |
mo += 12; |
|
322 |
} |
|
323 |
||
324 |
gd->year = yr; |
|
325 |
gd->month = mo; |
|
326 |
} |
|
327 |
||
328 |
static void OperatingProfitWndProc(Window *w, WindowEvent *e) |
|
329 |
{ |
|
2952 | 330 |
switch (e->event) { |
0 | 331 |
case WE_PAINT: { |
332 |
GraphDrawer gd; |
|
2475 | 333 |
const Player* p; |
0 | 334 |
int i,j; |
335 |
int numd; |
|
336 |
||
337 |
DrawWindowWidgets(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
338 |
|
0 | 339 |
gd.left = 2; |
340 |
gd.top = 18; |
|
341 |
gd.height = 136; |
|
342 |
gd.include_neg = true; |
|
2246
f25de67915ee
(svn r2766) Remove string and make use of the plural feature
tron
parents:
2187
diff
changeset
|
343 |
gd.format_str_y_axis = STR_CURRCOMPACT; |
0 | 344 |
gd.color_3 = 0x10; |
345 |
gd.color_2 = 0xD7; |
|
346 |
gd.bg_line_color = 0xE; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
347 |
|
0 | 348 |
SetupGraphDrawerForPlayers(&gd); |
349 |
||
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
350 |
numd = 0; |
0 | 351 |
FOR_ALL_PLAYERS(p) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
352 |
if (p->is_active) { |
4444
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4365
diff
changeset
|
353 |
gd.colors[numd] = _colour_gradient[p->player_color][6]; |
2952 | 354 |
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
355 |
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)(p->old_economy[j].income + p->old_economy[j].expenses); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
356 |
i++; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
357 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
358 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
359 |
numd++; |
0 | 360 |
} |
1085
408f95e1b70a
(svn r1586) Fix: [ 1107340 ] Graphs don't show comapany info for company #8
dominik
parents:
1079
diff
changeset
|
361 |
|
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
362 |
gd.num_dataset = numd; |
0 | 363 |
|
364 |
DrawGraph(&gd); |
|
236
da0ae9d977e0
(svn r237) -Fix: [1025836] Company value problem (again). Now company value rightly shows the value, including ALL your money.
darkvater
parents:
222
diff
changeset
|
365 |
} break; |
0 | 366 |
case WE_CLICK: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
367 |
if (e->we.click.widget == 2) /* Clicked on Legend */ |
0 | 368 |
ShowGraphLegend(); |
369 |
break; |
|
370 |
} |
|
371 |
} |
|
372 |
||
373 |
static const Widget _operating_profit_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
374 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
375 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 525, 0, 13, STR_7025_OPERATING_PROFIT_GRAPH, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
376 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
377 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 575, 14, 173, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
165
diff
changeset
|
378 |
{ WIDGETS_END}, |
0 | 379 |
}; |
380 |
||
381 |
static const WindowDesc _operating_profit_desc = { |
|
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
382 |
WDP_AUTO, WDP_AUTO, 576, 174, |
0 | 383 |
WC_OPERATING_PROFIT,0, |
384 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
385 |
_operating_profit_widgets, |
|
386 |
OperatingProfitWndProc |
|
387 |
}; |
|
388 |
||
389 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
390 |
void ShowOperatingProfitGraph(void) |
0 | 391 |
{ |
392 |
if (AllocateWindowDescFront(&_operating_profit_desc, 0)) { |
|
393 |
InvalidateWindow(WC_GRAPH_LEGEND, 0); |
|
394 |
} |
|
395 |
} |
|
396 |
||
397 |
||
398 |
/****************/ |
|
399 |
/* INCOME GRAPH */ |
|
400 |
/****************/ |
|
401 |
||
402 |
static void IncomeGraphWndProc(Window *w, WindowEvent *e) |
|
403 |
{ |
|
2952 | 404 |
switch (e->event) { |
0 | 405 |
case WE_PAINT: { |
406 |
GraphDrawer gd; |
|
2475 | 407 |
const Player* p; |
0 | 408 |
int i,j; |
409 |
int numd; |
|
410 |
||
411 |
DrawWindowWidgets(w); |
|
412 |
||
413 |
gd.left = 2; |
|
414 |
gd.top = 18; |
|
415 |
gd.height = 104; |
|
416 |
gd.include_neg = false; |
|
2246
f25de67915ee
(svn r2766) Remove string and make use of the plural feature
tron
parents:
2187
diff
changeset
|
417 |
gd.format_str_y_axis = STR_CURRCOMPACT; |
0 | 418 |
gd.color_3 = 0x10; |
419 |
gd.color_2 = 0xD7; |
|
420 |
gd.bg_line_color = 0xE; |
|
421 |
SetupGraphDrawerForPlayers(&gd); |
|
422 |
||
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
423 |
numd = 0; |
0 | 424 |
FOR_ALL_PLAYERS(p) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
425 |
if (p->is_active) { |
4444
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4365
diff
changeset
|
426 |
gd.colors[numd] = _colour_gradient[p->player_color][6]; |
2952 | 427 |
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
428 |
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].income; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
429 |
i++; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
430 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
431 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
432 |
numd++; |
0 | 433 |
} |
434 |
||
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
435 |
gd.num_dataset = numd; |
0 | 436 |
|
437 |
DrawGraph(&gd); |
|
438 |
break; |
|
439 |
} |
|
440 |
||
441 |
case WE_CLICK: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
442 |
if (e->we.click.widget == 2) |
0 | 443 |
ShowGraphLegend(); |
444 |
break; |
|
445 |
} |
|
446 |
} |
|
447 |
||
448 |
static const Widget _income_graph_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
449 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
450 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 525, 0, 13, STR_7022_INCOME_GRAPH, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
451 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
452 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 575, 14, 141, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
165
diff
changeset
|
453 |
{ WIDGETS_END}, |
0 | 454 |
}; |
455 |
||
456 |
static const WindowDesc _income_graph_desc = { |
|
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
457 |
WDP_AUTO, WDP_AUTO, 576, 142, |
0 | 458 |
WC_INCOME_GRAPH,0, |
459 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
460 |
_income_graph_widgets, |
|
461 |
IncomeGraphWndProc |
|
462 |
}; |
|
463 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
464 |
void ShowIncomeGraph(void) |
0 | 465 |
{ |
466 |
if (AllocateWindowDescFront(&_income_graph_desc, 0)) { |
|
467 |
InvalidateWindow(WC_GRAPH_LEGEND, 0); |
|
468 |
} |
|
469 |
} |
|
470 |
||
471 |
/*******************/ |
|
472 |
/* DELIVERED CARGO */ |
|
473 |
/*******************/ |
|
474 |
||
475 |
static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e) |
|
476 |
{ |
|
2952 | 477 |
switch (e->event) { |
0 | 478 |
case WE_PAINT: { |
479 |
GraphDrawer gd; |
|
2475 | 480 |
const Player* p; |
0 | 481 |
int i,j; |
482 |
int numd; |
|
483 |
||
484 |
DrawWindowWidgets(w); |
|
485 |
||
486 |
gd.left = 2; |
|
487 |
gd.top = 18; |
|
488 |
gd.height = 104; |
|
489 |
gd.include_neg = false; |
|
490 |
gd.format_str_y_axis = STR_7024; |
|
491 |
gd.color_3 = 0x10; |
|
492 |
gd.color_2 = 0xD7; |
|
493 |
gd.bg_line_color = 0xE; |
|
494 |
SetupGraphDrawerForPlayers(&gd); |
|
495 |
||
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
496 |
numd = 0; |
0 | 497 |
FOR_ALL_PLAYERS(p) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
498 |
if (p->is_active) { |
4444
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4365
diff
changeset
|
499 |
gd.colors[numd] = _colour_gradient[p->player_color][6]; |
2952 | 500 |
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
501 |
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].delivered_cargo; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
502 |
i++; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
503 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
504 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
505 |
numd++; |
0 | 506 |
} |
507 |
||
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
508 |
gd.num_dataset = numd; |
0 | 509 |
|
510 |
DrawGraph(&gd); |
|
511 |
break; |
|
512 |
} |
|
513 |
||
514 |
case WE_CLICK: |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
515 |
if (e->we.click.widget == 2) |
0 | 516 |
ShowGraphLegend(); |
517 |
break; |
|
518 |
} |
|
519 |
} |
|
520 |
||
521 |
static const Widget _delivered_cargo_graph_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
522 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
523 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 525, 0, 13, STR_7050_UNITS_OF_CARGO_DELIVERED, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
524 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
525 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 575, 14, 141, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
165
diff
changeset
|
526 |
{ WIDGETS_END}, |
0 | 527 |
}; |
528 |
||
529 |
static const WindowDesc _delivered_cargo_graph_desc = { |
|
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
530 |
WDP_AUTO, WDP_AUTO, 576, 142, |
0 | 531 |
WC_DELIVERED_CARGO,0, |
532 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
533 |
_delivered_cargo_graph_widgets, |
|
534 |
DeliveredCargoGraphWndProc |
|
535 |
}; |
|
536 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
537 |
void ShowDeliveredCargoGraph(void) |
0 | 538 |
{ |
539 |
if (AllocateWindowDescFront(&_delivered_cargo_graph_desc, 0)) { |
|
540 |
InvalidateWindow(WC_GRAPH_LEGEND, 0); |
|
541 |
} |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
542 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
543 |
|
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
544 |
/***********************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
545 |
/* PERFORMANCE HISTORY */ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
546 |
/***********************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
547 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
548 |
static void PerformanceHistoryWndProc(Window *w, WindowEvent *e) |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
549 |
{ |
2952 | 550 |
switch (e->event) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
551 |
case WE_PAINT: { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
552 |
GraphDrawer gd; |
2475 | 553 |
const Player* p; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
554 |
int i,j; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
555 |
int numd; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
556 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
557 |
DrawWindowWidgets(w); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
558 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
559 |
gd.left = 2; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
560 |
gd.top = 18; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
561 |
gd.height = 200; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
562 |
gd.include_neg = false; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
563 |
gd.format_str_y_axis = STR_7024; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
564 |
gd.color_3 = 0x10; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
565 |
gd.color_2 = 0xD7; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
566 |
gd.bg_line_color = 0xE; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
567 |
SetupGraphDrawerForPlayers(&gd); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
568 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
569 |
numd = 0; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
570 |
FOR_ALL_PLAYERS(p) { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
571 |
if (p->is_active) { |
4444
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4365
diff
changeset
|
572 |
gd.colors[numd] = _colour_gradient[p->player_color][6]; |
2952 | 573 |
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
574 |
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].performance_history; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
575 |
i++; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
576 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
577 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
578 |
numd++; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
579 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
580 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
581 |
gd.num_dataset = numd; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
582 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
583 |
DrawGraph(&gd); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
584 |
break; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
585 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
586 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
587 |
case WE_CLICK: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
588 |
if (e->we.click.widget == 2) |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
589 |
ShowGraphLegend(); |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
590 |
if (e->we.click.widget == 3) |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
591 |
ShowPerformanceRatingDetail(); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
592 |
break; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
593 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
594 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
595 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
596 |
static const Widget _performance_history_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
597 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
598 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 475, 0, 13, STR_7051_COMPANY_PERFORMANCE_RATINGS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
599 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
600 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 476, 525, 0, 13, STR_PERFORMANCE_DETAIL_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
601 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 575, 14, 237, 0x0, STR_NULL}, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
602 |
{ WIDGETS_END}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
603 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
604 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
605 |
static const WindowDesc _performance_history_desc = { |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
606 |
WDP_AUTO, WDP_AUTO, 576, 238, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
607 |
WC_PERFORMANCE_HISTORY,0, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
608 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
609 |
_performance_history_widgets, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
610 |
PerformanceHistoryWndProc |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
611 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
612 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
613 |
void ShowPerformanceHistoryGraph(void) |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
614 |
{ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
615 |
if (AllocateWindowDescFront(&_performance_history_desc, 0)) { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
616 |
InvalidateWindow(WC_GRAPH_LEGEND, 0); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
617 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
618 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
619 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
620 |
/*****************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
621 |
/* COMPANY VALUE */ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
622 |
/*****************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
623 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
624 |
static void CompanyValueGraphWndProc(Window *w, WindowEvent *e) |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
625 |
{ |
2952 | 626 |
switch (e->event) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
627 |
case WE_PAINT: { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
628 |
GraphDrawer gd; |
2475 | 629 |
const Player* p; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
630 |
int i,j; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
631 |
int numd; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
632 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
633 |
DrawWindowWidgets(w); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
634 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
635 |
gd.left = 2; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
636 |
gd.top = 18; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
637 |
gd.height = 200; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
638 |
gd.include_neg = false; |
2246
f25de67915ee
(svn r2766) Remove string and make use of the plural feature
tron
parents:
2187
diff
changeset
|
639 |
gd.format_str_y_axis = STR_CURRCOMPACT; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
640 |
gd.color_3 = 0x10; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
641 |
gd.color_2 = 0xD7; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
642 |
gd.bg_line_color = 0xE; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
643 |
SetupGraphDrawerForPlayers(&gd); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
644 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
645 |
numd = 0; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
646 |
FOR_ALL_PLAYERS(p) { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
647 |
if (p->is_active) { |
4444
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4365
diff
changeset
|
648 |
gd.colors[numd] = _colour_gradient[p->player_color][6]; |
2952 | 649 |
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
650 |
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].company_value; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
651 |
i++; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
652 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
653 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
654 |
numd++; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
655 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
656 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
657 |
gd.num_dataset = numd; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
658 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
659 |
DrawGraph(&gd); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
660 |
break; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
661 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
662 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
663 |
case WE_CLICK: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
664 |
if (e->we.click.widget == 2) |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
665 |
ShowGraphLegend(); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
666 |
break; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
667 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
668 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
669 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
670 |
static const Widget _company_value_graph_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
671 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
672 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 525, 0, 13, STR_7052_COMPANY_VALUES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
673 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
674 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 575, 14, 237, 0x0, STR_NULL}, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
675 |
{ WIDGETS_END}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
676 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
677 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
678 |
static const WindowDesc _company_value_graph_desc = { |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
679 |
WDP_AUTO, WDP_AUTO, 576, 238, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
680 |
WC_COMPANY_VALUE,0, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
681 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
682 |
_company_value_graph_widgets, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
683 |
CompanyValueGraphWndProc |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
684 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
685 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
686 |
void ShowCompanyValueGraph(void) |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
687 |
{ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
688 |
if (AllocateWindowDescFront(&_company_value_graph_desc, 0)) { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
689 |
InvalidateWindow(WC_GRAPH_LEGEND, 0); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
690 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
691 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
692 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
693 |
/*****************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
694 |
/* PAYMENT RATES */ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
695 |
/*****************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
696 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
697 |
static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e) |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
698 |
{ |
2952 | 699 |
switch (e->event) { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
700 |
case WE_CREATE: { |
5235
3c309f43f0a6
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5070
diff
changeset
|
701 |
uint i; |
3c309f43f0a6
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5070
diff
changeset
|
702 |
for (i = 3; i < w->widget_count; i++) { |
3c309f43f0a6
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5070
diff
changeset
|
703 |
if (!HASBIT(_legend_cargobits, i - 3)) LowerWindowWidget(w, i); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
704 |
} |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
705 |
break; |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
706 |
} |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
707 |
|
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
708 |
case WE_PAINT: { |
3344
d86c852715fa
(svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents:
3033
diff
changeset
|
709 |
int j, x, y; |
d86c852715fa
(svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents:
3033
diff
changeset
|
710 |
CargoID i; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
711 |
GraphDrawer gd; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
712 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
713 |
DrawWindowWidgets(w); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
714 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
715 |
x = 495; |
4911
84e907c7822a
(svn r6882) -Fix r6777: Off by one drawing error for cargo buttons
Darkvater
parents:
4851
diff
changeset
|
716 |
y = 24; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
717 |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
718 |
gd.sel = _legend_cargobits; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
719 |
gd.left = 2; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
720 |
gd.top = 24; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
721 |
gd.height = 104; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
722 |
gd.include_neg = false; |
2246
f25de67915ee
(svn r2766) Remove string and make use of the plural feature
tron
parents:
2187
diff
changeset
|
723 |
gd.format_str_y_axis = STR_CURRCOMPACT; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
724 |
gd.color_3 = 16; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
725 |
gd.color_2 = 215; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
726 |
gd.bg_line_color = 14; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
727 |
gd.num_dataset = NUM_CARGO; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
728 |
gd.num_on_x_axis = 20; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
729 |
gd.num_vert_lines = 20; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
730 |
gd.month = 0xFF; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
731 |
gd.unk61A = 10; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
732 |
gd.unk61C = 10; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
733 |
|
2952 | 734 |
for (i = 0; i != NUM_CARGO; i++) { |
4851
15d60e1f41a2
(svn r6777) -GuiChange: When painting a lowered button on CargoPaymentsRates, displace the content of one pixel to the right and to the bottom. This will make it look like a normal button
belugas
parents:
4760
diff
changeset
|
735 |
/* Since the buttons have no text, no images, |
15d60e1f41a2
(svn r6777) -GuiChange: When painting a lowered button on CargoPaymentsRates, displace the content of one pixel to the right and to the bottom. This will make it look like a normal button
belugas
parents:
4760
diff
changeset
|
736 |
* both the text and the colored box have to be manually painted. |
15d60e1f41a2
(svn r6777) -GuiChange: When painting a lowered button on CargoPaymentsRates, displace the content of one pixel to the right and to the bottom. This will make it look like a normal button
belugas
parents:
4760
diff
changeset
|
737 |
* clk_dif will move one pixel down and one pixel to the right |
15d60e1f41a2
(svn r6777) -GuiChange: When painting a lowered button on CargoPaymentsRates, displace the content of one pixel to the right and to the bottom. This will make it look like a normal button
belugas
parents:
4760
diff
changeset
|
738 |
* when the button is clicked */ |
15d60e1f41a2
(svn r6777) -GuiChange: When painting a lowered button on CargoPaymentsRates, displace the content of one pixel to the right and to the bottom. This will make it look like a normal button
belugas
parents:
4760
diff
changeset
|
739 |
byte clk_dif = IsWindowWidgetLowered(w, i + 3) ? 1 : 0; |
15d60e1f41a2
(svn r6777) -GuiChange: When painting a lowered button on CargoPaymentsRates, displace the content of one pixel to the right and to the bottom. This will make it look like a normal button
belugas
parents:
4760
diff
changeset
|
740 |
|
15d60e1f41a2
(svn r6777) -GuiChange: When painting a lowered button on CargoPaymentsRates, displace the content of one pixel to the right and to the bottom. This will make it look like a normal button
belugas
parents:
4760
diff
changeset
|
741 |
GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0); |
5291
5e4d9ab3cc0f
(svn r7444) -Codechange: Use one (global) cargo-colours array for drawing cargo-colours. Change Food
Darkvater
parents:
5247
diff
changeset
|
742 |
GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, _cargo_colours[i]); |
3801
866d8cb1d707
(svn r4809) Codechange : Merged two loops in only one.
belugas
parents:
3733
diff
changeset
|
743 |
SetDParam(0, _cargoc.names_s[i]); |
4851
15d60e1f41a2
(svn r6777) -GuiChange: When painting a lowered button on CargoPaymentsRates, displace the content of one pixel to the right and to the bottom. This will make it look like a normal button
belugas
parents:
4760
diff
changeset
|
744 |
DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, 0); |
3801
866d8cb1d707
(svn r4809) Codechange : Merged two loops in only one.
belugas
parents:
3733
diff
changeset
|
745 |
y += 8; |
5291
5e4d9ab3cc0f
(svn r7444) -Codechange: Use one (global) cargo-colours array for drawing cargo-colours. Change Food
Darkvater
parents:
5247
diff
changeset
|
746 |
gd.colors[i] = _cargo_colours[i]; |
2952 | 747 |
for (j = 0; j != 20; j++) { |
748 |
gd.cost[i][j] = (uint64)GetTransportedGoodsIncome(10, 20, j * 6 + 6, i); |
|
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
749 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
750 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
751 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
752 |
DrawGraph(&gd); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
753 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
754 |
DrawString(2 + 46, 24 + gd.height + 7, STR_7062_DAYS_IN_TRANSIT, 0); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
755 |
DrawString(2 + 84, 24 - 9, STR_7063_PAYMENT_FOR_DELIVERING, 0); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
756 |
} break; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
757 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
758 |
case WE_CLICK: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
759 |
switch (e->we.click.widget) { |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
760 |
case 3: case 4: case 5: case 6: |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
761 |
case 7: case 8: case 9: case 10: |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
762 |
case 11: case 12: case 13: case 14: |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
763 |
TOGGLEBIT(_legend_cargobits, e->we.click.widget - 3); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
764 |
ToggleWidgetLoweredState(w, e->we.click.widget); |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
765 |
SetWindowDirty(w); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
766 |
break; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
767 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
768 |
} break; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
769 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
770 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
771 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
772 |
static const Widget _cargo_payment_rates_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
773 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
774 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 567, 0, 13, STR_7061_CARGO_PAYMENT_RATES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
775 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 567, 14, 141, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
776 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 24, 31, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
777 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 32, 39, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
778 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 40, 47, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
779 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 48, 55, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
780 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 56, 63, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
781 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 64, 71, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
782 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 72, 79, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
783 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 80, 87, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
784 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 88, 95, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
785 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 96, 103, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
786 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 104, 111, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
787 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 112, 119, 0x0, STR_7064_TOGGLE_GRAPH_FOR_CARGO}, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
788 |
{ WIDGETS_END}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
789 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
790 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
791 |
static const WindowDesc _cargo_payment_rates_desc = { |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
792 |
WDP_AUTO, WDP_AUTO, 568, 142, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
793 |
WC_PAYMENT_RATES,0, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
794 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
795 |
_cargo_payment_rates_widgets, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
796 |
CargoPaymentRatesWndProc |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
797 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
798 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
799 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
800 |
void ShowCargoPaymentRates(void) |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
801 |
{ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
802 |
AllocateWindowDescFront(&_cargo_payment_rates_desc, 0); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
803 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
804 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
805 |
/************************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
806 |
/* COMPANY LEAGUE TABLE */ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
807 |
/************************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
808 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
809 |
static const StringID _performance_titles[] = { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
810 |
STR_7066_ENGINEER, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
811 |
STR_7066_ENGINEER, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
812 |
STR_7067_TRAFFIC_MANAGER, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
813 |
STR_7067_TRAFFIC_MANAGER, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
814 |
STR_7068_TRANSPORT_COORDINATOR, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
815 |
STR_7068_TRANSPORT_COORDINATOR, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
816 |
STR_7069_ROUTE_SUPERVISOR, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
817 |
STR_7069_ROUTE_SUPERVISOR, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
818 |
STR_706A_DIRECTOR, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
819 |
STR_706A_DIRECTOR, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
820 |
STR_706B_CHIEF_EXECUTIVE, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
821 |
STR_706B_CHIEF_EXECUTIVE, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
822 |
STR_706C_CHAIRMAN, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
823 |
STR_706C_CHAIRMAN, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
824 |
STR_706D_PRESIDENT, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
825 |
STR_706E_TYCOON, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
826 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
827 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
828 |
static inline StringID GetPerformanceTitleFromValue(uint value) |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
829 |
{ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
830 |
return _performance_titles[minu(value, 1000) >> 6]; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
831 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
832 |
|
2656
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
833 |
static int CDECL PerfHistComp(const void* elem1, const void* elem2) |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
834 |
{ |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
835 |
const Player* p1 = *(const Player* const*)elem1; |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
836 |
const Player* p2 = *(const Player* const*)elem2; |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
837 |
|
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
838 |
return p2->old_economy[1].performance_history - p1->old_economy[1].performance_history; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
839 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
840 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
841 |
static void CompanyLeagueWndProc(Window *w, WindowEvent *e) |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
842 |
{ |
2482
dffcca243dbc
(svn r3008) [ 1247535 ] Native Support for Win64 (compile&run only) (michi_cc)
Darkvater
parents:
2475
diff
changeset
|
843 |
switch (e->event) { |
2656
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
844 |
case WE_PAINT: { |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
845 |
const Player* plist[MAX_PLAYERS]; |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
846 |
const Player* p; |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
847 |
uint pl_num; |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
848 |
uint i; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
849 |
|
2656
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
850 |
DrawWindowWidgets(w); |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
851 |
|
2656
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
852 |
pl_num = 0; |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
853 |
FOR_ALL_PLAYERS(p) if (p->is_active) plist[pl_num++] = p; |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
854 |
|
2673
1c1e8cb73c67
(svn r3215) - Fix: warning on VS.NET 2003 complaining about constness reintroduced by revision 3192
Darkvater
parents:
2656
diff
changeset
|
855 |
qsort((void*)plist, pl_num, sizeof(*plist), PerfHistComp); |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
856 |
|
2656
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
857 |
for (i = 0; i != pl_num; i++) { |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
858 |
p = plist[i]; |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
859 |
SetDParam(0, i + STR_01AC_1ST); |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
860 |
SetDParam(1, p->name_1); |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
861 |
SetDParam(2, p->name_2); |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
862 |
SetDParam(3, GetPlayerNameString(p->index, 4)); |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
863 |
SetDParam(5, GetPerformanceTitleFromValue(p->old_economy[1].performance_history)); |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
864 |
|
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
865 |
DrawString(2, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, 0); |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
866 |
DrawPlayerIcon(p->index, 27, 16 + i * 10); |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
867 |
} |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
868 |
|
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
869 |
break; |
796b75ba15e3
(svn r3198) Rewrite the company league drawing routine for better readability
tron
parents:
2639
diff
changeset
|
870 |
} |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
871 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
872 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
873 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
874 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
875 |
static const Widget _company_league_widgets[] = { |
2869
5cf9acd29edd
(svn r3417) - Make company league table window pinnable.
peter1138
parents:
2725
diff
changeset
|
876 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5cf9acd29edd
(svn r3417) - Make company league table window pinnable.
peter1138
parents:
2725
diff
changeset
|
877 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 387, 0, 13, STR_7053_COMPANY_LEAGUE_TABLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5cf9acd29edd
(svn r3417) - Make company league table window pinnable.
peter1138
parents:
2725
diff
changeset
|
878 |
{ WWT_STICKYBOX, RESIZE_NONE, 14, 388, 399, 0, 13, STR_NULL, STR_STICKY_BUTTON}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
879 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 399, 14, 96, 0x0, STR_NULL}, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
880 |
{ WIDGETS_END}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
881 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
882 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
883 |
static const WindowDesc _company_league_desc = { |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
884 |
WDP_AUTO, WDP_AUTO, 400, 97, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
885 |
WC_COMPANY_LEAGUE,0, |
2869
5cf9acd29edd
(svn r3417) - Make company league table window pinnable.
peter1138
parents:
2725
diff
changeset
|
886 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
887 |
_company_league_widgets, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
888 |
CompanyLeagueWndProc |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
889 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
890 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
891 |
void ShowCompanyLeagueTable(void) |
1086
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
892 |
{ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
893 |
AllocateWindowDescFront(&_company_league_desc,0); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
894 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
895 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
896 |
/*****************************/ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
897 |
/* PERFORMANCE RATING DETAIL */ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
898 |
/*****************************/ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
899 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
900 |
static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
901 |
{ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
902 |
static PlayerID _performance_rating_detail_player = PLAYER_FIRST; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
903 |
|
2952 | 904 |
switch (e->event) { |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
905 |
case WE_PAINT: { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
906 |
byte x; |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
907 |
uint16 y = 14; |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
908 |
int total_score = 0; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
909 |
int color_done, color_notdone; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
910 |
|
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
911 |
// Draw standard stuff |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
912 |
DrawWindowWidgets(w); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
913 |
|
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
914 |
// Paint the player icons |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
915 |
for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
916 |
if (!GetPlayer(i)->is_active) { |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
917 |
// Check if we have the player as an active player |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
918 |
if (!IsWindowWidgetDisabled(w, i + 13)) { |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
919 |
// Bah, player gone :( |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
920 |
DisableWindowWidget(w, i + 13); |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
921 |
// Is this player selected? If so, select first player (always save? :s) |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
922 |
if (IsWindowWidgetLowered(w, i + 13)) { |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
923 |
RaiseWindowWidget(w, i + 13); |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
924 |
LowerWindowWidget(w, 13); |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
925 |
_performance_rating_detail_player = PLAYER_FIRST; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
926 |
} |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
927 |
// We need a repaint |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
928 |
SetWindowDirty(w); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
929 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
930 |
continue; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
931 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
932 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
933 |
// Check if we have the player marked as inactive |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
934 |
if (IsWindowWidgetDisabled(w, i + 13)) { |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
935 |
// New player! Yippie :p |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
936 |
EnableWindowWidget(w, i + 13); |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
937 |
// We need a repaint |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
938 |
SetWindowDirty(w); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
939 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
940 |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
941 |
x = (i == _performance_rating_detail_player) ? 1 : 0; |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
942 |
DrawPlayerIcon(i, i * 37 + 13 + x, 16 + x); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
943 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
944 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
945 |
// The colors used to show how the progress is going |
4444
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4365
diff
changeset
|
946 |
color_done = _colour_gradient[COLOUR_GREEN][4]; |
9c9c7f962482
(svn r6222) Remove struct ColorList, because the names of its attributes are plain confusing
tron
parents:
4365
diff
changeset
|
947 |
color_notdone = _colour_gradient[COLOUR_RED][4]; |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
948 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
949 |
// Draw all the score parts |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
950 |
for (ScoreID i = SCORE_BEGIN; i < SCORE_END; i++) { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
951 |
int val = _score_part[_performance_rating_detail_player][i]; |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
952 |
int needed = _score_info[i].needed; |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
953 |
int score = _score_info[i].score; |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
954 |
|
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
955 |
y += 20; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
956 |
// SCORE_TOTAL has his own rulez ;) |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
957 |
if (i == SCORE_TOTAL) { |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
958 |
needed = total_score; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
959 |
score = SCORE_MAX; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
960 |
} else { |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
961 |
total_score += score; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
962 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
963 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
964 |
DrawString(7, y, STR_PERFORMANCE_DETAIL_VEHICLES + i, 0); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
965 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
966 |
// Draw the score |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
967 |
SetDParam(0, score); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
968 |
DrawStringRightAligned(107, y, SET_PERFORMANCE_DETAIL_INT, 0); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
969 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
970 |
// Calculate the %-bar |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
971 |
if (val > needed) { |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
972 |
x = 50; |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
973 |
} else if (val == 0) { |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
974 |
x = 0; |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
975 |
} else { |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
976 |
x = val * 50 / needed; |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
977 |
} |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
978 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
979 |
// SCORE_LOAN is inversed |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
980 |
if (val < 0 && i == SCORE_LOAN) x = 0; |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
981 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
982 |
// Draw the bar |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
983 |
if (x != 0) GfxFillRect(112, y - 2, 112 + x, y + 10, color_done); |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
984 |
if (x != 50) GfxFillRect(112 + x, y - 2, 112 + 50, y + 10, color_notdone); |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
985 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
986 |
// Calculate the % |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
987 |
x = (val <= needed) ? val * 100 / needed : 100; |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
988 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
989 |
// SCORE_LOAN is inversed |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
990 |
if (val < 0 && i == SCORE_LOAN) x = 0; |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
991 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
992 |
// Draw it |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
993 |
SetDParam(0, x); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
994 |
DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, 0); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
995 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
996 |
// SCORE_LOAN is inversed |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
997 |
if (i == SCORE_LOAN) val = needed - val; |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
998 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
999 |
// Draw the amount we have against what is needed |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1000 |
// For some of them it is in currency format |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1001 |
SetDParam(0, val); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1002 |
SetDParam(1, needed); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1003 |
switch (i) { |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1004 |
case SCORE_MIN_PROFIT: |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1005 |
case SCORE_MIN_INCOME: |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1006 |
case SCORE_MAX_INCOME: |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1007 |
case SCORE_MONEY: |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1008 |
case SCORE_LOAN: |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1009 |
DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY, 0); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1010 |
break; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1011 |
default: |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1012 |
DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_INT, 0); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1013 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1014 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1015 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1016 |
break; |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1017 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1018 |
|
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1019 |
case WE_CLICK: |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1020 |
// Check which button is clicked |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4444
diff
changeset
|
1021 |
if (IS_INT_INSIDE(e->we.click.widget, 13, 21)) { |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1022 |
// Is it no on disable? |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
1023 |
if (!IsWindowWidgetDisabled(w, e->we.click.widget)) { |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1024 |
RaiseWindowWidget(w, _performance_rating_detail_player + 13); |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1025 |
_performance_rating_detail_player = (PlayerID)(e->we.click.widget - 13); |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1026 |
LowerWindowWidget(w, _performance_rating_detail_player + 13); |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1027 |
SetWindowDirty(w); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1028 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1029 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1030 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1031 |
|
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1032 |
case WE_CREATE: { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1033 |
PlayerID i; |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1034 |
Player *p2; |
4702
5179f9adc5b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4634
diff
changeset
|
1035 |
|
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
1036 |
/* Disable the players who are not active */ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1037 |
for (i = PLAYER_FIRST; i < MAX_PLAYERS; i++) { |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
1038 |
SetWindowWidgetDisabledState(w, i + 13, !GetPlayer(i)->is_active); |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1039 |
} |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1040 |
/* Update all player stats with the current data |
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1041 |
* (this is because _score_info is not saved to a savegame) */ |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
1042 |
FOR_ALL_PLAYERS(p2) { |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
1043 |
if (p2->is_active) UpdateCompanyRatingAndValue(p2, false); |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
1044 |
} |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1045 |
|
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1046 |
w->custom[0] = DAY_TICKS; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1047 |
w->custom[1] = 5; |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1048 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1049 |
_performance_rating_detail_player = PLAYER_FIRST; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
1050 |
LowerWindowWidget(w, _performance_rating_detail_player + 13); |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1051 |
SetWindowDirty(w); |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1052 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1053 |
break; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1054 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1055 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1056 |
case WE_TICK: { |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1057 |
// Update the player score every 5 days |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1058 |
if (--w->custom[0] == 0) { |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1059 |
w->custom[0] = DAY_TICKS; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1060 |
if (--w->custom[1] == 0) { |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1061 |
Player *p2; |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
1062 |
|
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1063 |
w->custom[1] = 5; |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
1064 |
FOR_ALL_PLAYERS(p2) { |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1065 |
// Skip if player is not active |
3033
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
1066 |
if (p2->is_active) UpdateCompanyRatingAndValue(p2, false); |
e4f7c60a1742
(svn r3613) Some more const, indentation, whitespace and similar stuff
tron
parents:
3027
diff
changeset
|
1067 |
} |
3027
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1068 |
SetWindowDirty(w); |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1069 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1070 |
} |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1071 |
|
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1072 |
break; |
43ffdf4d6a1f
(svn r3607) - Fix indenting of PerformanceRatingDetailWndProc()
peter1138
parents:
2952
diff
changeset
|
1073 |
} |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1074 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1075 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1076 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1077 |
static const Widget _performance_rating_detail_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
1078 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4293
diff
changeset
|
1079 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 298, 0, 13, STR_PERFORMANCE_DETAIL, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1080 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 14, 27, 0x0, STR_NULL}, |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1081 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1082 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 28, 47, 0x0, STR_PERFORMANCE_DETAIL_VEHICLES_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1083 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 48, 67, 0x0, STR_PERFORMANCE_DETAIL_STATIONS_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1084 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 68, 87, 0x0, STR_PERFORMANCE_DETAIL_MIN_PROFIT_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1085 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 88, 107, 0x0, STR_PERFORMANCE_DETAIL_MIN_INCOME_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1086 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 108, 127, 0x0, STR_PERFORMANCE_DETAIL_MAX_INCOME_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1087 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 128, 147, 0x0, STR_PERFORMANCE_DETAIL_DELIVERED_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1088 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 148, 167, 0x0, STR_PERFORMANCE_DETAIL_CARGO_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1089 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 168, 187, 0x0, STR_PERFORMANCE_DETAIL_MONEY_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1090 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 188, 207, 0x0, STR_PERFORMANCE_DETAIL_LOAN_TIP}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1091 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 298, 208, 227, 0x0, STR_PERFORMANCE_DETAIL_TOTAL_TIP}, |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1092 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1093 |
{ WWT_PANEL, RESIZE_NONE, 14, 2, 38, 14, 26, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1094 |
{ WWT_PANEL, RESIZE_NONE, 14, 39, 75, 14, 26, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1095 |
{ WWT_PANEL, RESIZE_NONE, 14, 76, 112, 14, 26, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1096 |
{ WWT_PANEL, RESIZE_NONE, 14, 113, 149, 14, 26, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1097 |
{ WWT_PANEL, RESIZE_NONE, 14, 150, 186, 14, 26, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1098 |
{ WWT_PANEL, RESIZE_NONE, 14, 187, 223, 14, 26, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1099 |
{ WWT_PANEL, RESIZE_NONE, 14, 224, 260, 14, 26, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4912
diff
changeset
|
1100 |
{ WWT_PANEL, RESIZE_NONE, 14, 261, 297, 14, 26, 0x0, STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
165
diff
changeset
|
1101 |
{ WIDGETS_END}, |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1102 |
}; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1103 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1104 |
static const WindowDesc _performance_rating_detail_desc = { |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4938
diff
changeset
|
1105 |
WDP_AUTO, WDP_AUTO, 299, 228, |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1106 |
WC_PERFORMANCE_DETAIL,0, |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1107 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1108 |
_performance_rating_detail_widgets, |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1109 |
PerformanceRatingDetailWndProc |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1110 |
}; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1111 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1086
diff
changeset
|
1112 |
void ShowPerformanceRatingDetail(void) |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1113 |
{ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1114 |
AllocateWindowDescFront(&_performance_rating_detail_desc, 0); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1115 |
} |