author | rubidium |
Thu, 01 Feb 2007 15:49:12 +0000 | |
changeset 5893 | 7e431a4abebb |
parent 5688 | c4ba40106d5d |
child 5983 | 49d077336ca1 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
3 |
/** @file |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
4 |
* All actions handling saving and loading of the settings/configuration goes on in this file. |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
5 |
* The file consists of four parts: |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
6 |
* <ol> |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
7 |
* <li>Parsing the configuration file (openttd.cfg). This is achieved with the ini_ functions which |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
8 |
* handle various types, such as normal 'key = value' pairs, lists and value combinations of |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
9 |
* lists, strings, integers, 'bit'-masks and element selections. |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
10 |
* <li>Defining the data structures that go into the configuration. These include for example |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
11 |
* the _patches struct, but also network-settings, banlists, newgrf, etc. There are a lot |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
12 |
* of helper macros available for the various types, and also saving/loading of these settings |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
13 |
* in a savegame is handled inside these structures. |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
14 |
* <li>Handle reading and writing to the setting-structures from inside the game either from |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
15 |
* the console for example or through the gui with CMD_ functions. |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
16 |
* <li>Handle saving/loading of the PATS chunk inside the savegame. |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
17 |
* </ol> |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
18 |
* @see SettingDesc |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
19 |
* @see SaveLoad |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
20 |
*/ |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
21 |
|
0 | 22 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1777
diff
changeset
|
23 |
#include "openttd.h" |
2291
c142846954ee
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
2191
diff
changeset
|
24 |
#include "currency.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2153
diff
changeset
|
25 |
#include "functions.h" |
2191 | 26 |
#include "macros.h" |
2121
267f7d75d036
(svn r2631) Move screenshot related variables from variables.h to screenshot.[ch]
tron
parents:
2044
diff
changeset
|
27 |
#include "screenshot.h" |
0 | 28 |
#include "sound.h" |
1317
3c90086ff34f
(svn r1821) Move generic string handling functions to string.[ch] and introduce stre{cpy,cat}, see string.h for their semantics
tron
parents:
1282
diff
changeset
|
29 |
#include "string.h" |
2153
ecfc674410b4
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
2125
diff
changeset
|
30 |
#include "variables.h" |
5469
7edfc643abbc
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5346
diff
changeset
|
31 |
#include "network/network.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
32 |
#include "settings.h" |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
33 |
#include "command.h" |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
34 |
#include "console.h" |
3112
a6fda4d4c7ca
(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
parents:
3052
diff
changeset
|
35 |
#include "saveload.h" |
3358
c69b64a580b2
(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
parents:
3352
diff
changeset
|
36 |
#include "npf.h" |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
37 |
#include "yapf/yapf.h" |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
38 |
#include "newgrf.h" |
5228
26dc9acf7d94
(svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
5211
diff
changeset
|
39 |
#include "newgrf_config.h" |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4293
diff
changeset
|
40 |
#include "genworld.h" |
4261
28670f743746
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
4258
diff
changeset
|
41 |
#include "date.h" |
5116
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5113
diff
changeset
|
42 |
#include "rail.h" |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
43 |
#include "helpers.hpp" |
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
44 |
#ifdef WITH_FREETYPE |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
45 |
#include "gfx.h" |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
46 |
#include "fontcache.h" |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
47 |
#endif |
0 | 48 |
|
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
49 |
/** The patch values that are used for new games and/or modified in config file */ |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
50 |
Patches _patches_newgame; |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
51 |
|
0 | 52 |
typedef struct IniFile IniFile; |
53 |
typedef struct IniItem IniItem; |
|
54 |
typedef struct IniGroup IniGroup; |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
55 |
typedef struct SettingsMemoryPool SettingsMemoryPool; |
0 | 56 |
|
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
57 |
typedef const char *SettingListCallbackProc(const IniItem *item, uint index); |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
58 |
typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, const char *grpname, void *object); |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
59 |
typedef void SettingDescProcList(IniFile *ini, const char *grpname, char **list, uint len, SettingListCallbackProc proc); |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
60 |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
61 |
static void pool_init(SettingsMemoryPool **pool); |
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
62 |
static void *pool_alloc(SettingsMemoryPool **pool, uint size); |
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
63 |
static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, uint size); |
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
64 |
static void pool_free(SettingsMemoryPool **pool); |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
65 |
static bool IsSignedVarMemType(VarType vt); |
0 | 66 |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
67 |
struct SettingsMemoryPool { |
0 | 68 |
uint pos,size; |
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
69 |
SettingsMemoryPool *next; |
0 | 70 |
byte mem[1]; |
71 |
}; |
|
72 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
73 |
static SettingsMemoryPool *pool_new(uint minsize) |
0 | 74 |
{ |
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
75 |
SettingsMemoryPool *p; |
0 | 76 |
if (minsize < 4096 - 12) minsize = 4096 - 12; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
77 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
78 |
p = (SettingsMemoryPool*)malloc(sizeof(SettingsMemoryPool) - 1 + minsize); |
0 | 79 |
p->pos = 0; |
80 |
p->size = minsize; |
|
81 |
p->next = NULL; |
|
82 |
return p; |
|
83 |
} |
|
84 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
85 |
static void pool_init(SettingsMemoryPool **pool) |
0 | 86 |
{ |
87 |
*pool = pool_new(0); |
|
88 |
} |
|
89 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
90 |
static void *pool_alloc(SettingsMemoryPool **pool, uint size) |
0 | 91 |
{ |
92 |
uint pos; |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
93 |
SettingsMemoryPool *p = *pool; |
0 | 94 |
|
2450
d7edd1def1e0
(svn r2976) -Fix: Align settings pool items to the size of void* to fix bus errors on 64bit architectures which require aligned variables
tron
parents:
2398
diff
changeset
|
95 |
size = ALIGN(size, sizeof(void*)); |
0 | 96 |
|
97 |
// first check if there's memory in the next pool |
|
98 |
if (p->next && p->next->pos + size <= p->next->size) { |
|
99 |
p = p->next; |
|
100 |
// then check if there's not memory in the cur pool |
|
101 |
} else if (p->pos + size > p->size) { |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
102 |
SettingsMemoryPool *n = pool_new(size); |
0 | 103 |
*pool = n; |
104 |
n->next = p; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
105 |
p = n; |
0 | 106 |
} |
107 |
||
108 |
pos = p->pos; |
|
109 |
p->pos += size; |
|
110 |
return p->mem + pos; |
|
111 |
} |
|
112 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
113 |
static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, uint size) |
0 | 114 |
{ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
115 |
byte *p = (byte*)pool_alloc(pool, size + 1); |
0 | 116 |
p[size] = 0; |
117 |
memcpy(p, mem, size); |
|
118 |
return p; |
|
119 |
} |
|
120 |
||
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
121 |
static void pool_free(SettingsMemoryPool **pool) |
0 | 122 |
{ |
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
123 |
SettingsMemoryPool *p = *pool, *n; |
0 | 124 |
*pool = NULL; |
125 |
while (p) { |
|
126 |
n = p->next; |
|
127 |
free(p); |
|
128 |
p = n; |
|
129 |
} |
|
130 |
} |
|
131 |
||
132 |
// structs describing the ini format. |
|
133 |
struct IniItem { |
|
134 |
char *name; |
|
135 |
char *value; |
|
136 |
char *comment; |
|
137 |
IniItem *next; |
|
138 |
}; |
|
139 |
||
140 |
struct IniGroup { |
|
141 |
char *name; // name of group |
|
142 |
char *comment; //comment for group |
|
143 |
IniItem *item, **last_item; |
|
144 |
IniGroup *next; |
|
145 |
IniFile *ini; |
|
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
146 |
IniGroupType type; // type of group |
0 | 147 |
}; |
148 |
||
149 |
struct IniFile { |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
150 |
SettingsMemoryPool *pool; |
0 | 151 |
IniGroup *group, **last_group; |
152 |
char *comment; // last comment in file |
|
153 |
}; |
|
154 |
||
155 |
// allocate an inifile object |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
156 |
static IniFile *ini_alloc(void) |
0 | 157 |
{ |
158 |
IniFile *ini; |
|
1258
220b6e3b4d10
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
159 |
SettingsMemoryPool *pool; |
0 | 160 |
pool_init(&pool); |
161 |
ini = (IniFile*)pool_alloc(&pool, sizeof(IniFile)); |
|
162 |
ini->pool = pool; |
|
163 |
ini->group = NULL; |
|
164 |
ini->last_group = &ini->group; |
|
165 |
ini->comment = NULL; |
|
166 |
return ini; |
|
167 |
} |
|
168 |
||
169 |
// allocate an ini group object |
|
170 |
static IniGroup *ini_group_alloc(IniFile *ini, const char *grpt, int len) |
|
171 |
{ |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
172 |
IniGroup *grp = (IniGroup*)pool_alloc(&ini->pool, sizeof(IniGroup)); |
0 | 173 |
grp->ini = ini; |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
174 |
grp->name = (char*)pool_strdup(&ini->pool, grpt, len); |
2953
4d933ef9a41f
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
175 |
if (!strcmp(grp->name, "newgrf") || !strcmp(grp->name, "servers") || !strcmp(grp->name, "bans")) { |
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
176 |
grp->type = IGT_LIST; |
2953
4d933ef9a41f
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
177 |
} else { |
705
71cf9f0d7e7f
(svn r1157) Enhanced the config file (openttd.cfg) to use another section type. "List sections" as opposed to "variable sections" contain a list of values, separated by a new line. This is now used for the [newgrf] group. You have to edit each line in this section from e.g. "0 = firstset.grf" to only "firstset.grf".
dominik
parents:
690
diff
changeset
|
178 |
grp->type = IGT_VARIABLES; |
2953
4d933ef9a41f
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
179 |
} |
0 | 180 |
grp->next = NULL; |
181 |
grp->item = NULL; |
|
182 |
grp->comment = NULL; |
|
183 |
grp->last_item = &grp->item; |
|
184 |
*ini->last_group = grp; |
|
185 |
ini->last_group = &grp->next; |
|
186 |
return grp; |
|
187 |
} |
|
188 |
||
189 |
static IniItem *ini_item_alloc(IniGroup *group, const char *name, int len) |
|
190 |
{ |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
191 |
IniItem *item = (IniItem*)pool_alloc(&group->ini->pool, sizeof(IniItem)); |
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
192 |
item->name = (char*)pool_strdup(&group->ini->pool, name, len); |
0 | 193 |
item->next = NULL; |
194 |
item->comment = NULL; |
|
195 |
item->value = NULL; |
|
196 |
*group->last_item = item; |
|
197 |
group->last_item = &item->next; |
|
198 |
return item; |
|
199 |
} |
|
200 |
||
201 |
// load an ini file into the "abstract" format |
|
202 |
static IniFile *ini_load(const char *filename) |
|
203 |
{ |
|
204 |
char buffer[1024], c, *s, *t, *e; |
|
205 |
FILE *in; |
|
206 |
IniFile *ini; |
|
207 |
IniGroup *group = NULL; |
|
208 |
IniItem *item; |
|
209 |
||
1329 | 210 |
char *comment = NULL; |
0 | 211 |
uint comment_size = 0; |
212 |
uint comment_alloc = 0; |
|
213 |
||
214 |
ini = ini_alloc(); |
|
215 |
||
216 |
in = fopen(filename, "r"); |
|
217 |
if (in == NULL) return ini; |
|
218 |
||
219 |
// for each line in the file |
|
220 |
while (fgets(buffer, sizeof(buffer), in)) { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
221 |
|
0 | 222 |
// trim whitespace from the left side |
3598
a02daaf41761
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
223 |
for (s = buffer; *s == ' ' || *s == '\t'; s++); |
0 | 224 |
|
225 |
// trim whitespace from right side. |
|
226 |
e = s + strlen(s); |
|
227 |
while (e > s && ((c=e[-1]) == '\n' || c == '\r' || c == ' ' || c == '\t')) e--; |
|
3598
a02daaf41761
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
228 |
*e = '\0'; |
0 | 229 |
|
230 |
// skip comments and empty lines |
|
4969
90562b457b84
(svn r6972) - Codechange: Allow standard ini-file style comments
peter1138
parents:
4870
diff
changeset
|
231 |
if (*s == '#' || *s == ';' || *s == '\0') { |
0 | 232 |
uint ns = comment_size + (e - s + 1); |
233 |
uint a = comment_alloc; |
|
234 |
uint pos; |
|
235 |
// add to comment |
|
236 |
if (ns > a) { |
|
5601
d58f82901b2f
(svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
celestar
parents:
5587
diff
changeset
|
237 |
a = max(a, 128U); |
0 | 238 |
do a*=2; while (a < ns); |
5609
dc6a58930ba4
(svn r8066) - Codechange: MallocT(), CallocT(), ReallocT() now return the pointer to allocated memory instead of modifying the pointer given as parameter
KUDr
parents:
5601
diff
changeset
|
239 |
comment = ReallocT(comment, comment_alloc = a); |
0 | 240 |
} |
241 |
pos = comment_size; |
|
242 |
comment_size += (e - s + 1); |
|
243 |
comment[pos + e - s] = '\n'; // comment newline |
|
244 |
memcpy(comment + pos, s, e - s); // copy comment contents |
|
245 |
continue; |
|
246 |
} |
|
247 |
||
248 |
// it's a group? |
|
249 |
if (s[0] == '[') { |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
250 |
if (e[-1] != ']') { |
5576
b19c640dfc37
(svn r8013) -Codechange (r6921, rUnknown): Show the error message of corrupt or missing (own) files
Darkvater
parents:
5475
diff
changeset
|
251 |
ShowInfoF("ini: invalid group name '%s'", buffer); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
252 |
} else { |
0 | 253 |
e--; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
254 |
} |
0 | 255 |
s++; // skip [ |
256 |
group = ini_group_alloc(ini, s, e - s); |
|
257 |
if (comment_size) { |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
258 |
group->comment = (char*)pool_strdup(&ini->pool, comment, comment_size); |
0 | 259 |
comment_size = 0; |
260 |
} |
|
261 |
} else if (group) { |
|
262 |
// find end of keyname |
|
3598
a02daaf41761
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
263 |
for (t = s; *t != '\0' && *t != '=' && *t != '\t' && *t != ' '; t++); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
264 |
|
0 | 265 |
// it's an item in an existing group |
266 |
item = ini_item_alloc(group, s, t-s); |
|
267 |
if (comment_size) { |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
268 |
item->comment = (char*)pool_strdup(&ini->pool, comment, comment_size); |
0 | 269 |
comment_size = 0; |
270 |
} |
|
271 |
||
272 |
// find start of parameter |
|
273 |
while (*t == '=' || *t == ' ' || *t == '\t') t++; |
|
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
274 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
275 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
276 |
// remove starting quotation marks |
2952 | 277 |
if (*t == '\"') t++; |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
278 |
// remove ending quotation marks |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
279 |
e = t + strlen(t); |
3598
a02daaf41761
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
280 |
if (e > t && e[-1] == '\"') e--; |
a02daaf41761
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
281 |
*e = '\0'; |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
282 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
283 |
item->value = (char*)pool_strdup(&ini->pool, t, e - t); |
0 | 284 |
} else { |
285 |
// it's an orphan item |
|
5576
b19c640dfc37
(svn r8013) -Codechange (r6921, rUnknown): Show the error message of corrupt or missing (own) files
Darkvater
parents:
5475
diff
changeset
|
286 |
ShowInfoF("ini: '%s' outside of group", buffer); |
0 | 287 |
} |
288 |
} |
|
289 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
290 |
if (comment_size > 0) { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
291 |
ini->comment = (char*)pool_strdup(&ini->pool, comment, comment_size); |
0 | 292 |
comment_size = 0; |
293 |
} |
|
294 |
||
295 |
free(comment); |
|
296 |
fclose(in); |
|
297 |
||
298 |
return ini; |
|
299 |
} |
|
300 |
||
301 |
// lookup a group or make a new one |
|
302 |
static IniGroup *ini_getgroup(IniFile *ini, const char *name, int len) |
|
303 |
{ |
|
304 |
IniGroup *group; |
|
305 |
||
306 |
if (len == -1) len = strlen(name); |
|
307 |
||
308 |
// does it exist already? |
|
2952 | 309 |
for (group = ini->group; group; group = group->next) |
0 | 310 |
if (!memcmp(group->name, name, len) && group->name[len] == 0) |
311 |
return group; |
|
312 |
||
313 |
// otherwise make a new one |
|
314 |
group = ini_group_alloc(ini, name, len); |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
315 |
group->comment = (char*)pool_strdup(&ini->pool, "\n", 1); |
0 | 316 |
return group; |
317 |
} |
|
318 |
||
319 |
// lookup an item or make a new one |
|
320 |
static IniItem *ini_getitem(IniGroup *group, const char *name, bool create) |
|
321 |
{ |
|
322 |
IniItem *item; |
|
323 |
uint len = strlen(name); |
|
324 |
||
2952 | 325 |
for (item = group->item; item; item = item->next) |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
326 |
if (strcmp(item->name, name) == 0) return item; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
327 |
|
0 | 328 |
if (!create) return NULL; |
329 |
||
330 |
// otherwise make a new one |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
331 |
return ini_item_alloc(group, name, len); |
0 | 332 |
} |
333 |
||
334 |
// save ini file from the "abstract" format. |
|
335 |
static bool ini_save(const char *filename, IniFile *ini) |
|
336 |
{ |
|
337 |
FILE *f; |
|
338 |
IniGroup *group; |
|
339 |
IniItem *item; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
340 |
|
0 | 341 |
f = fopen(filename, "w"); |
342 |
if (f == NULL) return false; |
|
343 |
||
2919
3e42ca528f01
(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
Darkvater
parents:
2916
diff
changeset
|
344 |
for (group = ini->group; group != NULL; group = group->next) { |
0 | 345 |
if (group->comment) fputs(group->comment, f); |
346 |
fprintf(f, "[%s]\n", group->name); |
|
2919
3e42ca528f01
(svn r3475) - Fix: you couldn't remove an item from a list-type of config ingame from the configuration file. Whatever you did, upon restart of OpenTTD those items were still there. To fix this we initialize the first item to NULL in SaveList as it is rebuilt anyways fully.
Darkvater
parents:
2916
diff
changeset
|
347 |
for (item = group->item; item != NULL; item = item->next) { |
3600
b2f245c26617
(svn r4491) - Codechange: handle IGT_LIST types just as the other types with a proper name and value setting (for example for newgrf parameters).
Darkvater
parents:
3599
diff
changeset
|
348 |
assert(item->value != NULL); |
b2f245c26617
(svn r4491) - Codechange: handle IGT_LIST types just as the other types with a proper name and value setting (for example for newgrf parameters).
Darkvater
parents:
3599
diff
changeset
|
349 |
if (item->comment != NULL) fputs(item->comment, f); |
b2f245c26617
(svn r4491) - Codechange: handle IGT_LIST types just as the other types with a proper name and value setting (for example for newgrf parameters).
Darkvater
parents:
3599
diff
changeset
|
350 |
|
4434
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4431
diff
changeset
|
351 |
/* Don't give an equal sign to list items that don't have a parameter */ |
3600
b2f245c26617
(svn r4491) - Codechange: handle IGT_LIST types just as the other types with a proper name and value setting (for example for newgrf parameters).
Darkvater
parents:
3599
diff
changeset
|
352 |
if (group->type == IGT_LIST && *item->value == '\0') { |
b2f245c26617
(svn r4491) - Codechange: handle IGT_LIST types just as the other types with a proper name and value setting (for example for newgrf parameters).
Darkvater
parents:
3599
diff
changeset
|
353 |
fprintf(f, "%s\n", item->name); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
354 |
} else { |
3600
b2f245c26617
(svn r4491) - Codechange: handle IGT_LIST types just as the other types with a proper name and value setting (for example for newgrf parameters).
Darkvater
parents:
3599
diff
changeset
|
355 |
fprintf(f, "%s = %s\n", item->name, item->value); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
356 |
} |
0 | 357 |
} |
358 |
} |
|
359 |
if (ini->comment) fputs(ini->comment, f); |
|
360 |
||
361 |
fclose(f); |
|
362 |
return true; |
|
363 |
} |
|
364 |
||
365 |
static void ini_free(IniFile *ini) |
|
366 |
{ |
|
367 |
pool_free(&ini->pool); |
|
368 |
} |
|
369 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
370 |
/** Find the index value of a ONEofMANY type in a string seperated by | |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
371 |
* @param many full domain of values the ONEofMANY setting can have |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
372 |
* @param one the current value of the setting for which a value needs found |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
373 |
* @param onelen force calculation of the *one parameter |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
374 |
* @return the integer index of the full-list, or -1 if not found */ |
0 | 375 |
static int lookup_oneofmany(const char *many, const char *one, int onelen) |
376 |
{ |
|
377 |
const char *s; |
|
378 |
int idx; |
|
379 |
||
380 |
if (onelen == -1) onelen = strlen(one); |
|
381 |
||
382 |
// check if it's an integer |
|
383 |
if (*one >= '0' && *one <= '9') |
|
384 |
return strtoul(one, NULL, 0); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
385 |
|
0 | 386 |
idx = 0; |
2952 | 387 |
for (;;) { |
0 | 388 |
// find end of item |
389 |
s = many; |
|
390 |
while (*s != '|' && *s != 0) s++; |
|
391 |
if (s - many == onelen && !memcmp(one, many, onelen)) return idx; |
|
392 |
if (*s == 0) return -1; |
|
393 |
many = s + 1; |
|
394 |
idx++; |
|
395 |
} |
|
396 |
} |
|
397 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
398 |
/** Find the set-integer value MANYofMANY type in a string |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
399 |
* @param many full domain of values the MANYofMANY setting can have |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
400 |
* @param str the current string value of the setting, each individual |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
401 |
* of seperated by a whitespace\tab or | character |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
402 |
* @return the 'fully' set integer, or -1 if a set is not found */ |
0 | 403 |
static uint32 lookup_manyofmany(const char *many, const char *str) |
404 |
{ |
|
405 |
const char *s; |
|
406 |
int r; |
|
407 |
uint32 res = 0; |
|
408 |
||
2952 | 409 |
for (;;) { |
0 | 410 |
// skip "whitespace" |
411 |
while (*str == ' ' || *str == '\t' || *str == '|') str++; |
|
412 |
if (*str == 0) break; |
|
413 |
||
414 |
s = str; |
|
415 |
while (*s != 0 && *s != ' ' && *s != '\t' && *s != '|') s++; |
|
416 |
||
417 |
r = lookup_oneofmany(many, str, s - str); |
|
418 |
if (r == -1) return (uint32)-1; |
|
419 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
420 |
SETBIT(res, r); // value found, set it |
0 | 421 |
if (*s == 0) break; |
422 |
str = s + 1; |
|
423 |
} |
|
424 |
return res; |
|
425 |
} |
|
426 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
427 |
/** Parse an integerlist string and set each found value |
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
428 |
* @param p the string to be parsed. Each element in the list is seperated by a |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
429 |
* comma or a space character |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
430 |
* @param items pointer to the integerlist-array that will be filled with values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
431 |
* @param maxitems the maximum number of elements the integerlist-array has |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
432 |
* @return returns the number of items found, or -1 on an error */ |
0 | 433 |
static int parse_intlist(const char *p, int *items, int maxitems) |
434 |
{ |
|
435 |
int n = 0, v; |
|
436 |
char *end; |
|
437 |
||
2952 | 438 |
for (;;) { |
0 | 439 |
v = strtol(p, &end, 0); |
440 |
if (p == end || n == maxitems) return -1; |
|
441 |
p = end; |
|
442 |
items[n++] = v; |
|
3598
a02daaf41761
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
443 |
if (*p == '\0') break; |
3599
c09257ed88f8
(svn r4490) - Feature: The integer-list parser now accepts a space character as an item seperator next to the comma.
Darkvater
parents:
3598
diff
changeset
|
444 |
if (*p != ',' && *p != ' ') return -1; |
0 | 445 |
p++; |
446 |
} |
|
447 |
||
448 |
return n; |
|
449 |
} |
|
450 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
451 |
/** Load parsed string-values into an integer-array (intlist) |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
452 |
* @param str the string that contains the values (and will be parsed) |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
453 |
* @param array pointer to the integer-arrays that will be filled |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
454 |
* @param nelems the number of elements the array holds. Maximum is 64 elements |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
455 |
* @param type the type of elements the array holds (eg INT8, UINT16, etc.) |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
456 |
* @return return true on success and false on error */ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
457 |
static bool load_intlist(const char *str, void *array, int nelems, VarType type) |
0 | 458 |
{ |
459 |
int items[64]; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
460 |
int i, nitems; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
461 |
|
0 | 462 |
if (str == NULL) { |
463 |
memset(items, 0, sizeof(items)); |
|
464 |
nitems = nelems; |
|
465 |
} else { |
|
466 |
nitems = parse_intlist(str, items, lengthof(items)); |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
467 |
if (nitems != nelems) return false; |
0 | 468 |
} |
469 |
||
2952 | 470 |
switch (type) { |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
471 |
case SLE_VAR_BL: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
472 |
case SLE_VAR_I8: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
473 |
case SLE_VAR_U8: |
2952 | 474 |
for (i = 0; i != nitems; i++) ((byte*)array)[i] = items[i]; |
0 | 475 |
break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
476 |
case SLE_VAR_I16: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
477 |
case SLE_VAR_U16: |
2952 | 478 |
for (i = 0; i != nitems; i++) ((uint16*)array)[i] = items[i]; |
0 | 479 |
break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
480 |
case SLE_VAR_I32: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
481 |
case SLE_VAR_U32: |
2952 | 482 |
for (i = 0; i != nitems; i++) ((uint32*)array)[i] = items[i]; |
0 | 483 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
484 |
default: NOT_REACHED(); |
0 | 485 |
} |
486 |
||
487 |
return true; |
|
488 |
} |
|
489 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
490 |
/** Convert an integer-array (intlist) to a string representation. Each value |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
491 |
* is seperated by a comma or a space character |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
492 |
* @param buf output buffer where the string-representation will be stored |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
493 |
* @param array pointer to the integer-arrays that is read from |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
494 |
* @param nelems the number of elements the array holds. |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
495 |
* @param type the type of elements the array holds (eg INT8, UINT16, etc.) */ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
496 |
static void make_intlist(char *buf, const void *array, int nelems, VarType type) |
0 | 497 |
{ |
498 |
int i, v = 0; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
499 |
const byte *p = (const byte*)array; |
2952 | 500 |
|
501 |
for (i = 0; i != nelems; i++) { |
|
502 |
switch (type) { |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
503 |
case SLE_VAR_BL: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
504 |
case SLE_VAR_I8: v = *(int8*)p; p += 1; break; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
505 |
case SLE_VAR_U8: v = *(byte*)p; p += 1; break; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
506 |
case SLE_VAR_I16: v = *(int16*)p; p += 2; break; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
507 |
case SLE_VAR_U16: v = *(uint16*)p; p += 2; break; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
508 |
case SLE_VAR_I32: v = *(int32*)p; p += 4; break; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
509 |
case SLE_VAR_U32: v = *(uint32*)p; p += 4; break; |
0 | 510 |
default: NOT_REACHED(); |
511 |
} |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
512 |
buf += sprintf(buf, (i == 0) ? "%d" : ",%d", v); |
0 | 513 |
} |
514 |
} |
|
515 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
516 |
/** Convert a ONEofMANY structure to a string representation. |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
517 |
* @param buf output buffer where the string-representation will be stored |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
518 |
* @param many the full-domain string of possible values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
519 |
* @param id the value of the variable and whose string-representation must be found */ |
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
520 |
static void make_oneofmany(char *buf, const char *many, int id) |
0 | 521 |
{ |
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
522 |
int orig_id = id; |
0 | 523 |
|
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
524 |
// Look for the id'th element |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
525 |
while (--id >= 0) { |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
526 |
for (; *many != '|'; many++) { |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
527 |
if (*many == '\0') { // not found |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
528 |
sprintf(buf, "%d", orig_id); |
0 | 529 |
return; |
530 |
} |
|
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
531 |
} |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
532 |
many++; // pass the |-character |
0 | 533 |
} |
534 |
||
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
535 |
// copy string until next item (|) or the end of the list if this is the last one |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
536 |
while (*many != '\0' && *many != '|') *buf++ = *many++; |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
537 |
*buf = '\0'; |
0 | 538 |
} |
539 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
540 |
/** Convert a MANYofMANY structure to a string representation. |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
541 |
* @param buf output buffer where the string-representation will be stored |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
542 |
* @param many the full-domain string of possible values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
543 |
* @param x the value of the variable and whose string-representation must |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
544 |
* be found in the bitmasked many string */ |
0 | 545 |
static void make_manyofmany(char *buf, const char *many, uint32 x) |
546 |
{ |
|
547 |
const char *start; |
|
548 |
int i = 0; |
|
549 |
bool init = true; |
|
550 |
||
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
551 |
for (; x != 0; x >>= 1, i++) { |
0 | 552 |
start = many; |
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
553 |
while (*many != 0 && *many != '|') many++; // advance to the next element |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
554 |
|
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
555 |
if (HASBIT(x, 0)) { // item found, copy it |
0 | 556 |
if (!init) *buf++ = '|'; |
557 |
init = false; |
|
558 |
if (start == many) { |
|
559 |
buf += sprintf(buf, "%d", i); |
|
560 |
} else { |
|
561 |
memcpy(buf, start, many - start); |
|
562 |
buf += many - start; |
|
563 |
} |
|
564 |
} |
|
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
565 |
|
0 | 566 |
if (*many == '|') many++; |
2973
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
567 |
} |
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
568 |
|
454819aa8fe0
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
569 |
*buf = '\0'; |
0 | 570 |
} |
571 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
572 |
/** Convert a string representation (external) of a setting to the internal rep. |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
573 |
* @param desc SettingDesc struct that holds all information about the variable |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
574 |
* @param str input string that will be parsed based on the type of desc |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
575 |
* @return return the parsed value of the setting */ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
576 |
static const void *string_to_val(const SettingDescBase *desc, const char *str) |
0 | 577 |
{ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
578 |
switch (desc->cmd) { |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
579 |
case SDT_NUMX: { |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
580 |
char *end; |
2991
8a6e9bfa2f2f
(svn r3567) -Fix: for once and for all, use 'unsigned long' if you want to cast something
truelight
parents:
2975
diff
changeset
|
581 |
unsigned long val = strtoul(str, &end, 0); |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
582 |
if (*end != '\0') ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name); |
0 | 583 |
return (void*)val; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
584 |
} |
0 | 585 |
case SDT_ONEOFMANY: { |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
586 |
long r = lookup_oneofmany(desc->many, str, -1); |
0 | 587 |
if (r != -1) return (void*)r; |
588 |
ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); |
|
589 |
return 0; |
|
590 |
} |
|
591 |
case SDT_MANYOFMANY: { |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
592 |
unsigned long r = lookup_manyofmany(desc->many, str); |
2923
f4d43b8c6a40
(svn r3479) -Fix: fixed warnings on 64bit platforms (anyway, most 64bit platforms)
truelight
parents:
2919
diff
changeset
|
593 |
if (r != (unsigned long)-1) return (void*)r; |
0 | 594 |
ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); |
595 |
return 0; |
|
596 |
} |
|
597 |
case SDT_BOOLX: |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
598 |
if (strcmp(str, "true") == 0 || strcmp(str, "on") == 0 || strcmp(str, "1") == 0) |
0 | 599 |
return (void*)true; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
600 |
if (strcmp(str, "false") == 0 || strcmp(str, "off") == 0 || strcmp(str, "0") == 0) |
0 | 601 |
return (void*)false; |
602 |
ShowInfoF("ini: invalid setting value '%s' for '%s'", str, desc->name); |
|
603 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
604 |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
605 |
case SDT_STRING: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
606 |
case SDT_INTLIST: return str; |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
607 |
default: break; |
0 | 608 |
} |
609 |
||
610 |
return NULL; |
|
611 |
} |
|
612 |
||
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
613 |
/** Set the value of a setting and if needed clamp the value to |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
614 |
* the preset minimum and maximum. |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
615 |
* @param ptr the variable itself |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
616 |
* @param sd pointer to the 'information'-database of the variable |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
617 |
* @param val signed long version of the new value |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
618 |
* @pre SettingDesc is of type SDT_BOOLX, SDT_NUMX, |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
619 |
* SDT_ONEOFMANY or SDT_MANYOFMANY. Other types are not supported as of now */ |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
620 |
static void Write_ValidateSetting(void *ptr, const SettingDesc *sd, int32 val) |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
621 |
{ |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
622 |
const SettingDescBase *sdb = &sd->desc; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
623 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
624 |
if (sdb->cmd != SDT_BOOLX && |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
625 |
sdb->cmd != SDT_NUMX && |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
626 |
sdb->cmd != SDT_ONEOFMANY && |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
627 |
sdb->cmd != SDT_MANYOFMANY) { |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
628 |
return; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
629 |
} |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
630 |
|
24c7e92baa31
(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
parents:
3112
diff
changeset
|
631 |
/* We cannot know the maximum value of a bitset variable, so just have faith */ |
3352
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
632 |
if (sdb->cmd != SDT_MANYOFMANY) { |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
633 |
/* We need to take special care of the uint32 type as we receive from the function |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
634 |
* a signed integer. While here also bail out on 64-bit settings as those are not |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
635 |
* supported. Unsigned 8 and 16-bit variables are safe since they fit into a signed |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
636 |
* 32-bit variable |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
637 |
* TODO: Support 64-bit settings/variables */ |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
638 |
switch (GetVarMemType(sd->save.conv)) { |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
639 |
case SLE_VAR_BL: |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
640 |
case SLE_VAR_I8: |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
641 |
case SLE_VAR_U8: |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
642 |
case SLE_VAR_I16: |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
643 |
case SLE_VAR_U16: |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
644 |
case SLE_VAR_I32: { |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
645 |
/* Override the minimum value. No value below sdb->min, except special value 0 */ |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
646 |
int32 min = ((sdb->flags & SGF_0ISDISABLED) && val <= sdb->min) ? 0 : sdb->min; |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
647 |
val = clamp(val, min, sdb->max); |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
648 |
} break; |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
649 |
case SLE_VAR_U32: { |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
650 |
/* Override the minimum value. No value below sdb->min, except special value 0 */ |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
651 |
uint min = ((sdb->flags & SGF_0ISDISABLED) && (uint)val <= (uint)sdb->min) ? 0 : sdb->min; |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
652 |
WriteValue(ptr, SLE_VAR_U32, (int64)clampu(val, min, sdb->max)); |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
653 |
return; |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
654 |
} |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
655 |
case SLE_VAR_I64: |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
656 |
case SLE_VAR_U64: |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
657 |
default: NOT_REACHED(); break; |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
658 |
} |
99e5e3634e9d
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Darkvater
parents:
3342
diff
changeset
|
659 |
} |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
660 |
|
24c7e92baa31
(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
parents:
3112
diff
changeset
|
661 |
WriteValue(ptr, sd->save.conv, (int64)val); |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
662 |
} |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
663 |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
664 |
/** Load values from a group of an IniFile structure into the internal representation |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
665 |
* @param ini pointer to IniFile structure that holds administrative information |
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
666 |
* @param sd pointer to SettingDesc structure whose internally pointed variables will |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
667 |
* be given values |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
668 |
* @param grpname the group of the IniFile to search in for the new values */ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
669 |
static void ini_load_settings(IniFile *ini, const SettingDesc *sd, const char *grpname, void *object) |
0 | 670 |
{ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
671 |
IniGroup *group; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
672 |
IniGroup *group_def = ini_getgroup(ini, grpname, -1); |
0 | 673 |
IniItem *item; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
193
diff
changeset
|
674 |
const void *p; |
0 | 675 |
void *ptr; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
676 |
const char *s; |
0 | 677 |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
678 |
for (; sd->save.cmd != SL_END; sd++) { |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
679 |
const SettingDescBase *sdb = &sd->desc; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
680 |
const SaveLoad *sld = &sd->save; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
681 |
|
3117
4c9e8842598e
(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
parents:
3116
diff
changeset
|
682 |
if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue; |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
683 |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
684 |
// XXX - wtf is this?? (group override?) |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
685 |
s = strchr(sdb->name, '.'); |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
686 |
if (s != NULL) { |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
687 |
group = ini_getgroup(ini, sdb->name, s - sdb->name); |
0 | 688 |
s++; |
689 |
} else { |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
690 |
s = sdb->name; |
0 | 691 |
group = group_def; |
692 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
693 |
|
0 | 694 |
item = ini_getitem(group, s, false); |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
695 |
p = (item == NULL) ? sdb->def : string_to_val(sdb, item->value); |
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
696 |
ptr = GetVariableAddress(object, sld); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
697 |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
698 |
switch (sdb->cmd) { |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
699 |
case SDT_BOOLX: /* All four are various types of (integer) numbers */ |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
700 |
case SDT_NUMX: |
0 | 701 |
case SDT_ONEOFMANY: |
702 |
case SDT_MANYOFMANY: |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
703 |
Write_ValidateSetting(ptr, sd, (unsigned long)p); break; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
704 |
|
24c7e92baa31
(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
parents:
3112
diff
changeset
|
705 |
case SDT_STRING: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
706 |
switch (GetVarMemType(sld->conv)) { |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
707 |
case SLE_VAR_STRB: |
4255
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
708 |
case SLE_VAR_STRBQ: |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
709 |
if (p != NULL) ttd_strlcpy((char*)ptr, (const char*)p, sld->length); |
4255
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
710 |
break; |
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
711 |
case SLE_VAR_STR: |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
712 |
case SLE_VAR_STRQ: |
4255
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
713 |
if (p != NULL) { |
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
714 |
free(*(char**)ptr); |
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
715 |
*(char**)ptr = strdup((const char*)p); |
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
716 |
} |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
717 |
break; |
3192
ad4404f6d03d
(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
parents:
3152
diff
changeset
|
718 |
case SLE_VAR_CHAR: *(char*)ptr = *(char*)p; break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
719 |
default: NOT_REACHED(); break; |
0 | 720 |
} |
721 |
break; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
722 |
|
0 | 723 |
case SDT_INTLIST: { |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
724 |
if (!load_intlist((const char*)p, ptr, sld->length, GetVarMemType(sld->conv))) |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
725 |
ShowInfoF("ini: error in array '%s'", sdb->name); |
0 | 726 |
break; |
727 |
} |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
728 |
default: NOT_REACHED(); break; |
0 | 729 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
730 |
} |
0 | 731 |
} |
732 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
733 |
/** Save the values of settings to the inifile. |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
734 |
* @param ini pointer to IniFile structure |
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
735 |
* @param sd read-only SettingDesc structure which contains the unmodified, |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
736 |
* loaded values of the configuration file and various information about it |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
737 |
* @param grpname holds the name of the group (eg. [network]) where these will be saved |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
738 |
* The function works as follows: for each item in the SettingDesc structure we |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
739 |
* have a look if the value has changed since we started the game (the original |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
740 |
* values are reloaded when saving). If settings indeed have changed, we get |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
741 |
* these and save them. |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
742 |
*/ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
743 |
static void ini_save_settings(IniFile *ini, const SettingDesc *sd, const char *grpname, void *object) |
0 | 744 |
{ |
745 |
IniGroup *group_def = NULL, *group; |
|
746 |
IniItem *item; |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
747 |
char buf[512]; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
748 |
const char *s; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
193
diff
changeset
|
749 |
void *ptr; |
0 | 750 |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
751 |
for (; sd->save.cmd != SL_END; sd++) { |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
752 |
const SettingDescBase *sdb = &sd->desc; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
753 |
const SaveLoad *sld = &sd->save; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
754 |
|
24c7e92baa31
(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
parents:
3112
diff
changeset
|
755 |
/* If the setting is not saved to the configuration |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
756 |
* file, just continue with the next setting */ |
3117
4c9e8842598e
(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
parents:
3116
diff
changeset
|
757 |
if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
758 |
if (sld->conv & SLF_CONFIG_NO) continue; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
759 |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
760 |
// XXX - wtf is this?? (group override?) |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
761 |
s = strchr(sdb->name, '.'); |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
762 |
if (s != NULL) { |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
763 |
group = ini_getgroup(ini, sdb->name, s - sdb->name); |
0 | 764 |
s++; |
765 |
} else { |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
766 |
if (group_def == NULL) group_def = ini_getgroup(ini, grpname, -1); |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
767 |
s = sdb->name; |
0 | 768 |
group = group_def; |
769 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
770 |
|
0 | 771 |
item = ini_getitem(group, s, true); |
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
772 |
ptr = GetVariableAddress(object, sld); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
773 |
|
0 | 774 |
if (item->value != NULL) { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
775 |
// check if the value is the same as the old value |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
776 |
const void *p = string_to_val(sdb, item->value); |
0 | 777 |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
778 |
/* The main type of a variable/setting is in bytes 8-15 |
4549
106ed18a7675
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4511
diff
changeset
|
779 |
* The subtype (what kind of numbers do we have there) is in 0-7 */ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
780 |
switch (sdb->cmd) { |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
781 |
case SDT_BOOLX: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
782 |
case SDT_NUMX: |
0 | 783 |
case SDT_ONEOFMANY: |
784 |
case SDT_MANYOFMANY: |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
785 |
switch (GetVarMemType(sld->conv)) { |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
786 |
case SLE_VAR_BL: |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
787 |
if (*(bool*)ptr == (p != NULL)) continue; |
5066
04e428f911be
(svn r7124) -Fix (r37xx): sizeof(bool) = 4 for (certain) OSX do not assume it is 1. This would break
Darkvater
parents:
5052
diff
changeset
|
788 |
break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
789 |
case SLE_VAR_I8: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
790 |
case SLE_VAR_U8: |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
791 |
if (*(byte*)ptr == (byte)(unsigned long)p) continue; |
0 | 792 |
break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
793 |
case SLE_VAR_I16: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
794 |
case SLE_VAR_U16: |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
795 |
if (*(uint16*)ptr == (uint16)(unsigned long)p) continue; |
0 | 796 |
break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
797 |
case SLE_VAR_I32: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
798 |
case SLE_VAR_U32: |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
799 |
if (*(uint32*)ptr == (uint32)(unsigned long)p) continue; |
0 | 800 |
break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
801 |
default: NOT_REACHED(); |
0 | 802 |
} |
803 |
break; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
804 |
default: break; /* Assume the other types are always changed */ |
0 | 805 |
} |
806 |
} |
|
807 |
||
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
808 |
/* Value has changed, get the new value and put it into a buffer */ |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
809 |
switch (sdb->cmd) { |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
810 |
case SDT_BOOLX: |
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
811 |
case SDT_NUMX: |
0 | 812 |
case SDT_ONEOFMANY: |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
813 |
case SDT_MANYOFMANY: { |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
814 |
uint32 i = (uint32)ReadValue(ptr, sld->conv); |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
815 |
|
24c7e92baa31
(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
parents:
3112
diff
changeset
|
816 |
switch (sdb->cmd) { |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
817 |
case SDT_BOOLX: strcpy(buf, (i != 0) ? "true" : "false"); break; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
818 |
case SDT_NUMX: sprintf(buf, IsSignedVarMemType(sld->conv) ? "%d" : "%u", i); break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
819 |
case SDT_ONEOFMANY: make_oneofmany(buf, sdb->many, i); break; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
820 |
case SDT_MANYOFMANY: make_manyofmany(buf, sdb->many, i); break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
821 |
default: NOT_REACHED(); |
0 | 822 |
} |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
823 |
} break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
824 |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
825 |
case SDT_STRING: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
826 |
switch (GetVarMemType(sld->conv)) { |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
827 |
case SLE_VAR_STRB: strcpy(buf, (char*)ptr); break; |
4255
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
828 |
case SLE_VAR_STRBQ:sprintf(buf, "\"%s\"", (char*)ptr); break; |
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
829 |
case SLE_VAR_STR: strcpy(buf, *(char**)ptr); break; |
e550bf3de1c8
(svn r5871) -Feature: Add a possibility to handle pointer strings without a buffer from the configuration file. Handy for variables that will never be changed during runtime
Darkvater
parents:
4143
diff
changeset
|
830 |
case SLE_VAR_STRQ: sprintf(buf, "\"%s\"", *(char**)ptr); break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
831 |
case SLE_VAR_CHAR: sprintf(buf, "\"%c\"", *(char*)ptr); break; |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
832 |
default: NOT_REACHED(); |
0 | 833 |
} |
834 |
break; |
|
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
835 |
|
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
836 |
case SDT_INTLIST: |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
837 |
make_intlist(buf, ptr, sld->length, GetVarMemType(sld->conv)); |
0 | 838 |
break; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
839 |
default: NOT_REACHED(); |
0 | 840 |
} |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
841 |
|
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
842 |
/* The value is different, that means we have to write it to the ini */ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
843 |
item->value = (char*)pool_strdup(&ini->pool, buf, strlen(buf)); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
844 |
} |
0 | 845 |
} |
846 |
||
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
847 |
/** Loads all items from a 'grpname' section into a list |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
848 |
* The list parameter can be a NULL pointer, in this case nothing will be |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
849 |
* saved and a callback function should be defined that will take over the |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
850 |
* list-handling and store the data itself somewhere. |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
851 |
* @param IniFile handle to the ini file with the source data |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
852 |
* @param grpname character string identifying the section-header of the ini |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
853 |
* file that will be parsed |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
854 |
* @param list pointer to an string(pointer) array that will store the parsed |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
855 |
* entries of the given section |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
856 |
* @param len the maximum number of items available for the above list |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
857 |
* @param proc callback function that can override how the values are stored |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
858 |
* inside the list */ |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
859 |
static void ini_load_setting_list(IniFile *ini, const char *grpname, char **list, uint len, SettingListCallbackProc proc) |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
860 |
{ |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
861 |
IniGroup *group = ini_getgroup(ini, grpname, -1); |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
862 |
IniItem *item; |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
863 |
const char *entry; |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
864 |
uint i, j; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
865 |
|
24c7e92baa31
(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
parents:
3112
diff
changeset
|
866 |
if (group == NULL) return; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
867 |
|
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
868 |
for (i = j = 0, item = group->item; item != NULL; item = item->next) { |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
869 |
entry = (proc != NULL) ? proc(item, i++) : item->name; |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
870 |
|
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
871 |
if (entry == NULL || list == NULL) continue; |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
872 |
|
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
873 |
if (j == len) break; |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
874 |
list[j++] = strdup(entry); |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
875 |
} |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
876 |
} |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
877 |
|
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
878 |
/** Saves all items from a list into the 'grpname' section |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
879 |
* The list parameter can be a NULL pointer, in this case a callback function |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
880 |
* should be defined that will provide the source data to be saved. |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
881 |
* @param IniFile handle to the ini file where the destination data is saved |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
882 |
* @param grpname character string identifying the section-header of the ini file |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
883 |
* @param list pointer to an string(pointer) array that will be used as the |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
884 |
* source to be saved into the relevant ini section |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
885 |
* @param len the maximum number of items available for the above list |
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
886 |
* @param proc callback function that can will provide the source data if defined */ |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
887 |
static void ini_save_setting_list(IniFile *ini, const char *grpname, char **list, uint len, SettingListCallbackProc proc) |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
888 |
{ |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
889 |
IniGroup *group = ini_getgroup(ini, grpname, -1); |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
890 |
IniItem *item = NULL; |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
891 |
const char *entry; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
892 |
uint i; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
893 |
bool first = true; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
894 |
|
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
895 |
if (proc == NULL && list == NULL) return; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
896 |
if (group == NULL) return; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
897 |
group->item = NULL; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
898 |
|
24c7e92baa31
(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
parents:
3112
diff
changeset
|
899 |
for (i = 0; i != len; i++) { |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
900 |
entry = (proc != NULL) ? proc(NULL, i) : list[i]; |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
901 |
|
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
902 |
if (entry == NULL || *entry == '\0') continue; |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
903 |
|
24c7e92baa31
(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
parents:
3112
diff
changeset
|
904 |
if (first) { // add first item to the head of the group |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
905 |
item = ini_item_alloc(group, entry, strlen(entry)); |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
906 |
item->value = item->name; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
907 |
group->item = item; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
908 |
first = false; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
909 |
} else { // all other items are attached to the previous one |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
910 |
item->next = ini_item_alloc(group, entry, strlen(entry)); |
3115
24c7e92baa31
(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
parents:
3112
diff
changeset
|
911 |
item = item->next; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
912 |
item->value = item->name; |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
913 |
} |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
914 |
} |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
915 |
} |
24c7e92baa31
(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
parents:
3112
diff
changeset
|
916 |
|
0 | 917 |
//*************************** |
2972
1eacb2fc37ae
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
918 |
// OTTD specific INI stuff |
0 | 919 |
//*************************** |
920 |
||
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
921 |
/** Settings-macro usage: |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
922 |
* The list might look daunting at first, but is in general easy to understand. |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
923 |
* We have two types of list: |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
924 |
* 1. SDTG_something |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
925 |
* 2. SDT_something |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
926 |
* The 'G' stands for global, so this is the one you will use for a |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
927 |
* SettingDescGlobVarList section meaning global variables. The other uses a |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
928 |
* Base/Offset and runtime variable selection mechanism, known from the saveload * convention (it also has global so it should not be hard). |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
929 |
* Of each type there are again two versions, the normal one and one prefixed |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
930 |
* with 'COND'. |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
931 |
* COND means that the setting is only valid in certain savegame versions |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
932 |
* (since patches are saved to the savegame, this bookkeeping is necessary. |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
933 |
* Now there are a lot of types. Easy ones are: |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
934 |
* - VAR: any number type, 'type' field specifies what number. eg int8 or uint32 |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
935 |
* - BOOL: a boolean number type |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
936 |
* - STR: a string or character. 'type' field specifies what string. Normal, string, or quoted |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
937 |
* A bit more difficult to use are MMANY (meaning ManyOfMany) and OMANY (OneOfMany) |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
938 |
* These are actually normal numbers, only bitmasked. In MMANY several bits can |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
939 |
* be set, in the other only one. |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
940 |
* The most complex type is INTLIST. This is basically an array of numbers. If |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
941 |
* the intlist is only valid in certain savegame versions because for example |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
942 |
* it has grown in size its length cannot be automatically be calculated so |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
943 |
* use SDT(G)_CONDLISTO() meaning Old. |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
944 |
* If nothing fits you, you can use the GENERAL macros, but it exposes the |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
945 |
* internal structure somewhat so it needs a little looking. There are _NULL() |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
946 |
* macros as well, these fill up space so you can add more patches there (in |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
947 |
* place) and you DON'T have to increase the savegame version. */ |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
948 |
|
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
949 |
#define NSD_GENERAL(name, def, cmd, guiflags, min, max, interval, many, str, proc)\ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
950 |
{name, (const void*)(def), {cmd}, {guiflags}, min, max, interval, many, str, proc} |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
951 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
952 |
/* Macros for various objects to go in the configuration file. |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
953 |
* This section is for global variables */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
954 |
#define SDTG_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, var, length, def, min, max, interval, full, str, proc, from, to)\ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
955 |
{NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, proc), SLEG_GENERAL(sle_cmd, var, type | flags, length, from, to)} |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
956 |
|
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
957 |
#define SDTG_CONDVAR(name, type, flags, guiflags, var, def, min, max, interval, str, proc, from, to)\ |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
958 |
SDTG_GENERAL(name, SDT_NUMX, SL_VAR, type, flags, guiflags, var, 0, def, min, max, interval, NULL, str, proc, from, to) |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
959 |
#define SDTG_VAR(name, type, flags, guiflags, var, def, min, max, interval, str, proc)\ |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
960 |
SDTG_CONDVAR(name, type, flags, guiflags, var, def, min, max, interval, str, proc, 0, SL_MAX_VERSION) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
961 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
962 |
#define SDTG_CONDBOOL(name, flags, guiflags, var, def, str, proc, from, to)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
963 |
SDTG_GENERAL(name, SDT_BOOLX, SL_VAR, SLE_UINT8, flags, guiflags, var, 0, def, 0, 1, 0, NULL, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
964 |
#define SDTG_BOOL(name, flags, guiflags, var, def, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
965 |
SDTG_CONDBOOL(name, flags, guiflags, var, def, str, proc, 0, SL_MAX_VERSION) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
966 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
967 |
#define SDTG_CONDLIST(name, type, length, flags, guiflags, var, def, str, proc, from, to)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
968 |
SDTG_GENERAL(name, SDT_INTLIST, SL_ARR, type, flags, guiflags, var, length, def, 0, 0, 0, NULL, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
969 |
#define SDTG_LIST(name, type, flags, guiflags, var, def, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
970 |
SDTG_GENERAL(name, SDT_INTLIST, SL_ARR, type, flags, guiflags, var, lengthof(var), def, 0, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
971 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
972 |
#define SDTG_CONDSTR(name, type, length, flags, guiflags, var, def, str, proc, from, to)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
973 |
SDTG_GENERAL(name, SDT_STRING, SL_STR, type, flags, guiflags, var, length, def, 0, 0, 0, NULL, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
974 |
#define SDTG_STR(name, type, flags, guiflags, var, def, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
975 |
SDTG_GENERAL(name, SDT_STRING, SL_STR, type, flags, guiflags, var, lengthof(var), def, 0, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
976 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
977 |
#define SDTG_CONDOMANY(name, type, flags, guiflags, var, def, max, full, str, proc, from, to)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
978 |
SDTG_GENERAL(name, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, var, 0, def, 0, max, 0, full, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
979 |
#define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
980 |
SDTG_CONDOMANY(name, type, flags, guiflags, var, def, max full, str, proc, 0, SL_MAX_VERSION) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
981 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
982 |
#define SDTG_CONDMMANY(name, type, flags, guiflags, var, def, full, str, proc, from, to)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
983 |
SDTG_GENERAL(name, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, var, 0, def, 0, 0, 0, full, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
984 |
#define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
985 |
SDTG_CONDMMANY(name, type, flags, guiflags, var, def, full, str, proc, 0, SL_MAX_VERSION) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
986 |
|
3222
6de22e06a1e9
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater
parents:
3210
diff
changeset
|
987 |
#define SDTG_CONDNULL(length, from, to)\ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
988 |
{{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL}, SLEG_CONDNULL(length, from, to)} |
3222
6de22e06a1e9
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater
parents:
3210
diff
changeset
|
989 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
990 |
#define SDTG_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL}, SLEG_END()} |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
991 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
992 |
/* Macros for various objects to go in the configuration file. |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
993 |
* This section is for structures where their various members are saved */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
994 |
#define SDT_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, base, var, length, def, min, max, interval, full, str, proc, from, to)\ |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
995 |
{NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, proc), SLE_GENERAL(sle_cmd, base, var, type | flags, length, from, to)} |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
996 |
|
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
997 |
#define SDT_CONDVAR(base, var, type, from, to, flags, guiflags, def, min, max, interval, str, proc)\ |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
998 |
SDT_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, base, var, 1, def, min, max, interval, NULL, str, proc, from, to) |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
999 |
#define SDT_VAR(base, var, type, flags, guiflags, def, min, max, interval, str, proc)\ |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1000 |
SDT_CONDVAR(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, min, max, interval, str, proc) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1001 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1002 |
#define SDT_CONDBOOL(base, var, from, to, flags, guiflags, def, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1003 |
SDT_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, base, var, 1, def, 0, 1, 0, NULL, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1004 |
#define SDT_BOOL(base, var, flags, guiflags, def, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1005 |
SDT_CONDBOOL(base, var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1006 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1007 |
#define SDT_CONDLIST(base, var, type, from, to, flags, guiflags, def, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1008 |
SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, NULL, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1009 |
#define SDT_LIST(base, var, type, flags, guiflags, def, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1010 |
SDT_CONDLIST(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1011 |
#define SDT_CONDLISTO(base, var, length, type, from, to, flags, guiflags, def, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1012 |
SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, length, def, 0, 0, 0, NULL, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1013 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1014 |
#define SDT_CONDSTR(base, var, type, from, to, flags, guiflags, def, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1015 |
SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, NULL, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1016 |
#define SDT_STR(base, var, type, flags, guiflags, def, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1017 |
SDT_CONDSTR(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1018 |
#define SDT_CONDSTRO(base, var, length, type, from, to, flags, def, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1019 |
SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, 0, base, var, length, def, 0, 0, NULL, str, proc, from, to) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1020 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1021 |
#define SDT_CONDCHR(base, var, from, to, flags, guiflags, def, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1022 |
SDT_GENERAL(#var, SDT_STRING, SL_VAR, SLE_CHAR, flags, guiflags, base, var, 1, def, 0, 0, 0, NULL, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1023 |
#define SDT_CHR(base, var, flags, guiflags, def, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1024 |
SDT_CONDCHR(base, var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1025 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1026 |
#define SDT_CONDOMANY(base, var, type, from, to, flags, guiflags, def, max, full, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1027 |
SDT_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, max, 0, full, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1028 |
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1029 |
SDT_CONDOMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, max, full, str, proc) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1030 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1031 |
#define SDT_CONDMMANY(base, var, type, from, to, flags, guiflags, def, full, str, proc)\ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1032 |
SDT_GENERAL(#var, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, 0, 0, full, str, proc, from, to) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1033 |
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, proc)\ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1034 |
SDT_CONDMMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, full, str, proc) |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1035 |
|
3222
6de22e06a1e9
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater
parents:
3210
diff
changeset
|
1036 |
#define SDT_CONDNULL(length, from, to)\ |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1037 |
{{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL}, SLE_CONDNULL(length, from, to)} |
3222
6de22e06a1e9
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater
parents:
3210
diff
changeset
|
1038 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1039 |
#define SDT_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL}, SLE_END()} |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1040 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1041 |
/* Shortcuts for macros below. Logically if we don't save the value |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1042 |
* we also don't sync it in a network game */ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1043 |
#define S SLF_SAVE_NO | SLF_NETWORK_NO |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1044 |
#define NS SLF_SAVE_NO |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1045 |
#define C SLF_CONFIG_NO |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1046 |
#define N SLF_NETWORK_NO |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1047 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1048 |
#define D0 SGF_0ISDISABLED |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1049 |
#define NC SGF_NOCOMMA |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1050 |
#define MS SGF_MULTISTRING |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1051 |
#define NO SGF_NETWORK_ONLY |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1052 |
#define CR SGF_CURRENCY |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1053 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1054 |
#include "table/strings.h" |
3131
b56514952c8c
(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
parents:
3125
diff
changeset
|
1055 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1056 |
/* Begin - Callback Functions for the various settings */ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1057 |
#include "window.h" |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1058 |
#include "gui.h" |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1059 |
#include "town.h" |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1060 |
#include "gfx.h" |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1061 |
// virtual PositionMainToolbar function, calls the right one. |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1062 |
static int32 v_PositionMainToolbar(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1063 |
{ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1064 |
if (_game_mode != GM_MENU) PositionMainToolbar(NULL); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1065 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1066 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1067 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1068 |
static int32 AiNew_PatchActive_Warning(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1069 |
{ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1070 |
if (p1 == 1) ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_ACTIVATED, 0, 0); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1071 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1072 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1073 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1074 |
static int32 Ai_In_Multiplayer_Warning(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1075 |
{ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1076 |
if (p1 == 1) { |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1077 |
ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_MULTIPLAYER, 0, 0); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1078 |
_patches.ainew_active = true; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1079 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1080 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1081 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1082 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1083 |
static int32 PopulationInLabelActive(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1084 |
{ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1085 |
Town* t; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1086 |
|
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
1087 |
FOR_ALL_TOWNS(t) UpdateTownVirtCoord(t); |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
1088 |
|
3131
b56514952c8c
(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
parents:
3125
diff
changeset
|
1089 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1090 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1091 |
|
4082
6a21544873f0
(svn r5397) -Fix: Redraw the screen, when switching the signal side
tron
parents:
4077
diff
changeset
|
1092 |
static int32 RedrawScreen(int32 p1) |
3131
b56514952c8c
(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
parents:
3125
diff
changeset
|
1093 |
{ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1094 |
MarkWholeScreenDirty(); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1095 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1096 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1097 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1098 |
static int32 InValidateDetailsWindow(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1099 |
{ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1100 |
InvalidateWindowClasses(WC_VEHICLE_DETAILS); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1101 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1102 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1103 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1104 |
static int32 InvalidateStationBuildWindow(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1105 |
{ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1106 |
InvalidateWindow(WC_BUILD_STATION, 0); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1107 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1108 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1109 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1110 |
/* Check service intervals of vehicles, p1 is value of % or day based servicing */ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1111 |
static int32 CheckInterval(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1112 |
{ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1113 |
bool warning; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1114 |
const Patches *ptc = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1115 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1116 |
if (p1) { |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1117 |
warning = ( (IS_INT_INSIDE(ptc->servint_trains, 5, 90+1) || ptc->servint_trains == 0) && |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1118 |
(IS_INT_INSIDE(ptc->servint_roadveh, 5, 90+1) || ptc->servint_roadveh == 0) && |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1119 |
(IS_INT_INSIDE(ptc->servint_aircraft, 5, 90+1) || ptc->servint_aircraft == 0) && |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1120 |
(IS_INT_INSIDE(ptc->servint_ships, 5, 90+1) || ptc->servint_ships == 0) ); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1121 |
} else { |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1122 |
warning = ( (IS_INT_INSIDE(ptc->servint_trains, 30, 800+1) || ptc->servint_trains == 0) && |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1123 |
(IS_INT_INSIDE(ptc->servint_roadveh, 30, 800+1) || ptc->servint_roadveh == 0) && |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1124 |
(IS_INT_INSIDE(ptc->servint_aircraft, 30, 800+1) || ptc->servint_aircraft == 0) && |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1125 |
(IS_INT_INSIDE(ptc->servint_ships, 30, 800+1) || ptc->servint_ships == 0) ); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1126 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1127 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1128 |
if (!warning) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1129 |
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1130 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1131 |
return InValidateDetailsWindow(0); |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1132 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1133 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1134 |
static int32 EngineRenewUpdate(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1135 |
{ |
4661
89c3cbba9846
(svn r6544) - Codechange: Rename CmdReplaceVehicle to CmdSetAutoReplace, to reflect what it does.
peter1138
parents:
4616
diff
changeset
|
1136 |
DoCommandP(0, 0, _patches.autorenew, NULL, CMD_SET_AUTOREPLACE); |
3131
b56514952c8c
(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
parents:
3125
diff
changeset
|
1137 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1138 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1139 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1140 |
static int32 EngineRenewMonthsUpdate(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1141 |
{ |
4661
89c3cbba9846
(svn r6544) - Codechange: Rename CmdReplaceVehicle to CmdSetAutoReplace, to reflect what it does.
peter1138
parents:
4616
diff
changeset
|
1142 |
DoCommandP(0, 1, _patches.autorenew_months, NULL, CMD_SET_AUTOREPLACE); |
3131
b56514952c8c
(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
parents:
3125
diff
changeset
|
1143 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1144 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1145 |
|
b56514952c8c
(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
parents:
3125
diff
changeset
|
1146 |
static int32 EngineRenewMoneyUpdate(int32 p1) |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1147 |
{ |
4661
89c3cbba9846
(svn r6544) - Codechange: Rename CmdReplaceVehicle to CmdSetAutoReplace, to reflect what it does.
peter1138
parents:
4616
diff
changeset
|
1148 |
DoCommandP(0, 2, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE); |
3131
b56514952c8c
(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
parents:
3125
diff
changeset
|
1149 |
return 0; |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1150 |
} |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1151 |
/* End - Callback Functions */ |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1152 |
|
1584
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
1153 |
#ifndef EXTERNAL_PLAYER |
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
1154 |
#define EXTERNAL_PLAYER "timidity" |
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
1155 |
#endif |
7122e759d56c
(svn r2088) - Fix: [ 1155158 ] Make extmidi command a config option in addition to the compile-time MIDI switch. Patch by macbaine.
pasky
parents:
1500
diff
changeset
|
1156 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1157 |
static const SettingDesc _music_settings[] = { |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1158 |
SDT_VAR(MusicFileSettings, playlist, SLE_UINT8, S, 0, 0, 0, 5, 1, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1159 |
SDT_VAR(MusicFileSettings, music_vol, SLE_UINT8, S, 0, 128, 0, 100, 1, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1160 |
SDT_VAR(MusicFileSettings, effect_vol, SLE_UINT8, S, 0, 128, 0, 100, 1, STR_NULL, NULL), |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1161 |
SDT_LIST(MusicFileSettings, custom_1, SLE_UINT8, S, 0, NULL, STR_NULL, NULL), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1162 |
SDT_LIST(MusicFileSettings, custom_2, SLE_UINT8, S, 0, NULL, STR_NULL, NULL), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1163 |
SDT_BOOL(MusicFileSettings, playing, S, 0, true, STR_NULL, NULL), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1164 |
SDT_BOOL(MusicFileSettings, shuffle, S, 0, false, STR_NULL, NULL), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
1165 |
SDT_STR(MusicFileSettings, extmidi, SLE_STRB, S, 0, EXTERNAL_PLAYER, STR_NULL, NULL), |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1166 |
SDT_END() |
0 | 1167 |
}; |
1168 |
||
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1169 |
/* win32_v.c only settings */ |
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1170 |
#ifdef WIN32 |
4258
087d44b3514f
(svn r5874) -Feature [FS#234]: Remember the maximized state and restore on start. This also fixes a bug where a different resolution is chosen for a maximized window, but it retains the maximized flag. Only win32.
Darkvater
parents:
4255
diff
changeset
|
1171 |
extern bool _force_full_redraw, _double_size, _window_maximize; |
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1172 |
extern uint _display_hz, _fullscreen_bpp; |
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1173 |
|
3124
cf624337b649
(svn r3732) - Fix two warnings. Stupid MSVC didn't even complain :s (Thank Tron and peter1138)
Darkvater
parents:
3121
diff
changeset
|
1174 |
static const SettingDescGlobVarList _win32_settings[] = { |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1175 |
SDTG_VAR("display_hz", SLE_UINT, S, 0, _display_hz, 0, 0, 120, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1176 |
SDTG_BOOL("force_full_redraw", S, 0, _force_full_redraw,false, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1177 |
SDTG_VAR("fullscreen_bpp", SLE_UINT, S, 0, _fullscreen_bpp, 8, 8, 32, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1178 |
SDTG_BOOL("double_size", S, 0, _double_size, false, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1179 |
SDTG_BOOL("window_maximize", S, 0, _window_maximize, false, STR_NULL, NULL), |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1180 |
SDTG_END() |
0 | 1181 |
}; |
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1182 |
#endif /* WIN32 */ |
0 | 1183 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1184 |
static const SettingDescGlobVarList _misc_settings[] = { |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1185 |
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), |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1186 |
SDTG_VAR("news_display_opt", SLE_UINT, S, 0, _news_display_opt,0xAAAAAAAA,0,0xAAAAAAAA,0,STR_NULL, NULL), // default to all full messages: 10101010101010101010 = 0xAAAAAAAA |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1187 |
SDTG_BOOL("news_ticker_sound", S, 0, _news_ticker_sound, true, STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1188 |
SDTG_BOOL("fullscreen", S, 0, _fullscreen, false, STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1189 |
SDTG_STR("videodriver", SLE_STRB,C|S,0, _ini_videodriver, NULL, STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1190 |
SDTG_STR("musicdriver", SLE_STRB,C|S,0, _ini_musicdriver, NULL, STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1191 |
SDTG_STR("sounddriver", SLE_STRB,C|S,0, _ini_sounddriver, NULL, STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1192 |
SDTG_STR("language", SLE_STRB, S, 0, _dynlang.curr_file, NULL, STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1193 |
SDTG_LIST("resolution", SLE_UINT16, S, 0, _cur_resolution, "640,480", STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1194 |
SDTG_STR("screenshot_format",SLE_STRB, S, 0, _screenshot_format_name,NULL, STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1195 |
SDTG_STR("savegame_format", SLE_STRB, S, 0, _savegame_format, NULL, STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1196 |
SDTG_BOOL("rightclick_emulate", S, 0, _rightclick_emulate, false, STR_NULL, NULL), |
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
1197 |
#ifdef WITH_FREETYPE |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
1198 |
SDTG_STR("small_font", SLE_STRB, S, 0, _freetype.small_font, NULL, STR_NULL, NULL), |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
1199 |
SDTG_STR("medium_font", SLE_STRB, S, 0, _freetype.medium_font, NULL, STR_NULL, NULL), |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
1200 |
SDTG_STR("large_font", SLE_STRB, S, 0, _freetype.large_font, NULL, STR_NULL, NULL), |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
1201 |
SDTG_VAR("small_size", SLE_UINT, S, 0, _freetype.small_size, 6, 0, 72, 0, STR_NULL, NULL), |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
1202 |
SDTG_VAR("medium_size", SLE_UINT, S, 0, _freetype.medium_size, 10, 0, 72, 0, STR_NULL, NULL), |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
1203 |
SDTG_VAR("large_size", SLE_UINT, S, 0, _freetype.large_size, 16, 0, 72, 0, STR_NULL, NULL), |
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5107
diff
changeset
|
1204 |
#endif |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1205 |
SDTG_END() |
0 | 1206 |
}; |
1207 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1208 |
#ifdef ENABLE_NETWORK |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1209 |
static const SettingDescGlobVarList _network_settings[] = { |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1210 |
SDTG_VAR("sync_freq", SLE_UINT16,C|S,0, _network_sync_freq, 100, 0, 100, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1211 |
SDTG_VAR("frame_freq", SLE_UINT8,C|S,0, _network_frame_freq, 0, 0, 100, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1212 |
SDTG_VAR("max_join_time", SLE_UINT16, S, 0, _network_max_join_time, 500, 0, 32000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1213 |
SDTG_BOOL("pause_on_join", S, 0, _network_pause_on_join, true, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1214 |
SDTG_STR("server_bind_ip", SLE_STRB, S, 0, _network_server_bind_ip_host, "0.0.0.0", STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1215 |
SDTG_VAR("server_port", SLE_UINT16, S, 0, _network_server_port, NETWORK_DEFAULT_PORT, 0, 65535, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1216 |
SDTG_BOOL("server_advertise", S, 0, _network_advertise, false, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1217 |
SDTG_VAR("lan_internet", SLE_UINT8, S, 0, _network_lan_internet, 0, 0, 1, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1218 |
SDTG_STR("player_name", SLE_STRB, S, 0, _network_player_name, NULL, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1219 |
SDTG_STR("server_password", SLE_STRB, S, 0, _network_server_password, NULL, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1220 |
SDTG_STR("rcon_password", SLE_STRB, S, 0, _network_rcon_password, NULL, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1221 |
SDTG_STR("server_name", SLE_STRB, S, 0, _network_server_name, NULL, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1222 |
SDTG_STR("connect_to_ip", SLE_STRB, S, 0, _network_default_ip, NULL, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1223 |
SDTG_STR("network_id", SLE_STRB, S, 0, _network_unique_id, NULL, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1224 |
SDTG_BOOL("autoclean_companies", S, 0, _network_autoclean_companies, false, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1225 |
SDTG_VAR("autoclean_unprotected",SLE_UINT8, S, 0, _network_autoclean_unprotected,12, 0, 60, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1226 |
SDTG_VAR("autoclean_protected", SLE_UINT8, S, 0, _network_autoclean_protected, 36, 0, 180, 0, STR_NULL, NULL), |
4496
5201d305375e
(svn r6281) -Fix (r6186): three settings were accidently removed. Thanks go to Osai for reporting and providing the patch.
rubidium
parents:
4434
diff
changeset
|
1227 |
SDTG_VAR("max_companies", SLE_UINT8, S, 0, _network_game_info.companies_max, 8, 0, 8, 0, STR_NULL, NULL), |
5201d305375e
(svn r6281) -Fix (r6186): three settings were accidently removed. Thanks go to Osai for reporting and providing the patch.
rubidium
parents:
4434
diff
changeset
|
1228 |
SDTG_VAR("max_clients", SLE_UINT8, S, 0, _network_game_info.clients_max, 10, 0, 10, 0, STR_NULL, NULL), |
5201d305375e
(svn r6281) -Fix (r6186): three settings were accidently removed. Thanks go to Osai for reporting and providing the patch.
rubidium
parents:
4434
diff
changeset
|
1229 |
SDTG_VAR("max_spectators", SLE_UINT8, S, 0, _network_game_info.spectators_max, 10, 0, 10, 0, STR_NULL, NULL), |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1230 |
SDTG_VAR("restart_game_year", SLE_INT32, S,D0, _network_restart_game_year, 0, MIN_YEAR, MAX_YEAR, 1, STR_NULL, NULL), |
4716
8a05bf6d951d
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
peter1138
parents:
4661
diff
changeset
|
1231 |
SDTG_VAR("min_players", SLE_UINT8, S, 0, _network_min_players, 0, 0, 10, 0, STR_NULL, NULL), |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1232 |
SDTG_END() |
0 | 1233 |
}; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1234 |
#endif /* ENABLE_NETWORK */ |
0 | 1235 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1236 |
static const SettingDesc _gameopt_settings[] = { |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1237 |
/* In version 4 a new difficulty setting has been added to the difficulty settings, |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1238 |
* town attitude towards demolishing. Needs special handling because some dimwit thought |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1239 |
* it funny to have the GameDifficulty struct be an array while it is a struct of |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1240 |
* same-sized members |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1241 |
* XXX - To save file-space and since values are never bigger than about 10? only |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1242 |
* save the first 16 bits in the savegame. Question is why the values are still int32 |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1243 |
* and why not byte for example? */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1244 |
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, 0, 3), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1245 |
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, 4, SL_MAX_VERSION), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1246 |
SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9, 0, 9, 0, STR_NULL, NULL), |
5091
a7dfbe278c05
(svn r7160) -Feature [SF 1243657, 1171147]: Slovak/Brazil currency patch (gpsoft, klanticus)
Darkvater
parents:
5066
diff
changeset
|
1247 |
SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL), |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1248 |
SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1249 |
SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 20, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1250 |
SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "normal|hilly|desert|candy", STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1251 |
SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 1, 0, 56, 0, STR_NULL, NULL), |
3241
99a877e225a8
(svn r3915) - Savegame version 23: Do not save the autosave interval anymore with savegames. Some people should be very happe atm ;)
Darkvater
parents:
3240
diff
changeset
|
1252 |
SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22, N, 0, 0, 0, "", STR_NULL, NULL), |
99a877e225a8
(svn r3915) - Savegame version 23: Do not save the autosave interval anymore with savegames. Some people should be very happe atm ;)
Darkvater
parents:
3240
diff
changeset
|
1253 |
SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8,23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL), |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1254 |
SDT_OMANY(GameOptions, road_side, SLE_UINT8, 0, 0, 1, 1, "left|right", STR_NULL, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1255 |
SDT_END() |
0 | 1256 |
}; |
1257 |
||
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1258 |
/* Some patches do not need to be synchronised when playing in multiplayer. |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1259 |
* These include for example the GUI settings and will not be saved with the |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1260 |
* savegame. |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1261 |
* It is also a bit tricky since you would think that service_interval |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1262 |
* for example doesn't need to be synched. Every client assigns the |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1263 |
* service_interval value to the v->service_interval, meaning that every client |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1264 |
* assigns his value. If the setting was player-based, that would mean that |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1265 |
* vehicles could decide on different moments that they are heading back to a |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1266 |
* service depot, causing desyncs on a massive scale. */ |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1267 |
const SettingDesc _patch_settings[] = { |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1268 |
/***************************************************************************/ |
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1269 |
/* User-interface section of the GUI-configure patches window */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1270 |
SDT_BOOL(Patches, vehicle_speed, S, 0, true, STR_CONFIG_PATCHES_VEHICLESPEED, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1271 |
SDT_BOOL(Patches, status_long_date, S, 0, true, STR_CONFIG_PATCHES_LONGDATE, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1272 |
SDT_BOOL(Patches, show_finances, S, 0, true, STR_CONFIG_PATCHES_SHOWFINANCES, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1273 |
SDT_BOOL(Patches, autoscroll, S, 0, false, STR_CONFIG_PATCHES_AUTOSCROLL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1274 |
SDT_BOOL(Patches, reverse_scroll, S, 0, false, STR_CONFIG_PATCHES_REVERSE_SCROLLING, NULL), |
4834
3c6e8a547174
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4716
diff
changeset
|
1275 |
SDT_BOOL(Patches, measure_tooltip, S, 0, false, STR_CONFIG_PATCHES_MEASURE_TOOLTIP, NULL), |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1276 |
SDT_VAR(Patches, errmsg_duration, SLE_UINT8, S, 0, 5, 0, 20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1277 |
SDT_VAR(Patches, toolbar_pos, SLE_UINT8, S,MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS, v_PositionMainToolbar), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1278 |
SDT_VAR(Patches, window_snap_radius, SLE_UINT8, S,D0, 10, 1, 32, 0, STR_CONFIG_PATCHES_SNAP_RADIUS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1279 |
SDT_BOOL(Patches, invisible_trees, S, 0, false, STR_CONFIG_PATCHES_INVISIBLE_TREES, RedrawScreen), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1280 |
SDT_BOOL(Patches, population_in_label, S, 0, true, STR_CONFIG_PATCHES_POPULATION_IN_LABEL, PopulationInLabelActive), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1281 |
SDT_VAR(Patches, map_x, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_X, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1282 |
SDT_VAR(Patches, map_y, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_Y, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1283 |
SDT_BOOL(Patches, link_terraform_toolbar, S, 0, false, STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,NULL), |
4616
3c22e5eb5ffe
(svn r6474) - Add a patch option to control display of liveries, allowing none, your
peter1138
parents:
4601
diff
changeset
|
1284 |
SDT_VAR(Patches, liveries, SLE_UINT8, S,MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_LIVERIES, RedrawScreen), |
5107
f3cddd9ce5f4
(svn r7179) -Codechange (r7173): Actually "prefer" team chat through the patch setting instead of
Darkvater
parents:
5102
diff
changeset
|
1285 |
SDT_BOOL(Patches, prefer_teamchat, S, 0, false, STR_CONFIG_PATCHES_PREFER_TEAMCHAT, NULL), |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1286 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1287 |
/***************************************************************************/ |
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1288 |
/* Construction section of the GUI-configure patches window */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1289 |
SDT_BOOL(Patches, build_on_slopes, 0, 0, true, STR_CONFIG_PATCHES_BUILDONSLOPES, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1290 |
SDT_BOOL(Patches, extra_dynamite, 0, 0, false, STR_CONFIG_PATCHES_EXTRADYNAMITE, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1291 |
SDT_BOOL(Patches, longbridges, 0, 0, true, STR_CONFIG_PATCHES_LONGBRIDGES, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1292 |
SDT_BOOL(Patches, signal_side, N, 0, true, STR_CONFIG_PATCHES_SIGNALSIDE, RedrawScreen), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1293 |
SDT_BOOL(Patches, always_small_airport, 0, 0, false, STR_CONFIG_PATCHES_SMALL_AIRPORTS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1294 |
SDT_VAR(Patches, drag_signals_density,SLE_UINT8,S, 0, 4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,NULL), |
5688
c4ba40106d5d
(svn r8151) -Feature: Automatically build semaphores before a configurable date, which can be set by each network player seperately.
maedhros
parents:
5609
diff
changeset
|
1295 |
SDT_VAR(Patches, semaphore_build_before,SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, NULL), |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1296 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1297 |
/***************************************************************************/ |
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1298 |
/* Vehicle section of the GUI-configure patches window */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1299 |
SDT_BOOL(Patches, realistic_acceleration, 0, 0, false, STR_CONFIG_PATCHES_REALISTICACCEL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1300 |
SDT_BOOL(Patches, forbid_90_deg, 0, 0, false, STR_CONFIG_PATCHES_FORBID_90_DEG, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1301 |
SDT_BOOL(Patches, mammoth_trains, 0, 0, true, STR_CONFIG_PATCHES_MAMMOTHTRAINS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1302 |
SDT_BOOL(Patches, gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1303 |
SDT_BOOL(Patches, roadveh_queue, 0, 0, true, STR_CONFIG_PATCHES_ROADVEH_QUEUE, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1304 |
SDT_BOOL(Patches, new_pathfinding_all, 0, 0, false, STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL, NULL), |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1305 |
|
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1306 |
SDT_CONDBOOL(Patches, yapf.ship_use_yapf, 28, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_PATCHES_YAPF_SHIPS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1307 |
SDT_CONDBOOL(Patches, yapf.road_use_yapf, 28, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_YAPF_ROAD, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1308 |
SDT_CONDBOOL(Patches, yapf.rail_use_yapf, 28, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_YAPF_RAIL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1309 |
|
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1310 |
SDT_BOOL(Patches, train_income_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_INCOME_LESS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1311 |
SDT_VAR(Patches, order_review_system,SLE_UINT8, S,MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_ORDER_REVIEW, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1312 |
SDT_BOOL(Patches, never_expire_vehicles, 0, 0, false, STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES,NULL), |
4870
2d8c7ffbbac9
(svn r6800) -Feature change: [train is lost] message is now generated immediately when pathfinder can't find the path. (thanks MeusH, peter1138 and Brianetta for ideas and help).
KUDr
parents:
4834
diff
changeset
|
1313 |
SDT_BOOL(Patches, lost_train_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_LOST_TRAIN, NULL), |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1314 |
SDT_BOOL(Patches, autorenew, S, 0, false, STR_CONFIG_PATCHES_AUTORENEW_VEHICLE, EngineRenewUpdate), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1315 |
SDT_VAR(Patches, autorenew_months, SLE_INT16, S, 0, 6, -12, 12, 0, STR_CONFIG_PATCHES_AUTORENEW_MONTHS, EngineRenewMonthsUpdate), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1316 |
SDT_VAR(Patches, autorenew_money, SLE_UINT, S,CR,100000, 0, 2000000, 0, STR_CONFIG_PATCHES_AUTORENEW_MONEY, EngineRenewMoneyUpdate), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1317 |
SDT_VAR(Patches, max_trains, SLE_UINT16, 0, 0, 500, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_TRAINS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1318 |
SDT_VAR(Patches, max_roadveh, SLE_UINT16, 0, 0, 500, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_ROADVEH, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1319 |
SDT_VAR(Patches, max_aircraft, SLE_UINT16, 0, 0, 200, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1320 |
SDT_VAR(Patches, max_ships, SLE_UINT16, 0, 0, 300, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1321 |
SDT_BOOL(Patches, servint_ispercent, 0, 0, false, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, CheckInterval), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1322 |
SDT_VAR(Patches, servint_trains, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS, InValidateDetailsWindow), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1323 |
SDT_VAR(Patches, servint_roadveh, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH, InValidateDetailsWindow), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1324 |
SDT_VAR(Patches, servint_ships, SLE_UINT16, 0,D0, 360, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS, InValidateDetailsWindow), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1325 |
SDT_VAR(Patches, servint_aircraft, SLE_UINT16, 0,D0, 100, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, InValidateDetailsWindow), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1326 |
SDT_BOOL(Patches, no_servicing_if_no_breakdowns, 0, 0, false, STR_CONFIG_PATCHES_NOSERVICE, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1327 |
SDT_BOOL(Patches, wagon_speed_limits, 0, 0, true, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, NULL), |
5116
3c0c3da214ca
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5113
diff
changeset
|
1328 |
SDT_CONDBOOL(Patches, disable_elrails, 38, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_PATCHES_DISABLE_ELRAILS, SettingsDisableElrail), |
5163
459b243f8413
(svn r7269) -Feature: Add freight trains patch option. This option is a multiplier for the weight of cargo on freight trains, to simulate longer heavier trains. The default value of 1 behaves as before.
peter1138
parents:
5142
diff
changeset
|
1329 |
SDT_CONDVAR(Patches, freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0, 0, 1, 1, 255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS, NULL), |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1330 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1331 |
/***************************************************************************/ |
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1332 |
/* Station section of the GUI-configure patches window */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1333 |
SDT_BOOL(Patches, join_stations, 0, 0, true, STR_CONFIG_PATCHES_JOINSTATIONS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1334 |
SDT_BOOL(Patches, full_load_any, 0, 0, true, STR_CONFIG_PATCHES_FULLLOADANY, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1335 |
SDT_BOOL(Patches, improved_load, 0, 0, false, STR_CONFIG_PATCHES_IMPROVEDLOAD, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1336 |
SDT_BOOL(Patches, selectgoods, 0, 0, true, STR_CONFIG_PATCHES_SELECTGOODS, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1337 |
SDT_BOOL(Patches, new_nonstop, 0, 0, false, STR_CONFIG_PATCHES_NEW_NONSTOP, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1338 |
SDT_BOOL(Patches, nonuniform_stations, 0, 0, true, STR_CONFIG_PATCHES_NONUNIFORM_STATIONS,NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1339 |
SDT_VAR(Patches, station_spread,SLE_UINT8,0, 0, 12, 4, 64, 0, STR_CONFIG_PATCHES_STATION_SPREAD, InvalidateStationBuildWindow), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1340 |
SDT_BOOL(Patches, serviceathelipad, 0, 0, true, STR_CONFIG_PATCHES_SERVICEATHELIPAD, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1341 |
SDT_BOOL(Patches, modified_catchment, 0, 0, true, STR_CONFIG_PATCHES_CATCHMENT, NULL), |
5211
fb4dc0ca975d
(svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros)
peter1138
parents:
5186
diff
changeset
|
1342 |
SDT_CONDBOOL(Patches, gradual_loading, 40, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_GRADUAL_LOADING, NULL), |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1343 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1344 |
/***************************************************************************/ |
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1345 |
/* Economy section of the GUI-configure patches window */ |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1346 |
SDT_BOOL(Patches, inflation, 0, 0, true, STR_CONFIG_PATCHES_INFLATION, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1347 |
SDT_BOOL(Patches, build_rawmaterial_ind, 0, 0, false, STR_CONFIG_PATCHES_BUILDXTRAIND, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1348 |
SDT_BOOL(Patches, multiple_industry_per_town, 0, 0, false, STR_CONFIG_PATCHES_MULTIPINDTOWN, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1349 |
SDT_BOOL(Patches, same_industry_close, 0, 0, false, STR_CONFIG_PATCHES_SAMEINDCLOSE, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1350 |
SDT_BOOL(Patches, bribe, 0, 0, true, STR_CONFIG_PATCHES_BRIBE, NULL), |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1351 |
SDT_VAR(Patches, snow_line_height,SLE_UINT8, 0, 0, 7, 2, 13, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1352 |
SDT_VAR(Patches, colored_news_year,SLE_INT32, 0,NC, 2000, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1353 |
SDT_VAR(Patches, starting_year, SLE_INT32, 0,NC, 1950, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_STARTING_YEAR,NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1354 |
SDT_VAR(Patches, ending_year, SLE_INT32,0,NC|NO,2051, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_ENDING_YEAR, NULL), |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1355 |
SDT_BOOL(Patches, smooth_economy, 0, 0, true, STR_CONFIG_PATCHES_SMOOTH_ECONOMY, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1356 |
SDT_BOOL(Patches, allow_shares, 0, 0, true, STR_CONFIG_PATCHES_ALLOW_SHARES, NULL), |
1218 | 1357 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1358 |
/***************************************************************************/ |
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1359 |
/* AI section of the GUI-configure patches window */ |
3131
b56514952c8c
(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
parents:
3125
diff
changeset
|
1360 |
SDT_BOOL(Patches, ainew_active, 0, 0, false, STR_CONFIG_PATCHES_AINEW_ACTIVE, AiNew_PatchActive_Warning), |
b56514952c8c
(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
parents:
3125
diff
changeset
|
1361 |
SDT_BOOL(Patches, ai_in_multiplayer, 0, 0, false, STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER, Ai_In_Multiplayer_Warning), |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1362 |
SDT_BOOL(Patches, ai_disable_veh_train, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_TRAINS, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1363 |
SDT_BOOL(Patches, ai_disable_veh_roadveh, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH, NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1364 |
SDT_BOOL(Patches, ai_disable_veh_aircraft,0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,NULL), |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1365 |
SDT_BOOL(Patches, ai_disable_veh_ship, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_SHIPS, NULL), |
1271
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1366 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1367 |
/***************************************************************************/ |
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1368 |
/* Patches without any GUI representation */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1369 |
SDT_BOOL(Patches, keep_all_autosave, S, 0, false, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1370 |
SDT_BOOL(Patches, autosave_on_exit, S, 0, false, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1371 |
SDT_VAR(Patches, max_num_autosaves, SLE_UINT8, S, 0, 16, 0, 255, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1372 |
SDT_BOOL(Patches, bridge_pillars, S, 0, true, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1373 |
SDT_VAR(Patches, extend_vehicle_life, SLE_UINT8, 0, 0, 0, 0, 100, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1374 |
SDT_BOOL(Patches, auto_euro, S, 0, true, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1375 |
SDT_VAR(Patches, dist_local_authority,SLE_UINT8, 0, 0, 20, 5, 60, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1376 |
SDT_VAR(Patches, wait_oneway_signal, SLE_UINT8, 0, 0, 15, 2, 100, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1377 |
SDT_VAR(Patches, wait_twoway_signal, SLE_UINT8, 0, 0, 41, 2, 100, 0, STR_NULL, NULL), |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1378 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1379 |
/***************************************************************************/ |
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1380 |
/* New Pathfinding patch settings */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1381 |
SDT_VAR(Patches, pf_maxlength, SLE_UINT16, 0, 0, 4096, 64, 65535, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1382 |
SDT_VAR(Patches, pf_maxdepth, SLE_UINT8, 0, 0, 48, 4, 255, 0, STR_NULL, NULL), |
1700
e1fe3446d013
(svn r2204) - Add: [NPF] NPF now has a maximum number of nodes it will search. The default value is 5000 for now, which is an educated guess. Probably needs some finetuning. Hopefully this "feature" can be removed later on, when more sophisticated means of limiting the pathfinder have been implemented. This should make ships and larger networks playable for now, though.
matthijs
parents:
1688
diff
changeset
|
1383 |
/* The maximum number of nodes to search */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1384 |
SDT_VAR(Patches, npf_max_search_nodes,SLE_UINT, 0, 0, 10000, 500, 100000, 0, STR_NULL, NULL), |
1700
e1fe3446d013
(svn r2204) - Add: [NPF] NPF now has a maximum number of nodes it will search. The default value is 5000 for now, which is an educated guess. Probably needs some finetuning. Hopefully this "feature" can be removed later on, when more sophisticated means of limiting the pathfinder have been implemented. This should make ships and larger networks playable for now, though.
matthijs
parents:
1688
diff
changeset
|
1385 |
|
1271
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1386 |
/* When a red signal is encountered, a small detour can be made around |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1387 |
* it. This specifically occurs when a track is doubled, in which case |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1388 |
* the detour is typically 2 tiles. It is also often used at station |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1389 |
* entrances, when there is a choice of multiple platforms. If we take |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1390 |
* a typical 4 platform station, the detour is 4 tiles. To properly |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1391 |
* support larger stations we increase this value. |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1392 |
* We want to prevent that trains that want to leave at one side of a |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1393 |
* station, leave through the other side, turn around, enter the |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1394 |
* station on another platform and exit the station on the right side |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1395 |
* again, just because the sign at the right side was red. If we take |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1396 |
* a typical 5 length station, this detour is 10 or 11 tiles (not |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1397 |
* sure), so we set the default penalty at 10 (the station tile |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1398 |
* penalty will further prevent this. |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1399 |
* We give presignal exits (and combo's) a different (larger) penalty, because |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3982
diff
changeset
|
1400 |
* we really don't want trains waiting in front of a presignal exit. */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1401 |
SDT_VAR(Patches, npf_rail_firstred_penalty, SLE_UINT, 0, 0, (10 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1402 |
SDT_VAR(Patches, npf_rail_firstred_exit_penalty,SLE_UINT, 0, 0, (100 * NPF_TILE_LENGTH),0, 100000, 0, STR_NULL, NULL), |
1459
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1403 |
/* This penalty is for when the last signal before the target is red. |
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1404 |
* This is useful for train stations, where there are multiple |
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1405 |
* platforms to choose from, which lie in different signal blocks. |
19333d7f99b3
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1422
diff
changeset
|
1406 |
* Every target in a occupied signal block (ie an occupied platform) |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1407 |
* will get this penalty. */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1408 |
SDT_VAR(Patches, npf_rail_lastred_penalty, SLE_UINT, 0, 0, (10 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
1271
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1409 |
/* When a train plans a route over a station tile, this penalty is |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1410 |
* applied. We want that trains plan a route around a typical, 4x5 |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1411 |
* station, which means two tiles to the right, and two tiles back to |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1412 |
* the left around it, or 5 tiles of station through it. If we assign |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1413 |
* a penalty of 1 tile for every station tile passed, the route will |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1414 |
* be around it. */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1415 |
SDT_VAR(Patches, npf_rail_station_penalty, SLE_UINT, 0, 0, (1 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1416 |
SDT_VAR(Patches, npf_rail_slope_penalty, SLE_UINT, 0, 0, (1 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
1751
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1417 |
/* This penalty is applied when a train makes a turn. Its value of 1 makes |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1418 |
* sure that it has a minimal impact on the pathfinding, only when two |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1419 |
* paths have equal length it will make a difference */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1420 |
SDT_VAR(Patches, npf_rail_curve_penalty, SLE_UINT, 0, 0, 1, 0, 100000, 0, STR_NULL, NULL), |
1777
f703cf05b5b9
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
1421 |
/* Ths penalty is applied when a vehicle reverses inside a depot (doesn't |
f703cf05b5b9
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
1422 |
* apply to ships, as they can just come out the other end). XXX: Is this a |
f703cf05b5b9
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
1423 |
* good value? */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1424 |
SDT_VAR(Patches, npf_rail_depot_reverse_penalty,SLE_UINT, 0, 0, (NPF_TILE_LENGTH * 50), 0, 100000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1425 |
SDT_VAR(Patches, npf_buoy_penalty, SLE_UINT, 0, 0, (2 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
1751
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1426 |
/* This penalty is applied when a ship makes a turn. It is bigger than the |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1427 |
* rail curve penalty, since ships (realisticly) have more trouble with |
009a240d035a
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1727
diff
changeset
|
1428 |
* making turns */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1429 |
SDT_VAR(Patches, npf_water_curve_penalty, SLE_UINT, 0, 0, (NPF_TILE_LENGTH / 4), 0, 100000, 0, STR_NULL, NULL), |
1941
ca268f8837df
(svn r2447) * Add: [NPF] Penalty for road vehicles making turns.
matthijs
parents:
1891
diff
changeset
|
1430 |
/* This is the penalty for road, same as for rail. */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1431 |
SDT_VAR(Patches, npf_road_curve_penalty, SLE_UINT, 0, 0, 1, 0, 100000, 0, STR_NULL, NULL), |
2006
9d5d7fd428c2
(svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
matthijs
parents:
1941
diff
changeset
|
1432 |
/* This is the penalty for level crossings, for both road and rail vehicles */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1433 |
SDT_VAR(Patches, npf_crossing_penalty, SLE_UINT, 0, 0, (3 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
1271
322ab55eca62
(svn r1775) -Fix: The NPF patch setting was not synced in network.
truelight
parents:
1258
diff
changeset
|
1434 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1435 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1436 |
// The maximum number of nodes to search |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1437 |
SDT_CONDBOOL(Patches, yapf.disable_node_optimization , 28, SL_MAX_VERSION, 0, 0, false , STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1438 |
SDT_CONDVAR (Patches, yapf.max_search_nodes , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10000 , 500, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1439 |
SDT_CONDBOOL(Patches, yapf.rail_firstred_twoway_eol , 28, SL_MAX_VERSION, 0, 0, true , STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1440 |
SDT_CONDVAR (Patches, yapf.rail_firstred_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1441 |
SDT_CONDVAR (Patches, yapf.rail_firstred_exit_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 100 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1442 |
SDT_CONDVAR (Patches, yapf.rail_lastred_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1443 |
SDT_CONDVAR (Patches, yapf.rail_lastred_exit_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 100 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1444 |
SDT_CONDVAR (Patches, yapf.rail_station_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 30 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1445 |
SDT_CONDVAR (Patches, yapf.rail_slope_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 2 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1446 |
SDT_CONDVAR (Patches, yapf.rail_curve45_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 1 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1447 |
SDT_CONDVAR (Patches, yapf.rail_curve90_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 6 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1448 |
// This penalty is applied when a train reverses inside a depot |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1449 |
SDT_CONDVAR (Patches, yapf.rail_depot_reverse_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 50 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1450 |
// This is the penalty for level crossings (for trains only) |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1451 |
SDT_CONDVAR (Patches, yapf.rail_crossing_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 3 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1452 |
// look-ahead how many signals are checked |
5186
1b5e0a0eace5
(svn r7296) -Fix: [YAPF] setting yapf.rail_look_ahead_max_signals to zero causes YAPF to behave incorrectly. Set its min value to 1. (Danny)
KUDr
parents:
5163
diff
changeset
|
1453 |
SDT_CONDVAR (Patches, yapf.rail_look_ahead_max_signals, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10 , 1, 100, 0, STR_NULL, NULL), |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1454 |
// look-ahead n-th red signal penalty polynomial: penalty = p2 * n^2 + p1 * n + p0 |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1455 |
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p0 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, 500 , -1000000, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1456 |
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p1 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, -100 , -1000000, 1000000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1457 |
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p2 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, 5 , -1000000, 1000000, 0, STR_NULL, NULL), |
4590
3bb61fa03c69
(svn r6440) -Fix: [YAPF] some YAPF settings were not saved (i misunderstood how save flags work). This probably caused some MP desyncs. Thanks Maedhros for noticing and peter1138 for this patch.
KUDr
parents:
4549
diff
changeset
|
1458 |
// penalties for too long or too short station platforms |
3bb61fa03c69
(svn r6440) -Fix: [YAPF] some YAPF settings were not saved (i misunderstood how save flags work). This probably caused some MP desyncs. Thanks Maedhros for noticing and peter1138 for this patch.
KUDr
parents:
4549
diff
changeset
|
1459 |
SDT_CONDVAR (Patches, yapf.rail_longer_platform_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 8 * YAPF_TILE_LENGTH, 0, 20000, 0, STR_NULL, NULL), |
3bb61fa03c69
(svn r6440) -Fix: [YAPF] some YAPF settings were not saved (i misunderstood how save flags work). This probably caused some MP desyncs. Thanks Maedhros for noticing and peter1138 for this patch.
KUDr
parents:
4549
diff
changeset
|
1460 |
SDT_CONDVAR (Patches, yapf.rail_longer_platform_per_tile_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 0 * YAPF_TILE_LENGTH, 0, 20000, 0, STR_NULL, NULL), |
3bb61fa03c69
(svn r6440) -Fix: [YAPF] some YAPF settings were not saved (i misunderstood how save flags work). This probably caused some MP desyncs. Thanks Maedhros for noticing and peter1138 for this patch.
KUDr
parents:
4549
diff
changeset
|
1461 |
SDT_CONDVAR (Patches, yapf.rail_shorter_platform_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 40 * YAPF_TILE_LENGTH, 0, 20000, 0, STR_NULL, NULL), |
3bb61fa03c69
(svn r6440) -Fix: [YAPF] some YAPF settings were not saved (i misunderstood how save flags work). This probably caused some MP desyncs. Thanks Maedhros for noticing and peter1138 for this patch.
KUDr
parents:
4549
diff
changeset
|
1462 |
SDT_CONDVAR (Patches, yapf.rail_shorter_platform_per_tile_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 0 * YAPF_TILE_LENGTH, 0, 20000, 0, STR_NULL, NULL), |
3981
b61ec1c297cd
(svn r5169) - CodeChange: [YAPF] RVs now use YAPF_TILE_LENGTH as base unit and 2 configurable settings (slope and crossing penalties) for cost calculation
KUDr
parents:
3980
diff
changeset
|
1463 |
// road vehicles - penalties |
4590
3bb61fa03c69
(svn r6440) -Fix: [YAPF] some YAPF settings were not saved (i misunderstood how save flags work). This probably caused some MP desyncs. Thanks Maedhros for noticing and peter1138 for this patch.
KUDr
parents:
4549
diff
changeset
|
1464 |
SDT_CONDVAR (Patches, yapf.road_slope_penalty , SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 2 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
3bb61fa03c69
(svn r6440) -Fix: [YAPF] some YAPF settings were not saved (i misunderstood how save flags work). This probably caused some MP desyncs. Thanks Maedhros for noticing and peter1138 for this patch.
KUDr
parents:
4549
diff
changeset
|
1465 |
SDT_CONDVAR (Patches, yapf.road_curve_penalty , SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 1 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
3bb61fa03c69
(svn r6440) -Fix: [YAPF] some YAPF settings were not saved (i misunderstood how save flags work). This probably caused some MP desyncs. Thanks Maedhros for noticing and peter1138 for this patch.
KUDr
parents:
4549
diff
changeset
|
1466 |
SDT_CONDVAR (Patches, yapf.road_crossing_penalty , SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 3 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1467 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4293
diff
changeset
|
1468 |
/***************************************************************************/ |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4293
diff
changeset
|
1469 |
/* Terrain genation related patch options */ |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1470 |
SDT_CONDVAR(Patches, land_generator, SLE_UINT8, 30, SL_MAX_VERSION, 0, MS, 1, 0, 1, 0, STR_CONFIG_PATCHES_LAND_GENERATOR, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1471 |
SDT_CONDVAR(Patches, oil_refinery_limit, SLE_UINT8, 30, SL_MAX_VERSION, 0, 0, 16, 12, 48, 0, STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1472 |
SDT_CONDVAR(Patches, tgen_smoothness, SLE_UINT8, 30, SL_MAX_VERSION, 0, MS, 1, 0, 3, 0, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1473 |
SDT_CONDVAR(Patches, generation_seed, SLE_UINT32, 30, SL_MAX_VERSION, 0, 0, GENERATE_NEW_SEED, 0, MAX_UVALUE(uint32), 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1474 |
SDT_CONDVAR(Patches, tree_placer, SLE_UINT8, 30, SL_MAX_VERSION, 0, MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_TREE_PLACER, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1475 |
SDT_VAR (Patches, heightmap_rotation, SLE_UINT8, S, MS, 0, 0, 1, 0, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1476 |
SDT_VAR (Patches, se_flat_world_height, SLE_UINT8, S, 0, 0, 0, 15, 0, STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT, NULL), |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4293
diff
changeset
|
1477 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1478 |
SDT_END() |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1479 |
}; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1480 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1481 |
static const SettingDesc _currency_settings[] = { |
4431
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1482 |
SDT_VAR(CurrencySpec, rate, SLE_UINT16, S, 0, 1, 0, 100, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1483 |
SDT_CHR(CurrencySpec, separator, S, 0, ".", STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1484 |
SDT_VAR(CurrencySpec, to_euro, SLE_INT32, S, 0, 0, 0,1000, 0, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1485 |
SDT_STR(CurrencySpec, prefix, SLE_STRBQ, S, 0, NULL, STR_NULL, NULL), |
7ecf73508c31
(svn r6186) -Fix [FS#309]: add an override system to the dynamically determined size of steps for numeric patch settings in the 'Configure patches' GUI.
rubidium
parents:
4419
diff
changeset
|
1486 |
SDT_STR(CurrencySpec, suffix, SLE_STRBQ, S, 0, " credits", STR_NULL, NULL), |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1487 |
SDT_END() |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
1488 |
}; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
1489 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1490 |
/* Undefine for the shortcut macros above */ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1491 |
#undef S |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1492 |
#undef C |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1493 |
#undef N |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1494 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1495 |
#undef D0 |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1496 |
#undef NC |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1497 |
#undef MS |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1498 |
#undef NO |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1499 |
#undef CR |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1500 |
|
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
1501 |
|
5329
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1502 |
/* Load a GRF configuration from the given group name */ |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1503 |
static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_static) |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1504 |
{ |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1505 |
IniGroup *group = ini_getgroup(ini, grpname, -1); |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1506 |
IniItem *item; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1507 |
GRFConfig *first = NULL; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1508 |
GRFConfig **curr = &first; |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
1509 |
|
5329
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1510 |
if (group == NULL) return NULL; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1511 |
|
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1512 |
for (item = group->item; item != NULL; item = item->next) { |
5609
dc6a58930ba4
(svn r8066) - Codechange: MallocT(), CallocT(), ReallocT() now return the pointer to allocated memory instead of modifying the pointer given as parameter
KUDr
parents:
5601
diff
changeset
|
1513 |
GRFConfig *c = CallocT<GRFConfig>(1); |
5329
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1514 |
c->filename = strdup(item->name); |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1515 |
|
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1516 |
/* Parse parameters */ |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1517 |
if (*item->value != '\0') { |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1518 |
c->num_params = parse_intlist(item->value, (int*)c->param, lengthof(c->param)); |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1519 |
if (c->num_params == (byte)-1) { |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1520 |
ShowInfoF("ini: error in array '%s'", item->name); |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1521 |
c->num_params = 0; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1522 |
} |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1523 |
} |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1524 |
|
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1525 |
/* Check if item is valid */ |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1526 |
if (!FillGRFDetails(c, is_static)) { |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1527 |
const char *msg; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1528 |
|
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1529 |
if (HASBIT(c->flags, GCF_NOT_FOUND)) { |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1530 |
msg = "not found"; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1531 |
} else if (HASBIT(c->flags, GCF_UNSAFE)) { |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1532 |
msg = "unsafe for static use"; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1533 |
} else if (HASBIT(c->flags, GCF_SYSTEM)) { |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1534 |
msg = "system NewGRF"; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1535 |
} else { |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1536 |
msg = "unknown"; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1537 |
} |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1538 |
|
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1539 |
ShowInfoF("ini: ignoring invalid NewGRF '%s': %s", item->name, msg); |
5346
3687c73bc65b
(svn r7517) -Codechange: Set pointers to NULL when freeing the newgrf config variables and add the proper const to CopyGRFConfigList
Darkvater
parents:
5329
diff
changeset
|
1540 |
ClearGRFConfig(&c); |
5329
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1541 |
continue; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1542 |
} |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1543 |
|
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1544 |
/* Mark file as static to avoid saving in savegame. */ |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1545 |
if (is_static) SETBIT(c->flags, GCF_STATIC); |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1546 |
|
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1547 |
/* Add item to list */ |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1548 |
*curr = c; |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1549 |
curr = &c->next; |
5307
1d3295f87e8d
(svn r7463) -Codechange: Don't load invalid NewGRF files from the configuration file; instead show a warning.
peter1138
parents:
5228
diff
changeset
|
1550 |
} |
3631
c6a094f0c14e
(svn r4530) - Fix [NewGRF]: don't spew a warning when a grf file has no parameters.
Darkvater
parents:
3628
diff
changeset
|
1551 |
|
5329
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1552 |
return first; |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
1553 |
} |
0 | 1554 |
|
5329
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1555 |
|
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1556 |
/* Save a GRF configuration to the given group name */ |
5309
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1557 |
static void GRFSaveConfig(IniFile *ini, const char *grpname, const GRFConfig *list) |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1558 |
{ |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1559 |
IniGroup *group = ini_getgroup(ini, grpname, -1); |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1560 |
IniItem **item; |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1561 |
const GRFConfig *c; |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1562 |
|
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1563 |
if (group == NULL) return; |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1564 |
group->item = NULL; |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1565 |
item = &group->item; |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1566 |
|
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1567 |
for (c = list; c != NULL; c = c->next) { |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1568 |
char params[512]; |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1569 |
GRFBuildParamList(params, c, lastof(params)); |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1570 |
|
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1571 |
*item = ini_item_alloc(group, c->filename, strlen(c->filename)); |
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1572 |
(*item)->value = (char*)pool_strdup(&ini->pool, params, strlen(params)); |
5309
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1573 |
item = &(*item)->next; |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1574 |
} |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1575 |
} |
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1576 |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1577 |
/* Common handler for saving/loading variables to the configuration file */ |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1578 |
static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescProcList *proc_list) |
0 | 1579 |
{ |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1580 |
proc(ini, (const SettingDesc*)_misc_settings, "misc", NULL); |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1581 |
proc(ini, (const SettingDesc*)_music_settings, "music", &msf); |
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1582 |
#ifdef WIN32 |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1583 |
proc(ini, (const SettingDesc*)_win32_settings, "win32", NULL); |
3051
6a9ddcac6d56
(svn r3640) - Remove win32-only variables from variables.h and put them into win32_v.c. Also ifdef the win32 specific configuration file settings.
Darkvater
parents:
3042
diff
changeset
|
1584 |
#endif /* WIN32 */ |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1585 |
|
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1586 |
proc(ini, _gameopt_settings, "gameopt", &_opt_newgame); |
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1587 |
proc(ini, _patch_settings, "patches", &_patches_newgame); |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1588 |
proc(ini, _currency_settings,"currency", &_custom_currency); |
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1589 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1590 |
#ifdef ENABLE_NETWORK |
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1591 |
proc(ini, (const SettingDesc*)_network_settings, "network", NULL); |
3628
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
1592 |
proc_list(ini, "servers", _network_host_list, lengthof(_network_host_list), NULL); |
69646d0924a5
(svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples.
Darkvater
parents:
3615
diff
changeset
|
1593 |
proc_list(ini, "bans", _network_ban_list, lengthof(_network_ban_list), NULL); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1594 |
#endif /* ENABLE_NETWORK */ |
0 | 1595 |
} |
1596 |
||
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1597 |
/** Load the values from the configuration files */ |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
1598 |
void LoadFromConfig(void) |
0 | 1599 |
{ |
1600 |
IniFile *ini = ini_load(_config_file); |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1601 |
HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list); |
5329
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1602 |
_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false); |
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1603 |
_grfconfig_static = GRFLoadConfig(ini, "newgrf-static", true); |
0 | 1604 |
ini_free(ini); |
1605 |
} |
|
1606 |
||
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1607 |
/** Save the values to the configuration file */ |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
1608 |
void SaveToConfig(void) |
0 | 1609 |
{ |
1610 |
IniFile *ini = ini_load(_config_file); |
|
3116
b125bf75b4b0
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates them with the unified types. These new settings are heavily macro'd, which should make it easy to add/edit entries within sections.
Darkvater
parents:
3115
diff
changeset
|
1611 |
HandleSettingDescs(ini, ini_save_settings, ini_save_setting_list); |
5309
3e7883483280
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
1612 |
GRFSaveConfig(ini, "newgrf", _grfconfig_newgame); |
5329
9c5e8061ea0f
(svn r7490) -Feature: Load a list of NewGRFs from the config (in the [newgrf-static] section) that should always be loaded. These will also be active during the intro screen, and in multiplayer games. Only "network-safe" NewGRFs are permitted, such as fonts and sprite replacement sets.
peter1138
parents:
5309
diff
changeset
|
1613 |
GRFSaveConfig(ini, "newgrf-static", _grfconfig_static); |
0 | 1614 |
ini_save(_config_file, ini); |
1615 |
ini_free(ini); |
|
1616 |
} |
|
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1617 |
|
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1618 |
static const SettingDesc *GetSettingDescription(uint index) |
3118
adc86793eee1
(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
parents:
3117
diff
changeset
|
1619 |
{ |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1620 |
if (index >= lengthof(_patch_settings)) return NULL; |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1621 |
return &_patch_settings[index]; |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1622 |
} |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1623 |
|
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1624 |
/** Network-safe changing of patch-settings (server-only). |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1625 |
* @param p1 the index of the patch in the SettingDesc array which identifies it |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1626 |
* @param p2 the new value for the patch |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1627 |
* The new value is properly clamped to its minimum/maximum when setting |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1628 |
* @see _patch_settings |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1629 |
*/ |
3491
35d747bb5e82
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3358
diff
changeset
|
1630 |
int32 CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1631 |
{ |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1632 |
const SettingDesc *sd = GetSettingDescription(p1); |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1633 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1634 |
if (sd == NULL) return CMD_ERROR; |
3223
eed8c6a62ec2
(svn r3896) - [Patches] Fix: Honour any conditional settings when retrieving the setting entries.
Darkvater
parents:
3222
diff
changeset
|
1635 |
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) return CMD_ERROR; |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1636 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1637 |
if (flags & DC_EXEC) { |
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1638 |
Patches *patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; |
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
1639 |
void *var = GetVariableAddress(patches_ptr, &sd->save); |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1640 |
Write_ValidateSetting(var, sd, (int32)p2); |
5113
84cabfb98a67
(svn r7190) -Fix: If the non-player-based _patches setting was changed on the server during MP game, the callback function was:
KUDr
parents:
5108
diff
changeset
|
1641 |
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1642 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1643 |
InvalidateWindow(WC_GAME_OPTIONS, 0); |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1644 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1645 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1646 |
return 0; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1647 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1648 |
|
3615
4afd81377ba3
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
1649 |
/** Top function to save the new value of an element of the Patches struct |
3118
adc86793eee1
(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
parents:
3117
diff
changeset
|
1650 |
* @param index offset in the SettingDesc array of the Patches struct which |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1651 |
* identifies the patch member we want to change |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1652 |
* @param object pointer to a valid patches struct that has its settings change. |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1653 |
* This only affects patch-members that are not needed to be the same on all |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1654 |
* clients in a network game. |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1655 |
* @param value new value of the patch */ |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1656 |
bool SetPatchValue(uint index, const Patches *object, int32 value) |
3118
adc86793eee1
(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
parents:
3117
diff
changeset
|
1657 |
{ |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1658 |
const SettingDesc *sd = &_patch_settings[index]; |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1659 |
/* If an item is player-based, we do not send it over the network |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1660 |
* (if any) to change. Also *hack*hack* we update the _newgame version |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1661 |
* of patches because changing a player-based setting in a game also |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1662 |
* changes its defaults. At least that is the convention we have chosen */ |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1663 |
if (sd->save.conv & SLF_NETWORK_NO) { |
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
1664 |
void *var = GetVariableAddress(object, &sd->save); |
3118
adc86793eee1
(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
parents:
3117
diff
changeset
|
1665 |
Write_ValidateSetting(var, sd, value); |
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1666 |
|
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1667 |
if (_game_mode != GM_MENU) { |
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
1668 |
void *var2 = GetVariableAddress(&_patches_newgame, &sd->save); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
1669 |
Write_ValidateSetting(var2, sd, value); |
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1670 |
} |
5113
84cabfb98a67
(svn r7190) -Fix: If the non-player-based _patches setting was changed on the server during MP game, the callback function was:
KUDr
parents:
5108
diff
changeset
|
1671 |
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1672 |
InvalidateWindow(WC_GAME_OPTIONS, 0); |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1673 |
return true; |
3118
adc86793eee1
(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
parents:
3117
diff
changeset
|
1674 |
} |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1675 |
|
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1676 |
/* send non-player-based settings over the network */ |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1677 |
if (!_networking || (_networking && _network_server)) { |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1678 |
return DoCommandP(0, index, value, NULL, CMD_CHANGE_PATCH_SETTING); |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1679 |
} |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1680 |
return false; |
3118
adc86793eee1
(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
parents:
3117
diff
changeset
|
1681 |
} |
adc86793eee1
(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
parents:
3117
diff
changeset
|
1682 |
|
3247
ede7a53941b2
(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
parents:
3246
diff
changeset
|
1683 |
const SettingDesc *GetPatchFromName(const char *name, uint *i) |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1684 |
{ |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1685 |
const SettingDesc *sd; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1686 |
|
3131
b56514952c8c
(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
parents:
3125
diff
changeset
|
1687 |
for (*i = 0, sd = _patch_settings; sd->save.cmd != SL_END; sd++, (*i)++) { |
3223
eed8c6a62ec2
(svn r3896) - [Patches] Fix: Honour any conditional settings when retrieving the setting entries.
Darkvater
parents:
3222
diff
changeset
|
1688 |
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; |
3210
2c3f6ea896f4
(svn r3880) - just do a string compare without length restrictions; followup for r3875
Darkvater
parents:
3207
diff
changeset
|
1689 |
if (strcmp(sd->desc.name, name) == 0) return sd; |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1690 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1691 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1692 |
return NULL; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1693 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1694 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1695 |
/* Those 2 functions need to be here, else we have to make some stuff non-static |
4278
761e05083f9c
(svn r5908) - Codechange (r5903): Move the retrieval of the new value of a patch to console_cmds.c, so there is no need for that function in settings.c
Darkvater
parents:
4275
diff
changeset
|
1696 |
* and besides, it is also better to keep stuff like this at the same place */ |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1697 |
bool IConsoleSetPatchSetting(const char *name, int32 value) |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1698 |
{ |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1699 |
bool success; |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1700 |
uint index; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1701 |
const SettingDesc *sd = GetPatchFromName(name, &index); |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1702 |
const Patches *patches_ptr; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1703 |
void *ptr; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1704 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1705 |
if (sd == NULL) { |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1706 |
IConsolePrintF(_icolour_warn, "'%s' is an unknown patch setting.", name); |
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1707 |
return true; |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1708 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1709 |
|
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1710 |
patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; |
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
1711 |
ptr = GetVariableAddress(patches_ptr, &sd->save); |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1712 |
|
4600
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1713 |
success = SetPatchValue(index, patches_ptr, value); |
8215dd63a2a3
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
1714 |
return success; |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1715 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1716 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1717 |
void IConsoleGetPatchSetting(const char *name) |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1718 |
{ |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1719 |
char value[20]; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1720 |
uint index; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1721 |
const SettingDesc *sd = GetPatchFromName(name, &index); |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1722 |
const void *ptr; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1723 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1724 |
if (sd == NULL) { |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1725 |
IConsolePrintF(_icolour_warn, "'%s' is an unknown patch setting.", name); |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1726 |
return; |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1727 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1728 |
|
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
1729 |
ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_patches_newgame : &_patches, &sd->save); |
3119
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1730 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1731 |
if (sd->desc.cmd == SDT_BOOLX) { |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1732 |
snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off"); |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1733 |
} else { |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1734 |
snprintf(value, sizeof(value), "%d", (int32)ReadValue(ptr, sd->save.conv)); |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1735 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1736 |
|
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1737 |
IConsolePrintF(_icolour_warn, "Current value for '%s' is: '%s' (min: %s%d, max: %d)", |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1738 |
name, value, (sd->desc.flags & SGF_0ISDISABLED) ? "(0) " : "", sd->desc.min, sd->desc.max); |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1739 |
} |
8f1b561d9870
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
1740 |
|
3117
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1741 |
/** Save and load handler for patches/settings |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1742 |
* @param osd SettingDesc struct containing all information |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1743 |
* @param object can be either NULL in which case we load global variables or |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1744 |
* a pointer to a struct which is getting saved */ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1745 |
static void LoadSettings(const SettingDesc *osd, void *object) |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1746 |
{ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1747 |
for (; osd->save.cmd != SL_END; osd++) { |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1748 |
const SaveLoad *sld = &osd->save; |
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
1749 |
void *ptr = GetVariableAddress(object, sld); |
3117
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1750 |
|
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1751 |
if (!SlObjectMember(ptr, sld)) continue; |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1752 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1753 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1754 |
|
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1755 |
/** Loadhandler for a list of global variables |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1756 |
* @note this is actually a stub for LoadSettings with the |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1757 |
* object pointer set to NULL */ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1758 |
static inline void LoadSettingsGlobList(const SettingDescGlobVarList *sdg) |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1759 |
{ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1760 |
LoadSettings((const SettingDesc*)sdg, NULL); |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1761 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1762 |
|
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1763 |
/** Save and load handler for patches/settings |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1764 |
* @param osd SettingDesc struct containing all information |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1765 |
* @param object can be either NULL in which case we load global variables or |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1766 |
* a pointer to a struct which is getting saved */ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1767 |
static void SaveSettings(const SettingDesc *sd, void *object) |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1768 |
{ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1769 |
/* We need to write the CH_RIFF header, but unfortunately can't call |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1770 |
* SlCalcLength() because we have a different format. So do this manually */ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1771 |
const SettingDesc *i; |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1772 |
size_t length = 0; |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1773 |
for (i = sd; i->save.cmd != SL_END; i++) { |
5142
ee34e9968a62
(svn r7232) -Codechange: Also allow for the save/load of non pre-allocated strings inside structs.
Darkvater
parents:
5141
diff
changeset
|
1774 |
const void *ptr = GetVariableAddress(object, &i->save); |
ee34e9968a62
(svn r7232) -Codechange: Also allow for the save/load of non pre-allocated strings inside structs.
Darkvater
parents:
5141
diff
changeset
|
1775 |
length += SlCalcObjMemberLength(ptr, &i->save); |
3117
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1776 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1777 |
SlSetLength(length); |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1778 |
|
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1779 |
for (i = sd; i->save.cmd != SL_END; i++) { |
5141
63e24cb6f071
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
1780 |
void *ptr = GetVariableAddress(object, &i->save); |
3117
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1781 |
SlObjectMember(ptr, &i->save); |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1782 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1783 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1784 |
|
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1785 |
/** Savehandler for a list of global variables |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1786 |
* @note this is actually a stub for SaveSettings with the |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1787 |
* object pointer set to NULL */ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1788 |
static inline void SaveSettingsGlobList(const SettingDescGlobVarList *sdg) |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1789 |
{ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1790 |
SaveSettings((const SettingDesc*)sdg, NULL); |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1791 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1792 |
|
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1793 |
static void Load_OPTS(void) |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1794 |
{ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1795 |
/* Copy over default setting since some might not get loaded in |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1796 |
* a networking environment. This ensures for example that the local |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1797 |
* autosave-frequency stays when joining a network-server */ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1798 |
_opt = _opt_newgame; |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1799 |
LoadSettings(_gameopt_settings, &_opt); |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1800 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1801 |
|
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1802 |
static void Save_OPTS(void) |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1803 |
{ |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1804 |
SaveSettings(_gameopt_settings, &_opt); |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1805 |
} |
4c9e8842598e
(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
parents:
3116
diff
changeset
|
1806 |
|
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1807 |
static void Load_PATS(void) |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1808 |
{ |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1809 |
/* Copy over default setting since some might not get loaded in |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1810 |
* a networking environment. This ensures for example that the local |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1811 |
* signal_side stays when joining a network-server */ |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1812 |
_patches = _patches_newgame; |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1813 |
LoadSettings(_patch_settings, &_patches); |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1814 |
} |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1815 |
|
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1816 |
static void Save_PATS(void) |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1817 |
{ |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1818 |
SaveSettings(_patch_settings, &_patches); |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1819 |
} |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1820 |
|
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1821 |
void CheckConfig(void) |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1822 |
{ |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1823 |
// fix up news_display_opt from old to new |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1824 |
int i; |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1825 |
uint32 tmp; |
1723
edb80d6bcc2d
(svn r2227) - Fix (regression): [ 1188408 ] Fix news settings load check. When updating old news-message-types to new ones, certain combinations of new were wrongly recognized as old (glx)
Darkvater
parents:
1700
diff
changeset
|
1826 |
for (i = 0, tmp = _news_display_opt; i != 10; i++, tmp >>= 2) { |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1827 |
if ((tmp & 0x3) == 0x3) { // old settings |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1828 |
_news_display_opt = 0xAAAAAAAA; // set all news-messages to full 1010101010... |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1829 |
break; |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1830 |
} |
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1831 |
} |
2044
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1832 |
|
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1833 |
// Increase old default values for pf_maxdepth and pf_maxlength |
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1834 |
// to support big networks. |
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1835 |
if (_patches_newgame.pf_maxdepth == 16 && _patches_newgame.pf_maxlength == 512) { |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1836 |
_patches_newgame.pf_maxdepth = 48; |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1837 |
_patches_newgame.pf_maxlength = 4096; |
2044
df63b9a7dec3
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
1838 |
} |
1688
af2bb9bcb2ed
(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents:
1643
diff
changeset
|
1839 |
} |
3112
a6fda4d4c7ca
(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
parents:
3052
diff
changeset
|
1840 |
|
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1841 |
void UpdatePatches(void) |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1842 |
{ |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1843 |
/* Since old(er) savegames don't have any patches saved, we initialise |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1844 |
* them with the default values just as it was in the old days. |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1845 |
* Also new games need this copying-over */ |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1846 |
_patches = _patches_newgame; /* backwards compatibility */ |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1847 |
} |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1848 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
1849 |
extern const ChunkHandler _setting_chunk_handlers[] = { |
3121
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1850 |
{ 'OPTS', Save_OPTS, Load_OPTS, CH_RIFF}, |
72fb0554f9f1
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
1851 |
{ 'PATS', Save_PATS, Load_PATS, CH_RIFF | CH_LAST}, |
3112
a6fda4d4c7ca
(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
parents:
3052
diff
changeset
|
1852 |
}; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1853 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1854 |
static bool IsSignedVarMemType(VarType vt) |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1855 |
{ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1856 |
switch (GetVarMemType(vt)) { |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1857 |
case SLE_VAR_I8: |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1858 |
case SLE_VAR_I16: |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1859 |
case SLE_VAR_I32: |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1860 |
case SLE_VAR_I64: |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1861 |
return true; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1862 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1863 |
return false; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
1864 |
} |