author | tron |
Fri, 24 Feb 2006 19:52:26 +0000 | |
changeset 3075 | fd64f71655eb |
parent 3052 | ebb8c7a94e5f |
child 3112 | a6fda4d4c7ca |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1777
diff
changeset
|
4 |
#include "openttd.h" |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
2191
diff
changeset
|
5 |
#include "currency.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2153
diff
changeset
|
6 |
#include "functions.h" |
2191 | 7 |
#include "macros.h" |
2121
267f7d75d036
(svn r2631) Move screenshot related variables from variables.h to screenshot.[ch]
tron
parents:
2044
diff
changeset
|
8 |
#include "screenshot.h" |
0 | 9 |
#include "sound.h" |
1317
3c90086ff34f
(svn r1821) Move generic string handling functions to string.[ch] and introduce stre{cpy,cat}, see string.h for their semantics
tron
parents:
1282
diff
changeset
|
10 |
#include "string.h" |
2153
ecfc674410b4
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
2125
diff
changeset
|
11 |
#include "variables.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
12 |
#include "network.h" |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
13 |
#include "settings.h" |
0 | 14 |
|
15 |
typedef struct IniFile IniFile; |
|
16 |
typedef struct IniItem IniItem; |
|
17 |
typedef struct IniGroup IniGroup; |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
18 |
typedef struct SettingsMemoryPool SettingsMemoryPool; |
0 | 19 |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
20 |
static void pool_init(SettingsMemoryPool **pool); |
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
21 |
static void *pool_alloc(SettingsMemoryPool **pool, uint size); |
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
22 |
static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, uint size); |
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
23 |
static void pool_free(SettingsMemoryPool **pool); |
0 | 24 |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
25 |
struct SettingsMemoryPool { |
0 | 26 |
uint pos,size; |
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
27 |
SettingsMemoryPool *next; |
0 | 28 |
byte mem[1]; |
29 |
}; |
|
30 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
31 |
static SettingsMemoryPool *pool_new(uint minsize) |
0 | 32 |
{ |
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
33 |
SettingsMemoryPool *p; |
0 | 34 |
if (minsize < 4096 - 12) minsize = 4096 - 12; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
35 |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
36 |
p = malloc(sizeof(SettingsMemoryPool) - 1 + minsize); |
0 | 37 |
p->pos = 0; |
38 |
p->size = minsize; |
|
39 |
p->next = NULL; |
|
40 |
return p; |
|
41 |
} |
|
42 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
43 |
static void pool_init(SettingsMemoryPool **pool) |
0 | 44 |
{ |
45 |
*pool = pool_new(0); |
|
46 |
} |
|
47 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
48 |
static void *pool_alloc(SettingsMemoryPool **pool, uint size) |
0 | 49 |
{ |
50 |
uint pos; |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
51 |
SettingsMemoryPool *p = *pool; |
0 | 52 |
|
2450
d7edd1def1e0
(svn r2976) -Fix: Align settings pool items to the size of void* to fix bus errors on 64bit architectures which require aligned variables
tron
parents:
2398
diff
changeset
|
53 |
size = ALIGN(size, sizeof(void*)); |
0 | 54 |
|
55 |
// first check if there's memory in the next pool |
|
56 |
if (p->next && p->next->pos + size <= p->next->size) { |
|
57 |
p = p->next; |
|
58 |
// then check if there's not memory in the cur pool |
|
59 |
} else if (p->pos + size > p->size) { |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
60 |
SettingsMemoryPool *n = pool_new(size); |
0 | 61 |
*pool = n; |
62 |
n->next = p; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
63 |
p = n; |
0 | 64 |
} |
65 |
||
66 |
pos = p->pos; |
|
67 |
p->pos += size; |
|
68 |
return p->mem + pos; |
|
69 |
} |
|
70 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
71 |
static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, uint size) |
0 | 72 |
{ |
73 |
byte *p = pool_alloc(pool, size + 1); |
|
74 |
p[size] = 0; |
|
75 |
memcpy(p, mem, size); |
|
76 |
return p; |
|
77 |
} |
|
78 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
79 |
static void pool_free(SettingsMemoryPool **pool) |
0 | 80 |
{ |
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
81 |
SettingsMemoryPool *p = *pool, *n; |
0 | 82 |
*pool = NULL; |
83 |
while (p) { |
|
84 |
n = p->next; |
|
85 |
free(p); |
|
86 |
p = n; |
|
87 |
} |
|
88 |
} |
|
89 |
||
90 |
// structs describing the ini format. |
|
91 |
struct IniItem { |
|
92 |
char *name; |
|
93 |
char *value; |
|
94 |
char *comment; |
|
95 |
IniItem *next; |
|
96 |
}; |
|
97 |
||
98 |
struct IniGroup { |
|
99 |
char *name; // name of group |
|
100 |
char *comment; //comment for group |
|
101 |
IniItem *item, **last_item; |
|
102 |
IniGroup *next; |
|
103 |
IniFile *ini; |
|
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
104 |
IniGroupType type; // type of group |
0 | 105 |
}; |
106 |
||
107 |
struct IniFile { |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
108 |
SettingsMemoryPool *pool; |
0 | 109 |
IniGroup *group, **last_group; |
110 |
char *comment; // last comment in file |
|
111 |
}; |
|
112 |
||
113 |
// allocate an inifile object |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
114 |
static IniFile *ini_alloc(void) |
0 | 115 |
{ |
116 |
IniFile *ini; |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
117 |
SettingsMemoryPool *pool; |
0 | 118 |
pool_init(&pool); |
119 |
ini = (IniFile*)pool_alloc(&pool, sizeof(IniFile)); |
|
120 |
ini->pool = pool; |
|
121 |
ini->group = NULL; |
|
122 |
ini->last_group = &ini->group; |
|
123 |
ini->comment = NULL; |
|
124 |
return ini; |
|
125 |
} |
|
126 |
||
127 |
// allocate an ini group object |
|
128 |
static IniGroup *ini_group_alloc(IniFile *ini, const char *grpt, int len) |
|
129 |
{ |
|
130 |
IniGroup *grp = pool_alloc(&ini->pool, sizeof(IniGroup)); |
|
131 |
grp->ini = ini; |
|
132 |
grp->name = pool_strdup(&ini->pool, grpt, len); |
|
2953
4d933ef9a41f
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
133 |
if (!strcmp(grp->name, "newgrf") || !strcmp(grp->name, "servers") || !strcmp(grp->name, "bans")) { |
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
134 |
grp->type = IGT_LIST; |
2953
4d933ef9a41f
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
135 |
} else { |
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
136 |
grp->type = IGT_VARIABLES; |
2953
4d933ef9a41f
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
137 |
} |
0 | 138 |
grp->next = NULL; |
139 |
grp->item = NULL; |
|
140 |
grp->comment = NULL; |
|
141 |
grp->last_item = &grp->item; |
|
142 |
*ini->last_group = grp; |
|
143 |
ini->last_group = &grp->next; |
|
144 |
return grp; |
|
145 |
} |
|
146 |
||
147 |
static IniItem *ini_item_alloc(IniGroup *group, const char *name, int len) |
|
148 |
{ |
|
149 |
IniItem *item = pool_alloc(&group->ini->pool, sizeof(IniItem)); |
|
150 |
item->name = pool_strdup(&group->ini->pool, name, len); |
|
151 |
item->next = NULL; |
|
152 |
item->comment = NULL; |
|
153 |
item->value = NULL; |
|
154 |
*group->last_item = item; |
|
155 |
group->last_item = &item->next; |
|
156 |
return item; |
|
157 |
} |
|
158 |
||
159 |
// load an ini file into the "abstract" format |
|
160 |
static IniFile *ini_load(const char *filename) |
|
161 |
{ |
|
162 |
char buffer[1024], c, *s, *t, *e; |
|
163 |
FILE *in; |
|
164 |
IniFile *ini; |
|
165 |
IniGroup *group = NULL; |
|
166 |
IniItem *item; |
|
167 |
||
1329 | 168 |
char *comment = NULL; |
0 | 169 |
uint comment_size = 0; |
170 |
uint comment_alloc = 0; |
|
171 |
||
172 |
ini = ini_alloc(); |
|
173 |
||
174 |
in = fopen(filename, "r"); |
|
175 |
if (in == NULL) return ini; |
|
176 |
||
177 |
// for each line in the file |
|
178 |
while (fgets(buffer, sizeof(buffer), in)) { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
179 |
|
0 | 180 |
// trim whitespace from the left side |
2952 | 181 |
for (s = buffer; s[0] == ' ' || s[0] == '\t'; s++); |
0 | 182 |
|
183 |
// trim whitespace from right side. |
|
184 |
e = s + strlen(s); |
|
185 |
while (e > s && ((c=e[-1]) == '\n' || c == '\r' || c == ' ' || c == '\t')) e--; |
|
186 |
*e = 0; |
|
187 |
||
188 |
// skip comments and empty lines |
|
189 |
if (*s == '#' || *s == 0) { |
|
190 |
uint ns = comment_size + (e - s + 1); |
|
191 |
uint a = comment_alloc; |
|
192 |
uint pos; |
|
193 |
// add to comment |
|
194 |
if (ns > a) { |
|
195 |
a = max(a, 128); |
|
196 |
do a*=2; while (a < ns); |
|
197 |
comment = realloc(comment, comment_alloc = a); |
|
198 |
} |
|
199 |
pos = comment_size; |
|
200 |
comment_size += (e - s + 1); |
|
201 |
comment[pos + e - s] = '\n'; // comment newline |
|
202 |
memcpy(comment + pos, s, e - s); // copy comment contents |
|
203 |
continue; |
|
204 |
} |
|
205 |
||
206 |
// it's a group? |
|
207 |
if (s[0] == '[') { |
|
208 |
if (e[-1] != ']') |
|
209 |
ShowInfoF("ini: invalid group name '%s'\n", buffer); |
|
210 |
else |
|
211 |
e--; |
|
212 |
s++; // skip [ |
|
213 |
group = ini_group_alloc(ini, s, e - s); |
|
214 |
if (comment_size) { |
|
215 |
group->comment = pool_strdup(&ini->pool, comment, comment_size); |
|
216 |
comment_size = 0; |
|
217 |
} |
|
218 |
} else if (group) { |
|
219 |
// find end of keyname |
|
2952 | 220 |
for (t=s; *t != 0 && *t != '=' && *t != '\t' && *t != ' '; t++) {} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
221 |
|
0 | 222 |
// it's an item in an existing group |
223 |
item = ini_item_alloc(group, s, t-s); |
|
224 |
if (comment_size) { |
|
225 |
item->comment = pool_strdup(&ini->pool, comment, comment_size); |
|
226 |
comment_size = 0; |
|
227 |
} |
|
228 |
||
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
229 |
// for list items, the name and value are the same: |
2952 | 230 |
if (group->type == IGT_LIST) { |
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
231 |
item->value = item->name; |
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
232 |
continue; |
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
233 |
} |
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
234 |
|
0 | 235 |
// find start of parameter |
236 |
while (*t == '=' || *t == ' ' || *t == '\t') t++; |
|
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
237 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
238 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
239 |
// remove starting quotation marks |
2952 | 240 |
if (*t == '\"') t++; |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
241 |
// remove ending quotation marks |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
242 |
e = t + strlen(t); |
2952 | 243 |
if (e > t && e[-1] =='\"') e--; |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
244 |
*e = 0; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
245 |
|
0 | 246 |
item->value = pool_strdup(&ini->pool, t, e - t); |
247 |
} else { |
|
248 |
// it's an orphan item |
|
249 |
ShowInfoF("ini: '%s' outside of group\n", buffer); |
|
250 |
} |
|
251 |
} |
|
252 |
||
253 |
if (comment_size) { |
|
254 |
ini->comment = pool_strdup(&ini->pool, comment, comment_size); |
|
255 |
comment_size = 0; |
|
256 |
} |
|
257 |
||
258 |
free(comment); |
|
259 |
fclose(in); |
|
260 |
||
261 |
return ini; |
|
262 |
} |
|
263 |
||
264 |
// lookup a group or make a new one |
|
265 |
static IniGroup *ini_getgroup(IniFile *ini, const char *name, int len) |
|
266 |
{ |
|
267 |
IniGroup *group; |
|
268 |
||
269 |
if (len == -1) len = strlen(name); |
|
270 |
||
271 |
// does it exist already? |
|
2952 | 272 |
for (group = ini->group; group; group = group->next) |
0 | 273 |
if (!memcmp(group->name, name, len) && group->name[len] == 0) |
274 |
return group; |
|
275 |
||
276 |
// otherwise make a new one |
|
277 |
group = ini_group_alloc(ini, name, len); |
|
278 |
group->comment = pool_strdup(&ini->pool, "\n", 1); |
|
279 |
return group; |
|
280 |
} |
|
281 |
||
282 |
// lookup an item or make a new one |
|
283 |
static IniItem *ini_getitem(IniGroup *group, const char *name, bool create) |
|
284 |
{ |
|
285 |
IniItem *item; |
|
286 |
uint len = strlen(name); |
|
287 |
||
2952 | 288 |
for (item = group->item; item; item = item->next) |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
289 |
if (strcmp(item->name, name) == 0) return item; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
290 |
|
0 | 291 |
if (!create) return NULL; |
292 |
||
293 |
// otherwise make a new one |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
294 |
return ini_item_alloc(group, name, len); |
0 | 295 |
} |
296 |
||
297 |
// save ini file from the "abstract" format. |
|
298 |
static bool ini_save(const char *filename, IniFile *ini) |
|
299 |
{ |
|
300 |
FILE *f; |
|
301 |
IniGroup *group; |
|
302 |
IniItem *item; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
303 |
|
0 | 304 |
f = fopen(filename, "w"); |
305 |
if (f == NULL) return false; |
|
306 |
||
2919
3e42ca528f01
(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
Darkvater
parents:
2916
diff
changeset
|
307 |
for (group = ini->group; group != NULL; group = group->next) { |
0 | 308 |
if (group->comment) fputs(group->comment, f); |
309 |
fprintf(f, "[%s]\n", group->name); |
|
2919
3e42ca528f01
(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
Darkvater
parents:
2916
diff
changeset
|
310 |
for (item = group->item; item != NULL; item = item->next) { |
0 | 311 |
if (item->comment) fputs(item->comment, f); |
2952 | 312 |
if (group->type == IGT_LIST) |
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
313 |
fprintf(f, "%s\n", item->value ? item->value : ""); |
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
314 |
else |
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
315 |
fprintf(f, "%s = %s\n", item->name, item->value ? item->value : ""); |
0 | 316 |
} |
317 |
} |
|
318 |
if (ini->comment) fputs(ini->comment, f); |
|
319 |
||
320 |
fclose(f); |
|
321 |
return true; |
|
322 |
} |
|
323 |
||
324 |
static void ini_free(IniFile *ini) |
|
325 |
{ |
|
326 |
pool_free(&ini->pool); |
|
327 |
} |
|
328 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
329 |
/* Find the index value of a ONEofMANY type in a string seperated by | |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
330 |
* @param many full domain of values the ONEofMANY setting can have |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
331 |
* @param one the current value of the setting for which a value needs found |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
332 |
* @param onelen force calculation of the *one parameter |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
333 |
* @return the integer index of the full-list, or -1 if not found */ |
0 | 334 |
static int lookup_oneofmany(const char *many, const char *one, int onelen) |
335 |
{ |
|
336 |
const char *s; |
|
337 |
int idx; |
|
338 |
||
339 |
if (onelen == -1) onelen = strlen(one); |
|
340 |
||
341 |
// check if it's an integer |
|
342 |
if (*one >= '0' && *one <= '9') |
|
343 |
return strtoul(one, NULL, 0); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
344 |
|
0 | 345 |
idx = 0; |
2952 | 346 |
for (;;) { |
0 | 347 |
// find end of item |
348 |
s = many; |
|
349 |
while (*s != '|' && *s != 0) s++; |
|
350 |
if (s - many == onelen && !memcmp(one, many, onelen)) return idx; |
|
351 |
if (*s == 0) return -1; |
|
352 |
many = s + 1; |
|
353 |
idx++; |
|
354 |
} |
|
355 |
} |
|
356 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
357 |
/* Find the set-integer value MANYofMANY type in a string |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
358 |
* @param many full domain of values the MANYofMANY setting can have |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
359 |
* @param str the current string value of the setting, each individual |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
360 |
* of seperated by a whitespace\tab or | character |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
361 |
* @return the 'fully' set integer, or -1 if a set is not found */ |
0 | 362 |
static uint32 lookup_manyofmany(const char *many, const char *str) |
363 |
{ |
|
364 |
const char *s; |
|
365 |
int r; |
|
366 |
uint32 res = 0; |
|
367 |
||
2952 | 368 |
for (;;) { |
0 | 369 |
// skip "whitespace" |
370 |
while (*str == ' ' || *str == '\t' || *str == '|') str++; |
|
371 |
if (*str == 0) break; |
|
372 |
||
373 |
s = str; |
|
374 |
while (*s != 0 && *s != ' ' && *s != '\t' && *s != '|') s++; |
|
375 |
||
376 |
r = lookup_oneofmany(many, str, s - str); |
|
377 |
if (r == -1) return (uint32)-1; |
|
378 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
379 |
SETBIT(res, r); // value found, set it |
0 | 380 |
if (*s == 0) break; |
381 |
str = s + 1; |
|
382 |
} |
|
383 |
return res; |
|
384 |
} |
|
385 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
386 |
/** Parse an integerlist string and set each found value |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
387 |
* @param p the string to be parsed. Each element in the list is seperated by a comma |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
388 |
* @param items pointer to the integerlist-array that will be filled with values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
389 |
* @param maxitems the maximum number of elements the integerlist-array has |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
390 |
* @return returns the number of items found, or -1 on an error */ |
0 | 391 |
static int parse_intlist(const char *p, int *items, int maxitems) |
392 |
{ |
|
393 |
int n = 0, v; |
|
394 |
char *end; |
|
395 |
||
2952 | 396 |
for (;;) { |
0 | 397 |
v = strtol(p, &end, 0); |
398 |
if (p == end || n == maxitems) return -1; |
|
399 |
p = end; |
|
400 |
items[n++] = v; |
|
401 |
if (*p == 0) break; |
|
402 |
if (*p != ',') return -1; |
|
403 |
p++; |
|
404 |
} |
|
405 |
||
406 |
return n; |
|
407 |
} |
|
408 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
409 |
/* Load parsed string-values into an integer-array (intlist) |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
410 |
* @param str the string that contains the values (and will be parsed) |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
411 |
* @param array pointer to the integer-arrays that will be filled |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
412 |
* @param nelems the number of elements the array holds. Maximum is 64 elements |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
413 |
* @param type the type of elements the array holds (eg INT8, UINT16, etc.) |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
414 |
* @return return true on success and false on error */ |
0 | 415 |
static bool load_intlist(const char *str, void *array, int nelems, int type) |
416 |
{ |
|
417 |
int items[64]; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
418 |
int i, nitems; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
419 |
|
0 | 420 |
if (str == NULL) { |
421 |
memset(items, 0, sizeof(items)); |
|
422 |
nitems = nelems; |
|
423 |
} else { |
|
424 |
nitems = parse_intlist(str, items, lengthof(items)); |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
425 |
if (nitems != nelems) return false; |
0 | 426 |
} |
427 |
||
2952 | 428 |
switch (type) { |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
429 |
case SDT_INT8: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
430 |
case SDT_UINT8: |
2952 | 431 |
for (i = 0; i != nitems; i++) ((byte*)array)[i] = items[i]; |
0 | 432 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
433 |
case SDT_INT16: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
434 |
case SDT_UINT16: |
2952 | 435 |
for (i = 0; i != nitems; i++) ((uint16*)array)[i] = items[i]; |
0 | 436 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
437 |
case SDT_INT32: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
438 |
case SDT_UINT32: |
2952 | 439 |
for (i = 0; i != nitems; i++) ((uint32*)array)[i] = items[i]; |
0 | 440 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
441 |
default: NOT_REACHED(); |
0 | 442 |
} |
443 |
||
444 |
return true; |
|
445 |
} |
|
446 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
447 |
/* Convert an integer-array (intlist) to a string representation. Each value |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
448 |
* is seperated by a comma |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
449 |
* @param buf output buffer where the string-representation will be stored |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
450 |
* @param array pointer to the integer-arrays that is read from |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
451 |
* @param nelems the number of elements the array holds. |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
452 |
* @param type the type of elements the array holds (eg INT8, UINT16, etc.) */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
453 |
static void make_intlist(char *buf, const void *array, int nelems, int type) |
0 | 454 |
{ |
455 |
int i, v = 0; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
456 |
const byte *p = (const byte*)array; |
2952 | 457 |
|
458 |
for (i = 0; i != nelems; i++) { |
|
459 |
switch (type) { |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
460 |
case SDT_INT8: v = *(int8*)p; p += 1; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
461 |
case SDT_UINT8: v = *(byte*)p; p += 1; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
462 |
case SDT_INT16: v = *(int16*)p; p += 2; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
463 |
case SDT_UINT16: v = *(uint16*)p; p += 2; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
464 |
case SDT_INT32: v = *(int32*)p; p += 4; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
465 |
case SDT_UINT32: v = *(uint32*)p; p += 4; break; |
0 | 466 |
default: NOT_REACHED(); |
467 |
} |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
468 |
buf += sprintf(buf, (i == 0) ? "%d" : ",%d", v); |
0 | 469 |
} |
470 |
} |
|
471 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
472 |
/* Convert a ONEofMANY structure to a string representation. |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
473 |
* @param buf output buffer where the string-representation will be stored |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
474 |
* @param many the full-domain string of possible values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
475 |
* @param id the value of the variable and whose string-representation must be found */ |
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
476 |
static void make_oneofmany(char *buf, const char *many, int id) |
0 | 477 |
{ |
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
478 |
int orig_id = id; |
0 | 479 |
|
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
480 |
// Look for the id'th element |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
481 |
while (--id >= 0) { |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
482 |
for (; *many != '|'; many++) { |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
483 |
if (*many == '\0') { // not found |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
484 |
sprintf(buf, "%d", orig_id); |
0 | 485 |
return; |
486 |
} |
|
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
487 |
} |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
488 |
many++; // pass the |-character |
0 | 489 |
} |
490 |
||
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
491 |
// copy string until next item (|) or the end of the list if this is the last one |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
492 |
while (*many != '\0' && *many != '|') *buf++ = *many++; |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
493 |
*buf = '\0'; |
0 | 494 |
} |
495 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
496 |
/* Convert a MANYofMANY structure to a string representation. |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
497 |
* @param buf output buffer where the string-representation will be stored |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
498 |
* @param many the full-domain string of possible values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
499 |
* @param x the value of the variable and whose string-representation must |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
500 |
* be found in the bitmasked many string */ |
0 | 501 |
static void make_manyofmany(char *buf, const char *many, uint32 x) |
502 |
{ |
|
503 |
const char *start; |
|
504 |
int i = 0; |
|
505 |
bool init = true; |
|
506 |
||
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
507 |
for (; x != 0; x >>= 1, i++) { |
0 | 508 |
start = many; |
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
509 |
while (*many != 0 && *many != '|') many++; // advance to the next element |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
510 |
|
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
511 |
if (HASBIT(x, 0)) { // item found, copy it |
0 | 512 |
if (!init) *buf++ = '|'; |
513 |
init = false; |
|
514 |
if (start == many) { |
|
515 |
buf += sprintf(buf, "%d", i); |
|
516 |
} else { |
|
517 |
memcpy(buf, start, many - start); |
|
518 |
buf += many - start; |
|
519 |
} |
|
520 |
} |
|
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
521 |
|
0 | 522 |
if (*many == '|') many++; |
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
523 |
} |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
524 |
|
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
525 |
*buf = '\0'; |
0 | 526 |
} |
527 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
528 |
/* Get the GenericType of a setting. This describes the main type |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
529 |
* @param desc pointer to SettingDesc structure |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
530 |
* @return return GenericType, see SettingDescType */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
531 |
static inline int GetSettingGenericType(const SettingDesc *desc) |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
532 |
{ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
533 |
return desc->flags & 0xFF00; // GB(desc->flags, 8, 8) << 8; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
534 |
} |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
535 |
|
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
536 |
/* Get the NumberType of a setting. This describes the integer type |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
537 |
* @param desc pointer to SettingDesc structure |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
538 |
* @return return NumberType, see SettingDescType */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
539 |
static inline int GetSettingNumberType(const SettingDesc *desc) |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
540 |
{ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
541 |
return desc->flags & 0xF0; // GB(desc->flags, 4, 8); << 4 |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
542 |
} |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
543 |
|
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
544 |
/** Convert a string representation (external) of a setting to the internal rep. |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
545 |
* @param desc SettingDesc struct that holds all information about the variable |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
546 |
* @param str input string that will be parsed based on the type of desc |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
547 |
* @return return the parsed value of the setting */ |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
193
diff
changeset
|
548 |
static const void *string_to_val(const SettingDesc *desc, const char *str) |
0 | 549 |
{ |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
550 |
switch (GetSettingGenericType(desc)) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
551 |
case SDT_NUMX: { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
552 |
char *end; |
2991
8a6e9bfa2f2f
(svn r3567) -Fix: for once and for all, use 'unsigned long' if you want to cast something
truelight
parents:
2975
diff
changeset
|
553 |
unsigned long val = strtoul(str, &end, 0); |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
554 |
if (*end != '\0') ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name); |
0 | 555 |
return (void*)val; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
556 |
} |
0 | 557 |
case SDT_ONEOFMANY: { |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
558 |
long r = lookup_oneofmany(desc->many, str, -1); |
0 | 559 |
if (r != -1) return (void*)r; |
560 |
ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); |
|
561 |
return 0; |
|
562 |
} |
|
563 |
case SDT_MANYOFMANY: { |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
564 |
unsigned long r = lookup_manyofmany(desc->many, str); |
2923
f4d43b8c6a40
(svn r3479) -Fix: fixed warnings on 64bit platforms (anyway, most 64bit platforms)
truelight
parents:
2919
diff
changeset
|
565 |
if (r != (unsigned long)-1) return (void*)r; |
0 | 566 |
ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); |
567 |
return 0; |
|
568 |
} |
|
569 |
case SDT_BOOLX: |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
570 |
if (strcmp(str, "true") == 0 || strcmp(str, "on") == 0 || strcmp(str, "1") == 0) |
0 | 571 |
return (void*)true; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
572 |
if (strcmp(str, "false") == 0 || strcmp(str, "off") == 0 || strcmp(str, "0") == 0) |
0 | 573 |
return (void*)false; |
574 |
ShowInfoF("ini: invalid setting value '%s' for '%s'", str, desc->name); |
|
575 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
576 |
|
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
577 |
case SDT_STR: |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
578 |
case SDT_STRB: |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
579 |
case SDT_STRQ: |
0 | 580 |
case SDT_INTLIST: |
2307
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
581 |
case SDT_CHAR: |
1010
977aafc6b8e3
(svn r1509) Const correctness and add static where appropriate while touching the lines anyway
tron
parents:
998
diff
changeset
|
582 |
return str; |
0 | 583 |
} |
584 |
||
585 |
return NULL; |
|
586 |
} |
|
587 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
588 |
/** Load values from a group of an IniFile structure into the internal representation |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
589 |
* @param ini pointer to IniFile structure that holds administrative information |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
590 |
* @param desc pointer to SettingDesc structure whose internally pointed variables will |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
591 |
* be given values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
592 |
* @param grpname the group of the IniFile to search in for the new values */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
593 |
static void load_setting_desc(IniFile *ini, const SettingDesc *desc, const char *grpname) |
0 | 594 |
{ |
595 |
IniGroup *group_def = ini_getgroup(ini, grpname, -1), *group; |
|
596 |
IniItem *item; |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
193
diff
changeset
|
597 |
const void *p; |
0 | 598 |
void *ptr; |
599 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
600 |
for (;desc->name != NULL; desc++) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
601 |
// XXX - wtf is this?? (group override?) |
0 | 602 |
const char *s = strchr(desc->name, '.'); |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
603 |
if (s != NULL) { |
0 | 604 |
group = ini_getgroup(ini, desc->name, s - desc->name); |
605 |
s++; |
|
606 |
} else { |
|
607 |
s = desc->name; |
|
608 |
group = group_def; |
|
609 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
610 |
|
0 | 611 |
item = ini_getitem(group, s, false); |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
612 |
p = (item == NULL) ? desc->def : string_to_val(desc, item->value); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
613 |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
614 |
/* get pointer to the variable */ |
0 | 615 |
ptr = desc->ptr; |
616 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
617 |
/* The main type of a variable/setting is in bytes 8-15 |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
618 |
* The subtype (what kind of numbers do we have there) is in 0-7 */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
619 |
switch (GetSettingGenericType(desc)) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
620 |
case SDT_BOOLX: /* All four are various types of (integer) numbers */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
621 |
case SDT_NUMX: |
0 | 622 |
case SDT_ONEOFMANY: |
623 |
case SDT_MANYOFMANY: |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
624 |
switch (GetSettingNumberType(desc)) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
625 |
case SDT_INT8: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
626 |
case SDT_UINT8: *(byte*)ptr = (byte)(unsigned long)p; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
627 |
case SDT_INT16: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
628 |
case SDT_UINT16: *(uint16*)ptr = (uint16)(unsigned long)p; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
629 |
case SDT_INT32: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
630 |
case SDT_UINT32: *(uint32*)ptr = (uint32)(unsigned long)p; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
631 |
default: NOT_REACHED(); break; |
0 | 632 |
} |
633 |
break; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
634 |
|
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
635 |
case SDT_STR: |
1104 | 636 |
free(*(char**)ptr); |
1010
977aafc6b8e3
(svn r1509) Const correctness and add static where appropriate while touching the lines anyway
tron
parents:
998
diff
changeset
|
637 |
*(char**)ptr = strdup((const char*)p); |
0 | 638 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
639 |
|
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
640 |
case SDT_STRB: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
641 |
case SDT_STRQ: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
642 |
if (p != NULL) ttd_strlcpy((char*)ptr, p, GB(desc->flags, 16, 16)); |
0 | 643 |
break; |
2307
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
644 |
|
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
645 |
case SDT_CHAR: |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
646 |
*(char*)ptr = *(char*)p; |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
647 |
break; |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
648 |
|
0 | 649 |
case SDT_INTLIST: { |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
650 |
if (!load_intlist(p, ptr, GB(desc->flags, 16, 16), GetSettingNumberType(desc))) |
0 | 651 |
ShowInfoF("ini: error in array '%s'", desc->name); |
652 |
break; |
|
653 |
} |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
654 |
default: NOT_REACHED(); break; |
0 | 655 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
656 |
} |
0 | 657 |
} |
658 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
659 |
/* Save the values of settings to the inifile. |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
660 |
* @param ini pointer to IniFile structure |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
661 |
* @param desc read-only SettingDesc structure which contains the unmodified, |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
662 |
* loaded values of the configuration file and various information about it |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
663 |
* @param grpname holds the name of the group (eg. [network]) where these will be saved |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
664 |
* The function works as follows: for each item in the SettingDesc structure we have |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
665 |
* a look if the value has changed since we started the game (the original values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
666 |
* are reloaded when saving). If settings indeed have changed, we get these and save them.*/ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
667 |
static void save_setting_desc(IniFile *ini, const SettingDesc *desc, const char *grpname) |
0 | 668 |
{ |
669 |
IniGroup *group_def = NULL, *group; |
|
670 |
IniItem *item; |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
193
diff
changeset
|
671 |
const void *p; |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
193
diff
changeset
|
672 |
void *ptr; |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
673 |
uint32 i = 0; |
0 | 674 |
char buf[512]; // setting buffer |
675 |
const char *s; |
|
676 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
677 |
for (; desc->name != NULL; desc++) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
678 |
if (desc->flags & SDT_NOSAVE) continue; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
679 |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
680 |
// XXX - wtf is this?? (group override?) |
0 | 681 |
s = strchr(desc->name, '.'); |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
682 |
if (s != NULL) { |
0 | 683 |
group = ini_getgroup(ini, desc->name, s - desc->name); |
684 |
s++; |
|
685 |
} else { |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
686 |
if (group_def == NULL) group_def = ini_getgroup(ini, grpname, -1); |
0 | 687 |
s = desc->name; |
688 |
group = group_def; |
|
689 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
690 |
|
0 | 691 |
item = ini_getitem(group, s, true); |
692 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
693 |
/* get pointer to the variable */ |
0 | 694 |
ptr = desc->ptr; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
695 |
|
0 | 696 |
if (item->value != NULL) { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
697 |
// check if the value is the same as the old value |
0 | 698 |
p = string_to_val(desc, item->value); |
699 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
700 |
/* The main type of a variable/setting is in bytes 8-15 |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
701 |
* The subtype (what kind of numbers do we have there) is in 0-7 */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
702 |
switch (GetSettingGenericType(desc)) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
703 |
case SDT_BOOLX: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
704 |
case SDT_NUMX: |
0 | 705 |
case SDT_ONEOFMANY: |
706 |
case SDT_MANYOFMANY: |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
707 |
switch (GetSettingNumberType(desc)) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
708 |
case SDT_INT8: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
709 |
case SDT_UINT8: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
710 |
if (*(byte*)ptr == (byte)(unsigned long)p) continue; |
0 | 711 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
712 |
case SDT_INT16: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
713 |
case SDT_UINT16: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
714 |
if (*(uint16*)ptr == (uint16)(unsigned long)p) continue; |
0 | 715 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
716 |
case SDT_INT32: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
717 |
case SDT_UINT32: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
718 |
if (*(uint32*)ptr == (uint32)(unsigned long)p) continue; |
0 | 719 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
720 |
default: NOT_REACHED(); |
0 | 721 |
} |
722 |
break; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
723 |
case SDT_STR: assert(0); break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
724 |
default: break; /* Assume the other types are always changed */ |
0 | 725 |
} |
726 |
} |
|
727 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
728 |
/* Value has changed, get the new value and put it into a buffer */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
729 |
switch (GetSettingGenericType(desc)) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
730 |
case SDT_BOOLX: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
731 |
case SDT_NUMX: |
0 | 732 |
case SDT_ONEOFMANY: |
733 |
case SDT_MANYOFMANY: |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
734 |
switch (GetSettingNumberType(desc)) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
735 |
case SDT_INT8: i = *(int8*)ptr; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
736 |
case SDT_UINT8: i = *(byte*)ptr; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
737 |
case SDT_INT16: i = *(int16*)ptr; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
738 |
case SDT_UINT16: i = *(uint16*)ptr; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
739 |
case SDT_INT32: i = *(int32*)ptr; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
740 |
case SDT_UINT32: i = *(uint32*)ptr; break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
741 |
default: NOT_REACHED(); |
0 | 742 |
} |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
743 |
|
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
744 |
switch (GetSettingGenericType(desc)) { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
745 |
case SDT_BOOLX: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
746 |
strcpy(buf, (i != 0) ? "true" : "false"); |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
747 |
break; |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
748 |
case SDT_NUMX: |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
749 |
sprintf(buf, "%u", i); |
0 | 750 |
break; |
751 |
case SDT_ONEOFMANY: |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
752 |
make_oneofmany(buf, desc->many, i); |
0 | 753 |
break; |
754 |
case SDT_MANYOFMANY: |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
755 |
make_manyofmany(buf, desc->many, i); |
0 | 756 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
757 |
default: NOT_REACHED(); |
0 | 758 |
} |
759 |
break; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
760 |
|
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
761 |
case SDT_STR: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
762 |
strcpy(buf, *(char**)ptr); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
763 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
764 |
case SDT_STRB: |
0 | 765 |
strcpy(buf, (char*)ptr); |
766 |
break; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
767 |
case SDT_STRQ: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
768 |
sprintf(buf, "\"%s\"", (char*)ptr); |
0 | 769 |
break; |
2307
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
770 |
case SDT_CHAR: |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
771 |
sprintf(buf, "\"%c\"", *(char*)ptr); |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
772 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
773 |
case SDT_INTLIST: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
774 |
make_intlist(buf, ptr, GB(desc->flags, 16, 16), GetSettingNumberType(desc)); |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
775 |
break; |
0 | 776 |
} |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
777 |
|
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
778 |
/* The value is different, that means we have to write it to the ini */ |
0 | 779 |
item->value = pool_strdup(&ini->pool, buf, strlen(buf)); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
780 |
} |
0 | 781 |
} |
782 |
||
783 |
//*************************** |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
784 |
// OTTD specific INI stuff |
0 | 785 |
//*************************** |
786 |
||
1584
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
787 |
#ifndef EXTERNAL_PLAYER |
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
788 |
#define EXTERNAL_PLAYER "timidity" |
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
789 |
#endif |
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
790 |
|
0 | 791 |
static const SettingDesc music_settings[] = { |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
792 |
{"playlist", SDT_UINT8, (void*)0, &msf.playlist, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
793 |
{"music_vol", SDT_UINT8, (void*)128, &msf.music_vol, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
794 |
{"effect_vol",SDT_UINT8, (void*)128, &msf.effect_vol, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
795 |
{"custom_1", SDT_INTLIST | SDT_UINT8 | lengthof(msf.custom_1) << 16, NULL, &msf.custom_1, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
796 |
{"custom_2", SDT_INTLIST | SDT_UINT8 | lengthof(msf.custom_2) << 16, NULL, &msf.custom_2, NULL}, |
3052
ebb8c7a94e5f
(svn r3641) - Rename MusicFilesettings 'btn_down' to more sensible 'playing'
Darkvater
parents:
3051
diff
changeset
|
797 |
{"playing", SDT_BOOL, (void*)true, &msf.playing, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
798 |
{"shuffle", SDT_BOOL, (void*)false, &msf.shuffle, NULL}, |
1584
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
799 |
{"extmidi", SDT_STRINGBUF | (lengthof(msf.extmidi)<<16), EXTERNAL_PLAYER, &msf.extmidi, NULL}, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
800 |
{NULL, 0, NULL, NULL, NULL} |
0 | 801 |
}; |
802 |
||
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
803 |
/* win32_v.c only settings */ |
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
804 |
#ifdef WIN32 |
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
805 |
extern bool _force_full_redraw, _double_size; |
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
806 |
extern uint _display_hz, _fullscreen_bpp; |
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
807 |
|
0 | 808 |
static const SettingDesc win32_settings[] = { |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
809 |
{"display_hz", SDT_UINT, (void*)0, &_display_hz, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
810 |
{"force_full_redraw", SDT_BOOL, (void*)false, &_force_full_redraw, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
811 |
{"fullscreen_bpp", SDT_UINT, (void*)8, &_fullscreen_bpp, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
812 |
{"double_size", SDT_BOOL, (void*)false, &_double_size, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
813 |
{NULL, 0, NULL, NULL, NULL} |
0 | 814 |
}; |
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
815 |
#endif /* WIN32 */ |
0 | 816 |
|
817 |
static const SettingDesc misc_settings[] = { |
|
395
788a9bba0889
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
350
diff
changeset
|
818 |
{"display_opt", SDT_MANYOFMANY | SDT_UINT8, (void*)(DO_SHOW_TOWN_NAMES|DO_SHOW_STATION_NAMES|DO_SHOW_SIGNS|DO_FULL_ANIMATION|DO_FULL_DETAIL|DO_TRANS_BUILDINGS|DO_WAYPOINTS), &_display_opt, "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|TRANS_BUILDINGS|FULL_DETAIL|WAYPOINTS"}, |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
819 |
{"news_display_opt", SDT_UINT32, "0xAAAAAAAA", &_news_display_opt, NULL}, // default to all full messages: 10101010101010101010 = 0xAAAAAAAA |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
820 |
{"news_ticker_sound", SDT_BOOL, (void*)true, &_news_ticker_sound, NULL}, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
821 |
{"fullscreen", SDT_BOOL, (void*)false, &_fullscreen, NULL}, |
3021
4bccc35928b1
(svn r3601) -Codechange: special for Tron, and he was absolutely correct in thisone: added a comment for last commit
truelight
parents:
3020
diff
changeset
|
822 |
/* Added the (uint32) cast in the next 3 lines, to suppress a warning on 64bit targets -- TrueLight */ |
3020
ab7c25fb343e
(svn r3600) -Fix: suppress error on 64bit targets
truelight
parents:
2991
diff
changeset
|
823 |
{"videodriver", SDT_STRINGBUF | ((uint32)lengthof(_ini_videodriver)<<16) | SDT_NOSAVE,NULL, _ini_videodriver, NULL}, |
ab7c25fb343e
(svn r3600) -Fix: suppress error on 64bit targets
truelight
parents:
2991
diff
changeset
|
824 |
{"musicdriver", SDT_STRINGBUF | ((uint32)lengthof(_ini_musicdriver)<<16) | SDT_NOSAVE,NULL, _ini_musicdriver, NULL}, |
ab7c25fb343e
(svn r3600) -Fix: suppress error on 64bit targets
truelight
parents:
2991
diff
changeset
|
825 |
{"sounddriver", SDT_STRINGBUF | ((uint32)lengthof(_ini_sounddriver)<<16) | SDT_NOSAVE,NULL, _ini_sounddriver, NULL}, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
826 |
{"language", SDT_STRINGBUF | lengthof(_dynlang.curr_file)<<16, NULL, _dynlang.curr_file, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
827 |
{"resolution", SDT_UINT16 | SDT_INTLIST | lengthof(_cur_resolution) << 16, "640,480",_cur_resolution, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
828 |
{"screenshot_format", SDT_STRINGBUF | (lengthof(_screenshot_format_name)<<16), NULL, _screenshot_format_name,NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
829 |
{"savegame_format", SDT_STRINGBUF | (lengthof(_savegame_format)<<16), NULL, _savegame_format, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
830 |
{"rightclick_emulate",SDT_BOOL, (void*)false, &_rightclick_emulate, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
831 |
{NULL, 0, NULL, NULL, NULL} |
0 | 832 |
}; |
833 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
834 |
#ifdef ENABLE_NETWORK |
0 | 835 |
static const SettingDesc network_settings[] = { |
641
6f202631c443
(svn r1074) Fix: server_bind_ip was set to 255.255.255.255 by default
dominik
parents:
629
diff
changeset
|
836 |
{"sync_freq", SDT_UINT16 | SDT_NOSAVE, (void*)100, &_network_sync_freq, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
837 |
{"frame_freq", SDT_UINT8 | SDT_NOSAVE, (void*)0, &_network_frame_freq, NULL}, |
1727
25cb9c3129a6
(svn r2231) - Fix: max_join_time pointing to _network_max_join_time is an uint16, so it should have type SDT_UINT16; fix for revision 2106 (thanks peter1138)
Darkvater
parents:
1723
diff
changeset
|
838 |
{"max_join_time", SDT_UINT16, (void*)500, &_network_max_join_time, NULL}, |
1602
79f98b4b83fc
(svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
truelight
parents:
1584
diff
changeset
|
839 |
{"pause_on_join", SDT_BOOL, (void*)false, &_network_pause_on_join, NULL}, |
641
6f202631c443
(svn r1074) Fix: server_bind_ip was set to 255.255.255.255 by default
dominik
parents:
629
diff
changeset
|
840 |
{"server_bind_ip", SDT_STRINGBUF | (lengthof(_network_server_bind_ip_host) << 16), "0.0.0.0", &_network_server_bind_ip_host, NULL}, |
6f202631c443
(svn r1074) Fix: server_bind_ip was set to 255.255.255.255 by default
dominik
parents:
629
diff
changeset
|
841 |
{"server_port", SDT_UINT, (void*)NETWORK_DEFAULT_PORT, &_network_server_port, NULL}, |
675
9be22ffb4625
(svn r1113) -Add: [Network] Added the GUI part for server advertising. When you go
truelight
parents:
643
diff
changeset
|
842 |
{"server_advertise",SDT_BOOL, (void*)false, &_network_advertise, NULL}, |
764
7e1e17b7c7d4
(svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents:
759
diff
changeset
|
843 |
{"lan_internet", SDT_UINT8, (void*)0, &_network_lan_internet, NULL}, |
641
6f202631c443
(svn r1074) Fix: server_bind_ip was set to 255.255.255.255 by default
dominik
parents:
629
diff
changeset
|
844 |
{"player_name", SDT_STRINGBUF | (lengthof(_network_player_name) << 16), NULL, &_network_player_name, NULL}, |
1026
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1010
diff
changeset
|
845 |
{"server_password", SDT_STRINGBUF | (lengthof(_network_server_password) << 16), NULL, &_network_server_password, NULL}, |
02cc18821508
(svn r1527) -Add: RCon (Remote Connection). A server can set:
truelight
parents:
1010
diff
changeset
|
846 |
{"rcon_password", SDT_STRINGBUF | (lengthof(_network_rcon_password) << 16), NULL, &_network_rcon_password, NULL}, |
641
6f202631c443
(svn r1074) Fix: server_bind_ip was set to 255.255.255.255 by default
dominik
parents:
629
diff
changeset
|
847 |
{"server_name", SDT_STRINGBUF | (lengthof(_network_server_name) << 16), NULL, &_network_server_name, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
848 |
{"connect_to_ip", SDT_STRINGBUF | (lengthof(_network_default_ip) << 16), NULL, &_network_default_ip, NULL}, |
641
6f202631c443
(svn r1074) Fix: server_bind_ip was set to 255.255.255.255 by default
dominik
parents:
629
diff
changeset
|
849 |
{"network_id", SDT_STRINGBUF | (lengthof(_network_unique_id) << 16), NULL, &_network_unique_id, NULL}, |
690
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
675
diff
changeset
|
850 |
{"autoclean_companies", SDT_BOOL, (void*)false, &_network_autoclean_companies, NULL}, |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
675
diff
changeset
|
851 |
{"autoclean_unprotected", SDT_UINT8, (void*)12, &_network_autoclean_unprotected, NULL}, |
3afcad69d4f7
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
truelight
parents:
675
diff
changeset
|
852 |
{"autoclean_protected", SDT_UINT8, (void*)36, &_network_autoclean_protected, NULL}, |
785
bba7b3b35dec
(svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
truelight
parents:
774
diff
changeset
|
853 |
{"restart_game_date", SDT_UINT16, (void*)0, &_network_restart_game_date, NULL}, |
641
6f202631c443
(svn r1074) Fix: server_bind_ip was set to 255.255.255.255 by default
dominik
parents:
629
diff
changeset
|
854 |
{NULL, 0, NULL, NULL, NULL} |
0 | 855 |
}; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
856 |
#endif /* ENABLE_NETWORK */ |
0 | 857 |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
858 |
/* The settings showed when opened in the intro-menu. These values also are saved to |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
859 |
* openttd.cfg, thus _opt_newgame is used here (not _opt which is used ingame with loaded games!) */ |
0 | 860 |
static const SettingDesc gameopt_settings[] = { |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
861 |
{"diff_level", SDT_UINT8, (void*)9, &_opt_newgame.diff_level, NULL}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
862 |
{"diff_custom", SDT_INTLIST | SDT_UINT32 | (sizeof(GameDifficulty)/4) << 16, NULL, &_opt_newgame.diff, NULL}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
863 |
{"currency", SDT_UINT8 | SDT_ONEOFMANY, (void*)0, &_opt_newgame.currency, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SEK|custom" }, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
864 |
{"distances", SDT_UINT8 | SDT_ONEOFMANY, (void*)1, &_opt_newgame.kilometers, "imperial|metric" }, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
865 |
{"town_names", SDT_UINT8 | SDT_ONEOFMANY, (void*)0, &_opt_newgame.town_name, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss" }, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
866 |
{"landscape", SDT_UINT8 | SDT_ONEOFMANY, (void*)0, &_opt_newgame.landscape, "normal|hilly|desert|candy" }, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
867 |
{"autosave", SDT_UINT8 | SDT_ONEOFMANY, (void*)1, &_opt_newgame.autosave, "off|monthly|quarterly|half year|yearly" }, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
868 |
{"road_side", SDT_UINT8 | SDT_ONEOFMANY, (void*)1, &_opt_newgame.road_side, "left|right" }, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1460
diff
changeset
|
869 |
{NULL, 0, NULL, NULL, NULL} |
0 | 870 |
}; |
871 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
872 |
// The player-based settings (are not send over the network) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
873 |
// Not everything can just be added to this list. For example, service_interval |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
874 |
// can not be done, because every client assigns the service_interval value to the |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
875 |
// v->service_interval, meaning that every client assigns his value to the interval. |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
876 |
// If the setting was player-based, that would mean that vehicles could deside on |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
877 |
// different moments that they are heading back to a service depot, causing desyncs |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
878 |
// on a massive scale. |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
879 |
// Short, you can only add settings that does stuff for the screen, GUI, that kind |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
880 |
// of stuff. |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
881 |
static const SettingDesc patch_player_settings[] = { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
882 |
{"vehicle_speed", SDT_BOOL, (void*)true, &_patches.vehicle_speed, NULL}, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
883 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
884 |
{"lost_train_days", SDT_UINT16, (void*)180, &_patches.lost_train_days, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
885 |
{"train_income_warn", SDT_BOOL, (void*)true, &_patches.train_income_warn, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
886 |
{"order_review_system", SDT_UINT8, (void*)2, &_patches.order_review_system, NULL}, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
887 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
888 |
{"status_long_date", SDT_BOOL, (void*)true, &_patches.status_long_date, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
889 |
{"show_finances", SDT_BOOL, (void*)true, &_patches.show_finances, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
890 |
{"autoscroll", SDT_BOOL, (void*)false, &_patches.autoscroll, NULL}, |
2680
7fd99282368c
(svn r3222) -Feature: Right-Click-Scrolling optionally moves in the opposite direction (Requested by manx)
tron
parents:
2672
diff
changeset
|
891 |
{"reverse_scroll", SDT_BOOL, (void*)false, &_patches.reverse_scroll, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
892 |
{"errmsg_duration", SDT_UINT8, (void*)5, &_patches.errmsg_duration, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
893 |
{"toolbar_pos", SDT_UINT8, (void*)0, &_patches.toolbar_pos, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
894 |
{"keep_all_autosave", SDT_BOOL, (void*)false, &_patches.keep_all_autosave, NULL}, |
643
a9c84d04eacb
(svn r1076) Feature: Patch setting to autosave the game on exit
dominik
parents:
641
diff
changeset
|
895 |
{"autosave_on_exit", SDT_BOOL, (void*)false, &_patches.autosave_on_exit, NULL}, |
3042
227101cb98ca
(svn r3622) - Partly revert r3214. The patch setting max_num_autosaves stays to help control PDA-troubles which the commit was intended for. Didn't revert makefile-config version since it would cause trouble. But Bjarni promised to rewrite it :)
Darkvater
parents:
3041
diff
changeset
|
896 |
{"max_autosave_num", SDT_UINT8, (void*)16, &_patches.max_num_autosaves, NULL}, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
897 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
898 |
{"bridge_pillars", SDT_BOOL, (void*)true, &_patches.bridge_pillars, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
899 |
{"invisible_trees", SDT_BOOL, (void*)false, &_patches.invisible_trees, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
900 |
{"drag_signals_density",SDT_UINT8, (void*)4, &_patches.drag_signals_density, NULL}, |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
55
diff
changeset
|
901 |
|
545
ab2098c1da75
(svn r945) -Fix: [Network] Terraform callback went wrong in merge
truelight
parents:
543
diff
changeset
|
902 |
{"window_snap_radius", SDT_UINT8, (void*)10, &_patches.window_snap_radius, NULL}, |
ab2098c1da75
(svn r945) -Fix: [Network] Terraform callback went wrong in merge
truelight
parents:
543
diff
changeset
|
903 |
|
812
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
794
diff
changeset
|
904 |
{"autorenew", SDT_BOOL, (void*)false, &_patches.autorenew, NULL}, |
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
794
diff
changeset
|
905 |
{"autorenew_months", SDT_INT16, (void*)-6, &_patches.autorenew_months, NULL}, |
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
794
diff
changeset
|
906 |
{"autorenew_money", SDT_INT32, (void*)100000,&_patches.autorenew_money, NULL}, |
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
794
diff
changeset
|
907 |
|
835
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
812
diff
changeset
|
908 |
{"population_in_label", SDT_BOOL, (void*)true, &_patches.population_in_label, NULL}, |
2619
1b20d578a660
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2456
diff
changeset
|
909 |
{"link_terraform_toolbar", SDT_BOOL, (void*)false, &_patches.link_terraform_toolbar, NULL}, |
835
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
812
diff
changeset
|
910 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
156
diff
changeset
|
911 |
{NULL, 0, NULL, NULL, NULL} |
0 | 912 |
}; |
913 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
914 |
// Non-static, needed in network_server.c |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
915 |
const SettingDesc patch_settings[] = { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
916 |
{"build_on_slopes", SDT_BOOL, (void*)true, &_patches.build_on_slopes, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
917 |
{"mammoth_trains", SDT_BOOL, (void*)true, &_patches.mammoth_trains, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
918 |
{"join_stations", SDT_BOOL, (void*)true, &_patches.join_stations, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
919 |
{"station_spread", SDT_UINT8, (void*)12, &_patches.station_spread, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
920 |
{"full_load_any", SDT_BOOL, (void*)true, &_patches.full_load_any, NULL}, |
951
759ca1b993db
(svn r1441) Fixed a couple of warnings, and removed a pointless assert
celestar
parents:
930
diff
changeset
|
921 |
{"modified_catchment", SDT_BOOL, (void*)true, &_patches.modified_catchment, NULL}, |
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
545
diff
changeset
|
922 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
923 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
924 |
{"inflation", SDT_BOOL, (void*)true, &_patches.inflation, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
925 |
{"selectgoods", SDT_BOOL, (void*)true, &_patches.selectgoods, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
926 |
{"longbridges", SDT_BOOL, (void*)true, &_patches.longbridges, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
927 |
{"gotodepot", SDT_BOOL, (void*)true, &_patches.gotodepot, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
928 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
929 |
{"build_rawmaterial_ind", SDT_BOOL, (void*)false, &_patches.build_rawmaterial_ind,NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
930 |
{"multiple_industry_per_town",SDT_BOOL, (void*)false, &_patches.multiple_industry_per_town, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
931 |
{"same_industry_close", SDT_BOOL, (void*)false, &_patches.same_industry_close, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
932 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
933 |
{"signal_side", SDT_BOOL, (void*)true, &_patches.signal_side, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
934 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
935 |
{"new_nonstop", SDT_BOOL, (void*)false, &_patches.new_nonstop, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
936 |
{"roadveh_queue", SDT_BOOL, (void*)true, &_patches.roadveh_queue, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
937 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
938 |
{"snow_line_height", SDT_UINT8, (void*)7, &_patches.snow_line_height, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
939 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
940 |
{"bribe", SDT_BOOL, (void*)true, &_patches.bribe, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
941 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
942 |
{"nonuniform_stations", SDT_BOOL, (void*)true, &_patches.nonuniform_stations, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
943 |
{"always_small_airport",SDT_BOOL, (void*)false, &_patches.always_small_airport, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
944 |
{"realistic_acceleration",SDT_BOOL, (void*)false, &_patches.realistic_acceleration, NULL}, |
2456
2317dd6f4b19
(svn r2982) Newgrf: Added patch option for wagon speed limits. This is enabled by default.
peter1138
parents:
2450
diff
changeset
|
945 |
{"wagon_speed_limits", SDT_BOOL, (void*)true, &_patches.wagon_speed_limits, NULL}, |
1247 | 946 |
{"forbid_90_deg", SDT_BOOL, (void*)false, &_patches.forbid_90_deg, NULL}, |
545
ab2098c1da75
(svn r945) -Fix: [Network] Terraform callback went wrong in merge
truelight
parents:
543
diff
changeset
|
947 |
{"improved_load", SDT_BOOL, (void*)false, &_patches.improved_load, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
948 |
|
1282
ea2ae881814c
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
truelight
parents:
1271
diff
changeset
|
949 |
{"max_trains", SDT_UINT16, (void*)500, &_patches.max_trains, NULL}, |
ea2ae881814c
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
truelight
parents:
1271
diff
changeset
|
950 |
{"max_roadveh", SDT_UINT16, (void*)500, &_patches.max_roadveh, NULL}, |
ea2ae881814c
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
truelight
parents:
1271
diff
changeset
|
951 |
{"max_aircraft", SDT_UINT16, (void*)200, &_patches.max_aircraft, NULL}, |
ea2ae881814c
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
truelight
parents:
1271
diff
changeset
|
952 |
{"max_ships", SDT_UINT16, (void*)300, &_patches.max_ships, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
953 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
954 |
{"servint_ispercent", SDT_BOOL, (void*)false, &_patches.servint_ispercent, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
955 |
{"servint_trains", SDT_UINT16, (void*)150, &_patches.servint_trains, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
956 |
{"servint_roadveh", SDT_UINT16, (void*)150, &_patches.servint_roadveh, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
957 |
{"servint_ships", SDT_UINT16, (void*)360, &_patches.servint_ships, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
958 |
{"servint_aircraft", SDT_UINT16, (void*)100, &_patches.servint_aircraft, NULL}, |
1037
4fbbb01cf87b
(svn r1538) -Feature: [988816] Disable servicing when breakdowns set to none (jaguar7)
darkvater
parents:
1030
diff
changeset
|
959 |
{"no_servicing_if_no_breakdowns", SDT_BOOL, (void*)0, &_patches.no_servicing_if_no_breakdowns, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
960 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
961 |
{"pf_maxlength", SDT_UINT16, (void*)512, &_patches.pf_maxlength, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
962 |
{"pf_maxdepth", SDT_UINT8, (void*)16, &_patches.pf_maxdepth, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
963 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
964 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
965 |
{"ai_disable_veh_train",SDT_BOOL, (void*)false, &_patches.ai_disable_veh_train, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
966 |
{"ai_disable_veh_roadveh",SDT_BOOL, (void*)false, &_patches.ai_disable_veh_roadveh, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
967 |
{"ai_disable_veh_aircraft",SDT_BOOL,(void*)false, &_patches.ai_disable_veh_aircraft,NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
968 |
{"ai_disable_veh_ship", SDT_BOOL, (void*)false, &_patches.ai_disable_veh_ship, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
969 |
{"starting_date", SDT_UINT32, (void*)1950, &_patches.starting_date, NULL}, |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
960
diff
changeset
|
970 |
{"ending_date", SDT_UINT32, (void*)2051, &_patches.ending_date, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
971 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
972 |
{"colored_news_date", SDT_UINT32, (void*)2000, &_patches.colored_news_date, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
973 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
974 |
{"extra_dynamite", SDT_BOOL, (void*)false, &_patches.extra_dynamite, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
975 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
976 |
{"never_expire_vehicles",SDT_BOOL, (void*)false, &_patches.never_expire_vehicles,NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
977 |
{"extend_vehicle_life", SDT_UINT8, (void*)0, &_patches.extend_vehicle_life, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
978 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
979 |
{"auto_euro", SDT_BOOL, (void*)true, &_patches.auto_euro, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
980 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
981 |
{"serviceathelipad", SDT_BOOL, (void*)true, &_patches.serviceathelipad, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
982 |
{"smooth_economy", SDT_BOOL, (void*)true, &_patches.smooth_economy, NULL}, |
930
ab42e283749d
(svn r1418) -Feature: [1098254] (dis)Allow Shares. Add patch options to allow buying/selling of shares (Hackykid)
darkvater
parents:
898
diff
changeset
|
983 |
{"allow_shares", SDT_BOOL, (void*)true, &_patches.allow_shares, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
984 |
{"dist_local_authority",SDT_UINT8, (void*)20, &_patches.dist_local_authority, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
985 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
986 |
{"wait_oneway_signal", SDT_UINT8, (void*)15, &_patches.wait_oneway_signal, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
987 |
{"wait_twoway_signal", SDT_UINT8, (void*)41, &_patches.wait_twoway_signal, NULL}, |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
988 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
989 |
{"ainew_active", SDT_BOOL, (void*)false, &_patches.ainew_active, NULL}, |
2682
7fa4b202b9f0
(svn r3224) -Add: Allow the NewAI to work in Multiplayer Games (switchable via patch
truelight
parents:
2680
diff
changeset
|
990 |
{"ai_in_multiplayer", SDT_BOOL, (void*)false, &_patches.ai_in_multiplayer, NULL}, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
991 |
|
1218 | 992 |
{"map_x", SDT_UINT32, (void*)8, &_patches.map_x, NULL}, |
993 |
{"map_y", SDT_UINT32, (void*)8, &_patches.map_y, NULL}, |
|
994 |
||
1271
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
995 |
/* New Path Finding */ |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
996 |
{"new_pathfinding_all", SDT_BOOL, (void*)false, &_patches.new_pathfinding_all, NULL}, |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
997 |
|
1700
e1fe3446d013
(svn r2204) - Add: [NPF] NPF now has a maximum number of nodes it will search. The default value is 5000 for now, which is an educated guess. Probably needs some finetuning. Hopefully this "feature" can be removed later on, when more sophisticated means of limiting the pathfinder have been implemented. This should make ships and larger networks playable for now, though.
matthijs
parents:
1688
diff
changeset
|
998 |
/* The maximum number of nodes to search */ |
e1fe3446d013
(svn r2204) - Add: [NPF] NPF now has a maximum number of nodes it will search. The default value is 5000 for now, which is an educated guess. Probably needs some finetuning. Hopefully this "feature" can be removed later on, when more sophisticated means of limiting the pathfinder have been implemented. This should make ships and larger networks playable for now, though.
matthijs
parents:
1688
diff
changeset
|
999 |
{"npf_max_search_nodes", SDT_UINT32, (void*)10000, &_patches.npf_max_search_nodes, NULL}, |
e1fe3446d013
(svn r2204) - Add: [NPF] NPF now has a maximum number of nodes it will search. The default value is 5000 for now, which is an educated guess. Probably needs some finetuning. Hopefully this "feature" can be removed later on, when more sophisticated means of limiting the pathfinder have been implemented. This should make ships and larger networks playable for now, though.
matthijs
parents:
1688
diff
changeset
|
1000 |
|
1271
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1001 |
/* When a red signal is encountered, a small detour can be made around |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1002 |
* it. This specifically occurs when a track is doubled, in which case |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1003 |
* the detour is typically 2 tiles. It is also often used at station |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1004 |
* entrances, when there is a choice of multiple platforms. If we take |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1005 |
* a typical 4 platform station, the detour is 4 tiles. To properly |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1006 |
* support larger stations we increase this value. |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1007 |
* We want to prevent that trains that want to leave at one side of a |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1008 |
* station, leave through the other side, turn around, enter the |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1009 |
* station on another platform and exit the station on the right side |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1010 |
* again, just because the sign at the right side was red. If we take |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1011 |
* a typical 5 length station, this detour is 10 or 11 tiles (not |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1012 |
* sure), so we set the default penalty at 10 (the station tile |
1643
420cad9e62e4
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
matthijs
parents:
1602
diff
changeset
|
1013 |
* penalty will further prevent this. |
420cad9e62e4
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
matthijs
parents:
1602
diff
changeset
|
1014 |
* We give presignal exits (and combo's) a different (larger) penalty, because we really |
420cad9e62e4
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
matthijs
parents:
1602
diff
changeset
|
1015 |
* don't want trains waiting in front of a presignal exit. */ |
1751
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1016 |
{"npf_rail_firstred_penalty", SDT_UINT32, (void*)(10 * NPF_TILE_LENGTH), &_patches.npf_rail_firstred_penalty, NULL}, |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1017 |
{"npf_rail_firstred_exit_penalty", SDT_UINT32, (void*)(100 * NPF_TILE_LENGTH), &_patches.npf_rail_firstred_exit_penalty, NULL}, |
1459
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1018 |
/* This penalty is for when the last signal before the target is red. |
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1019 |
* This is useful for train stations, where there are multiple |
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1020 |
* platforms to choose from, which lie in different signal blocks. |
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1021 |
* Every target in a occupied signal block (ie an occupied platform) |
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1022 |
* will get this penalty. |
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1023 |
*/ |
1643
420cad9e62e4
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
matthijs
parents:
1602
diff
changeset
|
1024 |
{"npf_rail_lastred_penalty", SDT_UINT32, (void*)(10 * NPF_TILE_LENGTH), &_patches.npf_rail_lastred_penalty, NULL}, |
1271
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1025 |
/* When a train plans a route over a station tile, this penalty is |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1026 |
* applied. We want that trains plan a route around a typical, 4x5 |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1027 |
* station, which means two tiles to the right, and two tiles back to |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1028 |
* the left around it, or 5 tiles of station through it. If we assign |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1029 |
* a penalty of 1 tile for every station tile passed, the route will |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1030 |
* be around it. |
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1031 |
*/ |
1751
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1032 |
{"npf_rail_station_penalty", SDT_UINT32, (void*)(1 * NPF_TILE_LENGTH), &_patches.npf_rail_station_penalty, NULL}, |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1033 |
{"npf_rail_slope_penalty", SDT_UINT32, (void*)(1 * NPF_TILE_LENGTH), &_patches.npf_rail_slope_penalty, NULL}, |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1034 |
/* This penalty is applied when a train makes a turn. Its value of 1 makes |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1035 |
* sure that it has a minimal impact on the pathfinding, only when two |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1036 |
* paths have equal length it will make a difference */ |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1037 |
{"npf_rail_curve_penalty", SDT_UINT32, (void*)(1), &_patches.npf_rail_curve_penalty, NULL}, |
1777
f703cf05b5b9
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
1038 |
/* Ths penalty is applied when a vehicle reverses inside a depot (doesn't |
f703cf05b5b9
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
1039 |
* apply to ships, as they can just come out the other end). XXX: Is this a |
f703cf05b5b9
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
1040 |
* good value? */ |
f703cf05b5b9
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
1041 |
{"npf_rail_depot_reverse_penalty", SDT_UINT32, (void*)(NPF_TILE_LENGTH * 50), &_patches.npf_rail_depot_reverse_penalty, NULL}, |
1751
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1042 |
{"npf_buoy_penalty", SDT_UINT32, (void*)(2 * NPF_TILE_LENGTH), &_patches.npf_buoy_penalty, NULL}, |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1043 |
/* This penalty is applied when a ship makes a turn. It is bigger than the |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1044 |
* rail curve penalty, since ships (realisticly) have more trouble with |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1045 |
* making turns */ |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1046 |
{"npf_water_curve_penalty", SDT_UINT32, (void*)(NPF_TILE_LENGTH / 4), &_patches.npf_water_curve_penalty, NULL}, |
1941
ca268f8837df
(svn r2447) * Add: [NPF] Penalty for road vehicles making turns.
matthijs
parents:
1891
diff
changeset
|
1047 |
/* This is the penalty for road, same as for rail. */ |
ca268f8837df
(svn r2447) * Add: [NPF] Penalty for road vehicles making turns.
matthijs
parents:
1891
diff
changeset
|
1048 |
{"npf_road_curve_penalty", SDT_UINT32, (void*)(1), &_patches.npf_road_curve_penalty, NULL}, |
2006
9d5d7fd428c2
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
1941
diff
changeset
|
1049 |
/* This is the penalty for level crossings, for both road and rail vehicles */ |
9d5d7fd428c2
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
1941
diff
changeset
|
1050 |
{"npf_crossing_penalty", SDT_UINT32, (void*)(3 * NPF_TILE_LENGTH), &_patches.npf_crossing_penalty, NULL}, |
1271
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1051 |
|
1751
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1052 |
{NULL, 0, NULL, NULL, NULL} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1053 |
}; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1054 |
|
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
1055 |
static const SettingDesc currency_settings[] = { |
2307
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
1056 |
{ "rate", SDT_UINT16, (void*)1, &_custom_currency.rate, NULL }, |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
1057 |
{ "separator", SDT_CHAR, ".", &_custom_currency.separator, NULL }, |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
1058 |
{ "to_euro", SDT_UINT16, (void*)0, &_custom_currency.to_euro, NULL }, |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
1059 |
{ "prefix", SDT_STRINGQUOT | lengthof(_custom_currency.prefix) << 16, NULL, &_custom_currency.prefix, NULL }, |
484c654dc875
(svn r2831) Fix some potential and real buffer overflows
tron
parents:
2306
diff
changeset
|
1060 |
{ "suffix", SDT_STRINGQUOT | lengthof(_custom_currency.suffix) << 16, " credits", &_custom_currency.suffix, NULL }, |
2306
adb71c055afb
(svn r2830) Move CheckSwitchToEuro() to currency.[ch] and hide the truth about the custom currency behind a #define
tron
parents:
2291
diff
changeset
|
1061 |
{ NULL, 0, NULL, NULL, NULL } |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
1062 |
}; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
1063 |
|
2975 | 1064 |
typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, const char *grpname); |
0 | 1065 |
|
1066 |
static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc) |
|
1067 |
{ |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1068 |
proc(ini, misc_settings, "misc"); |
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1069 |
#ifdef WIN32 |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1070 |
proc(ini, win32_settings, "win32"); |
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1071 |
#endif /* WIN32 */ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1072 |
#ifdef ENABLE_NETWORK |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1073 |
proc(ini, network_settings, "network"); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1074 |
#endif /* ENABLE_NETWORK */ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1075 |
proc(ini, music_settings, "music"); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1076 |
proc(ini, gameopt_settings, "gameopt"); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1077 |
proc(ini, patch_settings, "patches"); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1078 |
proc(ini, patch_player_settings, "patches"); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
1079 |
proc(ini, currency_settings,"currency"); |
0 | 1080 |
} |
1081 |
||
710
2a13862fe86b
(svn r1162) The server list can now be automatically filled from the config file. Add a section [servers] with the addresses each in a new line. Those will be checked upon OpenTTD startup.
dominik
parents:
705
diff
changeset
|
1082 |
// loads all items from a *grpname section into the **list |
2a13862fe86b
(svn r1162) The server list can now be automatically filled from the config file. Add a section [servers] with the addresses each in a new line. Those will be checked upon OpenTTD startup.
dominik
parents:
705
diff
changeset
|
1083 |
static void LoadList(IniFile *ini, const char *grpname, char **list, int len) |
0 | 1084 |
{ |
710
2a13862fe86b
(svn r1162) The server list can now be automatically filled from the config file. Add a section [servers] with the addresses each in a new line. Those will be checked upon OpenTTD startup.
dominik
parents:
705
diff
changeset
|
1085 |
IniGroup *group = ini_getgroup(ini, grpname, -1); |
0 | 1086 |
IniItem *item; |
1087 |
int i; |
|
1088 |
||
1089 |
if (!group) |
|
1090 |
return; |
|
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
1091 |
item = group->item; |
710
2a13862fe86b
(svn r1162) The server list can now be automatically filled from the config file. Add a section [servers] with the addresses each in a new line. Those will be checked upon OpenTTD startup.
dominik
parents:
705
diff
changeset
|
1092 |
for ( i=0; i != len; i++) { |
2a13862fe86b
(svn r1162) The server list can now be automatically filled from the config file. Add a section [servers] with the addresses each in a new line. Those will be checked upon OpenTTD startup.
dominik
parents:
705
diff
changeset
|
1093 |
if (item == NULL) break; |
2a13862fe86b
(svn r1162) The server list can now be automatically filled from the config file. Add a section [servers] with the addresses each in a new line. Those will be checked upon OpenTTD startup.
dominik
parents:
705
diff
changeset
|
1094 |
list[i] = strdup(item->value); |
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
1095 |
item = item->next; |
0 | 1096 |
} |
1097 |
} |
|
1098 |
||
738
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1099 |
static void SaveList(IniFile *ini, const char *grpname, char **list, int len) |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1100 |
{ |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1101 |
IniGroup *group = ini_getgroup(ini, grpname, -1); |
774
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
764
diff
changeset
|
1102 |
IniItem *item = NULL; |
738
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1103 |
int i; |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1104 |
bool first = true; |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1105 |
|
2919
3e42ca528f01
(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
Darkvater
parents:
2916
diff
changeset
|
1106 |
if (group == NULL) return; |
3e42ca528f01
(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
Darkvater
parents:
2916
diff
changeset
|
1107 |
group->item = NULL; |
3e42ca528f01
(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
Darkvater
parents:
2916
diff
changeset
|
1108 |
|
774
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
764
diff
changeset
|
1109 |
for (i = 0; i != len; i++) { |
898
3413f88ae525
(svn r1384) Fix: Sometimes when lists were saved, a lot of blank lines had been added
dominik
parents:
841
diff
changeset
|
1110 |
if (list[i] == NULL || list[i][0] == '\0') continue; |
738
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1111 |
|
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1112 |
if (first) { // add first item to the head of the group |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1113 |
item = ini_item_alloc(group, list[i], strlen(list[i])); |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1114 |
item->value = item->name; |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1115 |
group->item = item; |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1116 |
first = false; |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1117 |
} else { // all other items are attached to the previous one |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1118 |
item->next = ini_item_alloc(group, list[i], strlen(list[i])); |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1119 |
item = item->next; |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1120 |
item->value = item->name; |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1121 |
} |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1122 |
} |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1123 |
} |
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1124 |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
1125 |
void LoadFromConfig(void) |
0 | 1126 |
{ |
1127 |
IniFile *ini = ini_load(_config_file); |
|
1128 |
HandleSettingDescs(ini, load_setting_desc); |
|
710
2a13862fe86b
(svn r1162) The server list can now be automatically filled from the config file. Add a section [servers] with the addresses each in a new line. Those will be checked upon OpenTTD startup.
dominik
parents:
705
diff
changeset
|
1129 |
LoadList(ini, "newgrf", _newgrf_files, lengthof(_newgrf_files)); |
3041
96c5e9e8c3f3
(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
Darkvater
parents:
3021
diff
changeset
|
1130 |
#ifdef ENABLE_NETWORK |
738
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1131 |
LoadList(ini, "servers", _network_host_list, lengthof(_network_host_list)); |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
835
diff
changeset
|
1132 |
LoadList(ini, "bans", _network_ban_list, lengthof(_network_ban_list)); |
3041
96c5e9e8c3f3
(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
Darkvater
parents:
3021
diff
changeset
|
1133 |
#endif /* ENABLE_NETWORK */ |
0 | 1134 |
ini_free(ini); |
1135 |
} |
|
1136 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
1137 |
void SaveToConfig(void) |
0 | 1138 |
{ |
1139 |
IniFile *ini = ini_load(_config_file); |
|
1140 |
HandleSettingDescs(ini, save_setting_desc); |
|
3041
96c5e9e8c3f3
(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
Darkvater
parents:
3021
diff
changeset
|
1141 |
#ifdef ENABLE_NETWORK |
738
b96ab9e63d22
(svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents:
710
diff
changeset
|
1142 |
SaveList(ini, "servers", _network_host_list, lengthof(_network_host_list)); |
841
4874b9ce2765
(svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents:
835
diff
changeset
|
1143 |
SaveList(ini, "bans", _network_ban_list, lengthof(_network_ban_list)); |
3041
96c5e9e8c3f3
(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
Darkvater
parents:
3021
diff
changeset
|
1144 |
#endif /* ENABLE_NETWORK */ |
0 | 1145 |
ini_save(_config_file, ini); |
1146 |
ini_free(ini); |
|
1147 |
} |
|
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1148 |
|
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1149 |
void CheckConfig(void) |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1150 |
{ |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1151 |
// fix up news_display_opt from old to new |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1152 |
int i; |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1153 |
uint32 tmp; |
1723
edb80d6bcc2d
(svn r2227) - Fix (regression): [ 1188408 ] Fix news settings load check. When updating old news-message-types to new ones, certain combinations of new were wrongly recognized as old (glx)
Darkvater
parents:
1700
diff
changeset
|
1154 |
for (i = 0, tmp = _news_display_opt; i != 10; i++, tmp >>= 2) { |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1155 |
if ((tmp & 0x3) == 0x3) { // old settings |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1156 |
_news_display_opt = 0xAAAAAAAA; // set all news-messages to full 1010101010... |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1157 |
break; |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1158 |
} |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1159 |
} |
2044
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1160 |
|
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1161 |
// Increase old default values for pf_maxdepth and pf_maxlength |
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1162 |
// to support big networks. |
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1163 |
if (_patches.pf_maxdepth == 16 && _patches.pf_maxlength == 512) { |
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1164 |
_patches.pf_maxdepth = 48; |
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1165 |
_patches.pf_maxlength = 4096; |
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1166 |
} |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1167 |
} |