author | Darkvater |
Tue, 19 Jul 2005 22:29:35 +0000 | |
changeset 2135 | 48fb9f0322cb |
parent 2133 | 098c9da8292e |
child 2159 | 3b634157c3b2 |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1575
diff
changeset
|
2 |
#include "openttd.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
410
diff
changeset
|
3 |
#include "table/strings.h" |
0 | 4 |
#include "window.h" |
5 |
#include "gui.h" |
|
6 |
#include "gfx.h" |
|
7 |
#include "player.h" |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
8 |
#include "economy.h" |
1575
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
9 |
#include "signs.h" |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
10 |
#include "strings.h" |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
11 |
#include "debug.h" |
0 | 12 |
|
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
13 |
static uint _legend_excludebits; |
0 | 14 |
static uint _legend_cargobits; |
15 |
||
16 |
/************************/ |
|
17 |
/* GENERIC GRAPH DRAWER */ |
|
18 |
/************************/ |
|
19 |
||
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
|
20 |
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
|
21 |
|
0 | 22 |
typedef struct GraphDrawer { |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
23 |
uint sel; // bitmask of the players *excluded* (e.g. 11111111 means that no players are shown) |
0 | 24 |
byte num_dataset; |
25 |
byte num_on_x_axis; |
|
26 |
byte month; |
|
27 |
byte year; |
|
28 |
bool include_neg; |
|
29 |
byte num_vert_lines; |
|
30 |
uint16 unk61A; |
|
31 |
uint16 unk61C; |
|
32 |
int left, top; |
|
33 |
uint height; |
|
34 |
StringID format_str_y_axis; |
|
35 |
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
|
36 |
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
|
37 |
uint64 cost[GRAPH_NUM][24]; // last 2 years |
0 | 38 |
} GraphDrawer; |
39 |
||
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
|
40 |
#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
|
41 |
|
410 | 42 |
static void DrawGraph(GraphDrawer *gw) |
0 | 43 |
{ |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
44 |
|
0 | 45 |
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
|
46 |
uint x,y,old_x,old_y; |
0 | 47 |
int color; |
48 |
int right, bottom; |
|
49 |
int num_x, num_dataset; |
|
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
|
50 |
uint64 *row_ptr, *col_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
|
51 |
int64 mx; |
0 | 52 |
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
|
53 |
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
|
54 |
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
|
55 |
int64 cur_val; |
0 | 56 |
uint sel; |
57 |
||
240 | 58 |
/* 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
|
59 |
* both values for cargo and players. So if any are higher, quit */ |
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 |
assert(GRAPH_NUM >= NUM_CARGO && GRAPH_NUM >= MAX_PLAYERS); |
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 |
|
0 | 62 |
color = _color_list[gw->bg_line_color].window_color_1b; |
63 |
||
64 |
/* draw the vertical lines */ |
|
65 |
i = gw->num_vert_lines; assert(i > 0); |
|
66 |
x = gw->left + 66; |
|
67 |
bottom = gw->top + gw->height - 1; |
|
68 |
do { |
|
69 |
GfxFillRect(x, gw->top, x, bottom, color); |
|
70 |
x += 22; |
|
71 |
} while (--i); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
72 |
|
0 | 73 |
/* draw the horizontal lines */ |
74 |
i = 9; |
|
75 |
x = gw->left + 44; |
|
76 |
y = gw->height + gw->top; |
|
77 |
right = gw->left + 44 + gw->num_vert_lines*22-1; |
|
78 |
||
79 |
do { |
|
80 |
GfxFillRect(x, y, right, y, color); |
|
81 |
y -= gw->height >> 3; |
|
82 |
} while (--i); |
|
83 |
||
84 |
/* draw vertical edge line */ |
|
85 |
GfxFillRect(x, gw->top, x, bottom, gw->color_2); |
|
86 |
||
87 |
adj_height = gw->height; |
|
88 |
if (gw->include_neg) adj_height >>= 1; |
|
89 |
||
90 |
/* draw horiz edge line */ |
|
91 |
y = adj_height + gw->top; |
|
92 |
GfxFillRect(x, y, right, y, gw->color_2); |
|
93 |
||
94 |
/* find the max element */ |
|
95 |
if (gw->num_on_x_axis == 0) |
|
96 |
return; |
|
97 |
||
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
|
98 |
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
|
99 |
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
|
100 |
|
0 | 101 |
row_ptr = gw->cost[0]; |
102 |
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
|
103 |
/* 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
|
104 |
* 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
|
105 |
sel = gw->sel; |
0 | 106 |
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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
if (*col_ptr != 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
|
113 |
mx = max64(mx, myabs64(*col_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
|
114 |
} |
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 |
} 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
|
116 |
} |
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 |
} 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
|
118 |
|
0 | 119 |
/* 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
|
120 |
y_scaling = INVALID_VALUE; |
0 | 121 |
value = adj_height * 2; |
122 |
||
123 |
if (mx > value) { |
|
124 |
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
|
125 |
y_scaling = (((uint64) (value>>1) << 32) / mx); |
0 | 126 |
value = mx; |
127 |
} |
|
128 |
||
129 |
/* draw text strings on the y axis */ |
|
130 |
tmp = value; |
|
131 |
if (gw->include_neg) tmp >>= 1; |
|
132 |
x = gw->left + 45; |
|
133 |
y = gw->top - 3; |
|
134 |
i = 9; |
|
135 |
do { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
136 |
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
|
137 |
SetDParam64(1, (int64)tmp); |
0 | 138 |
tmp -= (value >> 3); |
139 |
DrawStringRightAligned(x, y, STR_0170, gw->color_3); |
|
140 |
y += gw->height >> 3; |
|
141 |
} while (--i); |
|
142 |
||
143 |
/* draw strings on the x axis */ |
|
144 |
if (gw->month != 0xFF) { |
|
145 |
x = gw->left + 44; |
|
146 |
y = gw->top + gw->height + 1; |
|
147 |
j = gw->month; |
|
970
492ca84ecc6c
(svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
darkvater
parents:
867
diff
changeset
|
148 |
k = gw->year + MAX_YEAR_BEGIN_REAL; |
0 | 149 |
i = gw->num_on_x_axis;assert(i>0); |
150 |
do { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
151 |
SetDParam(2, k); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
152 |
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
|
153 |
SetDParam(1, j + STR_0162_JAN + 2); |
0 | 154 |
DrawString(x, y, j == 0 ? STR_016F : STR_016E, gw->color_3); |
155 |
||
156 |
j += 3; |
|
157 |
if (j >= 12) { |
|
158 |
j = 0; |
|
159 |
k++; |
|
160 |
} |
|
161 |
x += 22; |
|
162 |
} while (--i); |
|
163 |
} else { |
|
164 |
x = gw->left + 52; |
|
165 |
y = gw->top + gw->height + 1; |
|
166 |
j = gw->unk61A; |
|
167 |
i = gw->num_on_x_axis;assert(i>0); |
|
168 |
do { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
169 |
SetDParam(0, j); |
0 | 170 |
DrawString(x, y, STR_01CB, gw->color_3); |
171 |
j += gw->unk61C; |
|
172 |
x += 22; |
|
173 |
} while (--i); |
|
174 |
} |
|
175 |
||
176 |
/* draw lines and dots */ |
|
177 |
i = 0; |
|
178 |
row_ptr = gw->cost[0]; |
|
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
179 |
sel = gw->sel; // show only selected lines. GraphDrawer qw->sel set in Graph-Legend (_legend_excludebits) |
0 | 180 |
do { |
181 |
if (!(sel & 1)) { |
|
182 |
x = gw->left + 55; |
|
183 |
j = gw->num_on_x_axis;assert(j>0); |
|
184 |
col_ptr = row_ptr; |
|
185 |
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
|
186 |
old_y = old_x = INVALID_VALUE; |
0 | 187 |
do { |
188 |
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
|
189 |
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
|
190 |
y = adj_height - BIGMULSS64(cur_val, y_scaling >> 1, 31) + gw->top; |
0 | 191 |
|
192 |
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
|
193 |
if (old_x != INVALID_VALUE) |
0 | 194 |
GfxDrawLine(old_x, old_y, x, y, color); |
195 |
||
196 |
old_x = x; |
|
197 |
old_y = y; |
|
198 |
} 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
|
199 |
old_x = INVALID_VALUE; |
0 | 200 |
} |
201 |
} while (x+=22,--j); |
|
202 |
} |
|
203 |
} while (sel>>=1,row_ptr+=24, ++i < gw->num_dataset); |
|
204 |
} |
|
205 |
||
206 |
/****************/ |
|
207 |
/* GRAPH LEGEND */ |
|
208 |
/****************/ |
|
209 |
||
210 |
void DrawPlayerIcon(int p, int x, int y) |
|
211 |
{ |
|
212 |
DrawSprite(SPRITE_PALETTE(PLAYER_SPRITE_COLOR(p) + 0x2EB), x, y); |
|
213 |
} |
|
214 |
||
215 |
static void GraphLegendWndProc(Window *w, WindowEvent *e) |
|
216 |
{ |
|
217 |
Player *p; |
|
218 |
||
219 |
switch(e->event) { |
|
220 |
case WE_PAINT: |
|
221 |
FOR_ALL_PLAYERS(p) { |
|
222 |
if (!p->is_active) |
|
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
223 |
SETBIT(_legend_excludebits, p->index); |
0 | 224 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
225 |
w->click_state = ((~_legend_excludebits) << 3); |
0 | 226 |
DrawWindowWidgets(w); |
227 |
||
228 |
FOR_ALL_PLAYERS(p) { |
|
229 |
if (!p->is_active) |
|
230 |
continue; |
|
231 |
||
232 |
DrawPlayerIcon(p->index, 4, 18+p->index*12); |
|
233 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
234 |
SetDParam(0, p->name_1); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
235 |
SetDParam(1, p->name_2); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
236 |
SetDParam(2, GetPlayerNameString(p->index, 3)); |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
237 |
DrawString(21,17+p->index*12,STR_7021,HASBIT(_legend_excludebits, p->index) ? 0x10 : 0xC); |
0 | 238 |
} |
239 |
break; |
|
240 |
||
241 |
case WE_CLICK: |
|
242 |
if (IS_INT_INSIDE(e->click.widget, 3, 11)) { |
|
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
243 |
_legend_excludebits ^= (1 << (e->click.widget-3)); |
0 | 244 |
SetWindowDirty(w); |
245 |
InvalidateWindow(WC_INCOME_GRAPH, 0); |
|
246 |
InvalidateWindow(WC_OPERATING_PROFIT, 0); |
|
247 |
InvalidateWindow(WC_DELIVERED_CARGO, 0); |
|
248 |
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
|
249 |
InvalidateWindow(WC_COMPANY_VALUE, 0); |
0 | 250 |
} |
251 |
break; |
|
252 |
} |
|
253 |
} |
|
254 |
||
255 |
static const Widget _graph_legend_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
256 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
257 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 249, 0, 13, STR_704E_KEY_TO_COMPANY_GRAPHS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
258 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 249, 14, 113, 0x0,STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
259 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 16, 27, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
260 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 28, 39, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
261 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 40, 51, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
262 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 52, 63, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
263 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 64, 75, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
264 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 76, 87, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
265 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 247, 88, 99, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
266 |
{ WWT_IMGBTN, 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
|
267 |
{ WIDGETS_END}, |
0 | 268 |
}; |
269 |
||
270 |
static const WindowDesc _graph_legend_desc = { |
|
271 |
-1, -1, 250, 114, |
|
272 |
WC_GRAPH_LEGEND,0, |
|
273 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
274 |
_graph_legend_widgets, |
|
275 |
GraphLegendWndProc |
|
276 |
}; |
|
277 |
||
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
|
278 |
static void ShowGraphLegend(void) |
0 | 279 |
{ |
280 |
AllocateWindowDescFront(&_graph_legend_desc, 0); |
|
281 |
} |
|
282 |
||
283 |
/********************/ |
|
284 |
/* OPERATING PROFIT */ |
|
285 |
/********************/ |
|
286 |
||
287 |
static void SetupGraphDrawerForPlayers(GraphDrawer *gd) |
|
288 |
{ |
|
289 |
Player *p; |
|
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
290 |
uint excludebits = _legend_excludebits; |
0 | 291 |
int nums; |
292 |
int mo,yr; |
|
293 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
294 |
// Exclude the players which aren't valid |
0 | 295 |
FOR_ALL_PLAYERS(p) { |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
296 |
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
|
297 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
298 |
gd->sel = excludebits; |
0 | 299 |
gd->num_vert_lines = 24; |
300 |
||
301 |
nums = 0; |
|
302 |
FOR_ALL_PLAYERS(p) { |
|
303 |
if (p->is_active) nums = max(nums,p->num_valid_stat_ent); |
|
304 |
} |
|
305 |
gd->num_on_x_axis = min(nums,24); |
|
306 |
||
307 |
mo = (_cur_month/3-nums)*3; |
|
308 |
yr = _cur_year; |
|
309 |
while (mo < 0) { |
|
310 |
yr--; |
|
311 |
mo += 12; |
|
312 |
} |
|
313 |
||
314 |
gd->year = yr; |
|
315 |
gd->month = mo; |
|
316 |
} |
|
317 |
||
318 |
static void OperatingProfitWndProc(Window *w, WindowEvent *e) |
|
319 |
{ |
|
320 |
switch(e->event) { |
|
321 |
case WE_PAINT: { |
|
322 |
GraphDrawer gd; |
|
323 |
Player *p; |
|
324 |
int i,j; |
|
325 |
int numd; |
|
326 |
||
327 |
DrawWindowWidgets(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
328 |
|
0 | 329 |
gd.left = 2; |
330 |
gd.top = 18; |
|
331 |
gd.height = 136; |
|
332 |
gd.include_neg = true; |
|
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
|
333 |
gd.format_str_y_axis = STR_CURRCOMPACT32; |
0 | 334 |
gd.color_3 = 0x10; |
335 |
gd.color_2 = 0xD7; |
|
336 |
gd.bg_line_color = 0xE; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
337 |
|
0 | 338 |
SetupGraphDrawerForPlayers(&gd); |
339 |
||
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
|
340 |
numd = 0; |
0 | 341 |
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
|
342 |
if (p->is_active) { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
343 |
gd.colors[numd] = _color_list[p->player_color].window_color_bgb; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
344 |
for(j=gd.num_on_x_axis,i=0; --j >= 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
|
345 |
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
|
346 |
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
|
347 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
348 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
349 |
numd++; |
0 | 350 |
} |
1085
408f95e1b70a
(svn r1586) Fix: [ 1107340 ] Graphs don't show comapany info for company #8
dominik
parents:
1079
diff
changeset
|
351 |
|
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 |
gd.num_dataset = numd; |
0 | 353 |
|
354 |
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
|
355 |
} break; |
0 | 356 |
case WE_CLICK: |
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
|
357 |
if (e->click.widget == 2) /* Clicked on Legend */ |
0 | 358 |
ShowGraphLegend(); |
359 |
break; |
|
360 |
} |
|
361 |
} |
|
362 |
||
363 |
static const Widget _operating_profit_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
364 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
365 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 525, 0, 13, STR_7025_OPERATING_PROFIT_GRAPH, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
366 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
367 |
{ WWT_IMGBTN, 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
|
368 |
{ WIDGETS_END}, |
0 | 369 |
}; |
370 |
||
371 |
static const WindowDesc _operating_profit_desc = { |
|
372 |
-1, -1, 576, 174, |
|
373 |
WC_OPERATING_PROFIT,0, |
|
374 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
375 |
_operating_profit_widgets, |
|
376 |
OperatingProfitWndProc |
|
377 |
}; |
|
378 |
||
379 |
||
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
|
380 |
void ShowOperatingProfitGraph(void) |
0 | 381 |
{ |
382 |
if (AllocateWindowDescFront(&_operating_profit_desc, 0)) { |
|
383 |
InvalidateWindow(WC_GRAPH_LEGEND, 0); |
|
384 |
} |
|
385 |
} |
|
386 |
||
387 |
||
388 |
/****************/ |
|
389 |
/* INCOME GRAPH */ |
|
390 |
/****************/ |
|
391 |
||
392 |
static void IncomeGraphWndProc(Window *w, WindowEvent *e) |
|
393 |
{ |
|
394 |
switch(e->event) { |
|
395 |
case WE_PAINT: { |
|
396 |
GraphDrawer gd; |
|
397 |
Player *p; |
|
398 |
int i,j; |
|
399 |
int numd; |
|
400 |
||
401 |
DrawWindowWidgets(w); |
|
402 |
||
403 |
gd.left = 2; |
|
404 |
gd.top = 18; |
|
405 |
gd.height = 104; |
|
406 |
gd.include_neg = false; |
|
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
|
407 |
gd.format_str_y_axis = STR_CURRCOMPACT32; |
0 | 408 |
gd.color_3 = 0x10; |
409 |
gd.color_2 = 0xD7; |
|
410 |
gd.bg_line_color = 0xE; |
|
411 |
SetupGraphDrawerForPlayers(&gd); |
|
412 |
||
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
|
413 |
numd = 0; |
0 | 414 |
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
|
415 |
if (p->is_active) { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
416 |
gd.colors[numd] = _color_list[p->player_color].window_color_bgb; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
417 |
for(j=gd.num_on_x_axis,i=0; --j >= 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
|
418 |
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
|
419 |
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
|
420 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
421 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
422 |
numd++; |
0 | 423 |
} |
424 |
||
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 |
gd.num_dataset = numd; |
0 | 426 |
|
427 |
DrawGraph(&gd); |
|
428 |
break; |
|
429 |
} |
|
430 |
||
431 |
case WE_CLICK: |
|
432 |
if (e->click.widget == 2) |
|
433 |
ShowGraphLegend(); |
|
434 |
break; |
|
435 |
} |
|
436 |
} |
|
437 |
||
438 |
static const Widget _income_graph_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
439 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
440 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 525, 0, 13, STR_7022_INCOME_GRAPH, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
441 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
442 |
{ WWT_IMGBTN, 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
|
443 |
{ WIDGETS_END}, |
0 | 444 |
}; |
445 |
||
446 |
static const WindowDesc _income_graph_desc = { |
|
447 |
-1, -1, 576, 142, |
|
448 |
WC_INCOME_GRAPH,0, |
|
449 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
450 |
_income_graph_widgets, |
|
451 |
IncomeGraphWndProc |
|
452 |
}; |
|
453 |
||
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
|
454 |
void ShowIncomeGraph(void) |
0 | 455 |
{ |
456 |
if (AllocateWindowDescFront(&_income_graph_desc, 0)) { |
|
457 |
InvalidateWindow(WC_GRAPH_LEGEND, 0); |
|
458 |
} |
|
459 |
} |
|
460 |
||
461 |
/*******************/ |
|
462 |
/* DELIVERED CARGO */ |
|
463 |
/*******************/ |
|
464 |
||
465 |
static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e) |
|
466 |
{ |
|
467 |
switch(e->event) { |
|
468 |
case WE_PAINT: { |
|
469 |
GraphDrawer gd; |
|
470 |
Player *p; |
|
471 |
int i,j; |
|
472 |
int numd; |
|
473 |
||
474 |
DrawWindowWidgets(w); |
|
475 |
||
476 |
gd.left = 2; |
|
477 |
gd.top = 18; |
|
478 |
gd.height = 104; |
|
479 |
gd.include_neg = false; |
|
480 |
gd.format_str_y_axis = STR_7024; |
|
481 |
gd.color_3 = 0x10; |
|
482 |
gd.color_2 = 0xD7; |
|
483 |
gd.bg_line_color = 0xE; |
|
484 |
SetupGraphDrawerForPlayers(&gd); |
|
485 |
||
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
|
486 |
numd = 0; |
0 | 487 |
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
|
488 |
if (p->is_active) { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
489 |
gd.colors[numd] = _color_list[p->player_color].window_color_bgb; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
490 |
for(j=gd.num_on_x_axis,i=0; --j >= 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
|
491 |
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
|
492 |
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
|
493 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
494 |
} |
1079
d6da6dc920a4
(svn r1580) Fix: [ 1106354 ] Graph's keys get confused
dominik
parents:
983
diff
changeset
|
495 |
numd++; |
0 | 496 |
} |
497 |
||
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 |
gd.num_dataset = numd; |
0 | 499 |
|
500 |
DrawGraph(&gd); |
|
501 |
break; |
|
502 |
} |
|
503 |
||
504 |
case WE_CLICK: |
|
505 |
if (e->click.widget == 2) |
|
506 |
ShowGraphLegend(); |
|
507 |
break; |
|
508 |
} |
|
509 |
} |
|
510 |
||
511 |
static const Widget _delivered_cargo_graph_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
512 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
513 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 525, 0, 13, STR_7050_UNITS_OF_CARGO_DELIVERED, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
514 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
515 |
{ WWT_IMGBTN, 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
|
516 |
{ WIDGETS_END}, |
0 | 517 |
}; |
518 |
||
519 |
static const WindowDesc _delivered_cargo_graph_desc = { |
|
520 |
-1, -1, 576, 142, |
|
521 |
WC_DELIVERED_CARGO,0, |
|
522 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
523 |
_delivered_cargo_graph_widgets, |
|
524 |
DeliveredCargoGraphWndProc |
|
525 |
}; |
|
526 |
||
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
|
527 |
void ShowDeliveredCargoGraph(void) |
0 | 528 |
{ |
529 |
if (AllocateWindowDescFront(&_delivered_cargo_graph_desc, 0)) { |
|
530 |
InvalidateWindow(WC_GRAPH_LEGEND, 0); |
|
531 |
} |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
532 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
533 |
|
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
|
534 |
/***********************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
535 |
/* 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
|
536 |
/***********************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
537 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
538 |
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
|
539 |
{ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
540 |
switch(e->event) { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
541 |
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
|
542 |
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
|
543 |
Player *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
|
544 |
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
|
545 |
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
|
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 |
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
|
548 |
|
9d00ef71146e
(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 |
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
|
550 |
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
|
551 |
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
|
552 |
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
|
553 |
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
|
554 |
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
|
555 |
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
|
556 |
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
|
557 |
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
|
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 |
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
|
560 |
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
|
561 |
if (p->is_active) { |
9d00ef71146e
(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.colors[numd] = _color_list[p->player_color].window_color_bgb; |
9d00ef71146e
(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 |
for(j=gd.num_on_x_axis,i=0; --j >= 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
|
564 |
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
|
565 |
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
|
566 |
} |
9d00ef71146e
(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 |
} |
9d00ef71146e
(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 |
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
|
569 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
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
|
572 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
573 |
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
|
574 |
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
|
575 |
} |
9d00ef71146e
(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 |
case WE_CLICK: |
9d00ef71146e
(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 |
if (e->click.widget == 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
|
579 |
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
|
580 |
if (e->click.widget == 3) |
9d00ef71146e
(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 |
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
|
582 |
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
|
583 |
} |
9d00ef71146e
(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 |
} |
9d00ef71146e
(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 |
static const Widget _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
|
587 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
588 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 475, 0, 13, STR_7051_COMPANY_PERFORMANCE_RATINGS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
9d00ef71146e
(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 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
590 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 476, 525, 0, 13, STR_PERFORMANCE_DETAIL_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
9d00ef71146e
(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 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 575, 14, 237, 0x0, STR_NULL}, |
9d00ef71146e
(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 |
{ 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
|
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 |
static const WindowDesc _performance_history_desc = { |
9d00ef71146e
(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 |
-1, -1, 576, 238, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
597 |
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
|
598 |
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
|
599 |
_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
|
600 |
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
|
601 |
}; |
9d00ef71146e
(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 |
|
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
|
603 |
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
|
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 |
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
|
606 |
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
|
607 |
} |
9d00ef71146e
(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 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
/*****************/ |
9d00ef71146e
(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 |
/* 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
|
612 |
/*****************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
613 |
|
9d00ef71146e
(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 |
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
|
615 |
{ |
9d00ef71146e
(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 |
switch(e->event) { |
9d00ef71146e
(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 |
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
|
618 |
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
|
619 |
Player *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
|
620 |
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
|
621 |
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
|
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 |
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
|
624 |
|
9d00ef71146e
(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 |
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
|
626 |
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
|
627 |
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
|
628 |
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
|
629 |
gd.format_str_y_axis = STR_CURRCOMPACT64; |
9d00ef71146e
(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 |
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
|
631 |
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
|
632 |
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
|
633 |
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
|
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 |
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
|
636 |
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
|
637 |
if (p->is_active) { |
9d00ef71146e
(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.colors[numd] = _color_list[p->player_color].window_color_bgb; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
639 |
for(j=gd.num_on_x_axis,i=0; --j >= 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
|
640 |
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
|
641 |
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
|
642 |
} |
9d00ef71146e
(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 |
} |
9d00ef71146e
(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 |
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
|
645 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
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
|
648 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
649 |
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
|
650 |
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
|
651 |
} |
9d00ef71146e
(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 |
case WE_CLICK: |
9d00ef71146e
(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 |
if (e->click.widget == 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
|
655 |
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
|
656 |
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
|
657 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
static const Widget _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
|
661 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
9d00ef71146e
(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 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 525, 0, 13, STR_7052_COMPANY_VALUES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
9d00ef71146e
(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 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 526, 575, 0, 13, STR_704C_KEY, STR_704D_SHOW_KEY_TO_GRAPHS}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
664 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 575, 14, 237, 0x0, STR_NULL}, |
9d00ef71146e
(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 |
{ 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
|
666 |
}; |
9d00ef71146e
(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 |
static const WindowDesc _company_value_graph_desc = { |
9d00ef71146e
(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 |
-1, -1, 576, 238, |
9d00ef71146e
(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 |
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
|
671 |
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
|
672 |
_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
|
673 |
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
|
674 |
}; |
9d00ef71146e
(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 |
|
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
|
676 |
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
|
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 |
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
|
679 |
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
|
680 |
} |
9d00ef71146e
(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 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
/*****************/ |
9d00ef71146e
(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 |
/* 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
|
685 |
/*****************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
686 |
|
9d00ef71146e
(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 |
static const byte _cargo_legend_colors[12] = {152, 32, 15, 174, 208, 194, 191, 84, 184, 10, 202, 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
|
688 |
|
9d00ef71146e
(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 |
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
|
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 |
switch(e->event) { |
9d00ef71146e
(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 |
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
|
693 |
int i, j, x, y; |
9d00ef71146e
(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 |
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
|
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 |
gd.sel = _legend_cargobits; |
9d00ef71146e
(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 |
w->click_state = (~_legend_cargobits) << 3; |
9d00ef71146e
(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 |
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
|
699 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
700 |
x = 495; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
701 |
y = 25; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
702 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
703 |
for(i=0; i!=NUM_CARGO; 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
|
704 |
GfxFillRect(x, y, x+8, y+5, 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
|
705 |
GfxFillRect(x+1, y+1, x+7, y+4, _cargo_legend_colors[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
|
706 |
SetDParam(0, _cargoc.names_s[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
|
707 |
DrawString(x+14, y, STR_7065, 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
|
708 |
y += 8; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
709 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
710 |
|
9d00ef71146e
(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 |
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
|
712 |
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
|
713 |
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
|
714 |
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
|
715 |
gd.format_str_y_axis = STR_CURRCOMPACT32; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
716 |
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
|
717 |
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
|
718 |
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
|
719 |
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
|
720 |
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
|
721 |
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
|
722 |
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
|
723 |
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
|
724 |
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
|
725 |
|
9d00ef71146e
(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 |
for(i=0; i!=NUM_CARGO; 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
|
727 |
gd.colors[i] = _cargo_legend_colors[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
|
728 |
for(j=0; j!=20; 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
|
729 |
gd.cost[i][j] = (uint64)GetTransportedGoodsIncome(10, 20, j*6+6,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
|
730 |
} |
9d00ef71146e
(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 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
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
|
734 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
735 |
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
|
736 |
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
|
737 |
} 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
|
738 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
739 |
case WE_CLICK: { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
740 |
switch(e->click.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
|
741 |
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
|
742 |
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
|
743 |
case 11: case 12: case 13: case 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
|
744 |
_legend_cargobits ^= 1 << (e->click.widget - 3); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
745 |
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
|
746 |
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
|
747 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
748 |
} 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
|
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 |
static const Widget _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
|
753 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
9d00ef71146e
(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 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 567, 0, 13, STR_7061_CARGO_PAYMENT_RATES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
9d00ef71146e
(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 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 567, 14, 141, 0x0, STR_NULL}, |
9d00ef71146e
(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 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 24, 31, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
757 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 32, 39, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
758 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 40, 47, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
759 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 48, 55, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
760 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 56, 63, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
761 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 64, 71, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
762 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 72, 79, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
763 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 80, 87, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
764 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 88, 95, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
765 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 96, 103, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
766 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 104, 111, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
767 |
{ WWT_PANEL, RESIZE_NONE, 12, 493, 562, 112, 119, 0x0, STR_7064_TOGGLE_GRAPH_FOR_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
|
768 |
{ 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
|
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 |
static const WindowDesc _cargo_payment_rates_desc = { |
9d00ef71146e
(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 |
-1, -1, 568, 142, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
773 |
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
|
774 |
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
|
775 |
_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
|
776 |
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
|
777 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
778 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
779 |
|
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
|
780 |
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
|
781 |
{ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
782 |
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
|
783 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
784 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
785 |
/************************/ |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
786 |
/* 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
|
787 |
/************************/ |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
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
|
790 |
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
|
791 |
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
|
792 |
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
|
793 |
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
|
794 |
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
|
795 |
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
|
796 |
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
|
797 |
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
|
798 |
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
|
799 |
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
|
800 |
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
|
801 |
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
|
802 |
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
|
803 |
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
|
804 |
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
|
805 |
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
|
806 |
}; |
9d00ef71146e
(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 |
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
|
809 |
{ |
9d00ef71146e
(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 |
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
|
811 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
static int CDECL _perf_hist_comp(const void *elem1, const void *elem2 ) { |
9d00ef71146e
(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 |
const Player *p1 = *(const Player* const *)elem1; |
9d00ef71146e
(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 |
const Player *p2 = *(const Player* const *)elem2; |
9d00ef71146e
(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 |
int32 v = p2->old_economy[1].performance_history - p1->old_economy[1].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
|
817 |
return (v!=0) | (v >> (sizeof(int32)*8-1)); |
9d00ef71146e
(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 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(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 |
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
|
821 |
{ |
9d00ef71146e
(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 |
switch(e->event) { |
9d00ef71146e
(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 |
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
|
824 |
Player *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
|
825 |
Player *plist[MAX_PLAYERS]; |
9d00ef71146e
(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 |
size_t pl_num, 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
|
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 |
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
|
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 |
pl_num=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
|
831 |
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
|
832 |
if (p->is_active) |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
833 |
plist[pl_num++] = 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
|
834 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
835 |
assert(pl_num > 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
|
836 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
837 |
qsort(plist, pl_num, sizeof(Player*), _perf_hist_comp); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
838 |
|
9d00ef71146e
(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 |
i = 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
|
840 |
do { |
2063
95259a31ceb5
(svn r2572) - Codechange: [string] Changed string system so it's not as dependent on decode_parameters
ludde
parents:
1980
diff
changeset
|
841 |
SetDParam(0, i + STR_01AC_1ST); |
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
|
842 |
p = plist[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
|
843 |
SetDParam(1, p->name_1); |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
844 |
SetDParam(2, p->name_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
|
845 |
SetDParam(3, GetPlayerNameString(p->index, 4)); |
2063
95259a31ceb5
(svn r2572) - Codechange: [string] Changed string system so it's not as dependent on decode_parameters
ludde
parents:
1980
diff
changeset
|
846 |
SetDParam(5, GetPerformanceTitleFromValue(p->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
|
847 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
848 |
DrawString(2, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, 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
|
849 |
DrawPlayerIcon(p->index, 27, 16 + i * 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
|
850 |
} while (++i != pl_num); |
9d00ef71146e
(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 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
852 |
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
|
853 |
} |
9d00ef71146e
(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 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
855 |
} |
9d00ef71146e
(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 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
857 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
858 |
static const Widget _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
|
859 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
860 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 399, 0, 13, STR_7053_COMPANY_LEAGUE_TABLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
861 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 399, 14, 96, 0x0, STR_NULL}, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
862 |
{ 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
|
863 |
}; |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
864 |
|
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
865 |
static const WindowDesc _company_league_desc = { |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
866 |
-1, -1, 400, 97, |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
867 |
WC_COMPANY_LEAGUE,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
|
868 |
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
|
869 |
_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
|
870 |
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
|
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 |
|
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
|
873 |
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
|
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 |
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
|
876 |
} |
9d00ef71146e
(svn r1587) -CodeChange: fixed up the graph loop a little..numd now shows the exact amount, no +1 needed
darkvater
parents:
1085
diff
changeset
|
877 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
878 |
/*****************************/ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
879 |
/* PERFORMANCE RATING DETAIL */ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
880 |
/*****************************/ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
881 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
882 |
static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
883 |
{ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
884 |
switch(e->event) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
885 |
case WE_PAINT: { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
886 |
int val, needed, score, i; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
887 |
byte owner, x; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
888 |
uint16 y=14; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
889 |
int total_score = 0; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
890 |
int color_done, color_notdone; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
891 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
892 |
// Draw standard stuff |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
893 |
DrawWindowWidgets(w); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
894 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
895 |
// The player of which we check the detail performance rating |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
896 |
owner = FindFirstBit(w->click_state) - 13; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
897 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
898 |
// Paint the player icons |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
899 |
for (i=0;i<MAX_PLAYERS;i++) { |
1962
51ee4f459268
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1891
diff
changeset
|
900 |
if (!GetPlayer(i)->is_active) { |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
901 |
// Check if we have the player as an active player |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
902 |
if (!(w->disabled_state & (1 << (i+13)))) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
903 |
// Bah, player gone :( |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
904 |
w->disabled_state += 1 << (i+13); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
905 |
// Is this player selected? If so, select first player (always save? :s) |
979
f12f96116cdd
(svn r1475) Fix some more signed/unsigned comparison warnings
tron
parents:
970
diff
changeset
|
906 |
if (w->click_state == 1U << (i + 13)) |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
907 |
w->click_state = 1 << 13; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
908 |
// We need a repaint |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
909 |
SetWindowDirty(w); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
910 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
911 |
continue; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
912 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
913 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
914 |
// Check if we have the player marked as inactive |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
915 |
if ((w->disabled_state & (1 << (i+13)))) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
916 |
// New player! Yippie :p |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
917 |
w->disabled_state -= 1 << (i+13); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
918 |
// We need a repaint |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
919 |
SetWindowDirty(w); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
920 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
921 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
922 |
if (i == owner) x = 1; else x = 0; |
519
8d124eb58806
(svn r844) Fix some typos ([ 1074329 ]) and use a bigger font in the detailed performance rating window
tron
parents:
507
diff
changeset
|
923 |
DrawPlayerIcon(i, i * 37 + 13 + x, 16 + x); |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
924 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
925 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
926 |
// The colors used to show how the progress is going |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
927 |
color_done = _color_list[6].window_color_1b; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
928 |
color_notdone = _color_list[4].window_color_1b; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
929 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
930 |
// Draw all the score parts |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
931 |
for (i=0;i<NUM_SCORE;i++) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
932 |
y += 20; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
933 |
val = _score_part[owner][i]; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
934 |
needed = score_info[i].needed; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
935 |
score = score_info[i].score; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
936 |
// SCORE_TOTAL has his own rulez ;) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
937 |
if (i == SCORE_TOTAL) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
938 |
needed = total_score; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
939 |
score = SCORE_MAX; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
940 |
} else |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
941 |
total_score += score; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
942 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
943 |
DrawString(7, y, STR_PERFORMANCE_DETAIL_VEHICLES + i, 0); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
944 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
945 |
// Draw the score |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
946 |
SetDParam(0, score); |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
947 |
DrawStringRightAligned(107, y, SET_PERFORMANCE_DETAIL_INT, 0); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
948 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
949 |
// Calculate the %-bar |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
950 |
if (val > needed) x = 50; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
951 |
else if (val == 0) x = 0; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
952 |
else x = ((val * 50) / needed); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
953 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
954 |
// SCORE_LOAN is inversed |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
955 |
if (val < 0 && i == SCORE_LOAN) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
956 |
x = 0; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
957 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
958 |
// Draw the bar |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
959 |
if (x != 0) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
960 |
GfxFillRect(112, y-2, x + 112, y+10, color_done); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
961 |
if (x != 50) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
962 |
GfxFillRect(x + 112, y-2, 50 + 112, y+10, color_notdone); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
963 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
964 |
// Calculate the % |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
965 |
if (val > needed) x = 100; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
966 |
else x = ((val * 100) / needed); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
967 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
968 |
// SCORE_LOAN is inversed |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
969 |
if (val < 0 && i == SCORE_LOAN) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
970 |
x = 0; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
971 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
972 |
// Draw it |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
973 |
SetDParam(0, x); |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
974 |
DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, 0); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
975 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
976 |
// SCORE_LOAN is inversed |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
977 |
if (i == SCORE_LOAN) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
978 |
val = needed - val; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
979 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
980 |
// Draw the amount we have against what is needed |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
981 |
// For some of them it is in currency format |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
982 |
SetDParam(0, val); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
519
diff
changeset
|
983 |
SetDParam(1, needed); |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
984 |
switch (i) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
985 |
case SCORE_MIN_PROFIT: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
986 |
case SCORE_MIN_INCOME: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
987 |
case SCORE_MAX_INCOME: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
988 |
case SCORE_MONEY: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
989 |
case SCORE_LOAN: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
990 |
DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY, 0); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
991 |
break; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
992 |
default: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
993 |
DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_INT, 0); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
994 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
995 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
996 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
997 |
break; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
998 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
999 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1000 |
case WE_CLICK: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1001 |
// Check which button is clicked |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1002 |
if (IS_INT_INSIDE(e->click.widget, 13, 21)) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1003 |
// Is it no on disable? |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1004 |
if ((w->disabled_state & (1 << e->click.widget)) == 0) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1005 |
w->click_state = 1 << e->click.widget; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1006 |
SetWindowDirty(w); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1007 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1008 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1009 |
break; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1010 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1011 |
case WE_CREATE: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1012 |
{ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1013 |
int i; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1014 |
Player *p2; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1015 |
w->hidden_state = 0; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1016 |
w->disabled_state = 0; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1017 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1018 |
// Hide the player who are not active |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1019 |
for (i=0;i<MAX_PLAYERS;i++) { |
1962
51ee4f459268
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1891
diff
changeset
|
1020 |
if (!GetPlayer(i)->is_active) { |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1021 |
w->disabled_state += 1 << (i+13); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1022 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1023 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1024 |
// Update all player stats with the current data |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1025 |
// (this is because _score_info is not saved to a savegame) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1026 |
FOR_ALL_PLAYERS(p2) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1027 |
if (p2->is_active) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1028 |
UpdateCompanyRatingAndValue(p2, false); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1029 |
|
165
f81fa8c27236
(svn r166) -Codechange: change 74 for constant DAY_TICKS
darkvater
parents:
140
diff
changeset
|
1030 |
w->custom[0] = DAY_TICKS; |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1031 |
w->custom[1] = 5; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1032 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1033 |
w->click_state = 1 << 13; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1034 |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1035 |
SetWindowDirty(w); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1036 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1037 |
break; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1038 |
case WE_TICK: |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1039 |
{ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1040 |
// Update the player score every 5 days |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1041 |
if (--w->custom[0] == 0) { |
165
f81fa8c27236
(svn r166) -Codechange: change 74 for constant DAY_TICKS
darkvater
parents:
140
diff
changeset
|
1042 |
w->custom[0] = DAY_TICKS; |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1043 |
if (--w->custom[1] == 0) { |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1044 |
Player *p2; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1045 |
w->custom[1] = 5; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1046 |
FOR_ALL_PLAYERS(p2) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1047 |
// Skip if player is not active |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1048 |
if (p2->is_active) |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1049 |
UpdateCompanyRatingAndValue(p2, false); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1050 |
SetWindowDirty(w); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1051 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1052 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1053 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1054 |
break; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1055 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1056 |
} |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1057 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1058 |
static const Widget _performance_rating_detail_widgets[] = { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1059 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1060 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 298, 0, 13, STR_PERFORMANCE_DETAIL, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1061 |
{ WWT_IMGBTN, 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
|
1062 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1063 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 28, 47, 0x0,STR_PERFORMANCE_DETAIL_VEHICLES_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1064 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 48, 67, 0x0,STR_PERFORMANCE_DETAIL_STATIONS_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1065 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 68, 87, 0x0,STR_PERFORMANCE_DETAIL_MIN_PROFIT_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1066 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 88, 107, 0x0,STR_PERFORMANCE_DETAIL_MIN_INCOME_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1067 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 108, 127, 0x0,STR_PERFORMANCE_DETAIL_MAX_INCOME_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1068 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 128, 147, 0x0,STR_PERFORMANCE_DETAIL_DELIVERED_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1069 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 148, 167, 0x0,STR_PERFORMANCE_DETAIL_CARGO_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1070 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 168, 187, 0x0,STR_PERFORMANCE_DETAIL_MONEY_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1071 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 298, 188, 207, 0x0,STR_PERFORMANCE_DETAIL_LOAN_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1072 |
{ WWT_IMGBTN, 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
|
1073 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1074 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 2, 38, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1075 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 39, 75, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1076 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 76, 112, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1077 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 113, 149, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1078 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 150, 186, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1079 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 187, 223, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1080 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 224, 260, 14, 26, 0x0,STR_704F_CLICK_HERE_TO_TOGGLE_COMPANY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
1081 |
{ WWT_IMGBTN, 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
|
1082 |
{ WIDGETS_END}, |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1083 |
}; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1084 |
|
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1085 |
static const WindowDesc _performance_rating_detail_desc = { |
519
8d124eb58806
(svn r844) Fix some typos ([ 1074329 ]) and use a bigger font in the detailed performance rating window
tron
parents:
507
diff
changeset
|
1086 |
-1, -1, 299, 228, |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1087 |
WC_PERFORMANCE_DETAIL,0, |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1088 |
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
|
1089 |
_performance_rating_detail_widgets, |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1090 |
PerformanceRatingDetailWndProc |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1091 |
}; |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1092 |
|
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
|
1093 |
void ShowPerformanceRatingDetail(void) |
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1094 |
{ |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1095 |
AllocateWindowDescFront(&_performance_rating_detail_desc, 0); |
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
57
diff
changeset
|
1096 |
} |
1575
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1097 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1098 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1099 |
static uint16 _num_sign_sort; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1100 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1101 |
static char _bufcache[64]; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1102 |
static uint16 _last_sign_idx; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1103 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1104 |
static int CDECL SignNameSorter(const void *a, const void *b) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1105 |
{ |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1106 |
char buf1[64]; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1107 |
SignStruct *ss; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1108 |
const uint16 cmp1 = *(const uint16 *)a; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1109 |
const uint16 cmp2 = *(const uint16 *)b; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1110 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1111 |
ss = GetSign(cmp1); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1112 |
GetString(buf1, ss->str); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1113 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1114 |
if (cmp2 != _last_sign_idx) { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1115 |
_last_sign_idx = cmp2; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1116 |
ss = GetSign(cmp2); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1117 |
GetString(_bufcache, ss->str); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1118 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1119 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1120 |
return strcmp(buf1, _bufcache); // sort by name |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1121 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1122 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1123 |
static void GlobalSortSignList(void) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1124 |
{ |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1125 |
const SignStruct *ss; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1126 |
uint32 n = 0; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1127 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1128 |
_num_sign_sort = 0; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1129 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1130 |
/* Create array for sorting */ |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1131 |
_sign_sort = realloc(_sign_sort, GetSignPoolSize() * sizeof(_sign_sort[0])); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1132 |
if (_sign_sort == NULL) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1133 |
error("Could not allocate memory for the sign-sorting-list"); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1134 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1135 |
FOR_ALL_SIGNS(ss) { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1136 |
if(ss->str != STR_NULL) { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1137 |
_sign_sort[n++] = ss->index; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1138 |
_num_sign_sort++; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1139 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1140 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1141 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1142 |
qsort(_sign_sort, n, sizeof(_sign_sort[0]), SignNameSorter); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1143 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1144 |
_sign_sort_dirty = false; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1145 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1146 |
DEBUG(misc, 1) ("Resorting global sign list..."); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1147 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1148 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1149 |
static void SignListWndProc(Window *w, WindowEvent *e) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1150 |
{ |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1151 |
switch (e->event) { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1152 |
case WE_PAINT: { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1153 |
int y = 16; // offset from top of widget |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1154 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1155 |
if (_sign_sort_dirty) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1156 |
GlobalSortSignList(); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1157 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1158 |
SetVScrollCount(w, _num_sign_sort); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1159 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1160 |
SetDParam(0, w->vscroll.count); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1161 |
DrawWindowWidgets(w); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1162 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1163 |
/* No signs? */ |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1164 |
if (w->vscroll.count == 0) { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1165 |
DrawString(2, y, STR_304A_NONE, 0); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1166 |
return; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1167 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1168 |
|
2135
48fb9f0322cb
(svn r2645) Fix (useless)warning in graph_gui and add brackets around HASBIT in an if statement
Darkvater
parents:
2133
diff
changeset
|
1169 |
{ const SignStruct *ss; |
48fb9f0322cb
(svn r2645) Fix (useless)warning in graph_gui and add brackets around HASBIT in an if statement
Darkvater
parents:
2133
diff
changeset
|
1170 |
uint16 i; |
1575
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1171 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1172 |
/* Start drawing the signs */ |
2133 | 1173 |
for (i = w->vscroll.pos; i < w->vscroll.cap + w->vscroll.pos && i < w->vscroll.count; i++) { |
1575
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1174 |
ss = GetSign(_sign_sort[i]); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1175 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1176 |
if (ss->owner != OWNER_NONE) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1177 |
DrawPlayerIcon(ss->owner, 4, y + 1); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1178 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1179 |
DrawString(22, y, ss->str, 8); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1180 |
y += 10; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1181 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1182 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1183 |
} break; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1184 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1185 |
case WE_CLICK: { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1186 |
switch (e->click.widget) { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1187 |
case 3: { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1188 |
uint32 id_v = (e->click.pt.y - 15) / 10; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1189 |
SignStruct *ss; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1190 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1191 |
if (id_v >= w->vscroll.cap) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1192 |
return; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1193 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1194 |
id_v += w->vscroll.pos; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1195 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1196 |
if (id_v >= w->vscroll.count) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1197 |
return; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1198 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1199 |
ss = GetSign(_sign_sort[id_v]); |
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1962
diff
changeset
|
1200 |
ScrollMainWindowToTile(TileVirtXY(ss->x, ss->y)); |
1575
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1201 |
} break; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1202 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1203 |
} break; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1204 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1205 |
case WE_RESIZE: |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1206 |
w->vscroll.cap += e->sizing.diff.y / 10; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1207 |
break; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1208 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1209 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1210 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1211 |
static const Widget _sign_list_widget[] = { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1212 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1213 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 345, 0, 13, STR_SIGN_LIST_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1214 |
{ WWT_STICKYBOX, RESIZE_LR, 14, 346, 357, 0, 13, 0x0, STR_STICKY_BUTTON}, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1215 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 345, 14, 137, 0x0, STR_NULL}, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1216 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 346, 357, 14, 125, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1217 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 346, 357, 126, 137, 0x0, STR_RESIZE_BUTTON}, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1218 |
{ WIDGETS_END}, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1219 |
}; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1220 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1221 |
static const WindowDesc _sign_list_desc = { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1222 |
-1, -1, 358, 138, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1223 |
WC_SIGN_LIST,0, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1224 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1225 |
_sign_list_widget, |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1226 |
SignListWndProc |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1227 |
}; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1228 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1229 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1230 |
void ShowSignList(void) |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1231 |
{ |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1232 |
Window *w; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1233 |
|
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1234 |
w = AllocateWindowDescFront(&_sign_list_desc, 0); |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1235 |
if (w != NULL) { |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1236 |
w->vscroll.cap = 12; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1237 |
w->resize.step_height = 10; |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1238 |
w->resize.height = w->height - 10 * 7; // minimum if 5 in the list |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1239 |
} |
a566a645401f
(svn r2079) -Add: signlist, shows all signs in the map. Clicking on them, and you go
truelight
parents:
1130
diff
changeset
|
1240 |
} |