Mercurial > hg > openttd
annotate settings.c @ 3491:6aef91e18846 draft
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
Remove DoCommandByTile(), because now it does the same as DoCommand()
author | tron <tron@openttd.org> |
---|---|
date | Mon, 10 Apr 2006 07:15:58 +0000 |
parents | 7b32b272ff94 |
children | 4ec87b7cb8eb |
rev | line source |
---|---|
2186
042e6d005cb0
(svn r2701) Insert Id tags into all source files
tron <tron@openttd.org>
parents:
2163
diff
changeset
|
1 /* $Id$ */ |
042e6d005cb0
(svn r2701) Insert Id tags into all source files
tron <tron@openttd.org>
parents:
2163
diff
changeset
|
2 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
3 #include "stdafx.h" |
1891
81b2cb2fc036
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater <Darkvater@openttd.org>
parents:
1777
diff
changeset
|
4 #include "openttd.h" |
2291
d21d700e49c5
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron <tron@openttd.org>
parents:
2191
diff
changeset
|
5 #include "currency.h" |
2163
acad95b3c4a2
(svn r2673) Include functions.h directly, not globally via openttd.h
tron <tron@openttd.org>
parents:
2153
diff
changeset
|
6 #include "functions.h" |
2191
e8e4d71613a1
(svn r2706) Fix !WITH_NETWORK build
tron <tron@openttd.org>
parents:
2186
diff
changeset
|
7 #include "macros.h" |
2121
8a10fcb9efea
(svn r2631) Move screenshot related variables from variables.h to screenshot.[ch]
tron <tron@openttd.org>
parents:
2044
diff
changeset
|
8 #include "screenshot.h" |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
9 #include "sound.h" |
1317
963ca925a72a
(svn r1821) Move generic string handling functions to string.[ch] and introduce stre{cpy,cat}, see string.h for their semantics
tron <tron@openttd.org>
parents:
1282
diff
changeset
|
10 #include "string.h" |
2153
0dbefb90b5f5
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron <tron@openttd.org>
parents:
2125
diff
changeset
|
11 #include "variables.h" |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
12 #include "network.h" |
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
13 #include "settings.h" |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
14 #include "command.h" |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
15 #include "console.h" |
3112
3a5e0c62fb5e
(svn r3716) - Move the option settings (_game_opt_desc) from misc.c into settings.c. This will be merged with SettingDesc misc_settings above as they are actually the same. No functionality has changed beside the fact that the settings are now in a different Chunkhandler.
Darkvater <Darkvater@openttd.org>
parents:
3052
diff
changeset
|
16 #include "saveload.h" |
3358
7b32b272ff94
(svn r4153) -Codechange. Changed NPF_TILE_LENGTH into an enum and moved it out of variables.h. Just a drop in the bucket, but it is a start
celestar <celestar@openttd.org>
parents:
3352
diff
changeset
|
17 #include "npf.h" |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
18 |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
19 /** The patch values that are used for new games and/or modified in config file */ |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
20 Patches _patches_newgame; |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
21 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
22 typedef struct IniFile IniFile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
23 typedef struct IniItem IniItem; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
24 typedef struct IniGroup IniGroup; |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
25 typedef struct SettingsMemoryPool SettingsMemoryPool; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
26 |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
27 static void pool_init(SettingsMemoryPool **pool); |
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
28 static void *pool_alloc(SettingsMemoryPool **pool, uint size); |
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
29 static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, uint size); |
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
30 static void pool_free(SettingsMemoryPool **pool); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
31 |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
32 struct SettingsMemoryPool { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
33 uint pos,size; |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
34 SettingsMemoryPool *next; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
35 byte mem[1]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
36 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
37 |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
38 static SettingsMemoryPool *pool_new(uint minsize) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
39 { |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
40 SettingsMemoryPool *p; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
41 if (minsize < 4096 - 12) minsize = 4096 - 12; |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
42 |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
43 p = malloc(sizeof(SettingsMemoryPool) - 1 + minsize); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
44 p->pos = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
45 p->size = minsize; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
46 p->next = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
47 return p; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
48 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
49 |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
50 static void pool_init(SettingsMemoryPool **pool) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
51 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
52 *pool = pool_new(0); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
53 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
54 |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
55 static void *pool_alloc(SettingsMemoryPool **pool, uint size) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
56 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
57 uint pos; |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
58 SettingsMemoryPool *p = *pool; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
59 |
2450
e59bd8edffda
(svn r2976) -Fix: Align settings pool items to the size of void* to fix bus errors on 64bit architectures which require aligned variables
tron <tron@openttd.org>
parents:
2398
diff
changeset
|
60 size = ALIGN(size, sizeof(void*)); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
61 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
62 // first check if there's memory in the next pool |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
63 if (p->next && p->next->pos + size <= p->next->size) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
64 p = p->next; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
65 // then check if there's not memory in the cur pool |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
66 } else if (p->pos + size > p->size) { |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
67 SettingsMemoryPool *n = pool_new(size); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
68 *pool = n; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
69 n->next = p; |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
70 p = n; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
71 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
72 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
73 pos = p->pos; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
74 p->pos += size; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
75 return p->mem + pos; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
76 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
77 |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
78 static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, uint size) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
79 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
80 byte *p = pool_alloc(pool, size + 1); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
81 p[size] = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
82 memcpy(p, mem, size); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
83 return p; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
84 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
85 |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
86 static void pool_free(SettingsMemoryPool **pool) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
87 { |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
88 SettingsMemoryPool *p = *pool, *n; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
89 *pool = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
90 while (p) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
91 n = p->next; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
92 free(p); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
93 p = n; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
94 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
95 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
96 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
97 // structs describing the ini format. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
98 struct IniItem { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
99 char *name; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
100 char *value; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
101 char *comment; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
102 IniItem *next; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
103 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
104 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
105 struct IniGroup { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
106 char *name; // name of group |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
107 char *comment; //comment for group |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
108 IniItem *item, **last_item; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
109 IniGroup *next; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
110 IniFile *ini; |
705
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
111 IniGroupType type; // type of group |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
112 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
113 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
114 struct IniFile { |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
115 SettingsMemoryPool *pool; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
116 IniGroup *group, **last_group; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
117 char *comment; // last comment in file |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
118 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
119 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
120 // allocate an inifile object |
1093
5029c37a31c0
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron <tron@openttd.org>
parents:
1037
diff
changeset
|
121 static IniFile *ini_alloc(void) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
122 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
123 IniFile *ini; |
1258
ff6f9f3313e6
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight <truelight@openttd.org>
parents:
1247
diff
changeset
|
124 SettingsMemoryPool *pool; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
125 pool_init(&pool); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
126 ini = (IniFile*)pool_alloc(&pool, sizeof(IniFile)); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
127 ini->pool = pool; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
128 ini->group = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
129 ini->last_group = &ini->group; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
130 ini->comment = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
131 return ini; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
132 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
133 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
134 // allocate an ini group object |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
135 static IniGroup *ini_group_alloc(IniFile *ini, const char *grpt, int len) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
136 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
137 IniGroup *grp = pool_alloc(&ini->pool, sizeof(IniGroup)); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
138 grp->ini = ini; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
139 grp->name = pool_strdup(&ini->pool, grpt, len); |
2953
8de838c7c0d9
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138 <peter1138@openttd.org>
parents:
2952
diff
changeset
|
140 if (!strcmp(grp->name, "newgrf") || !strcmp(grp->name, "servers") || !strcmp(grp->name, "bans")) { |
705
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
141 grp->type = IGT_LIST; |
2953
8de838c7c0d9
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138 <peter1138@openttd.org>
parents:
2952
diff
changeset
|
142 } else { |
705
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
143 grp->type = IGT_VARIABLES; |
2953
8de838c7c0d9
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138 <peter1138@openttd.org>
parents:
2952
diff
changeset
|
144 } |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
145 grp->next = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
146 grp->item = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
147 grp->comment = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
148 grp->last_item = &grp->item; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
149 *ini->last_group = grp; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
150 ini->last_group = &grp->next; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
151 return grp; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
152 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
153 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
154 static IniItem *ini_item_alloc(IniGroup *group, const char *name, int len) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
155 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
156 IniItem *item = pool_alloc(&group->ini->pool, sizeof(IniItem)); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
157 item->name = pool_strdup(&group->ini->pool, name, len); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
158 item->next = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
159 item->comment = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
160 item->value = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
161 *group->last_item = item; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
162 group->last_item = &item->next; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
163 return item; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
164 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
165 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
166 // load an ini file into the "abstract" format |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
167 static IniFile *ini_load(const char *filename) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
168 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
169 char buffer[1024], c, *s, *t, *e; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
170 FILE *in; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
171 IniFile *ini; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
172 IniGroup *group = NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
173 IniItem *item; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
174 |
1329
51edb33bc458
(svn r1833) byte -> char transition: the rest
tron <tron@openttd.org>
parents:
1317
diff
changeset
|
175 char *comment = NULL; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
176 uint comment_size = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
177 uint comment_alloc = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
178 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
179 ini = ini_alloc(); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
180 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
181 in = fopen(filename, "r"); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
182 if (in == NULL) return ini; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
183 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
184 // for each line in the file |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
185 while (fgets(buffer, sizeof(buffer), in)) { |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
186 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
187 // trim whitespace from the left side |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
188 for (s = buffer; s[0] == ' ' || s[0] == '\t'; s++); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
189 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
190 // trim whitespace from right side. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
191 e = s + strlen(s); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
192 while (e > s && ((c=e[-1]) == '\n' || c == '\r' || c == ' ' || c == '\t')) e--; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
193 *e = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
194 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
195 // skip comments and empty lines |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
196 if (*s == '#' || *s == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
197 uint ns = comment_size + (e - s + 1); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
198 uint a = comment_alloc; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
199 uint pos; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
200 // add to comment |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
201 if (ns > a) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
202 a = max(a, 128); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
203 do a*=2; while (a < ns); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
204 comment = realloc(comment, comment_alloc = a); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
205 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
206 pos = comment_size; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
207 comment_size += (e - s + 1); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
208 comment[pos + e - s] = '\n'; // comment newline |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
209 memcpy(comment + pos, s, e - s); // copy comment contents |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
210 continue; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
211 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
212 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
213 // it's a group? |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
214 if (s[0] == '[') { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
215 if (e[-1] != ']') |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
216 ShowInfoF("ini: invalid group name '%s'\n", buffer); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
217 else |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
218 e--; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
219 s++; // skip [ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
220 group = ini_group_alloc(ini, s, e - s); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
221 if (comment_size) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
222 group->comment = pool_strdup(&ini->pool, comment, comment_size); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
223 comment_size = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
224 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
225 } else if (group) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
226 // find end of keyname |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
227 for (t=s; *t != 0 && *t != '=' && *t != '\t' && *t != ' '; t++) {} |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
228 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
229 // it's an item in an existing group |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
230 item = ini_item_alloc(group, s, t-s); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
231 if (comment_size) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
232 item->comment = pool_strdup(&ini->pool, comment, comment_size); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
233 comment_size = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
234 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
235 |
705
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
236 // for list items, the name and value are the same: |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
237 if (group->type == IGT_LIST) { |
705
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
238 item->value = item->name; |
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
239 continue; |
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
240 } |
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
241 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
242 // find start of parameter |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
243 while (*t == '=' || *t == ' ' || *t == '\t') t++; |
759
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
244 |
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
245 |
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
246 // remove starting quotation marks |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
247 if (*t == '\"') t++; |
759
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
248 // remove ending quotation marks |
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
249 e = t + strlen(t); |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
250 if (e > t && e[-1] =='\"') e--; |
759
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
251 *e = 0; |
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
252 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
253 item->value = pool_strdup(&ini->pool, t, e - t); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
254 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
255 // it's an orphan item |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
256 ShowInfoF("ini: '%s' outside of group\n", buffer); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
257 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
258 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
259 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
260 if (comment_size) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
261 ini->comment = pool_strdup(&ini->pool, comment, comment_size); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
262 comment_size = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
263 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
264 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
265 free(comment); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
266 fclose(in); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
267 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
268 return ini; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
269 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
270 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
271 // lookup a group or make a new one |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
272 static IniGroup *ini_getgroup(IniFile *ini, const char *name, int len) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
273 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
274 IniGroup *group; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
275 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
276 if (len == -1) len = strlen(name); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
277 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
278 // does it exist already? |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
279 for (group = ini->group; group; group = group->next) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
280 if (!memcmp(group->name, name, len) && group->name[len] == 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
281 return group; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
282 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
283 // otherwise make a new one |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
284 group = ini_group_alloc(ini, name, len); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
285 group->comment = pool_strdup(&ini->pool, "\n", 1); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
286 return group; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
287 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
288 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
289 // lookup an item or make a new one |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
290 static IniItem *ini_getitem(IniGroup *group, const char *name, bool create) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
291 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
292 IniItem *item; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
293 uint len = strlen(name); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
294 |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
295 for (item = group->item; item; item = item->next) |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
296 if (strcmp(item->name, name) == 0) return item; |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
297 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
298 if (!create) return NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
299 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
300 // otherwise make a new one |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
301 return ini_item_alloc(group, name, len); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
302 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
303 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
304 // save ini file from the "abstract" format. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
305 static bool ini_save(const char *filename, IniFile *ini) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
306 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
307 FILE *f; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
308 IniGroup *group; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
309 IniItem *item; |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
310 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
311 f = fopen(filename, "w"); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
312 if (f == NULL) return false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
313 |
2919
4e124e5a8b69
(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 <Darkvater@openttd.org>
parents:
2916
diff
changeset
|
314 for (group = ini->group; group != NULL; group = group->next) { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
315 if (group->comment) fputs(group->comment, f); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
316 fprintf(f, "[%s]\n", group->name); |
2919
4e124e5a8b69
(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 <Darkvater@openttd.org>
parents:
2916
diff
changeset
|
317 for (item = group->item; item != NULL; item = item->next) { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
318 if (item->comment) fputs(item->comment, f); |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
319 if (group->type == IGT_LIST) |
705
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
320 fprintf(f, "%s\n", item->value ? item->value : ""); |
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
321 else |
e90d0ce56818
(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 <dominik@openttd.org>
parents:
690
diff
changeset
|
322 fprintf(f, "%s = %s\n", item->name, item->value ? item->value : ""); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
323 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
324 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
325 if (ini->comment) fputs(ini->comment, f); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
326 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
327 fclose(f); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
328 return true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
329 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
330 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
331 static void ini_free(IniFile *ini) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
332 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
333 pool_free(&ini->pool); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
334 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
335 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
336 /* Find the index value of a ONEofMANY type in a string seperated by | |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
337 * @param many full domain of values the ONEofMANY setting can have |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
338 * @param one the current value of the setting for which a value needs found |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
339 * @param onelen force calculation of the *one parameter |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
340 * @return the integer index of the full-list, or -1 if not found */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
341 static int lookup_oneofmany(const char *many, const char *one, int onelen) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
342 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
343 const char *s; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
344 int idx; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
345 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
346 if (onelen == -1) onelen = strlen(one); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
347 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
348 // check if it's an integer |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
349 if (*one >= '0' && *one <= '9') |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
350 return strtoul(one, NULL, 0); |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
351 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
352 idx = 0; |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
353 for (;;) { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
354 // find end of item |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
355 s = many; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
356 while (*s != '|' && *s != 0) s++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
357 if (s - many == onelen && !memcmp(one, many, onelen)) return idx; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
358 if (*s == 0) return -1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
359 many = s + 1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
360 idx++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
361 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
362 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
363 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
364 /* Find the set-integer value MANYofMANY type in a string |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
365 * @param many full domain of values the MANYofMANY setting can have |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
366 * @param str the current string value of the setting, each individual |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
367 * of seperated by a whitespace\tab or | character |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
368 * @return the 'fully' set integer, or -1 if a set is not found */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
369 static uint32 lookup_manyofmany(const char *many, const char *str) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
370 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
371 const char *s; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
372 int r; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
373 uint32 res = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
374 |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
375 for (;;) { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
376 // skip "whitespace" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
377 while (*str == ' ' || *str == '\t' || *str == '|') str++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
378 if (*str == 0) break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
379 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
380 s = str; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
381 while (*s != 0 && *s != ' ' && *s != '\t' && *s != '|') s++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
382 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
383 r = lookup_oneofmany(many, str, s - str); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
384 if (r == -1) return (uint32)-1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
385 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
386 SETBIT(res, r); // value found, set it |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
387 if (*s == 0) break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
388 str = s + 1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
389 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
390 return res; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
391 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
392 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
393 /** Parse an integerlist string and set each found value |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
394 * @param p the string to be parsed. Each element in the list is seperated by a comma |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
395 * @param items pointer to the integerlist-array that will be filled with values |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
396 * @param maxitems the maximum number of elements the integerlist-array has |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
397 * @return returns the number of items found, or -1 on an error */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
398 static int parse_intlist(const char *p, int *items, int maxitems) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
399 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
400 int n = 0, v; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
401 char *end; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
402 |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
403 for (;;) { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
404 v = strtol(p, &end, 0); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
405 if (p == end || n == maxitems) return -1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
406 p = end; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
407 items[n++] = v; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
408 if (*p == 0) break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
409 if (*p != ',') return -1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
410 p++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
411 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
412 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
413 return n; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
414 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
415 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
416 /* Load parsed string-values into an integer-array (intlist) |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
417 * @param str the string that contains the values (and will be parsed) |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
418 * @param array pointer to the integer-arrays that will be filled |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
419 * @param nelems the number of elements the array holds. Maximum is 64 elements |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
420 * @param type the type of elements the array holds (eg INT8, UINT16, etc.) |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
421 * @return return true on success and false on error */ |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
422 static bool load_intlist(const char *str, void *array, int nelems, VarType type) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
423 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
424 int items[64]; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
425 int i, nitems; |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
426 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
427 if (str == NULL) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
428 memset(items, 0, sizeof(items)); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
429 nitems = nelems; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
430 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
431 nitems = parse_intlist(str, items, lengthof(items)); |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
432 if (nitems != nelems) return false; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
433 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
434 |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
435 switch (type) { |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
436 case SLE_VAR_BL: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
437 case SLE_VAR_I8: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
438 case SLE_VAR_U8: |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
439 for (i = 0; i != nitems; i++) ((byte*)array)[i] = items[i]; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
440 break; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
441 case SLE_VAR_I16: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
442 case SLE_VAR_U16: |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
443 for (i = 0; i != nitems; i++) ((uint16*)array)[i] = items[i]; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
444 break; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
445 case SLE_VAR_I32: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
446 case SLE_VAR_U32: |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
447 for (i = 0; i != nitems; i++) ((uint32*)array)[i] = items[i]; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
448 break; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
449 default: NOT_REACHED(); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
450 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
451 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
452 return true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
453 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
454 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
455 /* Convert an integer-array (intlist) to a string representation. Each value |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
456 * is seperated by a comma |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
457 * @param buf output buffer where the string-representation will be stored |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
458 * @param array pointer to the integer-arrays that is read from |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
459 * @param nelems the number of elements the array holds. |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
460 * @param type the type of elements the array holds (eg INT8, UINT16, etc.) */ |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
461 static void make_intlist(char *buf, const void *array, int nelems, VarType type) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
462 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
463 int i, v = 0; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
464 const byte *p = (const byte*)array; |
2952
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
465 |
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
466 for (i = 0; i != nelems; i++) { |
1d16b8a5c9a1
(svn r3511) More whitespace ([FS#46] by Rubidium)
tron <tron@openttd.org>
parents:
2923
diff
changeset
|
467 switch (type) { |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
468 case SLE_VAR_BL: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
469 case SLE_VAR_I8: v = *(int8*)p; p += 1; break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
470 case SLE_VAR_U8: v = *(byte*)p; p += 1; break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
471 case SLE_VAR_I16: v = *(int16*)p; p += 2; break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
472 case SLE_VAR_U16: v = *(uint16*)p; p += 2; break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
473 case SLE_VAR_I32: v = *(int32*)p; p += 4; break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
474 case SLE_VAR_U32: v = *(uint32*)p; p += 4; break; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
475 default: NOT_REACHED(); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
476 } |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
477 buf += sprintf(buf, (i == 0) ? "%d" : ",%d", v); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
478 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
479 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
480 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
481 /* Convert a ONEofMANY structure to a string representation. |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
482 * @param buf output buffer where the string-representation will be stored |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
483 * @param many the full-domain string of possible values |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
484 * @param id the value of the variable and whose string-representation must be found */ |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
485 static void make_oneofmany(char *buf, const char *many, int id) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
486 { |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
487 int orig_id = id; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
488 |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
489 // Look for the id'th element |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
490 while (--id >= 0) { |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
491 for (; *many != '|'; many++) { |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
492 if (*many == '\0') { // not found |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
493 sprintf(buf, "%d", orig_id); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
494 return; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
495 } |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
496 } |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
497 many++; // pass the |-character |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
498 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
499 |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
500 // copy string until next item (|) or the end of the list if this is the last one |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
501 while (*many != '\0' && *many != '|') *buf++ = *many++; |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
502 *buf = '\0'; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
503 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
504 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
505 /* Convert a MANYofMANY structure to a string representation. |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
506 * @param buf output buffer where the string-representation will be stored |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
507 * @param many the full-domain string of possible values |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
508 * @param x the value of the variable and whose string-representation must |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
509 * be found in the bitmasked many string */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
510 static void make_manyofmany(char *buf, const char *many, uint32 x) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
511 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
512 const char *start; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
513 int i = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
514 bool init = true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
515 |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
516 for (; x != 0; x >>= 1, i++) { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
517 start = many; |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
518 while (*many != 0 && *many != '|') many++; // advance to the next element |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
519 |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
520 if (HASBIT(x, 0)) { // item found, copy it |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
521 if (!init) *buf++ = '|'; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
522 init = false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
523 if (start == many) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
524 buf += sprintf(buf, "%d", i); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
525 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
526 memcpy(buf, start, many - start); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
527 buf += many - start; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
528 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
529 } |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
530 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
531 if (*many == '|') many++; |
2973
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
532 } |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
533 |
6b558cf46387
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater <Darkvater@openttd.org>
parents:
2972
diff
changeset
|
534 *buf = '\0'; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
535 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
536 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
537 /** Convert a string representation (external) of a setting to the internal rep. |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
538 * @param desc SettingDesc struct that holds all information about the variable |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
539 * @param str input string that will be parsed based on the type of desc |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
540 * @return return the parsed value of the setting */ |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
541 static const void *string_to_val(const SettingDescBase *desc, const char *str) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
542 { |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
543 switch (desc->cmd) { |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
544 case SDT_NUMX: { |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
545 char *end; |
2991
4993a64be87e
(svn r3567) -Fix: for once and for all, use 'unsigned long' if you want to cast something
truelight <truelight@openttd.org>
parents:
2975
diff
changeset
|
546 unsigned long val = strtoul(str, &end, 0); |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
547 if (*end != '\0') ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
548 return (void*)val; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
549 } |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
550 case SDT_ONEOFMANY: { |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
551 long r = lookup_oneofmany(desc->many, str, -1); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
552 if (r != -1) return (void*)r; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
553 ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
554 return 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
555 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
556 case SDT_MANYOFMANY: { |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
557 unsigned long r = lookup_manyofmany(desc->many, str); |
2923
041f961333fd
(svn r3479) -Fix: fixed warnings on 64bit platforms (anyway, most 64bit platforms)
truelight <truelight@openttd.org>
parents:
2919
diff
changeset
|
558 if (r != (unsigned long)-1) return (void*)r; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
559 ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
560 return 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
561 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
562 case SDT_BOOLX: |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
563 if (strcmp(str, "true") == 0 || strcmp(str, "on") == 0 || strcmp(str, "1") == 0) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
564 return (void*)true; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
565 if (strcmp(str, "false") == 0 || strcmp(str, "off") == 0 || strcmp(str, "0") == 0) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
566 return (void*)false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
567 ShowInfoF("ini: invalid setting value '%s' for '%s'", str, desc->name); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
568 break; |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
569 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
570 case SDT_STRING: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
571 case SDT_INTLIST: return str; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
572 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
573 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
574 return NULL; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
575 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
576 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
577 /** Set the value of a setting and if needed clamp the value to |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
578 * the preset minimum and maximum. |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
579 * @param ptr the variable itself |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
580 * @param sd pointer to the 'information'-database of the variable |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
581 * @param val signed long version of the new value |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
582 * @pre SettingDesc is of type SDT_BOOLX, SDT_NUMX, |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
583 * SDT_ONEOFMANY or SDT_MANYOFMANY. Other types are not supported as of now */ |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
584 static void Write_ValidateSetting(void *ptr, const SettingDesc *sd, int32 val) |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
585 { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
586 const SettingDescBase *sdb = &sd->desc; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
587 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
588 if (sdb->cmd != SDT_BOOLX && sdb->cmd != SDT_NUMX && |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
589 sdb->cmd != SDT_ONEOFMANY && sdb->cmd != SDT_MANYOFMANY) return; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
590 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
591 /* We cannot know the maximum value of a bitset variable, so just have faith */ |
3352
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
592 if (sdb->cmd != SDT_MANYOFMANY) { |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
593 /* We need to take special care of the uint32 type as we receive from the function |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
594 * a signed integer. While here also bail out on 64-bit settings as those are not |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
595 * supported. Unsigned 8 and 16-bit variables are safe since they fit into a signed |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
596 * 32-bit variable |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
597 * TODO: Support 64-bit settings/variables */ |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
598 switch (GetVarMemType(sd->save.conv)) { |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
599 case SLE_VAR_BL: |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
600 case SLE_VAR_I8: |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
601 case SLE_VAR_U8: |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
602 case SLE_VAR_I16: |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
603 case SLE_VAR_U16: |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
604 case SLE_VAR_I32: { |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
605 /* Override the minimum value. No value below sdb->min, except special value 0 */ |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
606 int32 min = ((sdb->flags & SGF_0ISDISABLED) && val <= sdb->min) ? 0 : sdb->min; |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
607 val = clamp(val, min, sdb->max); |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
608 } break; |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
609 case SLE_VAR_U32: { |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
610 /* Override the minimum value. No value below sdb->min, except special value 0 */ |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
611 uint min = ((sdb->flags & SGF_0ISDISABLED) && (uint)val <= (uint)sdb->min) ? 0 : sdb->min; |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
612 WriteValue(ptr, SLE_VAR_U32, (int64)clampu(val, min, sdb->max)); |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
613 return; |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
614 } |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
615 case SLE_VAR_I64: |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
616 case SLE_VAR_U64: |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
617 default: NOT_REACHED(); break; |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
618 } |
0de74d0a8212
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater <Darkvater@openttd.org>
parents:
3342
diff
changeset
|
619 } |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
620 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
621 WriteValue(ptr, sd->save.conv, (int64)val); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
622 } |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
623 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
624 /** Load values from a group of an IniFile structure into the internal representation |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
625 * @param ini pointer to IniFile structure that holds administrative information |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
626 * @param desc pointer to SettingDesc structure whose internally pointed variables will |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
627 * be given values |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
628 * @param grpname the group of the IniFile to search in for the new values */ |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
629 static void ini_load_settings(IniFile *ini, const SettingDesc *sd, const char *grpname, void *object) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
630 { |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
631 IniGroup *group; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
632 IniGroup *group_def = ini_getgroup(ini, grpname, -1); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
633 IniItem *item; |
222
d1b097f4593b
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater <darkvater@openttd.org>
parents:
193
diff
changeset
|
634 const void *p; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
635 void *ptr; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
636 const char *s; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
637 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
638 for (; sd->save.cmd != SL_END; sd++) { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
639 const SettingDescBase *sdb = &sd->desc; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
640 const SaveLoad *sld = &sd->save; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
641 |
3117
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
642 if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue; |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
643 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
644 // XXX - wtf is this?? (group override?) |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
645 s = strchr(sdb->name, '.'); |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
646 if (s != NULL) { |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
647 group = ini_getgroup(ini, sdb->name, s - sdb->name); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
648 s++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
649 } else { |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
650 s = sdb->name; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
651 group = group_def; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
652 } |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
653 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
654 item = ini_getitem(group, s, false); |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
655 p = (item == NULL) ? sdb->def : string_to_val(sdb, item->value); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
656 ptr = ini_get_variable(sld, object); |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
657 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
658 switch (sdb->cmd) { |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
659 case SDT_BOOLX: /* All four are various types of (integer) numbers */ |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
660 case SDT_NUMX: |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
661 case SDT_ONEOFMANY: |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
662 case SDT_MANYOFMANY: |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
663 Write_ValidateSetting(ptr, sd, (unsigned long)p); break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
664 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
665 case SDT_STRING: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
666 switch (GetVarMemType(sld->conv)) { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
667 case SLE_VAR_STRB: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
668 case SLE_VAR_STRQ: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
669 if (p != NULL) ttd_strlcpy((char*)ptr, p, sld->length); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
670 break; |
3192
ba051fd4f0b2
(svn r3852) - Revert r3733 which fixed the default value loading for char, but broke loading a set value. Added a better fix which needs a char value to be a string (eg enclosed in double-quotes)
Darkvater <Darkvater@openttd.org>
parents:
3152
diff
changeset
|
671 case SLE_VAR_CHAR: *(char*)ptr = *(char*)p; break; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
672 default: NOT_REACHED(); break; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
673 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
674 break; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
675 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
676 case SDT_INTLIST: { |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
677 if (!load_intlist(p, ptr, sld->length, GetVarMemType(sld->conv))) |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
678 ShowInfoF("ini: error in array '%s'", sdb->name); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
679 break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
680 } |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
681 default: NOT_REACHED(); break; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
682 } |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
683 } |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
684 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
685 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
686 /* Save the values of settings to the inifile. |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
687 * @param ini pointer to IniFile structure |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
688 * @param desc read-only SettingDesc structure which contains the unmodified, |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
689 * loaded values of the configuration file and various information about it |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
690 * @param grpname holds the name of the group (eg. [network]) where these will be saved |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
691 * The function works as follows: for each item in the SettingDesc structure we have |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
692 * a look if the value has changed since we started the game (the original values |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
693 * are reloaded when saving). If settings indeed have changed, we get these and save them.*/ |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
694 static void ini_save_settings(IniFile *ini, const SettingDesc *sd, const char *grpname, void *object) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
695 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
696 IniGroup *group_def = NULL, *group; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
697 IniItem *item; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
698 char buf[512]; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
699 const char *s; |
222
d1b097f4593b
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater <darkvater@openttd.org>
parents:
193
diff
changeset
|
700 void *ptr; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
701 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
702 for (; sd->save.cmd != SL_END; sd++) { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
703 const SettingDescBase *sdb = &sd->desc; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
704 const SaveLoad *sld = &sd->save; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
705 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
706 /* If the setting is not saved to the configuration |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
707 * file, just continue with the next setting */ |
3117
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
708 if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
709 if (sld->conv & SLF_CONFIG_NO) continue; |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
710 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
711 // XXX - wtf is this?? (group override?) |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
712 s = strchr(sdb->name, '.'); |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
713 if (s != NULL) { |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
714 group = ini_getgroup(ini, sdb->name, s - sdb->name); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
715 s++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
716 } else { |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
717 if (group_def == NULL) group_def = ini_getgroup(ini, grpname, -1); |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
718 s = sdb->name; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
719 group = group_def; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
720 } |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
721 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
722 item = ini_getitem(group, s, true); |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
723 ptr = ini_get_variable(sld, object); |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
724 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
725 if (item->value != NULL) { |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
726 // check if the value is the same as the old value |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
727 const void *p = string_to_val(sdb, item->value); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
728 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
729 /* The main type of a variable/setting is in bytes 8-15 |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
730 * The subtype (what kind of numbers do we have there) is in 0-7 */ |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
731 switch (sdb->cmd) { |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
732 case SDT_BOOLX: |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
733 case SDT_NUMX: |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
734 case SDT_ONEOFMANY: |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
735 case SDT_MANYOFMANY: |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
736 switch (GetVarMemType(sld->conv)) { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
737 case SLE_VAR_BL: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
738 case SLE_VAR_I8: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
739 case SLE_VAR_U8: |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
740 if (*(byte*)ptr == (byte)(unsigned long)p) continue; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
741 break; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
742 case SLE_VAR_I16: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
743 case SLE_VAR_U16: |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
744 if (*(uint16*)ptr == (uint16)(unsigned long)p) continue; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
745 break; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
746 case SLE_VAR_I32: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
747 case SLE_VAR_U32: |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
748 if (*(uint32*)ptr == (uint32)(unsigned long)p) continue; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
749 break; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
750 default: NOT_REACHED(); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
751 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
752 break; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
753 default: break; /* Assume the other types are always changed */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
754 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
755 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
756 |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
757 /* Value has changed, get the new value and put it into a buffer */ |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
758 switch (sdb->cmd) { |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
759 case SDT_BOOLX: |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
760 case SDT_NUMX: |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
761 case SDT_ONEOFMANY: |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
762 case SDT_MANYOFMANY: { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
763 uint32 i = (uint32)ReadValue(ptr, sld->conv); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
764 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
765 switch (sdb->cmd) { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
766 case SDT_BOOLX: strcpy(buf, (i != 0) ? "true" : "false"); break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
767 case SDT_NUMX: sprintf(buf, "%u", i); break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
768 case SDT_ONEOFMANY: make_oneofmany(buf, sdb->many, i); break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
769 case SDT_MANYOFMANY: make_manyofmany(buf, sdb->many, i); break; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
770 default: NOT_REACHED(); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
771 } |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
772 } break; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
773 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
774 case SDT_STRING: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
775 switch (GetVarMemType(sld->conv)) { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
776 case SLE_VAR_STRB: strcpy(buf, (char*)ptr); break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
777 case SLE_VAR_STRQ: sprintf(buf, "\"%s\"", (char*)ptr); break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
778 case SLE_VAR_CHAR: sprintf(buf, "\"%c\"", *(char*)ptr); break; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
779 default: NOT_REACHED(); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
780 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
781 break; |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
782 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
783 case SDT_INTLIST: |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
784 make_intlist(buf, ptr, sld->length, GetVarMemType(sld->conv)); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
785 break; |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
786 default: NOT_REACHED(); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
787 } |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
788 |
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
789 /* The value is different, that means we have to write it to the ini */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
790 item->value = pool_strdup(&ini->pool, buf, strlen(buf)); |
193
d9c55f0bc5ec
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents:
188
diff
changeset
|
791 } |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
792 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
793 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
794 // loads all items from a *grpname section into the **list |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
795 static void ini_load_setting_list(IniFile *ini, const char *grpname, char **list, uint len) |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
796 { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
797 IniGroup *group = ini_getgroup(ini, grpname, -1); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
798 IniItem *item; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
799 uint i; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
800 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
801 if (group == NULL) return; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
802 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
803 item = group->item; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
804 for (i = 0; i != len; i++) { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
805 if (item == NULL) break; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
806 list[i] = strdup(item->value); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
807 item = item->next; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
808 } |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
809 } |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
810 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
811 static void ini_save_setting_list(IniFile *ini, const char *grpname, char **list, uint len) |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
812 { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
813 IniGroup *group = ini_getgroup(ini, grpname, -1); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
814 IniItem *item = NULL; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
815 uint i; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
816 bool first = true; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
817 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
818 if (group == NULL) return; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
819 group->item = NULL; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
820 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
821 for (i = 0; i != len; i++) { |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
822 if (list[i] == NULL || list[i][0] == '\0') continue; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
823 |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
824 if (first) { // add first item to the head of the group |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
825 item = ini_item_alloc(group, list[i], strlen(list[i])); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
826 item->value = item->name; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
827 group->item = item; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
828 first = false; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
829 } else { // all other items are attached to the previous one |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
830 item->next = ini_item_alloc(group, list[i], strlen(list[i])); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
831 item = item->next; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
832 item->value = item->name; |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
833 } |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
834 } |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
835 } |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
836 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
837 //*************************** |
2972
a0b2b6f59f61
(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 <Darkvater@openttd.org>
parents:
2969
diff
changeset
|
838 // OTTD specific INI stuff |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
839 //*************************** |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
840 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
841 /** Settings-macro usage: |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
842 * The list might look daunting at first, but is in general easy to understand. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
843 * We have two types of list: |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
844 * 1. SDTG_something |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
845 * 2. SDT_something |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
846 * The 'G' stands for global, so this is the one you will use for a SettingDescGlobVarList |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
847 * section meaning global variables. The other uses a Base/Offset and runtime variable |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
848 * selection mechanism, known from the saveload convention (it also has global so it |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
849 * should not be hard). |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
850 * Of each type there are again two versions, the normal one and one prefixed with 'COND'. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
851 * COND means that the setting is only valid in certain savegame versions (since patches |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
852 * are saved to the savegame, this bookkeeping is necessary. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
853 * Now there are a lot of types. Easy ones are: |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
854 * - VAR: any number type, 'type' field specifies what number. eg int8 or uint32 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
855 * - BOOL: a boolean number type |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
856 * - STR: a string or character. 'type' field specifies what string. Normal, string, or quoted |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
857 * A bit more difficult to use are MMANY (meaning ManyOfMany) and OMANY (OneOfMany) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
858 * These are actually normal numbers, only bitmasked. In MMANY several bits can be |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
859 * set, in the other only one. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
860 * The most complex type is INTLIST. This is basically an array of numbers. If |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
861 * the intlist is only valid in certain savegame versions because for example |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
862 * it has grown in size its length cannot be automatically be calculated so |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
863 * use SDT(G)_CONDLISTO() meaning Old. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
864 * If nothing fits you, you can use the GENERAL macros, but it exposes the internal |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
865 * structure somewhat so it needs a little looking. There are _NULL() macros as |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
866 * well, these fill up space so you can add more patches there (in place) and you |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
867 * DON'T have to increase the savegame version. */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
868 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
869 #define NSD_GENERAL(name, def, cmd, guiflags, min, max, many, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
870 {name, (const void*)def, cmd, guiflags, min, max, many, str, proc} |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
871 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
872 /* Macros for various objects to go in the configuration file. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
873 * This section is for global variables */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
874 #define SDTG_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, var, length, def, min, max, full, str, proc, from, to)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
875 {NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, full, str, proc), SLEG_GENERAL(sle_cmd, var, type | flags, length, from, to)} |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
876 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
877 #define SDTG_CONDVAR(name, type, flags, guiflags, var, def, min, max, str, proc, from, to)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
878 SDTG_GENERAL(name, SDT_NUMX, SL_VAR, type, flags, guiflags, var, 0, def, min, max, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
879 #define SDTG_VAR(name, type, flags, guiflags, var, def, min, max, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
880 SDTG_CONDVAR(name, type, flags, guiflags, var, def, min, max, str, proc, 0, SL_MAX_VERSION) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
881 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
882 #define SDTG_CONDBOOL(name, flags, guiflags, var, def, str, proc, from, to)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
883 SDTG_GENERAL(name, SDT_BOOLX, SL_VAR, SLE_UINT8, flags, guiflags, var, 0, def, 0, 1, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
884 #define SDTG_BOOL(name, flags, guiflags, var, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
885 SDTG_CONDBOOL(name, flags, guiflags, var, def, str, proc, 0, SL_MAX_VERSION) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
886 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
887 #define SDTG_CONDLIST(name, type, length, flags, guiflags, var, def, str, proc, from, to)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
888 SDTG_GENERAL(name, SDT_INTLIST, SL_ARR, type, flags, guiflags, var, length, def, 0, 0, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
889 #define SDTG_LIST(name, type, flags, guiflags, var, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
890 SDTG_GENERAL(name, SDT_INTLIST, SL_ARR, type, flags, guiflags, var, lengthof(var), def, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
891 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
892 #define SDTG_CONDSTR(name, type, length, flags, guiflags, var, def, str, proc, from, to)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
893 SDTG_GENERAL(name, SDT_STRING, SL_STR, type, flags, guiflags, var, length, def, 0, 0, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
894 #define SDTG_STR(name, type, flags, guiflags, var, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
895 SDTG_GENERAL(name, SDT_STRING, SL_STR, type, flags, guiflags, var, lengthof(var), def, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
896 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
897 #define SDTG_CONDOMANY(name, type, flags, guiflags, var, def, max, full, str, proc, from, to)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
898 SDTG_GENERAL(name, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, var, 0, def, 0, max, full, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
899 #define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
900 SDTG_CONDOMANY(name, type, flags, guiflags, var, def, max full, str, proc, 0, SL_MAX_VERSION) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
901 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
902 #define SDTG_CONDMMANY(name, type, flags, guiflags, var, def, full, str, proc, from, to)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
903 SDTG_GENERAL(name, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, var, 0, def, 0, 0, full, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
904 #define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
905 SDTG_CONDMMANY(name, type, flags, guiflags, var, def, full, str, proc, 0, SL_MAX_VERSION) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
906 |
3222
0a9c7d482919
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater <Darkvater@openttd.org>
parents:
3210
diff
changeset
|
907 #define SDTG_CONDNULL(length, from, to)\ |
3240
930b158506e9
(svn r3914) - Properly implement SDT(G)_CONDNULL macro's without special cases (add flag SLF_CONFIG_NO and empty string as name)
Darkvater <Darkvater@openttd.org>
parents:
3223
diff
changeset
|
908 {{"", NULL, 0, 0, 0, 0, NULL, STR_NULL, NULL}, SLEG_CONDNULL(length, from, to)} |
3222
0a9c7d482919
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater <Darkvater@openttd.org>
parents:
3210
diff
changeset
|
909 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
910 #define SDTG_END() {{NULL, NULL, 0, 0, 0, 0, NULL, STR_NULL, NULL}, SLEG_END()} |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
911 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
912 /* Macros for various objects to go in the configuration file. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
913 * This section is for structures where their various members are saved */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
914 #define SDT_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, base, var, length, def, min, max, full, str, proc, from, to)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
915 {NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, full, str, proc), SLE_GENERAL(sle_cmd, base, var, type | flags, length, from, to)} |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
916 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
917 #define SDT_CONDVAR(base, var, type, from, to, flags, guiflags, def, min, max, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
918 SDT_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, base, var, 1, def, min, max, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
919 #define SDT_VAR(base, var, type, flags, guiflags, def, min, max, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
920 SDT_CONDVAR(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, min, max, str, proc) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
921 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
922 #define SDT_CONDBOOL(base, var, from, to, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
923 SDT_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, base, var, 1, def, 0, 1, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
924 #define SDT_BOOL(base, var, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
925 SDT_CONDBOOL(base, var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
926 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
927 #define SDT_CONDLIST(base, var, type, from, to, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
928 SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
929 #define SDT_LIST(base, var, type, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
930 SDT_CONDLIST(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
931 #define SDT_CONDLISTO(base, var, length, type, from, to, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
932 SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, length, def, 0, 0, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
933 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
934 #define SDT_CONDSTR(base, var, type, from, to, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
935 SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
936 #define SDT_STR(base, var, type, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
937 SDT_CONDSTR(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
938 #define SDT_CONDSTRO(base, var, length, type, from, to, flags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
939 SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, 0, base, var, length, def, 0, 0, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
940 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
941 #define SDT_CONDCHR(base, var, from, to, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
942 SDT_GENERAL(#var, SDT_STRING, SL_VAR, SLE_CHAR, flags, guiflags, base, var, 1, def, 0, 0, NULL, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
943 #define SDT_CHR(base, var, flags, guiflags, def, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
944 SDT_CONDCHR(base, var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
945 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
946 #define SDT_CONDOMANY(base, var, type, from, to, flags, guiflags, def, max, full, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
947 SDT_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, max, full, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
948 #define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
949 SDT_CONDOMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, max, full, str, proc) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
950 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
951 #define SDT_CONDMMANY(base, var, type, from, to, flags, guiflags, def, full, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
952 SDT_GENERAL(#var, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, 0, full, str, proc, from, to) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
953 #define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, proc)\ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
954 SDT_CONDMMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, full, str, proc) |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
955 |
3222
0a9c7d482919
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater <Darkvater@openttd.org>
parents:
3210
diff
changeset
|
956 #define SDT_CONDNULL(length, from, to)\ |
3240
930b158506e9
(svn r3914) - Properly implement SDT(G)_CONDNULL macro's without special cases (add flag SLF_CONFIG_NO and empty string as name)
Darkvater <Darkvater@openttd.org>
parents:
3223
diff
changeset
|
957 {{"", NULL, 0, 0, 0, 0, NULL, STR_NULL, NULL}, SLE_CONDNULL(length, from, to)} |
3222
0a9c7d482919
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater <Darkvater@openttd.org>
parents:
3210
diff
changeset
|
958 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
959 #define SDT_END() {{NULL, NULL, 0, 0, 0, 0, NULL, STR_NULL, NULL}, SLE_END()} |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
960 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
961 /* Shortcuts for macros below. Logically if we don't save the value |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
962 * we also don't sync it in a network game */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
963 #define S SLF_SAVE_NO | SLF_NETWORK_NO |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
964 #define C SLF_CONFIG_NO |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
965 #define N SLF_NETWORK_NO |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
966 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
967 #define D0 SGF_0ISDISABLED |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
968 #define NC SGF_NOCOMMA |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
969 #define MS SGF_MULTISTRING |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
970 #define NO SGF_NETWORK_ONLY |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
971 #define CR SGF_CURRENCY |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
972 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
973 #include "table/strings.h" |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
974 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
975 /* Begin - Callback Functions for the various settings */ |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
976 #include "window.h" |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
977 #include "gui.h" |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
978 #include "town.h" |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
979 #include "gfx.h" |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
980 // virtual PositionMainToolbar function, calls the right one. |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
981 static int32 v_PositionMainToolbar(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
982 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
983 if (_game_mode != GM_MENU) PositionMainToolbar(NULL); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
984 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
985 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
986 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
987 static int32 AiNew_PatchActive_Warning(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
988 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
989 if (p1 == 1) ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_ACTIVATED, 0, 0); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
990 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
991 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
992 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
993 static int32 Ai_In_Multiplayer_Warning(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
994 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
995 if (p1 == 1) { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
996 ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_MULTIPLAYER, 0, 0); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
997 _patches.ainew_active = true; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
998 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
999 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1000 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1001 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1002 static int32 PopulationInLabelActive(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1003 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1004 Town* t; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1005 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1006 FOR_ALL_TOWNS(t) { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1007 if (t->xy != 0) UpdateTownVirtCoord(t); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1008 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1009 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1010 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1011 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1012 static int32 InvisibleTreesActive(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1013 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1014 MarkWholeScreenDirty(); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1015 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1016 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1017 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1018 static int32 InValidateDetailsWindow(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1019 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1020 InvalidateWindowClasses(WC_VEHICLE_DETAILS); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1021 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1022 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1023 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1024 static int32 InvalidateStationBuildWindow(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1025 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1026 InvalidateWindow(WC_BUILD_STATION, 0); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1027 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1028 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1029 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1030 /* Check service intervals of vehicles, p1 is value of % or day based servicing */ |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1031 static int32 CheckInterval(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1032 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1033 bool warning; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1034 const Patches *ptc = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1035 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1036 if (p1) { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1037 warning = ( (IS_INT_INSIDE(ptc->servint_trains, 5, 90+1) || ptc->servint_trains == 0) && |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1038 (IS_INT_INSIDE(ptc->servint_roadveh, 5, 90+1) || ptc->servint_roadveh == 0) && |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1039 (IS_INT_INSIDE(ptc->servint_aircraft, 5, 90+1) || ptc->servint_aircraft == 0) && |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1040 (IS_INT_INSIDE(ptc->servint_ships, 5, 90+1) || ptc->servint_ships == 0) ); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1041 } else { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1042 warning = ( (IS_INT_INSIDE(ptc->servint_trains, 30, 800+1) || ptc->servint_trains == 0) && |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1043 (IS_INT_INSIDE(ptc->servint_roadveh, 30, 800+1) || ptc->servint_roadveh == 0) && |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1044 (IS_INT_INSIDE(ptc->servint_aircraft, 30, 800+1) || ptc->servint_aircraft == 0) && |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1045 (IS_INT_INSIDE(ptc->servint_ships, 30, 800+1) || ptc->servint_ships == 0) ); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1046 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1047 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1048 if (!warning) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1049 ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1050 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1051 return InValidateDetailsWindow(0); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1052 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1053 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1054 static int32 EngineRenewUpdate(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1055 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1056 DoCommandP(0, 0, _patches.autorenew, NULL, CMD_REPLACE_VEHICLE); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1057 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1058 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1059 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1060 static int32 EngineRenewMonthsUpdate(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1061 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1062 DoCommandP(0, 1, _patches.autorenew_months, NULL, CMD_REPLACE_VEHICLE); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1063 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1064 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1065 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1066 static int32 EngineRenewMoneyUpdate(int32 p1) |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1067 { |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1068 DoCommandP(0, 2, _patches.autorenew_money, NULL, CMD_REPLACE_VEHICLE); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1069 return 0; |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1070 } |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1071 /* End - Callback Functions */ |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1072 |
1584
6975c0cdd939
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky <pasky@openttd.org>
parents:
1500
diff
changeset
|
1073 #ifndef EXTERNAL_PLAYER |
6975c0cdd939
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky <pasky@openttd.org>
parents:
1500
diff
changeset
|
1074 #define EXTERNAL_PLAYER "timidity" |
6975c0cdd939
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky <pasky@openttd.org>
parents:
1500
diff
changeset
|
1075 #endif |
6975c0cdd939
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky <pasky@openttd.org>
parents:
1500
diff
changeset
|
1076 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1077 static const SettingDesc _music_settings[] = { |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1078 SDT_VAR(MusicFileSettings, playlist, SLE_UINT8, S, 0, 0, 0, 5, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1079 SDT_VAR(MusicFileSettings, music_vol, SLE_UINT8, S, 0, 128, 0, 100, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1080 SDT_VAR(MusicFileSettings, effect_vol,SLE_UINT8, S, 0, 128, 0, 100, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1081 SDT_LIST(MusicFileSettings, custom_1, SLE_UINT8, S, 0, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1082 SDT_LIST(MusicFileSettings, custom_2, SLE_UINT8, S, 0, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1083 SDT_BOOL(MusicFileSettings, playing, S, 0, true, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1084 SDT_BOOL(MusicFileSettings, shuffle, S, 0,false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1085 SDT_STR(MusicFileSettings, extmidi, SLE_STRB, S, 0, EXTERNAL_PLAYER,STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1086 SDT_END() |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1087 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1088 |
3051
464ba6811ebc
(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 <Darkvater@openttd.org>
parents:
3042
diff
changeset
|
1089 /* win32_v.c only settings */ |
464ba6811ebc
(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 <Darkvater@openttd.org>
parents:
3042
diff
changeset
|
1090 #ifdef WIN32 |
464ba6811ebc
(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 <Darkvater@openttd.org>
parents:
3042
diff
changeset
|
1091 extern bool _force_full_redraw, _double_size; |
464ba6811ebc
(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 <Darkvater@openttd.org>
parents:
3042
diff
changeset
|
1092 extern uint _display_hz, _fullscreen_bpp; |
464ba6811ebc
(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 <Darkvater@openttd.org>
parents:
3042
diff
changeset
|
1093 |
3124
0be45148a4e6
(svn r3732) - Fix two warnings. Stupid MSVC didn't even complain :s (Thank Tron and peter1138)
Darkvater <Darkvater@openttd.org>
parents:
3121
diff
changeset
|
1094 static const SettingDescGlobVarList _win32_settings[] = { |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1095 SDTG_VAR("display_hz", SLE_UINT, S, 0, _display_hz, 0, 0, 120, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1096 SDTG_BOOL("force_full_redraw", S, 0, _force_full_redraw,false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1097 SDTG_VAR("fullscreen_bpp", SLE_UINT, S, 0, _fullscreen_bpp, 8, 8, 32, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1098 SDTG_BOOL("double_size", S, 0, _double_size, false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1099 SDTG_END() |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1100 }; |
3051
464ba6811ebc
(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 <Darkvater@openttd.org>
parents:
3042
diff
changeset
|
1101 #endif /* WIN32 */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1102 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1103 static const SettingDescGlobVarList _misc_settings[] = { |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1104 SDTG_MMANY("display_opt", SLE_UINT8, S, 0, _display_opt, (DO_SHOW_TOWN_NAMES|DO_SHOW_STATION_NAMES|DO_SHOW_SIGNS|DO_FULL_ANIMATION|DO_FULL_DETAIL|DO_TRANS_BUILDINGS|DO_WAYPOINTS), "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|TRANS_BUILDINGS|FULL_DETAIL|WAYPOINTS", STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1105 SDTG_VAR("news_display_opt", SLE_UINT, S, 0, _news_display_opt,0xAAAAAAAA,0,0xAAAAAAAA,STR_NULL, NULL), // default to all full messages: 10101010101010101010 = 0xAAAAAAAA |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1106 SDTG_BOOL("news_ticker_sound", S, 0, _news_ticker_sound, true, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1107 SDTG_BOOL("fullscreen", S, 0, _fullscreen, false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1108 SDTG_STR("videodriver", SLE_STRB,C|S,0, _ini_videodriver, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1109 SDTG_STR("musicdriver", SLE_STRB,C|S,0, _ini_musicdriver, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1110 SDTG_STR("sounddriver", SLE_STRB,C|S,0, _ini_sounddriver, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1111 SDTG_STR("language", SLE_STRB, S, 0, _dynlang.curr_file, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1112 SDTG_LIST("resolution", SLE_UINT16, S, 0, _cur_resolution, "640,480", STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1113 SDTG_STR("screenshot_format",SLE_STRB, S, 0, _screenshot_format_name,NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1114 SDTG_STR("savegame_format", SLE_STRB, S, 0, _savegame_format, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1115 SDTG_BOOL("rightclick_emulate", S, 0, _rightclick_emulate, false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1116 SDTG_END() |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1117 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1118 |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1119 #ifdef ENABLE_NETWORK |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1120 static const SettingDescGlobVarList _network_settings[] = { |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1121 SDTG_VAR("sync_freq", SLE_UINT16,C|S,0, _network_sync_freq, 100, 0, 100,STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1122 SDTG_VAR("frame_freq", SLE_UINT8,C|S,0, _network_frame_freq, 0, 0, 100,STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1123 SDTG_VAR("max_join_time", SLE_UINT16, S, 0, _network_max_join_time, 500, 0,32000,STR_NULL, NULL), |
3283
79b65d4088f1
(svn r3997) - Default the patch-setting 'pause_on_join' to true.
Darkvater <Darkvater@openttd.org>
parents:
3247
diff
changeset
|
1124 SDTG_BOOL("pause_on_join", S, 0, _network_pause_on_join, true, STR_NULL, NULL), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1125 SDTG_STR("server_bind_ip", SLE_STRB, S, 0, _network_server_bind_ip_host, "0.0.0.0", STR_NULL, NULL), |
3152
feb87d62e9e2
(svn r3775) Fix loading of server_port from config file, introduced in Darkvater's unified configuration changes (r3719+)
peter1138 <peter1138@openttd.org>
parents:
3131
diff
changeset
|
1126 SDTG_VAR("server_port", SLE_UINT16, S, 0, _network_server_port, NETWORK_DEFAULT_PORT, 0, 65535,STR_NULL, NULL), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1127 SDTG_BOOL("server_advertise", S, 0, _network_advertise, false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1128 SDTG_BOOL("lan_internet", S, 0, _network_lan_internet, false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1129 SDTG_STR("player_name", SLE_STRB, S, 0, _network_player_name, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1130 SDTG_STR("server_password", SLE_STRB, S, 0, _network_server_password, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1131 SDTG_STR("rcon_password", SLE_STRB, S, 0, _network_rcon_password, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1132 SDTG_STR("server_name", SLE_STRB, S, 0, _network_server_name, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1133 SDTG_STR("connect_to_ip", SLE_STRB, S, 0, _network_default_ip, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1134 SDTG_STR("network_id", SLE_STRB, S, 0, _network_unique_id, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1135 SDTG_BOOL("autoclean_companies", S, 0, _network_autoclean_companies, false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1136 SDTG_VAR("autoclean_unprotected",SLE_UINT8, S, 0, _network_autoclean_unprotected,12, 0, 60, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1137 SDTG_VAR("autoclean_protected", SLE_UINT8, S, 0, _network_autoclean_protected, 36, 0, 180, STR_NULL, NULL), |
3194
6c2567946f86
(svn r3854) - Fix restart_game_date to default to zero and allow a value of 0 which got screwed up during the patch-rewrite. Thanks peter1138
Darkvater <Darkvater@openttd.org>
parents:
3192
diff
changeset
|
1138 SDTG_VAR("restart_game_date", SLE_UINT16, S,D0, _network_restart_game_date, 0, MAX_YEAR_BEGIN_REAL, MAX_YEAR_END_REAL, STR_NULL, NULL), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1139 SDTG_END() |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1140 }; |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1141 #endif /* ENABLE_NETWORK */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1142 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1143 static const SettingDesc _gameopt_settings[] = { |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1144 /* In version 4 a new difficulty setting has been added to the difficulty settings, |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1145 * town attitude towards demolishing. Needs special handling because some dimwit thought |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1146 * it funny to have the GameDifficulty struct be an array while it is a struct of |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1147 * same-sized members |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1148 * XXX - To save file-space and since values are never bigger than about 10? only |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1149 * save the first 16 bits in the savegame. Question is why the values are still int32 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1150 * and why not byte for example? */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1151 SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, NULL, STR_NULL, NULL, 0, 3), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1152 SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, NULL, STR_NULL, NULL, 4, SL_MAX_VERSION), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1153 SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9,0, 9, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1154 SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, 23, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SEK|custom", STR_NULL, NULL), |
3342
19cecdbab365
(svn r4126) - Feature: A new multi-lingual multi-measuring-unit system:
peter1138 <peter1138@openttd.org>
parents:
3283
diff
changeset
|
1155 SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1156 SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 16, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss", STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1157 SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "normal|hilly|desert|candy", STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1158 SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 1,0,56, STR_NULL, NULL), |
3241
4b84bed20b7e
(svn r3915) - Savegame version 23: Do not save the autosave interval anymore with savegames. Some people should be very happe atm ;)
Darkvater <Darkvater@openttd.org>
parents:
3240
diff
changeset
|
1159 SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22, N, 0, 0, 0, "", STR_NULL, NULL), |
4b84bed20b7e
(svn r3915) - Savegame version 23: Do not save the autosave interval anymore with savegames. Some people should be very happe atm ;)
Darkvater <Darkvater@openttd.org>
parents:
3240
diff
changeset
|
1160 SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8,23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1161 SDT_OMANY(GameOptions, road_side, SLE_UINT8, 0, 0, 1, 1, "left|right", STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1162 SDT_END() |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1163 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1164 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1165 /* Some patches do not need to be synchronised when playing in multiplayer. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1166 * These include for example the GUI settings and will not be saved with the |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1167 * savegame. |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1168 * It is also a bit tricky since you would think that service_interval |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1169 * for example doesn't need to be synched. Every client assigns the service_interval |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1170 * value to the v->service_interval, meaning that every client assigns his value. If |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1171 * the setting was player-based, that would mean that vehicles could decide on |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1172 * different moments that they are heading back to a service depot, causing desyncs |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1173 * on a massive scale. */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1174 const SettingDesc _patch_settings[] = { |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1175 /***************************************************************************/ |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1176 /* User-interface section of the GUI-configure patches window */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1177 SDT_BOOL(Patches, vehicle_speed, S, 0, true, STR_CONFIG_PATCHES_VEHICLESPEED, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1178 SDT_BOOL(Patches, status_long_date, S, 0, true, STR_CONFIG_PATCHES_LONGDATE, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1179 SDT_BOOL(Patches, show_finances, S, 0, true, STR_CONFIG_PATCHES_SHOWFINANCES, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1180 SDT_BOOL(Patches, autoscroll, S, 0, false, STR_CONFIG_PATCHES_AUTOSCROLL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1181 SDT_BOOL(Patches, reverse_scroll, S, 0, false, STR_CONFIG_PATCHES_REVERSE_SCROLLING, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1182 SDT_VAR(Patches, errmsg_duration, SLE_UINT8, S, 0, 5, 0,20, STR_CONFIG_PATCHES_ERRMSG_DURATION, NULL), |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1183 SDT_VAR(Patches, toolbar_pos, SLE_UINT8, S,MS, 0, 0, 2, STR_CONFIG_PATCHES_TOOLBAR_POS, v_PositionMainToolbar), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1184 SDT_VAR(Patches, window_snap_radius, SLE_UINT8, S,D0, 10, 1,32, STR_CONFIG_PATCHES_SNAP_RADIUS, NULL), |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1185 SDT_BOOL(Patches, invisible_trees, S, 0, false, STR_CONFIG_PATCHES_INVISIBLE_TREES, InvisibleTreesActive), |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1186 SDT_BOOL(Patches, population_in_label, S, 0, true, STR_CONFIG_PATCHES_POPULATION_IN_LABEL, PopulationInLabelActive), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1187 SDT_VAR(Patches, map_x, SLE_UINT8, S, 0, 8, 6,11, STR_CONFIG_PATCHES_MAP_X, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1188 SDT_VAR(Patches, map_y, SLE_UINT8, S, 0, 8, 6,11, STR_CONFIG_PATCHES_MAP_Y, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1189 SDT_BOOL(Patches, link_terraform_toolbar, S, 0, false, STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,NULL), |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1190 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1191 /***************************************************************************/ |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1192 /* Construction section of the GUI-configure patches window */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1193 SDT_BOOL(Patches, build_on_slopes, 0, 0, true, STR_CONFIG_PATCHES_BUILDONSLOPES, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1194 SDT_BOOL(Patches, extra_dynamite, 0, 0, false, STR_CONFIG_PATCHES_EXTRADYNAMITE, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1195 SDT_BOOL(Patches, longbridges, 0, 0, true, STR_CONFIG_PATCHES_LONGBRIDGES, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1196 SDT_BOOL(Patches, signal_side, N, 0, true, STR_CONFIG_PATCHES_SIGNALSIDE, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1197 SDT_BOOL(Patches, always_small_airport, 0, 0, false, STR_CONFIG_PATCHES_SMALL_AIRPORTS, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1198 SDT_VAR(Patches, drag_signals_density,SLE_UINT8,S, 0, 4, 1,20, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,NULL), |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1199 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1200 /***************************************************************************/ |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1201 /* Vehicle section of the GUI-configure patches window */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1202 SDT_BOOL(Patches, realistic_acceleration, 0, 0, false, STR_CONFIG_PATCHES_REALISTICACCEL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1203 SDT_BOOL(Patches, forbid_90_deg, 0, 0, false, STR_CONFIG_PATCHES_FORBID_90_DEG, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1204 SDT_BOOL(Patches, mammoth_trains, 0, 0, true, STR_CONFIG_PATCHES_MAMMOTHTRAINS, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1205 SDT_BOOL(Patches, gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1206 SDT_BOOL(Patches, roadveh_queue, 0, 0, true, STR_CONFIG_PATCHES_ROADVEH_QUEUE, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1207 SDT_BOOL(Patches, new_pathfinding_all, 0, 0, false, STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1208 SDT_BOOL(Patches, train_income_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_INCOME_LESS, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1209 SDT_VAR(Patches, order_review_system,SLE_UINT8, S,MS, 2, 0, 2, STR_CONFIG_PATCHES_ORDER_REVIEW, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1210 SDT_BOOL(Patches, never_expire_vehicles, 0, 0, false, STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES,NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1211 SDT_VAR(Patches, lost_train_days, SLE_UINT16, S,D0, 180, 180, 720, STR_CONFIG_PATCHES_LOST_TRAIN_DAYS, NULL), |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1212 SDT_BOOL(Patches, autorenew, S, 0, false, STR_CONFIG_PATCHES_AUTORENEW_VEHICLE, EngineRenewUpdate), |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1213 SDT_VAR(Patches, autorenew_months, SLE_INT16, S, 0, 6, -12, 12, STR_CONFIG_PATCHES_AUTORENEW_MONTHS, EngineRenewMonthsUpdate), |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1214 SDT_VAR(Patches, autorenew_money, SLE_UINT, S,CR,100000, 0,2000000, STR_CONFIG_PATCHES_AUTORENEW_MONEY, EngineRenewMoneyUpdate), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1215 SDT_VAR(Patches, max_trains, SLE_UINT16, 0, 0, 500, 0, 5000, STR_CONFIG_PATCHES_MAX_TRAINS, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1216 SDT_VAR(Patches, max_roadveh, SLE_UINT16, 0, 0, 500, 0, 5000, STR_CONFIG_PATCHES_MAX_ROADVEH, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1217 SDT_VAR(Patches, max_aircraft, SLE_UINT16, 0, 0, 200, 0, 5000, STR_CONFIG_PATCHES_MAX_AIRCRAFT, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1218 SDT_VAR(Patches, max_ships, SLE_UINT16, 0, 0, 300, 0, 5000, STR_CONFIG_PATCHES_MAX_SHIPS, NULL), |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1219 SDT_BOOL(Patches, servint_ispercent, 0, 0, false, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, CheckInterval), |
3246
4ffab2ee8200
(svn r3926) - [Patches]: Switched string for ship and aircraft replacement, and also forgot to put back the callback function. Thanks Tron
Darkvater <Darkvater@openttd.org>
parents:
3245
diff
changeset
|
1220 SDT_VAR(Patches, servint_trains, SLE_UINT16, 0,D0, 150, 5, 800, STR_CONFIG_PATCHES_SERVINT_TRAINS, InValidateDetailsWindow), |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1221 SDT_VAR(Patches, servint_roadveh, SLE_UINT16, 0,D0, 150, 5, 800, STR_CONFIG_PATCHES_SERVINT_ROADVEH, InValidateDetailsWindow), |
3246
4ffab2ee8200
(svn r3926) - [Patches]: Switched string for ship and aircraft replacement, and also forgot to put back the callback function. Thanks Tron
Darkvater <Darkvater@openttd.org>
parents:
3245
diff
changeset
|
1222 SDT_VAR(Patches, servint_ships, SLE_UINT16, 0,D0, 360, 5, 800, STR_CONFIG_PATCHES_SERVINT_SHIPS, InValidateDetailsWindow), |
4ffab2ee8200
(svn r3926) - [Patches]: Switched string for ship and aircraft replacement, and also forgot to put back the callback function. Thanks Tron
Darkvater <Darkvater@openttd.org>
parents:
3245
diff
changeset
|
1223 SDT_VAR(Patches, servint_aircraft, SLE_UINT16, 0,D0, 100, 5, 800, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, InValidateDetailsWindow), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1224 SDT_BOOL(Patches, no_servicing_if_no_breakdowns, 0, 0, false, STR_CONFIG_PATCHES_NOSERVICE, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1225 SDT_BOOL(Patches, wagon_speed_limits, 0, 0, true, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, NULL), |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1226 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1227 /***************************************************************************/ |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1228 /* Station section of the GUI-configure patches window */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1229 SDT_BOOL(Patches, join_stations, 0, 0, true, STR_CONFIG_PATCHES_JOINSTATIONS, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1230 SDT_BOOL(Patches, full_load_any, 0, 0, true, STR_CONFIG_PATCHES_FULLLOADANY, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1231 SDT_BOOL(Patches, improved_load, 0, 0, false, STR_CONFIG_PATCHES_IMPROVEDLOAD, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1232 SDT_BOOL(Patches, selectgoods, 0, 0, true, STR_CONFIG_PATCHES_SELECTGOODS, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1233 SDT_BOOL(Patches, new_nonstop, 0, 0, false, STR_CONFIG_PATCHES_NEW_NONSTOP, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1234 SDT_BOOL(Patches, nonuniform_stations, 0, 0, true, STR_CONFIG_PATCHES_NONUNIFORM_STATIONS,NULL), |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1235 SDT_VAR(Patches, station_spread,SLE_UINT8,0, 0, 12, 4,64,STR_CONFIG_PATCHES_STATION_SPREAD, InvalidateStationBuildWindow), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1236 SDT_BOOL(Patches, serviceathelipad, 0, 0, true, STR_CONFIG_PATCHES_SERVICEATHELIPAD, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1237 SDT_BOOL(Patches, modified_catchment, 0, 0, true, STR_CONFIG_PATCHES_CATCHMENT, NULL), |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1238 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1239 /***************************************************************************/ |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1240 /* Economy section of the GUI-configure patches window */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1241 SDT_BOOL(Patches, inflation, 0, 0, true, STR_CONFIG_PATCHES_INFLATION, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1242 SDT_BOOL(Patches, build_rawmaterial_ind, 0, 0, false, STR_CONFIG_PATCHES_BUILDXTRAIND, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1243 SDT_BOOL(Patches, multiple_industry_per_town, 0, 0, false, STR_CONFIG_PATCHES_MULTIPINDTOWN, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1244 SDT_BOOL(Patches, same_industry_close, 0, 0, false, STR_CONFIG_PATCHES_SAMEINDCLOSE, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1245 SDT_BOOL(Patches, bribe, 0, 0, true, STR_CONFIG_PATCHES_BRIBE, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1246 SDT_VAR(Patches, snow_line_height,SLE_UINT8, 0, 0, 7, 2, 13, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1247 SDT_VAR(Patches, colored_news_date,SLE_UINT, 0,NC, 2000,1900, 2200, STR_CONFIG_PATCHES_COLORED_NEWS_DATE,NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1248 SDT_VAR(Patches, starting_date, SLE_UINT, 0,NC, 1950, MAX_YEAR_BEGIN_REAL, MAX_YEAR_END_REAL, STR_CONFIG_PATCHES_STARTING_DATE,NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1249 SDT_VAR(Patches, ending_date, SLE_UINT,0,NC|NO,2051, MAX_YEAR_BEGIN_REAL, MAX_YEAR_END_REAL, STR_CONFIG_PATCHES_ENDING_DATE, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1250 SDT_BOOL(Patches, smooth_economy, 0, 0, true, STR_CONFIG_PATCHES_SMOOTH_ECONOMY, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1251 SDT_BOOL(Patches, allow_shares, 0, 0, true, STR_CONFIG_PATCHES_ALLOW_SHARES, NULL), |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1252 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1253 /***************************************************************************/ |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1254 /* AI section of the GUI-configure patches window */ |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1255 SDT_BOOL(Patches, ainew_active, 0, 0, false, STR_CONFIG_PATCHES_AINEW_ACTIVE, AiNew_PatchActive_Warning), |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1256 SDT_BOOL(Patches, ai_in_multiplayer, 0, 0, false, STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER, Ai_In_Multiplayer_Warning), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1257 SDT_BOOL(Patches, ai_disable_veh_train, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_TRAINS, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1258 SDT_BOOL(Patches, ai_disable_veh_roadveh, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1259 SDT_BOOL(Patches, ai_disable_veh_aircraft,0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1260 SDT_BOOL(Patches, ai_disable_veh_ship, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_SHIPS, NULL), |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1261 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1262 /***************************************************************************/ |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1263 /* Patches without any GUI representation */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1264 SDT_BOOL(Patches, keep_all_autosave, S, 0, false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1265 SDT_BOOL(Patches, autosave_on_exit, S, 0, false, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1266 SDT_VAR(Patches, max_num_autosaves, SLE_UINT8, S, 0, 16, 0, 255, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1267 SDT_BOOL(Patches, bridge_pillars, S, 0, true, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1268 SDT_VAR(Patches, extend_vehicle_life, SLE_UINT8, 0, 0, 0, 0, 100, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1269 SDT_BOOL(Patches, auto_euro, S, 0, true, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1270 SDT_VAR(Patches, dist_local_authority,SLE_UINT8, 0, 0, 20, 5, 60, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1271 SDT_VAR(Patches, wait_oneway_signal, SLE_UINT8, 0, 0, 15, 2, 100, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1272 SDT_VAR(Patches, wait_twoway_signal, SLE_UINT8, 0, 0, 41, 2, 100, STR_NULL, NULL), |
1218
27bc34be22da
(svn r1722) -Feature: Bigger maps - anyone?
tron <tron@openttd.org>
parents:
1104
diff
changeset
|
1273 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1274 /***************************************************************************/ |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1275 /* New Pathfinding patch settings */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1276 SDT_VAR(Patches, pf_maxlength, SLE_UINT16, 0, 0, 4096, 64, 65535, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1277 SDT_VAR(Patches, pf_maxdepth, SLE_UINT8, 0, 0, 48, 4, 255, STR_NULL, NULL), |
1700
fde260566b18
(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 <matthijs@openttd.org>
parents:
1688
diff
changeset
|
1278 /* The maximum number of nodes to search */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1279 SDT_VAR(Patches, npf_max_search_nodes,SLE_UINT, 0, 0,10000,500,100000, STR_NULL, NULL), |
1700
fde260566b18
(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 <matthijs@openttd.org>
parents:
1688
diff
changeset
|
1280 |
1271
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1281 /* When a red signal is encountered, a small detour can be made around |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1282 * it. This specifically occurs when a track is doubled, in which case |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1283 * the detour is typically 2 tiles. It is also often used at station |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1284 * entrances, when there is a choice of multiple platforms. If we take |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1285 * a typical 4 platform station, the detour is 4 tiles. To properly |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1286 * support larger stations we increase this value. |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1287 * We want to prevent that trains that want to leave at one side of a |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1288 * station, leave through the other side, turn around, enter the |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1289 * station on another platform and exit the station on the right side |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1290 * again, just because the sign at the right side was red. If we take |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1291 * a typical 5 length station, this detour is 10 or 11 tiles (not |
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1292 * sure), so we set the default penalty at 10 (the station tile |
1643
c030f03eaa9c
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
matthijs <matthijs@openttd.org>
parents:
1602
diff
changeset
|
1293 * penalty will further prevent this. |
c030f03eaa9c
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
matthijs <matthijs@openttd.org>
parents:
1602
diff
changeset
|
1294 * We give presignal exits (and combo's) a different (larger) penalty, because we really |
c030f03eaa9c
(svn r2147) - Add: [NPF] Give red presignal exit signals a different (higher) penalty, to discourage trains from waiting at presignal exits.
matthijs <matthijs@openttd.org>
parents:
1602
diff
changeset
|
1295 * don't want trains waiting in front of a presignal exit. */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1296 SDT_VAR(Patches, npf_rail_firstred_penalty, SLE_UINT, 0, 0, (10 * NPF_TILE_LENGTH), 0, 100000, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1297 SDT_VAR(Patches, npf_rail_firstred_exit_penalty,SLE_UINT, 0, 0, (100 * NPF_TILE_LENGTH),0, 100000, STR_NULL, NULL), |
1459
3854073cee76
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs <matthijs@openttd.org>
parents:
1422
diff
changeset
|
1298 /* This penalty is for when the last signal before the target is red. |
3854073cee76
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs <matthijs@openttd.org>
parents:
1422
diff
changeset
|
1299 * This is useful for train stations, where there are multiple |
3854073cee76
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs <matthijs@openttd.org>
parents:
1422
diff
changeset
|
1300 * platforms to choose from, which lie in different signal blocks. |
3854073cee76
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs <matthijs@openttd.org>
parents:
1422
diff
changeset
|
1301 * Every target in a occupied signal block (ie an occupied platform) |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1302 * will get this penalty. */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1303 SDT_VAR(Patches, npf_rail_lastred_penalty, SLE_UINT, 0, 0, (10 * NPF_TILE_LENGTH), 0, 100000, STR_NULL, NULL), |
1271
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1304 /* When a train plans a route over a station tile, this penalty is |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1305 * applied. We want that trains plan a route around a typical, 4x5 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1306 * station, which means two tiles to the right, and two tiles back to |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1307 * the left around it, or 5 tiles of station through it. If we assign |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1308 * a penalty of 1 tile for every station tile passed, the route will |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1309 * be around it. */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1310 SDT_VAR(Patches, npf_rail_station_penalty, SLE_UINT, 0, 0, (1 * NPF_TILE_LENGTH), 0, 100000, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1311 SDT_VAR(Patches, npf_rail_slope_penalty, SLE_UINT, 0, 0, (1 * NPF_TILE_LENGTH), 0, 100000, STR_NULL, NULL), |
1751
ae5bf77adcae
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs <matthijs@openttd.org>
parents:
1727
diff
changeset
|
1312 /* This penalty is applied when a train makes a turn. Its value of 1 makes |
ae5bf77adcae
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs <matthijs@openttd.org>
parents:
1727
diff
changeset
|
1313 * sure that it has a minimal impact on the pathfinding, only when two |
ae5bf77adcae
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs <matthijs@openttd.org>
parents:
1727
diff
changeset
|
1314 * paths have equal length it will make a difference */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1315 SDT_VAR(Patches, npf_rail_curve_penalty, SLE_UINT, 0, 0, 1, 0, 100000, STR_NULL, NULL), |
1777
f876aa3f7cdc
(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 <matthijs@openttd.org>
parents:
1751
diff
changeset
|
1316 /* Ths penalty is applied when a vehicle reverses inside a depot (doesn't |
f876aa3f7cdc
(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 <matthijs@openttd.org>
parents:
1751
diff
changeset
|
1317 * apply to ships, as they can just come out the other end). XXX: Is this a |
f876aa3f7cdc
(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 <matthijs@openttd.org>
parents:
1751
diff
changeset
|
1318 * good value? */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1319 SDT_VAR(Patches, npf_rail_depot_reverse_penalty,SLE_UINT, 0, 0, (NPF_TILE_LENGTH * 50), 0, 100000, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1320 SDT_VAR(Patches, npf_buoy_penalty, SLE_UINT, 0, 0, (2 * NPF_TILE_LENGTH), 0, 100000, STR_NULL, NULL), |
1751
ae5bf77adcae
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs <matthijs@openttd.org>
parents:
1727
diff
changeset
|
1321 /* This penalty is applied when a ship makes a turn. It is bigger than the |
ae5bf77adcae
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs <matthijs@openttd.org>
parents:
1727
diff
changeset
|
1322 * rail curve penalty, since ships (realisticly) have more trouble with |
ae5bf77adcae
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs <matthijs@openttd.org>
parents:
1727
diff
changeset
|
1323 * making turns */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1324 SDT_VAR(Patches, npf_water_curve_penalty, SLE_UINT, 0, 0, (NPF_TILE_LENGTH / 4), 0, 100000, STR_NULL, NULL), |
1941
52fdfd0cc51b
(svn r2447) * Add: [NPF] Penalty for road vehicles making turns.
matthijs <matthijs@openttd.org>
parents:
1891
diff
changeset
|
1325 /* This is the penalty for road, same as for rail. */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1326 SDT_VAR(Patches, npf_road_curve_penalty, SLE_UINT, 0, 0, 1, 0, 100000, STR_NULL, NULL), |
2006
8a0ef28193e7
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs <matthijs@openttd.org>
parents:
1941
diff
changeset
|
1327 /* This is the penalty for level crossings, for both road and rail vehicles */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1328 SDT_VAR(Patches, npf_crossing_penalty, SLE_UINT, 0, 0, (3 * NPF_TILE_LENGTH), 0, 100000, STR_NULL, NULL), |
1271
ce2ab4ce332f
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight <truelight@openttd.org>
parents:
1258
diff
changeset
|
1329 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1330 SDT_END() |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1331 }; |
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1332 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1333 static const SettingDesc _currency_settings[] = { |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1334 SDT_VAR(CurrencySpec, rate, SLE_UINT16, S, 0, 1, 0, 100, STR_NULL, NULL), |
3192
ba051fd4f0b2
(svn r3852) - Revert r3733 which fixed the default value loading for char, but broke loading a set value. Added a better fix which needs a char value to be a string (eg enclosed in double-quotes)
Darkvater <Darkvater@openttd.org>
parents:
3152
diff
changeset
|
1335 SDT_CHR(CurrencySpec, separator, S, 0, ".", STR_NULL, NULL), |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1336 SDT_VAR(CurrencySpec, to_euro, SLE_UINT16, S, 0, 0, 0,1000, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1337 SDT_STR(CurrencySpec, prefix, SLE_STRQ, S, 0, NULL, STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1338 SDT_STR(CurrencySpec, suffix, SLE_STRQ, S, 0, " credits", STR_NULL, NULL), |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1339 SDT_END() |
759
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
1340 }; |
f56e938f61dc
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik <dominik@openttd.org>
parents:
738
diff
changeset
|
1341 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1342 /* Undefine for the shortcut macros above */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1343 #undef S |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1344 #undef C |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1345 #undef N |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1346 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1347 #undef D0 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1348 #undef NC |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1349 #undef MS |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1350 #undef NO |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1351 #undef CR |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1352 |
3115
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
1353 typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, const char *grpname, void *object); |
b061869ec500
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This first part rewrites the configuration section to use the SaveLoad VarType in general.
Darkvater <Darkvater@openttd.org>
parents:
3112
diff
changeset
|
1354 typedef void SettingDescProcList(IniFile *ini, const char *grpname, char **list, uint len); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1355 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1356 /* Common handler for saving/loading variables to the configuration file */ |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1357 static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescProcList *proc_list) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1358 { |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1359 proc(ini, (const SettingDesc*)_misc_settings, "misc", NULL); |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1360 proc(ini, (const SettingDesc*)_music_settings, "music", &msf); |
3051
464ba6811ebc
(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 <Darkvater@openttd.org>
parents:
3042
diff
changeset
|
1361 #ifdef WIN32 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1362 proc(ini, (const SettingDesc*)_win32_settings, "win32", NULL); |
3051
464ba6811ebc
(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 <Darkvater@openttd.org>
parents:
3042
diff
changeset
|
1363 #endif /* WIN32 */ |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1364 |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1365 proc(ini, _gameopt_settings, "gameopt", &_opt_newgame); |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1366 proc(ini, _patch_settings, "patches", &_patches_newgame); |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1367 proc(ini, _currency_settings,"currency", &_custom_currency); |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1368 |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1369 #ifdef ENABLE_NETWORK |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1370 proc(ini, (const SettingDesc*)_network_settings, "network", NULL); |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1371 proc_list(ini, "servers", _network_host_list, lengthof(_network_host_list)); |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1372 proc_list(ini, "bans", _network_ban_list, lengthof(_network_ban_list)); |
543
0bade3c3b8ba
(svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents:
523
diff
changeset
|
1373 #endif /* ENABLE_NETWORK */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1374 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1375 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1376 /** Load the values from the configuration files */ |
1093
5029c37a31c0
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron <tron@openttd.org>
parents:
1037
diff
changeset
|
1377 void LoadFromConfig(void) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1378 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1379 IniFile *ini = ini_load(_config_file); |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1380 HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list); |
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1381 ini_load_setting_list(ini, "newgrf", _newgrf_files, lengthof(_newgrf_files)); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1382 ini_free(ini); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1383 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1384 |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1385 /** Save the values to the configuration file */ |
1093
5029c37a31c0
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron <tron@openttd.org>
parents:
1037
diff
changeset
|
1386 void SaveToConfig(void) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1387 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1388 IniFile *ini = ini_load(_config_file); |
3116
31bc97980534
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater <Darkvater@openttd.org>
parents:
3115
diff
changeset
|
1389 HandleSettingDescs(ini, ini_save_settings, ini_save_setting_list); |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1390 ini_save(_config_file, ini); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1391 ini_free(ini); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1392 } |
1688
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1393 |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1394 static const SettingDesc *GetSettingDescription(uint index) |
3118
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1395 { |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1396 if (index >= lengthof(_patch_settings)) return NULL; |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1397 return &_patch_settings[index]; |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1398 } |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1399 |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1400 /** Network-safe changing of patch-settings (server-only). |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1401 * @param p1 the index of the patch in the SettingDesc array which identifies it |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1402 * @param p2 the new value for the patch |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1403 * The new value is properly clamped to its minimum/maximum when setting |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1404 * @see _patch_settings |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1405 */ |
3491
6aef91e18846
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents:
3358
diff
changeset
|
1406 int32 CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1407 { |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1408 const SettingDesc *sd = GetSettingDescription(p1); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1409 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1410 if (sd == NULL) return CMD_ERROR; |
3223
bc4e66f7d010
(svn r3896) - [Patches] Fix: Honour any conditional settings when retrieving the setting entries.
Darkvater <Darkvater@openttd.org>
parents:
3222
diff
changeset
|
1411 if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) return CMD_ERROR; |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1412 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1413 if (flags & DC_EXEC) { |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1414 Patches *patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1415 void *var = ini_get_variable(&sd->save, patches_ptr); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1416 Write_ValidateSetting(var, sd, (int32)p2); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1417 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1418 InvalidateWindow(WC_GAME_OPTIONS, 0); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1419 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1420 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1421 return 0; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1422 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1423 |
3118
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1424 /* Top function to save the new value of an element of the Patches struct |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1425 * @param index offset in the SettingDesc array of the Patches struct which |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1426 * identifies the patch member we want to change |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1427 * @param object pointer to a valid patches struct that has its settings change. |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1428 * This only affects patch-members that are not needed to be the same on all |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1429 * clients in a network game. |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1430 * @param value new value of the patch */ |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1431 void SetPatchValue(uint index, const Patches *object, int32 value) |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1432 { |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1433 const SettingDesc *sd = &_patch_settings[index]; |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1434 /* If an item is player-based, we do not send it over the network |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1435 * (if any) to change. Also *hack*hack* we update the _newgame version |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1436 * of patches because changing a player-based setting in a game also |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1437 * changes its defaults. At least that is the convention we have chosen */ |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1438 if (sd->save.conv & SLF_NETWORK_NO) { |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1439 void *var = ini_get_variable(&sd->save, object); |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1440 Write_ValidateSetting(var, sd, value); |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1441 |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1442 if (_game_mode != GM_MENU) { |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1443 void *var2 = ini_get_variable(&sd->save, &_patches_newgame); |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1444 Write_ValidateSetting(var2, sd, value); |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1445 } |
3118
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1446 } else { |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1447 DoCommandP(0, index, value, NULL, CMD_CHANGE_PATCH_SETTING); |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1448 } |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1449 } |
2ec875a88fd4
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater <Darkvater@openttd.org>
parents:
3117
diff
changeset
|
1450 |
3247
561529ce375d
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater <Darkvater@openttd.org>
parents:
3246
diff
changeset
|
1451 const SettingDesc *GetPatchFromName(const char *name, uint *i) |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1452 { |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1453 const SettingDesc *sd; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1454 |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1455 for (*i = 0, sd = _patch_settings; sd->save.cmd != SL_END; sd++, (*i)++) { |
3223
bc4e66f7d010
(svn r3896) - [Patches] Fix: Honour any conditional settings when retrieving the setting entries.
Darkvater <Darkvater@openttd.org>
parents:
3222
diff
changeset
|
1456 if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; |
3210
ff325939f39d
(svn r3880) - just do a string compare without length restrictions; followup for r3875
Darkvater <Darkvater@openttd.org>
parents:
3207
diff
changeset
|
1457 if (strcmp(sd->desc.name, name) == 0) return sd; |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1458 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1459 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1460 return NULL; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1461 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1462 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1463 /* Those 2 functions need to be here, else we have to make some stuff non-static |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1464 * and besides, it is also better to keep stuff like this at the same place */ |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1465 void IConsoleSetPatchSetting(const char *name, const char *value) |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1466 { |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1467 char newval[20]; |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1468 int32 val; |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1469 uint index; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1470 const SettingDesc *sd = GetPatchFromName(name, &index); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1471 const Patches *patches_ptr; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1472 void *ptr; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1473 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1474 if (sd == NULL) { |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1475 IConsolePrintF(_icolour_warn, "'%s' is an unknown patch setting.", name); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1476 return; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1477 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1478 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1479 sscanf(value, "%d", &val); |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1480 patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1481 ptr = ini_get_variable(&sd->save, patches_ptr); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1482 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1483 SetPatchValue(index, patches_ptr, val); |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1484 val = ReadValue(ptr, sd->save.conv); |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1485 |
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1486 if (sd->desc.proc != NULL) sd->desc.proc(val); |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1487 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1488 if (sd->desc.cmd == SDT_BOOLX) { |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1489 snprintf(newval, sizeof(newval), (val != 0) ? "on" : "off"); |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1490 } else { |
3131
f939489986f9
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
Darkvater <Darkvater@openttd.org>
parents:
3125
diff
changeset
|
1491 snprintf(newval, sizeof(newval), "%d", val); |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1492 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1493 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1494 IConsolePrintF(_icolour_warn, "'%s' changed to: %s", name, newval); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1495 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1496 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1497 void IConsoleGetPatchSetting(const char *name) |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1498 { |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1499 char value[20]; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1500 uint index; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1501 const SettingDesc *sd = GetPatchFromName(name, &index); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1502 const void *ptr; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1503 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1504 if (sd == NULL) { |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1505 IConsolePrintF(_icolour_warn, "'%s' is an unknown patch setting.", name); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1506 return; |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1507 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1508 |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1509 ptr = ini_get_variable(&sd->save, (_game_mode == GM_MENU) ? &_patches_newgame : &_patches); |
3119
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1510 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1511 if (sd->desc.cmd == SDT_BOOLX) { |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1512 snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off"); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1513 } else { |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1514 snprintf(value, sizeof(value), "%d", (int32)ReadValue(ptr, sd->save.conv)); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1515 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1516 |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1517 IConsolePrintF(_icolour_warn, "Current value for '%s' is: '%s' (min: %s%d, max: %d)", |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1518 name, value, (sd->desc.flags & SGF_0ISDISABLED) ? "(0) " : "", sd->desc.min, sd->desc.max); |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1519 } |
bc448b6e3815
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater <Darkvater@openttd.org>
parents:
3118
diff
changeset
|
1520 |
3117
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1521 /** Save and load handler for patches/settings |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1522 * @param osd SettingDesc struct containing all information |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1523 * @param object can be either NULL in which case we load global variables or |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1524 * a pointer to a struct which is getting saved */ |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1525 static void LoadSettings(const SettingDesc *osd, void *object) |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1526 { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1527 for (; osd->save.cmd != SL_END; osd++) { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1528 const SaveLoad *sld = &osd->save; |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1529 void *ptr = ini_get_variable(sld, object); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1530 |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1531 if (!SlObjectMember(ptr, sld)) continue; |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1532 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1533 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1534 |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1535 /** Loadhandler for a list of global variables |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1536 * @note this is actually a stub for LoadSettings with the |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1537 * object pointer set to NULL */ |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1538 static inline void LoadSettingsGlobList(const SettingDescGlobVarList *sdg) |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1539 { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1540 LoadSettings((const SettingDesc*)sdg, NULL); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1541 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1542 |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1543 /** Save and load handler for patches/settings |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1544 * @param osd SettingDesc struct containing all information |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1545 * @param object can be either NULL in which case we load global variables or |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1546 * a pointer to a struct which is getting saved */ |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1547 static void SaveSettings(const SettingDesc *sd, void *object) |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1548 { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1549 /* We need to write the CH_RIFF header, but unfortunately can't call |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1550 * SlCalcLength() because we have a different format. So do this manually */ |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1551 const SettingDesc *i; |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1552 size_t length = 0; |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1553 for (i = sd; i->save.cmd != SL_END; i++) { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1554 length += SlCalcObjMemberLength(&i->save); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1555 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1556 SlSetLength(length); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1557 |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1558 for (i = sd; i->save.cmd != SL_END; i++) { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1559 void *ptr = ini_get_variable(&i->save, object); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1560 SlObjectMember(ptr, &i->save); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1561 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1562 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1563 |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1564 /** Savehandler for a list of global variables |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1565 * @note this is actually a stub for SaveSettings with the |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1566 * object pointer set to NULL */ |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1567 static inline void SaveSettingsGlobList(const SettingDescGlobVarList *sdg) |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1568 { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1569 SaveSettings((const SettingDesc*)sdg, NULL); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1570 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1571 |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1572 static void Load_OPTS(void) |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1573 { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1574 /* Copy over default setting since some might not get loaded in |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1575 * a networking environment. This ensures for example that the local |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1576 * autosave-frequency stays when joining a network-server */ |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1577 _opt = _opt_newgame; |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1578 LoadSettings(_gameopt_settings, &_opt); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1579 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1580 |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1581 static void Save_OPTS(void) |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1582 { |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1583 SaveSettings(_gameopt_settings, &_opt); |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1584 } |
4c425da07b4b
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
Darkvater <Darkvater@openttd.org>
parents:
3116
diff
changeset
|
1585 |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1586 static void Load_PATS(void) |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1587 { |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1588 /* Copy over default setting since some might not get loaded in |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1589 * a networking environment. This ensures for example that the local |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1590 * signal_side stays when joining a network-server */ |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1591 _patches = _patches_newgame; |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1592 LoadSettings(_patch_settings, &_patches); |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1593 } |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1594 |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1595 static void Save_PATS(void) |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1596 { |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1597 SaveSettings(_patch_settings, &_patches); |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1598 } |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1599 |
1688
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1600 void CheckConfig(void) |
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1601 { |
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1602 // fix up news_display_opt from old to new |
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1603 int i; |
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1604 uint32 tmp; |
1723
e435ca63a1d3
(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 <Darkvater@openttd.org>
parents:
1700
diff
changeset
|
1605 for (i = 0, tmp = _news_display_opt; i != 10; i++, tmp >>= 2) { |
1688
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1606 if ((tmp & 0x3) == 0x3) { // old settings |
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1607 _news_display_opt = 0xAAAAAAAA; // set all news-messages to full 1010101010... |
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1608 break; |
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1609 } |
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1610 } |
2044
41c5be148469
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde <ludde@openttd.org>
parents:
2008
diff
changeset
|
1611 |
41c5be148469
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde <ludde@openttd.org>
parents:
2008
diff
changeset
|
1612 // Increase old default values for pf_maxdepth and pf_maxlength |
41c5be148469
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde <ludde@openttd.org>
parents:
2008
diff
changeset
|
1613 // to support big networks. |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1614 if (_patches_newgame.pf_maxdepth == 16 && _patches_newgame.pf_maxlength == 512) { |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1615 _patches_newgame.pf_maxdepth = 48; |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1616 _patches_newgame.pf_maxlength = 4096; |
2044
41c5be148469
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde <ludde@openttd.org>
parents:
2008
diff
changeset
|
1617 } |
1688
6e19dd2337e4
(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 <Darkvater@openttd.org>
parents:
1643
diff
changeset
|
1618 } |
3112
3a5e0c62fb5e
(svn r3716) - Move the option settings (_game_opt_desc) from misc.c into settings.c. This will be merged with SettingDesc misc_settings above as they are actually the same. No functionality has changed beside the fact that the settings are now in a different Chunkhandler.
Darkvater <Darkvater@openttd.org>
parents:
3052
diff
changeset
|
1619 |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1620 void UpdatePatches(void) |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1621 { |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1622 /* Since old(er) savegames don't have any patches saved, we initialise |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1623 * them with the default values just as it was in the old days. |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1624 * Also new games need this copying-over */ |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1625 _patches = _patches_newgame; /* backwards compatibility */ |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1626 } |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1627 |
3112
3a5e0c62fb5e
(svn r3716) - Move the option settings (_game_opt_desc) from misc.c into settings.c. This will be merged with SettingDesc misc_settings above as they are actually the same. No functionality has changed beside the fact that the settings are now in a different Chunkhandler.
Darkvater <Darkvater@openttd.org>
parents:
3052
diff
changeset
|
1628 const ChunkHandler _setting_chunk_handlers[] = { |
3121
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1629 { 'OPTS', Save_OPTS, Load_OPTS, CH_RIFF}, |
5cd3c15d4002
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater <Darkvater@openttd.org>
parents:
3119
diff
changeset
|
1630 { 'PATS', Save_PATS, Load_PATS, CH_RIFF | CH_LAST}, |
3112
3a5e0c62fb5e
(svn r3716) - Move the option settings (_game_opt_desc) from misc.c into settings.c. This will be merged with SettingDesc misc_settings above as they are actually the same. No functionality has changed beside the fact that the settings are now in a different Chunkhandler.
Darkvater <Darkvater@openttd.org>
parents:
3052
diff
changeset
|
1631 }; |