author | rubidium |
Fri, 18 Jul 2008 12:20:31 +0000 | |
changeset 11171 | 04fc8e49df1b |
parent 11157 | a0173588b15e |
child 11180 | 982e9f814f97 |
permissions | -rw-r--r-- |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
1 |
/* $Id$ */ |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
2 |
|
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
9245
diff
changeset
|
3 |
/** @file newgrf_gui.cpp GUI to change NewGRF settings. */ |
6674
64f4781b4653
(svn r9385) -Cleanup: doxygen changes. Today, we are exploring the letter N.
belugas
parents:
6574
diff
changeset
|
4 |
|
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
5 |
#include "stdafx.h" |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
6 |
#include "openttd.h" |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
7 |
#include "variables.h" |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
8 |
#include "gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
9 |
#include "window_gui.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
10 |
#include "textbuf_gui.h" |
5352
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
11 |
#include "newgrf.h" |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
12 |
#include "newgrf_config.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8603
diff
changeset
|
13 |
#include "strings_func.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8626
diff
changeset
|
14 |
#include "window_func.h" |
8709
4187ad809fe7
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents:
8627
diff
changeset
|
15 |
#include "core/alloc_func.hpp" |
8710
52015340050c
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8709
diff
changeset
|
16 |
#include "string_func.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
17 |
#include "gfx_func.h" |
10824
1a34ba6f338a
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
10641
diff
changeset
|
18 |
#include "gamelog.h" |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
19 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8720
diff
changeset
|
20 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8720
diff
changeset
|
21 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8720
diff
changeset
|
22 |
|
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
23 |
/** Parse an integerlist string and set each found value |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
24 |
* @param p the string to be parsed. Each element in the list is seperated by a |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
25 |
* comma or a space character |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
26 |
* @param items pointer to the integerlist-array that will be filled with values |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
27 |
* @param maxitems the maximum number of elements the integerlist-array has |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
28 |
* @return returns the number of items found, or -1 on an error */ |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
29 |
static int parse_intlist(const char *p, int *items, int maxitems) |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
30 |
{ |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
31 |
int n = 0, v; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
32 |
char *end; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
33 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
34 |
for (;;) { |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
35 |
v = strtol(p, &end, 0); |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
36 |
if (p == end || n == maxitems) return -1; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
37 |
p = end; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
38 |
items[n++] = v; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
39 |
if (*p == '\0') break; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
40 |
if (*p != ',' && *p != ' ') return -1; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
41 |
p++; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
42 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
43 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
44 |
return n; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
45 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
46 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
47 |
|
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
48 |
static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, uint bottom, bool show_params) |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
49 |
{ |
5885
262234e81333
(svn r8093) -Codechange: Add a function to get a string representation of an MD5SUM and use it.
Darkvater
parents:
5860
diff
changeset
|
50 |
char buff[256]; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
51 |
|
6429
02c062eb2c74
(svn r8838) -Feature: Show newgrf error messages loaded in Action B in the newgrf gui
maedhros
parents:
6144
diff
changeset
|
52 |
if (c->error != NULL) { |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
53 |
char message[512]; |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
54 |
if (c->error->custom_message == NULL) { |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
55 |
SetDParamStr(0, c->filename); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
56 |
SetDParamStr(1, c->error->data); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
57 |
for (uint i = 0; i < c->error->num_params; i++) { |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
58 |
uint32 param = 0; |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
59 |
byte param_number = c->error->param_number[i]; |
6465
dddb39b41ee0
(svn r8881) -Feature: Allow built-in newgrf error messages to be translated, and load custom error messages properly.
maedhros
parents:
6429
diff
changeset
|
60 |
|
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
61 |
if (param_number < c->num_params) param = c->param[param_number]; |
6465
dddb39b41ee0
(svn r8881) -Feature: Allow built-in newgrf error messages to be translated, and load custom error messages properly.
maedhros
parents:
6429
diff
changeset
|
62 |
|
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
63 |
SetDParam(2 + i, param); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
64 |
} |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
65 |
|
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
66 |
GetString(message, c->error->message, lastof(message)); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
67 |
} else { |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
68 |
SetDParamStr(0, c->error->custom_message); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
69 |
GetString(message, STR_JUST_RAW_STRING, lastof(message)); |
6465
dddb39b41ee0
(svn r8881) -Feature: Allow built-in newgrf error messages to be translated, and load custom error messages properly.
maedhros
parents:
6429
diff
changeset
|
70 |
} |
dddb39b41ee0
(svn r8881) -Feature: Allow built-in newgrf error messages to be translated, and load custom error messages properly.
maedhros
parents:
6429
diff
changeset
|
71 |
|
dddb39b41ee0
(svn r8881) -Feature: Allow built-in newgrf error messages to be translated, and load custom error messages properly.
maedhros
parents:
6429
diff
changeset
|
72 |
SetDParamStr(0, message); |
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
73 |
y += DrawStringMultiLine(x, y, c->error->severity, w, bottom - y); |
6429
02c062eb2c74
(svn r8838) -Feature: Show newgrf error messages loaded in Action B in the newgrf gui
maedhros
parents:
6144
diff
changeset
|
74 |
} |
02c062eb2c74
(svn r8838) -Feature: Show newgrf error messages loaded in Action B in the newgrf gui
maedhros
parents:
6144
diff
changeset
|
75 |
|
5339
7573f179efe8
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5329
diff
changeset
|
76 |
/* Draw filename or not if it is not known (GRF sent over internet) */ |
7573f179efe8
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5329
diff
changeset
|
77 |
if (c->filename != NULL) { |
7573f179efe8
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5329
diff
changeset
|
78 |
SetDParamStr(0, c->filename); |
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
79 |
y += DrawStringMultiLine(x, y, STR_NEWGRF_FILENAME, w, bottom - y); |
5339
7573f179efe8
(svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents:
5329
diff
changeset
|
80 |
} |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
81 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
82 |
/* Prepare and draw GRF ID */ |
5894
eb5ff472c10f
(svn r8102) -Cleanup: Remove unreachable code (r8096), useless cast
Darkvater
parents:
5889
diff
changeset
|
83 |
snprintf(buff, lengthof(buff), "%08X", BSWAP32(c->grfid)); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
84 |
SetDParamStr(0, buff); |
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
85 |
y += DrawStringMultiLine(x, y, STR_NEWGRF_GRF_ID, w, bottom - y); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
86 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
87 |
/* Prepare and draw MD5 sum */ |
5885
262234e81333
(svn r8093) -Codechange: Add a function to get a string representation of an MD5SUM and use it.
Darkvater
parents:
5860
diff
changeset
|
88 |
md5sumToString(buff, lastof(buff), c->md5sum); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
89 |
SetDParamStr(0, buff); |
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
90 |
y += DrawStringMultiLine(x, y, STR_NEWGRF_MD5SUM, w, bottom - y); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
91 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
92 |
/* Show GRF parameter list */ |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
93 |
if (show_params) { |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
94 |
if (c->num_params > 0) { |
5308
bad31e174cc6
(svn r7464) -Codechange: move BuildParamList from newgrf_gui to newgrf_config and
peter1138
parents:
5248
diff
changeset
|
95 |
GRFBuildParamList(buff, c, lastof(buff)); |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
96 |
SetDParam(0, STR_JUST_RAW_STRING); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
97 |
SetDParamStr(1, buff); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
98 |
} else { |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
99 |
SetDParam(0, STR_01A9_NONE); |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
100 |
} |
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
101 |
y += DrawStringMultiLine(x, y, STR_NEWGRF_PARAMETER, w, bottom - y); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
102 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
103 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
104 |
/* Show flags */ |
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
105 |
if (c->status == GCS_NOT_FOUND) y += DrawStringMultiLine(x, y, STR_NEWGRF_NOT_FOUND, w, bottom - y); |
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
106 |
if (c->status == GCS_DISABLED) y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w, bottom - y); |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8378
diff
changeset
|
107 |
if (HasBit(c->flags, GCF_COMPATIBLE)) y += DrawStringMultiLine(x, y, STR_NEWGRF_COMPATIBLE_LOADED, w, bottom - y); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
108 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
109 |
/* Draw GRF info if it exists */ |
5889
272800d151ac
(svn r8097) Replace strlen() {==,!=,>} 0 by the more concise {,!}StrEmpty(). Additionally the test takes O(1) instead of O(n) now
tron
parents:
5886
diff
changeset
|
110 |
if (c->info != NULL && !StrEmpty(c->info)) { |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
111 |
SetDParam(0, STR_JUST_RAW_STRING); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
112 |
SetDParamStr(1, c->info); |
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
113 |
y += DrawStringMultiLine(x, y, STR_02BD, w, bottom - y); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
114 |
} else { |
6703
9ddfcb1849e4
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
maedhros
parents:
6674
diff
changeset
|
115 |
y += DrawStringMultiLine(x, y, STR_NEWGRF_NO_INFO, w, bottom - y); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
116 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
117 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
118 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
119 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
120 |
/** |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
121 |
* Window for adding NewGRF files |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
122 |
*/ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
123 |
struct NewGRFAddWindow : public Window { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
124 |
/* Names of the add a newgrf window widgets */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
125 |
enum AddNewGRFWindowWidgets { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
126 |
ANGRFW_CLOSEBOX = 0, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
127 |
ANGRFW_CAPTION, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
128 |
ANGRFW_BACKGROUND, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
129 |
ANGRFW_GRF_LIST, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
130 |
ANGRFW_SCROLLBAR, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
131 |
ANGRFW_GRF_INFO, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
132 |
ANGRFW_ADD, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
133 |
ANGRFW_RESCAN, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
134 |
ANGRFW_RESIZE, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
135 |
}; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
136 |
|
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
137 |
GRFConfig **list; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
138 |
const GRFConfig *sel; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
139 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
140 |
NewGRFAddWindow(const WindowDesc *desc, GRFConfig **list) : Window(desc, 0) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
141 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
142 |
this->list = list; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
143 |
this->resize.step_height = 10; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
144 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
145 |
this->FindWindowPlacementAndResize(desc); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
146 |
} |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
147 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
148 |
virtual void OnPaint() |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
149 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
150 |
const GRFConfig *c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
151 |
const Widget *wl = &this->widget[ANGRFW_GRF_LIST]; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
152 |
int n = 0; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
153 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
154 |
/* Count the number of GRFs */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
155 |
for (c = _all_grfs; c != NULL; c = c->next) n++; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
156 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
157 |
this->vscroll.cap = (wl->bottom - wl->top) / 10; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
158 |
SetVScrollCount(this, n); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
159 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
160 |
this->SetWidgetDisabledState(ANGRFW_ADD, this->sel == NULL || this->sel->IsOpenTTDBaseGRF()); |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10529
diff
changeset
|
161 |
this->DrawWidgets(); |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
162 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
163 |
GfxFillRect(wl->left + 1, wl->top + 1, wl->right, wl->bottom, 0xD7); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
164 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
165 |
uint y = wl->top + 1; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
166 |
for (c = _all_grfs, n = 0; c != NULL && n < (this->vscroll.pos + this->vscroll.cap); c = c->next, n++) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
167 |
if (n >= this->vscroll.pos) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
168 |
bool h = c == this->sel; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
169 |
const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
170 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
171 |
/* Draw selection background */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
172 |
if (h) GfxFillRect(3, y, this->width - 15, y + 9, 156); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
173 |
DoDrawStringTruncated(text, 4, y, h ? TC_WHITE : TC_ORANGE, this->width - 18); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
174 |
y += 10; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
175 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
176 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
177 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
178 |
if (this->sel != NULL) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
179 |
const Widget *wi = &this->widget[ANGRFW_GRF_INFO]; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
180 |
ShowNewGRFInfo(this->sel, wi->left + 2, wi->top + 2, wi->right - wi->left - 2, wi->bottom, false); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
181 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
182 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
183 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
184 |
virtual void OnDoubleClick(Point pt, int widget) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
185 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
186 |
if (widget == ANGRFW_GRF_LIST) this->OnClick(pt, ANGRFW_ADD); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
187 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
188 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
189 |
virtual void OnClick(Point pt, int widget) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
190 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
191 |
switch (widget) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
192 |
case ANGRFW_GRF_LIST: { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
193 |
/* Get row... */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
194 |
const GRFConfig *c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
195 |
uint i = (pt.y - this->widget[ANGRFW_GRF_LIST].top) / 10 + this->vscroll.pos; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
196 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
197 |
for (c = _all_grfs; c != NULL && i > 0; c = c->next, i--) {} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
198 |
this->sel = c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
199 |
this->SetDirty(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
200 |
break; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
201 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
202 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
203 |
case ANGRFW_ADD: // Add selection to list |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
204 |
if (this->sel != NULL) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
205 |
const GRFConfig *src = this->sel; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
206 |
GRFConfig **list; |
5243
a564347a939b
(svn r7367) -Codechange: prevent adding files where the GRF ID is already in the list
peter1138
parents:
5241
diff
changeset
|
207 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
208 |
/* Find last entry in the list, checking for duplicate grfid on the way */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
209 |
for (list = this->list; *list != NULL; list = &(*list)->next) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
210 |
if ((*list)->grfid == src->grfid) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
211 |
ShowErrorMessage(INVALID_STRING_ID, STR_NEWGRF_DUPLICATE_GRFID, 0, 0); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
212 |
return; |
5243
a564347a939b
(svn r7367) -Codechange: prevent adding files where the GRF ID is already in the list
peter1138
parents:
5241
diff
changeset
|
213 |
} |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
214 |
} |
5243
a564347a939b
(svn r7367) -Codechange: prevent adding files where the GRF ID is already in the list
peter1138
parents:
5241
diff
changeset
|
215 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
216 |
/* Copy GRF details from scanned list */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
217 |
GRFConfig *c = CallocT<GRFConfig>(1); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
218 |
*c = *src; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
219 |
c->filename = strdup(src->filename); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
220 |
if (src->name != NULL) c->name = strdup(src->name); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
221 |
if (src->info != NULL) c->info = strdup(src->info); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
222 |
c->next = NULL; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
223 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
224 |
/* Append GRF config to configuration list */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
225 |
*list = c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
226 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
227 |
DeleteWindowByClass(WC_SAVELOAD); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
228 |
InvalidateWindowData(WC_GAME_OPTIONS, 0); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
229 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
230 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
231 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
232 |
case ANGRFW_RESCAN: // Rescan list |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
233 |
this->sel = NULL; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
234 |
ScanNewGRFFiles(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
235 |
this->SetDirty(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
236 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
237 |
} |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
238 |
} |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
239 |
}; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
240 |
|
8521
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
241 |
/* Widget definition for the add a newgrf window */ |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
242 |
static const Widget _newgrf_add_dlg_widgets[] = { |
8521
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
243 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, // ANGRFW_CLOSEBOX |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
244 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 306, 0, 13, STR_NEWGRF_ADD_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS }, // ANGRFW_CAPTION |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
245 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 294, 14, 121, 0x0, STR_NULL }, // ANGRFW_BACKGROUND |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
246 |
{ WWT_INSET, RESIZE_RB, 14, 2, 292, 16, 119, 0x0, STR_NULL }, // ANGRFW_GRF_LIST |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
247 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 295, 306, 14, 121, 0x0, STR_NULL }, // ANGRFW_SCROLLBAR |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
248 |
{ WWT_PANEL, RESIZE_RTB, 14, 0, 306, 122, 224, 0x0, STR_NULL }, // ANGRFW_GRF_INFO |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
249 |
{ WWT_PUSHTXTBTN, RESIZE_RTB, 14, 0, 146, 225, 236, STR_NEWGRF_ADD_FILE, STR_NEWGRF_ADD_FILE_TIP }, // ANGRFW_ADD |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
250 |
{ WWT_PUSHTXTBTN, RESIZE_LRTB, 14, 147, 294, 225, 236, STR_NEWGRF_RESCAN_FILES, STR_NEWGRF_RESCAN_FILES_TIP }, // ANGRFW_RESCAN |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
251 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 295, 306, 225, 236, 0x0, STR_RESIZE_BUTTON }, // ANGRFW_RESIZE |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
252 |
{ WIDGETS_END }, |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
253 |
}; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
254 |
|
8521
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
255 |
/* Window definition for the add a newgrf window */ |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
256 |
static const WindowDesc _newgrf_add_dlg_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7530
diff
changeset
|
257 |
WDP_CENTER, WDP_CENTER, 307, 237, 307, 337, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5919
diff
changeset
|
258 |
WC_SAVELOAD, WC_NONE, |
8515
d0401d967e99
(svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents:
8514
diff
changeset
|
259 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
260 |
_newgrf_add_dlg_widgets, |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
261 |
}; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
262 |
|
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
263 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
264 |
static void NewGRFConfirmationCallback(Window *w, bool confirmed); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
265 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
266 |
/** |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
267 |
* Window for showing NewGRF files |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
268 |
*/ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
269 |
struct NewGRFWindow : public Window { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
270 |
/* Names of the manage newgrfs window widgets */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
271 |
enum ShowNewGRFStateWidgets { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
272 |
SNGRFS_CLOSEBOX = 0, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
273 |
SNGRFS_CAPTION, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
274 |
SNGRFS_BACKGROUND, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
275 |
SNGRFS_ADD, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
276 |
SNGRFS_REMOVE, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
277 |
SNGRFS_MOVE_UP, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
278 |
SNGRFS_MOVE_DOWN, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
279 |
SNGRFS_FILE_LIST, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
280 |
SNGRFS_SCROLLBAR, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
281 |
SNGRFS_NEWGRF_INFO, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
282 |
SNGRFS_SET_PARAMETERS, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
283 |
SNGRFS_APPLY_CHANGES, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
284 |
SNGRFS_RESIZE, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
285 |
}; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
286 |
|
5352
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
287 |
GRFConfig **orig_list; ///< grf list the window is shown with |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
288 |
GRFConfig *list; ///< temporary grf list to which changes are made |
5352
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
289 |
GRFConfig *sel; ///< selected grf item |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
290 |
bool editable; ///< is the window editable |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
291 |
bool show_params; ///< are the grf-parameters shown in the info-panel |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
292 |
bool execute; ///< on pressing 'apply changes' are grf changes applied immediately, or only list is updated |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
293 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
294 |
NewGRFWindow(const WindowDesc *desc, bool editable, bool show_params, bool exec_changes, GRFConfig **config) : Window(desc, 0) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
295 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
296 |
this->resize.step_height = 14; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
297 |
this->sel = NULL; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
298 |
this->list = NULL; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
299 |
this->orig_list = config; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
300 |
this->editable = editable; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
301 |
this->execute = exec_changes; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
302 |
this->show_params = show_params; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
303 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
304 |
CopyGRFConfigList(&this->list, *config, false); |
6555
c27c9d5b459f
(svn r9031) -Codechange: Introduce grfconfig->status, and use it for states that are
maedhros
parents:
6492
diff
changeset
|
305 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
306 |
this->FindWindowPlacementAndResize(desc); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
307 |
this->SetupNewGRFWindow(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
308 |
} |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
309 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
310 |
~NewGRFWindow() |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
311 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
312 |
if (!this->execute) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
313 |
CopyGRFConfigList(this->orig_list, this->list, true); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
314 |
ResetGRFConfig(false); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
315 |
ReloadNewGRFData(); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
316 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
317 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
318 |
/* Remove the temporary copy of grf-list used in window */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
319 |
ClearGRFConfigList(&this->list); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
320 |
} |
5248
2aa0c4cc8f23
(svn r7373) -Codechange: when removing a GRF from the list, make the next one selected, or the previous file if the last item is being removed. This makes clearing the list easier.
peter1138
parents:
5243
diff
changeset
|
321 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
322 |
void SetupNewGRFWindow() |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
323 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
324 |
const GRFConfig *c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
325 |
int i; |
5248
2aa0c4cc8f23
(svn r7373) -Codechange: when removing a GRF from the list, make the next one selected, or the previous file if the last item is being removed. This makes clearing the list easier.
peter1138
parents:
5243
diff
changeset
|
326 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
327 |
for (c = this->list, i = 0; c != NULL; c = c->next, i++) {} |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
328 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
329 |
this->vscroll.cap = (this->widget[SNGRFS_FILE_LIST].bottom - this->widget[SNGRFS_FILE_LIST].top) / 14 + 1; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
330 |
SetVScrollCount(this, i); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
331 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
332 |
this->SetWidgetDisabledState(SNGRFS_ADD, !this->editable); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
333 |
this->SetWidgetDisabledState(SNGRFS_APPLY_CHANGES, !this->editable); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
334 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
335 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
336 |
virtual void OnPaint() |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
337 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
338 |
bool disable_all = this->sel == NULL || !this->editable; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
339 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
340 |
this->SetWidgetsDisabledState(disable_all, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
341 |
SNGRFS_REMOVE, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
342 |
SNGRFS_MOVE_UP, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
343 |
SNGRFS_MOVE_DOWN, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
344 |
WIDGET_LIST_END |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
345 |
); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
346 |
this->SetWidgetDisabledState(SNGRFS_SET_PARAMETERS, !this->show_params || disable_all); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
347 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
348 |
if (!disable_all) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
349 |
/* All widgets are now enabled, so disable widgets we can't use */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
350 |
if (this->sel == this->list) this->DisableWidget(SNGRFS_MOVE_UP); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
351 |
if (this->sel->next == NULL) this->DisableWidget(SNGRFS_MOVE_DOWN); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
352 |
if (this->sel->IsOpenTTDBaseGRF()) this->DisableWidget(SNGRFS_REMOVE); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
353 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
354 |
|
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10529
diff
changeset
|
355 |
this->DrawWidgets(); |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
356 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
357 |
/* Draw NewGRF list */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
358 |
int y = this->widget[SNGRFS_FILE_LIST].top; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
359 |
int i = 0; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
360 |
for (const GRFConfig *c = this->list; c != NULL; c = c->next, i++) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
361 |
if (i >= this->vscroll.pos && i < this->vscroll.pos + this->vscroll.cap) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
362 |
const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
363 |
SpriteID pal; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
364 |
byte txtoffset; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
365 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
366 |
/* Pick a colour */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
367 |
switch (c->status) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
368 |
case GCS_NOT_FOUND: |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
369 |
case GCS_DISABLED: |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
370 |
pal = PALETTE_TO_RED; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
371 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
372 |
case GCS_ACTIVATED: |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
373 |
pal = PALETTE_TO_GREEN; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
374 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
375 |
default: |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
376 |
pal = PALETTE_TO_BLUE; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
377 |
break; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
378 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
379 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
380 |
/* Do not show a "not-failure" colour when it actually failed to load */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
381 |
if (pal != PALETTE_TO_RED) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
382 |
if (HasBit(c->flags, GCF_STATIC)) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
383 |
pal = PALETTE_TO_GREY; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
384 |
} else if (HasBit(c->flags, GCF_COMPATIBLE)) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
385 |
pal = PALETTE_TO_ORANGE; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
386 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
387 |
} |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
388 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
389 |
DrawSprite(SPR_SQUARE, pal, 5, y + 2); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
390 |
if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, 20, y + 2); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
391 |
txtoffset = c->error != NULL ? 35 : 25; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
392 |
DoDrawStringTruncated(text, txtoffset, y + 3, this->sel == c ? TC_WHITE : TC_BLACK, this->width - txtoffset - 10); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
393 |
y += 14; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
394 |
} |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
395 |
} |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
396 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
397 |
if (this->sel != NULL) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
398 |
/* Draw NewGRF file info */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
399 |
const Widget *wi = &this->widget[SNGRFS_NEWGRF_INFO]; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
400 |
ShowNewGRFInfo(this->sel, wi->left + 2, wi->top + 2, wi->right - wi->left - 2, wi->bottom, this->show_params); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
401 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
402 |
} |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
403 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
404 |
virtual void OnClick(Point pt, int widget) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
405 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
406 |
switch (widget) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
407 |
case SNGRFS_ADD: // Add GRF |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
408 |
DeleteWindowByClass(WC_SAVELOAD); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
409 |
new NewGRFAddWindow(&_newgrf_add_dlg_desc, &this->list); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
410 |
break; |
5352
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
411 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
412 |
case SNGRFS_REMOVE: { // Remove GRF |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
413 |
GRFConfig **pc, *c, *newsel; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
414 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
415 |
/* Choose the next GRF file to be the selected file */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
416 |
newsel = this->sel->next; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
417 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
418 |
for (pc = &this->list; (c = *pc) != NULL; pc = &c->next) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
419 |
/* If the new selection is empty (i.e. we're deleting the last item |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
420 |
* in the list, pick the file just before the selected file */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
421 |
if (newsel == NULL && c->next == this->sel) newsel = c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
422 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
423 |
if (c == this->sel) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
424 |
*pc = c->next; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
425 |
free(c); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
426 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
427 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
428 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
429 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
430 |
this->sel = newsel; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
431 |
this->SetupNewGRFWindow(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
432 |
this->SetDirty(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
433 |
break; |
9087
c6ff1721bb00
(svn r12172) -Codechange: Allow buttons to resize in NewGRF settings window
peter1138
parents:
8760
diff
changeset
|
434 |
} |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
435 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
436 |
case SNGRFS_MOVE_UP: { // Move GRF up |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
437 |
GRFConfig **pc, *c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
438 |
if (this->sel == NULL) break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
439 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
440 |
for (pc = &this->list; (c = *pc) != NULL; pc = &c->next) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
441 |
if (c->next == this->sel) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
442 |
c->next = this->sel->next; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
443 |
this->sel->next = c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
444 |
*pc = this->sel; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
445 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
446 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
447 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
448 |
this->SetDirty(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
449 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
450 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
451 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
452 |
case SNGRFS_MOVE_DOWN: { // Move GRF down |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
453 |
GRFConfig **pc, *c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
454 |
if (this->sel == NULL) break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
455 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
456 |
for (pc = &this->list; (c = *pc) != NULL; pc = &c->next) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
457 |
if (c == this->sel) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
458 |
*pc = c->next; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
459 |
c->next = c->next->next; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
460 |
(*pc)->next = c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
461 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
462 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
463 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
464 |
this->SetDirty(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
465 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
466 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
467 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
468 |
case SNGRFS_FILE_LIST: { // Select a GRF |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
469 |
GRFConfig *c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
470 |
uint i = (pt.y - this->widget[SNGRFS_FILE_LIST].top) / 14 + this->vscroll.pos; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
471 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
472 |
for (c = this->list; c != NULL && i > 0; c = c->next, i--) {} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
473 |
this->sel = c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
474 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
475 |
this->SetDirty(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
476 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
477 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
478 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
479 |
case SNGRFS_APPLY_CHANGES: // Apply changes made to GRF list |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
480 |
if (this->execute) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
481 |
ShowQuery( |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
482 |
STR_POPUP_CAUTION_CAPTION, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
483 |
STR_NEWGRF_CONFIRMATION_TEXT, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
484 |
this, |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
485 |
NewGRFConfirmationCallback |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
486 |
); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
487 |
} else { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
488 |
CopyGRFConfigList(this->orig_list, this->list, true); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
489 |
ResetGRFConfig(false); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
490 |
ReloadNewGRFData(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
491 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
492 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
493 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
494 |
case SNGRFS_SET_PARAMETERS: { // Edit parameters |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
495 |
if (this->sel == NULL) break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
496 |
|
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
497 |
static char buff[512]; |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
498 |
GRFBuildParamList(buff, this->sel, lastof(buff)); |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
499 |
SetDParamStr(0, buff); |
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
10824
diff
changeset
|
500 |
ShowQueryString(STR_JUST_RAW_STRING, STR_NEWGRF_PARAMETER_QUERY, 63, 250, this, CS_ALPHANUMERAL); |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
501 |
break; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
502 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
503 |
} |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
504 |
} |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
505 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
506 |
virtual void OnQueryTextFinished(char *str) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
507 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
508 |
if (str == NULL) return; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
509 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
510 |
/* Parse our new "int list" */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
511 |
GRFConfig *c = this->sel; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
512 |
c->num_params = parse_intlist(str, (int*)c->param, lengthof(c->param)); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
513 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
514 |
/* parse_intlist returns -1 on error */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
515 |
if (c->num_params == (byte)-1) c->num_params = 0; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
516 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
517 |
this->SetDirty(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
518 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
519 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
520 |
virtual void OnResize(Point new_size, Point delta) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
521 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
522 |
if (delta.x != 0) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
523 |
ResizeButtons(this, SNGRFS_ADD, SNGRFS_MOVE_DOWN); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
524 |
ResizeButtons(this, SNGRFS_SET_PARAMETERS, SNGRFS_APPLY_CHANGES); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
525 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
526 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
527 |
this->vscroll.cap += delta.y / 14; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
528 |
this->widget[SNGRFS_FILE_LIST].data = (this->vscroll.cap << 8) + 1; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
529 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
530 |
this->SetupNewGRFWindow(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
531 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
532 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
533 |
virtual void OnInvalidateData(int data = 0) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
534 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
535 |
this->SetupNewGRFWindow(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
536 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
537 |
}; |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
538 |
|
8521
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
539 |
/* Widget definition of the manage newgrfs window */ |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
540 |
static const Widget _newgrf_widgets[] = { |
8521
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
541 |
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, // SNGRFS_CLOSEBOX |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
542 |
{ WWT_CAPTION, RESIZE_RIGHT, 10, 11, 299, 0, 13, STR_NEWGRF_SETTINGS_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS }, // SNGRFS_CAPTION |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
543 |
{ WWT_PANEL, RESIZE_RIGHT, 10, 0, 299, 14, 29, STR_NULL, STR_NULL }, // SNGRFS_BACKGROUND |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
544 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 10, 79, 16, 27, STR_NEWGRF_ADD, STR_NEWGRF_ADD_TIP }, // SNGRFS_ADD |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
545 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 80, 149, 16, 27, STR_NEWGRF_REMOVE, STR_NEWGRF_REMOVE_TIP }, // SNGRFS_REMOVE |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
546 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 150, 219, 16, 27, STR_NEWGRF_MOVEUP, STR_NEWGRF_MOVEUP_TIP }, // SNGRFS_MOVE_UP |
9087
c6ff1721bb00
(svn r12172) -Codechange: Allow buttons to resize in NewGRF settings window
peter1138
parents:
8760
diff
changeset
|
547 |
{ WWT_PUSHTXTBTN, RESIZE_RIGHT, 3, 220, 289, 16, 27, STR_NEWGRF_MOVEDOWN, STR_NEWGRF_MOVEDOWN_TIP }, // SNGRFS_MOVE_DOWN |
8521
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
548 |
{ WWT_MATRIX, RESIZE_RB, 10, 0, 287, 30, 99, 0x501, STR_NEWGRF_FILE_TIP }, // SNGRFS_FILE_LIST |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
549 |
{ WWT_SCROLLBAR, RESIZE_LRB, 10, 288, 299, 30, 99, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST }, // SNGRFS_SCROLLBAR |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
550 |
{ WWT_PANEL, RESIZE_RTB, 10, 0, 299, 100, 212, STR_NULL, STR_NULL }, // SNGRFS_NEWGRF_INFO |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
551 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 10, 0, 143, 213, 224, STR_NEWGRF_SET_PARAMETERS, STR_NULL }, // SNGRFS_SET_PARAMETERS |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
552 |
{ WWT_PUSHTXTBTN, RESIZE_RTB, 10, 144, 287, 213, 224, STR_NEWGRF_APPLY_CHANGES, STR_NULL }, // SNGRFS_APPLY_CHANGES |
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
553 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 10, 288, 299, 213, 224, 0x0, STR_RESIZE_BUTTON }, // SNGRFS_RESIZE |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
554 |
{ WIDGETS_END }, |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
555 |
}; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
556 |
|
8521
ca9e5d1537c9
(svn r11585) -Codechange: Enumify the widgets of the newGRF gui and a slight cleanup there
skidd13
parents:
8515
diff
changeset
|
557 |
/* Window definition of the manage newgrfs window */ |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
558 |
static const WindowDesc _newgrf_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7530
diff
changeset
|
559 |
WDP_CENTER, WDP_CENTER, 300, 225, 300, 225, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5919
diff
changeset
|
560 |
WC_GAME_OPTIONS, WC_NONE, |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
561 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
562 |
_newgrf_widgets, |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
563 |
}; |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
564 |
|
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
565 |
/** Callback function for the newgrf 'apply changes' confirmation window |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
566 |
* @param w Window which is calling this callback |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
567 |
* @param confirmed boolean value, true when yes was clicked, false otherwise |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
568 |
*/ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
569 |
static void NewGRFConfirmationCallback(Window *w, bool confirmed) |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
570 |
{ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
571 |
if (confirmed) { |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
572 |
NewGRFWindow *nw = dynamic_cast<NewGRFWindow*>(w); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
573 |
GRFConfig *c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
574 |
int i = 0; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
575 |
|
10824
1a34ba6f338a
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
10641
diff
changeset
|
576 |
GamelogStartAction(GLAT_GRF); |
1a34ba6f338a
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
10641
diff
changeset
|
577 |
GamelogGRFUpdate(_grfconfig, nw->list); // log GRF changes |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
578 |
CopyGRFConfigList(nw->orig_list, nw->list, false); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
579 |
ReloadNewGRFData(); |
10824
1a34ba6f338a
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
10641
diff
changeset
|
580 |
GamelogStopAction(); |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
581 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
582 |
/* Show new, updated list */ |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
583 |
for (c = nw->list; c != NULL && c != nw->sel; c = c->next, i++) {} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
584 |
CopyGRFConfigList(&nw->list, *nw->orig_list, false); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
585 |
for (c = nw->list; c != NULL && i > 0; c = c->next, i--) {} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
586 |
nw->sel = c; |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
587 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
588 |
w->SetDirty(); |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
589 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
590 |
} |
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
591 |
|
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
592 |
|
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
593 |
|
5352
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
594 |
/** Setup the NewGRF gui |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
595 |
* @param editable allow the user to make changes to the grfconfig in the window |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
596 |
* @param show_params show information about what parameters are set for the grf files |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
597 |
* @param exec_changes if changes are made to the list (editable is true), apply these |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
598 |
* changes immediately or only update the list |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
599 |
* @param config pointer to a linked-list of grfconfig's that will be shown */ |
82a50c80b0c4
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
Darkvater
parents:
5345
diff
changeset
|
600 |
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config) |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
601 |
{ |
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
602 |
DeleteWindowByClass(WC_GAME_OPTIONS); |
10529
a4d6b2fe51e3
(svn r13073) -Codechange: make classes of the NewGRF windows
peter1138
parents:
10484
diff
changeset
|
603 |
new NewGRFWindow(&_newgrf_desc, editable, show_params, exec_changes, config); |
5237
c14c97d7030a
(svn r7357) -Codechange: new NewGRF set up window which allows modification of NewGRF settings.
peter1138
parents:
diff
changeset
|
604 |
} |