author | rubidium |
Fri, 30 May 2008 18:20:26 +0000 | |
changeset 10792 | 95b6eb9fcc9e |
parent 10790 | 9f507561b6a5 |
child 10814 | 94f35baf1614 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
3 |
/** @file settings.cpp |
3615
59b36aaa050a
(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. |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
5 |
* The file consists of four parts: |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
6 |
* <ol> |
59b36aaa050a
(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 |
59b36aaa050a
(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 |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
9 |
* lists, strings, integers, 'bit'-masks and element selections. |
59b36aaa050a
(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 |
59b36aaa050a
(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 |
59b36aaa050a
(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 |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
13 |
* in a savegame is handled inside these structures. |
59b36aaa050a
(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 |
59b36aaa050a
(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. |
59b36aaa050a
(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. |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
17 |
* </ol> |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
18 |
* @see SettingDesc |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
19 |
* @see SaveLoad |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
20 |
*/ |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
21 |
|
0 | 22 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1777
diff
changeset
|
23 |
#include "openttd.h" |
2291
2b064aa97f91
(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" |
2121
c86a863485ee
(svn r2631) Move screenshot related variables from variables.h to screenshot.[ch]
tron
parents:
2044
diff
changeset
|
25 |
#include "screenshot.h" |
2153
91e89aa8c299
(svn r2663) Include variables.h only in these files which need it, not globally via openttd.h
tron
parents:
2125
diff
changeset
|
26 |
#include "variables.h" |
5720
cc0ceeafaa55
(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
|
27 |
#include "network/network.h" |
10792
95b6eb9fcc9e
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
10790
diff
changeset
|
28 |
#include "network/network_func.h" |
8704
2857ec554839
(svn r11771) -Codechange: split settings.h into better separated headers.
rubidium
parents:
8653
diff
changeset
|
29 |
#include "settings_internal.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8610
diff
changeset
|
30 |
#include "command_func.h" |
10684 | 31 |
#include "console_func.h" |
3112
05a599216d83
(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
|
32 |
#include "saveload.h" |
3358
798877df0899
(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
|
33 |
#include "npf.h" |
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
34 |
#include "yapf/yapf.h" |
3628
bd4a6601e5a2
(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
|
35 |
#include "newgrf.h" |
5228
c4a780348f66
(svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
5211
diff
changeset
|
36 |
#include "newgrf_config.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4293
diff
changeset
|
37 |
#include "genworld.h" |
5116
2a33a74925c5
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
KUDr
parents:
5113
diff
changeset
|
38 |
#include "rail.h" |
8249
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
39 |
#include "train.h" |
9259
088d3649dd4f
(svn r12459) -Codechange: split news.h into news_type.h and news_func.h.
rubidium
parents:
9243
diff
changeset
|
40 |
#include "news_func.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
41 |
#include "window_func.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8609
diff
changeset
|
42 |
#include "strings_func.h" |
8640
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8636
diff
changeset
|
43 |
#include "vehicle_func.h" |
8653
a83f7a536919
(svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents:
8640
diff
changeset
|
44 |
#include "sound_func.h" |
8709
4187ad809fe7
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents:
8704
diff
changeset
|
45 |
#include "core/alloc_func.hpp" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8710
diff
changeset
|
46 |
#include "player_func.h" |
10402
b168fbb99f7c
(svn r12944) -Codechange: use rev.h instead of externs at many places
smatz
parents:
10382
diff
changeset
|
47 |
#include "rev.h" |
5108
dc67d70b5a45
(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
|
48 |
#ifdef WITH_FREETYPE |
dc67d70b5a45
(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
|
49 |
#include "fontcache.h" |
dc67d70b5a45
(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
|
50 |
#endif |
7299
74e163f03bbc
(svn r10042) -Codechange: Replace hardcoded spritecache size with a configuration
peter1138
parents:
7276
diff
changeset
|
51 |
#include "spritecache.h" |
8345
6caa3fdb972c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
8249
diff
changeset
|
52 |
#include "transparency.h" |
9233
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9226
diff
changeset
|
53 |
#include "textbuf_gui.h" |
8710
52015340050c
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8709
diff
changeset
|
54 |
#include "string_func.h" |
9305
0c214cd8b39e
(svn r12550) -Change: the signal GUI is now persistent - has the same data when it is reopened
smatz
parents:
9302
diff
changeset
|
55 |
#include "rail_gui.h" |
10473
ad730880e443
(svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
10471
diff
changeset
|
56 |
#include "elrail_func.h" |
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
57 |
#include "gui.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
58 |
#include "town.h" |
8771
f7ad4dba14bf
(svn r11839) -Codechange: move some variables from variables.h to a more logical location.
rubidium
parents:
8761
diff
changeset
|
59 |
#include "video/video_driver.hpp" |
f7ad4dba14bf
(svn r11839) -Codechange: move some variables from variables.h to a more logical location.
rubidium
parents:
8761
diff
changeset
|
60 |
#include "sound/sound_driver.hpp" |
f7ad4dba14bf
(svn r11839) -Codechange: move some variables from variables.h to a more logical location.
rubidium
parents:
8761
diff
changeset
|
61 |
#include "music/music_driver.hpp" |
f7ad4dba14bf
(svn r11839) -Codechange: move some variables from variables.h to a more logical location.
rubidium
parents:
8761
diff
changeset
|
62 |
#include "blitter/factory.hpp" |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
63 |
#include "station_func.h" |
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
64 |
|
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
65 |
#include "table/strings.h" |
0 | 66 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
67 |
ClientSettings _settings_client; |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
68 |
GameSettings _settings_game; |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
69 |
GameSettings _settings_newgame; |
3121
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
70 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
71 |
struct IniFile; |
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
72 |
struct IniItem; |
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
73 |
struct IniGroup; |
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
74 |
struct SettingsMemoryPool; |
0 | 75 |
|
3628
bd4a6601e5a2
(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
|
76 |
typedef const char *SettingListCallbackProc(const IniItem *item, uint index); |
bd4a6601e5a2
(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
|
77 |
typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, const char *grpname, void *object); |
bd4a6601e5a2
(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
|
78 |
typedef void SettingDescProcList(IniFile *ini, const char *grpname, char **list, uint len, SettingListCallbackProc proc); |
bd4a6601e5a2
(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
|
79 |
|
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
80 |
static void pool_init(SettingsMemoryPool **pool); |
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
81 |
static void *pool_alloc(SettingsMemoryPool **pool, size_t size); |
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
82 |
static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, size_t size); |
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
83 |
static void pool_free(SettingsMemoryPool **pool); |
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
84 |
static bool IsSignedVarMemType(VarType vt); |
0 | 85 |
|
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
86 |
struct SettingsMemoryPool { |
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
87 |
size_t pos, size; |
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
88 |
SettingsMemoryPool *next; |
0 | 89 |
byte mem[1]; |
90 |
}; |
|
91 |
||
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
92 |
static SettingsMemoryPool *pool_new(size_t minsize) |
0 | 93 |
{ |
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
94 |
SettingsMemoryPool *p; |
0 | 95 |
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
|
96 |
|
8533
a9b708fe4a00
(svn r11597) -Change: replace all remaining instances of (re|m|c)alloc with (Re|M|C)allocT and add a check for out-of-memory situations to the *allocT functions.
rubidium
parents:
8530
diff
changeset
|
97 |
p = (SettingsMemoryPool*)MallocT<byte>(sizeof(SettingsMemoryPool) - 1 + minsize); |
0 | 98 |
p->pos = 0; |
99 |
p->size = minsize; |
|
100 |
p->next = NULL; |
|
101 |
return p; |
|
102 |
} |
|
103 |
||
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
104 |
static void pool_init(SettingsMemoryPool **pool) |
0 | 105 |
{ |
106 |
*pool = pool_new(0); |
|
107 |
} |
|
108 |
||
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
109 |
static void *pool_alloc(SettingsMemoryPool **pool, size_t size) |
0 | 110 |
{ |
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
111 |
size_t pos; |
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
112 |
SettingsMemoryPool *p = *pool; |
0 | 113 |
|
8423
8453e9a0f0b5
(svn r11480) -Codechange: Rename the function ALIGN fitting to the naming style
skidd13
parents:
8418
diff
changeset
|
114 |
size = Align(size, sizeof(void*)); |
0 | 115 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
116 |
/* first check if there's memory in the next pool */ |
0 | 117 |
if (p->next && p->next->pos + size <= p->next->size) { |
118 |
p = p->next; |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
119 |
/* then check if there's not memory in the cur pool */ |
0 | 120 |
} else if (p->pos + size > p->size) { |
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
121 |
SettingsMemoryPool *n = pool_new(size); |
0 | 122 |
*pool = n; |
123 |
n->next = p; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
124 |
p = n; |
0 | 125 |
} |
126 |
||
127 |
pos = p->pos; |
|
128 |
p->pos += size; |
|
129 |
return p->mem + pos; |
|
130 |
} |
|
131 |
||
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
132 |
static void *pool_strdup(SettingsMemoryPool **pool, const char *mem, size_t size) |
0 | 133 |
{ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
134 |
byte *p = (byte*)pool_alloc(pool, size + 1); |
0 | 135 |
p[size] = 0; |
136 |
memcpy(p, mem, size); |
|
137 |
return p; |
|
138 |
} |
|
139 |
||
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
140 |
static void pool_free(SettingsMemoryPool **pool) |
0 | 141 |
{ |
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
142 |
SettingsMemoryPool *p = *pool, *n; |
0 | 143 |
*pool = NULL; |
144 |
while (p) { |
|
145 |
n = p->next; |
|
146 |
free(p); |
|
147 |
p = n; |
|
148 |
} |
|
149 |
} |
|
150 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
151 |
/** structs describing the ini format. */ |
0 | 152 |
struct IniItem { |
153 |
char *name; |
|
154 |
char *value; |
|
155 |
char *comment; |
|
156 |
IniItem *next; |
|
157 |
}; |
|
158 |
||
159 |
struct IniGroup { |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
160 |
char *name; ///< name of group |
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
161 |
char *comment; ///<comment for group |
0 | 162 |
IniItem *item, **last_item; |
163 |
IniGroup *next; |
|
164 |
IniFile *ini; |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
165 |
IniGroupType type; ///< type of group |
0 | 166 |
}; |
167 |
||
168 |
struct IniFile { |
|
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
169 |
SettingsMemoryPool *pool; |
0 | 170 |
IniGroup *group, **last_group; |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
171 |
char *comment; ///< last comment in file |
0 | 172 |
}; |
173 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
174 |
/** allocate an inifile object */ |
6573 | 175 |
static IniFile *ini_alloc() |
0 | 176 |
{ |
177 |
IniFile *ini; |
|
1258
7b078174f796
(svn r1762) -Codechange: renamed 'MemoryPool' to 'SettingsMemoryPool' (we need
truelight
parents:
1247
diff
changeset
|
178 |
SettingsMemoryPool *pool; |
0 | 179 |
pool_init(&pool); |
180 |
ini = (IniFile*)pool_alloc(&pool, sizeof(IniFile)); |
|
181 |
ini->pool = pool; |
|
182 |
ini->group = NULL; |
|
183 |
ini->last_group = &ini->group; |
|
184 |
ini->comment = NULL; |
|
185 |
return ini; |
|
186 |
} |
|
187 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
188 |
/** allocate an ini group object */ |
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
189 |
static IniGroup *ini_group_alloc(IniFile *ini, const char *grpt, size_t len) |
0 | 190 |
{ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
191 |
IniGroup *grp = (IniGroup*)pool_alloc(&ini->pool, sizeof(IniGroup)); |
0 | 192 |
grp->ini = ini; |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
193 |
grp->name = (char*)pool_strdup(&ini->pool, grpt, len); |
2953
310f58987d7b
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
194 |
if (!strcmp(grp->name, "newgrf") || !strcmp(grp->name, "servers") || !strcmp(grp->name, "bans")) { |
705
e213445d82ec
(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
|
195 |
grp->type = IGT_LIST; |
2953
310f58987d7b
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
196 |
} else { |
705
e213445d82ec
(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
|
197 |
grp->type = IGT_VARIABLES; |
2953
310f58987d7b
(svn r3512) Yet more whitespace fixes (mostly by Rubidium)
peter1138
parents:
2952
diff
changeset
|
198 |
} |
0 | 199 |
grp->next = NULL; |
200 |
grp->item = NULL; |
|
201 |
grp->comment = NULL; |
|
202 |
grp->last_item = &grp->item; |
|
203 |
*ini->last_group = grp; |
|
204 |
ini->last_group = &grp->next; |
|
205 |
return grp; |
|
206 |
} |
|
207 |
||
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
208 |
static IniItem *ini_item_alloc(IniGroup *group, const char *name, size_t len) |
0 | 209 |
{ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
210 |
IniItem *item = (IniItem*)pool_alloc(&group->ini->pool, sizeof(IniItem)); |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
211 |
item->name = (char*)pool_strdup(&group->ini->pool, name, len); |
0 | 212 |
item->next = NULL; |
213 |
item->comment = NULL; |
|
214 |
item->value = NULL; |
|
215 |
*group->last_item = item; |
|
216 |
group->last_item = &item->next; |
|
217 |
return item; |
|
218 |
} |
|
219 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
220 |
/** load an ini file into the "abstract" format */ |
0 | 221 |
static IniFile *ini_load(const char *filename) |
222 |
{ |
|
223 |
char buffer[1024], c, *s, *t, *e; |
|
224 |
FILE *in; |
|
225 |
IniFile *ini; |
|
226 |
IniGroup *group = NULL; |
|
227 |
IniItem *item; |
|
228 |
||
1329 | 229 |
char *comment = NULL; |
0 | 230 |
uint comment_size = 0; |
231 |
uint comment_alloc = 0; |
|
232 |
||
233 |
ini = ini_alloc(); |
|
234 |
||
235 |
in = fopen(filename, "r"); |
|
236 |
if (in == NULL) return ini; |
|
237 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
238 |
/* for each line in the file */ |
0 | 239 |
while (fgets(buffer, sizeof(buffer), in)) { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
240 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
241 |
/* trim whitespace from the left side */ |
9191
ae14770c829a
(svn r12368) -Codechange: use explicit body for loops and conditions and remove -Wno-empty-body from the configure script
smatz
parents:
9144
diff
changeset
|
242 |
for (s = buffer; *s == ' ' || *s == '\t'; s++) {} |
0 | 243 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
244 |
/* trim whitespace from right side. */ |
0 | 245 |
e = s + strlen(s); |
10229
fba3f9fa44d7
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
10178
diff
changeset
|
246 |
while (e > s && ((c = e[-1]) == '\n' || c == '\r' || c == ' ' || c == '\t')) e--; |
3598
0cf4d5726bf8
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
247 |
*e = '\0'; |
0 | 248 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
249 |
/* skip comments and empty lines */ |
4969
e68b7e0b27e3
(svn r6972) - Codechange: Allow standard ini-file style comments
peter1138
parents:
4870
diff
changeset
|
250 |
if (*s == '#' || *s == ';' || *s == '\0') { |
0 | 251 |
uint ns = comment_size + (e - s + 1); |
252 |
uint a = comment_alloc; |
|
253 |
uint pos; |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
254 |
/* add to comment */ |
0 | 255 |
if (ns > a) { |
5852
cb3f71b16e1a
(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:
5838
diff
changeset
|
256 |
a = max(a, 128U); |
10229
fba3f9fa44d7
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
10178
diff
changeset
|
257 |
do a *= 2; while (a < ns); |
5860
7fdc9b423ba1
(svn r8066) - Codechange: MallocT(), CallocT(), ReallocT() now return the pointer to allocated memory instead of modifying the pointer given as parameter
KUDr
parents:
5852
diff
changeset
|
258 |
comment = ReallocT(comment, comment_alloc = a); |
0 | 259 |
} |
260 |
pos = comment_size; |
|
261 |
comment_size += (e - s + 1); |
|
262 |
comment[pos + e - s] = '\n'; // comment newline |
|
263 |
memcpy(comment + pos, s, e - s); // copy comment contents |
|
264 |
continue; |
|
265 |
} |
|
266 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
267 |
/* it's a group? */ |
0 | 268 |
if (s[0] == '[') { |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
269 |
if (e[-1] != ']') { |
5827
20879afb77f6
(svn r8013) -Codechange (r6921, rUnknown): Show the error message of corrupt or missing (own) files
Darkvater
parents:
5726
diff
changeset
|
270 |
ShowInfoF("ini: invalid group name '%s'", buffer); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
271 |
} else { |
0 | 272 |
e--; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
273 |
} |
0 | 274 |
s++; // skip [ |
275 |
group = ini_group_alloc(ini, s, e - s); |
|
276 |
if (comment_size) { |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
277 |
group->comment = (char*)pool_strdup(&ini->pool, comment, comment_size); |
0 | 278 |
comment_size = 0; |
279 |
} |
|
280 |
} else if (group) { |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
281 |
/* find end of keyname */ |
6933
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
282 |
if (*s == '\"') { |
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
283 |
s++; |
9191
ae14770c829a
(svn r12368) -Codechange: use explicit body for loops and conditions and remove -Wno-empty-body from the configure script
smatz
parents:
9144
diff
changeset
|
284 |
for (t = s; *t != '\0' && *t != '\"'; t++) {} |
6933
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
285 |
if (*t == '\"') *t = ' '; |
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
286 |
} else { |
9191
ae14770c829a
(svn r12368) -Codechange: use explicit body for loops and conditions and remove -Wno-empty-body from the configure script
smatz
parents:
9144
diff
changeset
|
287 |
for (t = s; *t != '\0' && *t != '=' && *t != '\t' && *t != ' '; t++) {} |
6933
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
288 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
289 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
290 |
/* it's an item in an existing group */ |
0 | 291 |
item = ini_item_alloc(group, s, t-s); |
292 |
if (comment_size) { |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
293 |
item->comment = (char*)pool_strdup(&ini->pool, comment, comment_size); |
0 | 294 |
comment_size = 0; |
295 |
} |
|
296 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
297 |
/* find start of parameter */ |
0 | 298 |
while (*t == '=' || *t == ' ' || *t == '\t') t++; |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
299 |
|
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
300 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
301 |
/* remove starting quotation marks */ |
2952 | 302 |
if (*t == '\"') t++; |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
303 |
/* remove ending quotation marks */ |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
304 |
e = t + strlen(t); |
3598
0cf4d5726bf8
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
305 |
if (e > t && e[-1] == '\"') e--; |
0cf4d5726bf8
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
306 |
*e = '\0'; |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
307 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
308 |
item->value = (char*)pool_strdup(&ini->pool, t, e - t); |
0 | 309 |
} else { |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
310 |
/* it's an orphan item */ |
5827
20879afb77f6
(svn r8013) -Codechange (r6921, rUnknown): Show the error message of corrupt or missing (own) files
Darkvater
parents:
5726
diff
changeset
|
311 |
ShowInfoF("ini: '%s' outside of group", buffer); |
0 | 312 |
} |
313 |
} |
|
314 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
315 |
if (comment_size > 0) { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
316 |
ini->comment = (char*)pool_strdup(&ini->pool, comment, comment_size); |
0 | 317 |
comment_size = 0; |
318 |
} |
|
319 |
||
320 |
free(comment); |
|
321 |
fclose(in); |
|
322 |
||
323 |
return ini; |
|
324 |
} |
|
325 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
326 |
/** lookup a group or make a new one */ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
327 |
static IniGroup *ini_getgroup(IniFile *ini, const char *name, size_t len = 0) |
0 | 328 |
{ |
329 |
IniGroup *group; |
|
330 |
||
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
331 |
if (len == 0) len = strlen(name); |
0 | 332 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
333 |
/* does it exist already? */ |
10699
c8718b56d984
(svn r13247) -Codechange: small amount of coding style for settings.cpp.
rubidium
parents:
10695
diff
changeset
|
334 |
for (group = ini->group; group != NULL; group = group->next) { |
c8718b56d984
(svn r13247) -Codechange: small amount of coding style for settings.cpp.
rubidium
parents:
10695
diff
changeset
|
335 |
if (!memcmp(group->name, name, len) && group->name[len] == 0) { |
0 | 336 |
return group; |
10699
c8718b56d984
(svn r13247) -Codechange: small amount of coding style for settings.cpp.
rubidium
parents:
10695
diff
changeset
|
337 |
} |
c8718b56d984
(svn r13247) -Codechange: small amount of coding style for settings.cpp.
rubidium
parents:
10695
diff
changeset
|
338 |
} |
0 | 339 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
340 |
/* otherwise make a new one */ |
0 | 341 |
group = ini_group_alloc(ini, name, len); |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
342 |
group->comment = (char*)pool_strdup(&ini->pool, "\n", 1); |
0 | 343 |
return group; |
344 |
} |
|
345 |
||
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
346 |
static void ini_removegroup(IniFile *ini, const char *name) |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
347 |
{ |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
348 |
size_t len = strlen(name); |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
349 |
IniGroup *prev = NULL; |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
350 |
IniGroup *group; |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
351 |
|
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
352 |
/* does it exist already? */ |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
353 |
for (group = ini->group; group != NULL; prev = group, group = group->next) { |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
354 |
if (memcmp(group->name, name, len) == 0) { |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
355 |
break; |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
356 |
} |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
357 |
} |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
358 |
|
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
359 |
if (group == NULL) return; |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
360 |
|
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
361 |
if (prev != NULL) { |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
362 |
prev->next = prev->next->next; |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
363 |
} else { |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
364 |
ini->group = ini->group->next; |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
365 |
} |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
366 |
} |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
367 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
368 |
/** lookup an item or make a new one */ |
0 | 369 |
static IniItem *ini_getitem(IniGroup *group, const char *name, bool create) |
370 |
{ |
|
371 |
IniItem *item; |
|
10465
0c68afe3d725
(svn r13008) -Fix [FS#1997]: silence some MSVC x64 warnings
glx
parents:
10434
diff
changeset
|
372 |
size_t len = strlen(name); |
0 | 373 |
|
10699
c8718b56d984
(svn r13247) -Codechange: small amount of coding style for settings.cpp.
rubidium
parents:
10695
diff
changeset
|
374 |
for (item = group->item; item != NULL; item = item->next) { |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
375 |
if (strcmp(item->name, name) == 0) return item; |
10699
c8718b56d984
(svn r13247) -Codechange: small amount of coding style for settings.cpp.
rubidium
parents:
10695
diff
changeset
|
376 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
377 |
|
0 | 378 |
if (!create) return NULL; |
379 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
380 |
/* otherwise make a new one */ |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
381 |
return ini_item_alloc(group, name, len); |
0 | 382 |
} |
383 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
384 |
/** save ini file from the "abstract" format. */ |
0 | 385 |
static bool ini_save(const char *filename, IniFile *ini) |
386 |
{ |
|
387 |
FILE *f; |
|
388 |
IniGroup *group; |
|
389 |
IniItem *item; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
390 |
|
0 | 391 |
f = fopen(filename, "w"); |
392 |
if (f == NULL) return false; |
|
393 |
||
2919
5a867896b255
(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
|
394 |
for (group = ini->group; group != NULL; group = group->next) { |
0 | 395 |
if (group->comment) fputs(group->comment, f); |
396 |
fprintf(f, "[%s]\n", group->name); |
|
2919
5a867896b255
(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
|
397 |
for (item = group->item; item != NULL; item = item->next) { |
3600
8ac0930f937a
(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
|
398 |
assert(item->value != NULL); |
8ac0930f937a
(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
|
399 |
if (item->comment != NULL) fputs(item->comment, f); |
8ac0930f937a
(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
|
400 |
|
6933
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
401 |
/* protect item->name with quotes if needed */ |
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
402 |
if (strchr(item->name, ' ') != NULL) { |
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
403 |
fprintf(f, "\"%s\"", item->name); |
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
404 |
} else { |
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
405 |
fprintf(f, "%s", item->name); |
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
406 |
} |
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
407 |
|
4434
4175805666a5
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4431
diff
changeset
|
408 |
/* Don't give an equal sign to list items that don't have a parameter */ |
3600
8ac0930f937a
(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
|
409 |
if (group->type == IGT_LIST && *item->value == '\0') { |
6933
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
410 |
fprintf(f, "\n"); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
411 |
} else { |
6933
93e62a8e80bd
(svn r9573) -Fix: enclose settings names containing spaces (like newgrf paths) with quotes
glx
parents:
6925
diff
changeset
|
412 |
fprintf(f, " = %s\n", item->value); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
413 |
} |
0 | 414 |
} |
415 |
} |
|
416 |
if (ini->comment) fputs(ini->comment, f); |
|
417 |
||
418 |
fclose(f); |
|
419 |
return true; |
|
420 |
} |
|
421 |
||
422 |
static void ini_free(IniFile *ini) |
|
423 |
{ |
|
424 |
pool_free(&ini->pool); |
|
425 |
} |
|
426 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
427 |
/** Find the index value of a ONEofMANY type in a string seperated by | |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
428 |
* @param many full domain of values the ONEofMANY setting can have |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
429 |
* @param one the current value of the setting for which a value needs found |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 onelen force calculation of the *one parameter |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
* @return the integer index of the full-list, or -1 if not found */ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
432 |
static int lookup_oneofmany(const char *many, const char *one, size_t onelen = 0) |
0 | 433 |
{ |
434 |
const char *s; |
|
435 |
int idx; |
|
436 |
||
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
437 |
if (onelen == 0) onelen = strlen(one); |
0 | 438 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
439 |
/* check if it's an integer */ |
0 | 440 |
if (*one >= '0' && *one <= '9') |
441 |
return strtoul(one, NULL, 0); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
442 |
|
0 | 443 |
idx = 0; |
2952 | 444 |
for (;;) { |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
445 |
/* find end of item */ |
0 | 446 |
s = many; |
447 |
while (*s != '|' && *s != 0) s++; |
|
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
448 |
if ((size_t)(s - many) == onelen && !memcmp(one, many, onelen)) return idx; |
0 | 449 |
if (*s == 0) return -1; |
450 |
many = s + 1; |
|
451 |
idx++; |
|
452 |
} |
|
453 |
} |
|
454 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
455 |
/** Find the set-integer value MANYofMANY type in a string |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
* @param many full domain of values the MANYofMANY setting can have |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
457 |
* @param str the current string value of the setting, each individual |
6979
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
458 |
* of seperated by a whitespace,tab or | character |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
459 |
* @return the 'fully' set integer, or -1 if a set is not found */ |
0 | 460 |
static uint32 lookup_manyofmany(const char *many, const char *str) |
461 |
{ |
|
462 |
const char *s; |
|
463 |
int r; |
|
464 |
uint32 res = 0; |
|
465 |
||
2952 | 466 |
for (;;) { |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
467 |
/* skip "whitespace" */ |
0 | 468 |
while (*str == ' ' || *str == '\t' || *str == '|') str++; |
469 |
if (*str == 0) break; |
|
470 |
||
471 |
s = str; |
|
472 |
while (*s != 0 && *s != ' ' && *s != '\t' && *s != '|') s++; |
|
473 |
||
474 |
r = lookup_oneofmany(many, str, s - str); |
|
475 |
if (r == -1) return (uint32)-1; |
|
476 |
||
8427
143b0be22af1
(svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
skidd13
parents:
8424
diff
changeset
|
477 |
SetBit(res, r); // value found, set it |
0 | 478 |
if (*s == 0) break; |
479 |
str = s + 1; |
|
480 |
} |
|
481 |
return res; |
|
482 |
} |
|
483 |
||
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
/** Parse an integerlist string and set each found value |
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
485 |
* @param p the string to be parsed. Each element in the list is seperated by a |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
486 |
* comma or a space character |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
487 |
* @param items pointer to the integerlist-array that will be filled with values |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
488 |
* @param maxitems the maximum number of elements the integerlist-array has |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
489 |
* @return returns the number of items found, or -1 on an error */ |
0 | 490 |
static int parse_intlist(const char *p, int *items, int maxitems) |
491 |
{ |
|
492 |
int n = 0, v; |
|
493 |
char *end; |
|
494 |
||
2952 | 495 |
for (;;) { |
0 | 496 |
v = strtol(p, &end, 0); |
497 |
if (p == end || n == maxitems) return -1; |
|
498 |
p = end; |
|
499 |
items[n++] = v; |
|
3598
0cf4d5726bf8
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Darkvater
parents:
3596
diff
changeset
|
500 |
if (*p == '\0') break; |
3599
c24dba47af62
(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
|
501 |
if (*p != ',' && *p != ' ') return -1; |
0 | 502 |
p++; |
503 |
} |
|
504 |
||
505 |
return n; |
|
506 |
} |
|
507 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
508 |
/** Load parsed string-values into an integer-array (intlist) |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
509 |
* @param str the string that contains the values (and will be parsed) |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
510 |
* @param array pointer to the integer-arrays that will be filled |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
511 |
* @param nelems the number of elements the array holds. Maximum is 64 elements |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
* @param type the type of elements the array holds (eg INT8, UINT16, etc.) |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
513 |
* @return return true on success and false on error */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
514 |
static bool load_intlist(const char *str, void *array, int nelems, VarType type) |
0 | 515 |
{ |
516 |
int items[64]; |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
int i, nitems; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
518 |
|
0 | 519 |
if (str == NULL) { |
520 |
memset(items, 0, sizeof(items)); |
|
521 |
nitems = nelems; |
|
522 |
} else { |
|
523 |
nitems = parse_intlist(str, items, lengthof(items)); |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
524 |
if (nitems != nelems) return false; |
0 | 525 |
} |
526 |
||
2952 | 527 |
switch (type) { |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
528 |
case SLE_VAR_BL: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
529 |
case SLE_VAR_I8: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
530 |
case SLE_VAR_U8: |
2952 | 531 |
for (i = 0; i != nitems; i++) ((byte*)array)[i] = items[i]; |
0 | 532 |
break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
533 |
case SLE_VAR_I16: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
534 |
case SLE_VAR_U16: |
2952 | 535 |
for (i = 0; i != nitems; i++) ((uint16*)array)[i] = items[i]; |
0 | 536 |
break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
537 |
case SLE_VAR_I32: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
538 |
case SLE_VAR_U32: |
2952 | 539 |
for (i = 0; i != nitems; i++) ((uint32*)array)[i] = items[i]; |
0 | 540 |
break; |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
default: NOT_REACHED(); |
0 | 542 |
} |
543 |
||
544 |
return true; |
|
545 |
} |
|
546 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
547 |
/** Convert an integer-array (intlist) to a string representation. Each value |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
548 |
* is seperated by a comma or a space character |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
549 |
* @param buf output buffer where the string-representation will be stored |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
550 |
* @param array pointer to the integer-arrays that is read from |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
551 |
* @param nelems the number of elements the array holds. |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
552 |
* @param type the type of elements the array holds (eg INT8, UINT16, etc.) */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
553 |
static void make_intlist(char *buf, const void *array, int nelems, VarType type) |
0 | 554 |
{ |
555 |
int i, v = 0; |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
556 |
const byte *p = (const byte*)array; |
2952 | 557 |
|
558 |
for (i = 0; i != nelems; i++) { |
|
559 |
switch (type) { |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
560 |
case SLE_VAR_BL: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
561 |
case SLE_VAR_I8: v = *(int8*)p; p += 1; break; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
562 |
case SLE_VAR_U8: v = *(byte*)p; p += 1; break; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
563 |
case SLE_VAR_I16: v = *(int16*)p; p += 2; break; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
564 |
case SLE_VAR_U16: v = *(uint16*)p; p += 2; break; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
565 |
case SLE_VAR_I32: v = *(int32*)p; p += 4; break; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
566 |
case SLE_VAR_U32: v = *(uint32*)p; p += 4; break; |
0 | 567 |
default: NOT_REACHED(); |
568 |
} |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
569 |
buf += sprintf(buf, (i == 0) ? "%d" : ",%d", v); |
0 | 570 |
} |
571 |
} |
|
572 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
573 |
/** Convert a ONEofMANY structure to a string representation. |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 buf output buffer where the string-representation will be stored |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
* @param many the full-domain string of possible values |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
576 |
* @param id the value of the variable and whose string-representation must be found */ |
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
577 |
static void make_oneofmany(char *buf, const char *many, int id) |
0 | 578 |
{ |
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
579 |
int orig_id = id; |
0 | 580 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
581 |
/* Look for the id'th element */ |
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
582 |
while (--id >= 0) { |
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
583 |
for (; *many != '|'; many++) { |
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
584 |
if (*many == '\0') { // not found |
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
585 |
sprintf(buf, "%d", orig_id); |
0 | 586 |
return; |
587 |
} |
|
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
588 |
} |
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
589 |
many++; // pass the |-character |
0 | 590 |
} |
591 |
||
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
592 |
/* copy string until next item (|) or the end of the list if this is the last one */ |
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
593 |
while (*many != '\0' && *many != '|') *buf++ = *many++; |
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
594 |
*buf = '\0'; |
0 | 595 |
} |
596 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
597 |
/** Convert a MANYofMANY structure to a string representation. |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
* @param buf output buffer where the string-representation will be stored |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
599 |
* @param many the full-domain string of possible values |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
* @param x the value of the variable and whose string-representation must |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
601 |
* be found in the bitmasked many string */ |
0 | 602 |
static void make_manyofmany(char *buf, const char *many, uint32 x) |
603 |
{ |
|
604 |
const char *start; |
|
605 |
int i = 0; |
|
606 |
bool init = true; |
|
607 |
||
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
608 |
for (; x != 0; x >>= 1, i++) { |
0 | 609 |
start = many; |
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
610 |
while (*many != 0 && *many != '|') many++; // advance to the next element |
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
611 |
|
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8423
diff
changeset
|
612 |
if (HasBit(x, 0)) { // item found, copy it |
0 | 613 |
if (!init) *buf++ = '|'; |
614 |
init = false; |
|
615 |
if (start == many) { |
|
616 |
buf += sprintf(buf, "%d", i); |
|
617 |
} else { |
|
618 |
memcpy(buf, start, many - start); |
|
619 |
buf += many - start; |
|
620 |
} |
|
621 |
} |
|
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
622 |
|
0 | 623 |
if (*many == '|') many++; |
2973
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
624 |
} |
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
625 |
|
350705be2913
(svn r3548) - [Patches]: rework two loops in make_oneofmany() and make_manyofmany()
Darkvater
parents:
2972
diff
changeset
|
626 |
*buf = '\0'; |
0 | 627 |
} |
628 |
||
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
629 |
/** Convert a string representation (external) of a setting to the internal rep. |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
630 |
* @param desc SettingDesc struct that holds all information about the variable |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
631 |
* @param str input string that will be parsed based on the type of desc |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
632 |
* @return return the parsed value of the setting */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
633 |
static const void *string_to_val(const SettingDescBase *desc, const char *str) |
0 | 634 |
{ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
635 |
switch (desc->cmd) { |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
636 |
case SDT_NUMX: { |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
637 |
char *end; |
2991
4582583fba15
(svn r3567) -Fix: for once and for all, use 'unsigned long' if you want to cast something
truelight
parents:
2975
diff
changeset
|
638 |
unsigned long val = strtoul(str, &end, 0); |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
639 |
if (*end != '\0') ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name); |
0 | 640 |
return (void*)val; |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
641 |
} |
0 | 642 |
case SDT_ONEOFMANY: { |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
643 |
long r = lookup_oneofmany(desc->many, str); |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
644 |
/* if the first attempt of conversion from string to the appropriate value fails, |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
645 |
* look if we have defined a converter from old value to new value. */ |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
646 |
if (r == -1 && desc->proc_cnvt != NULL) r = desc->proc_cnvt(str); |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
647 |
if (r != -1) return (void*)r; //and here goes converted value |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
648 |
ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); //sorry, we failed |
0 | 649 |
return 0; |
650 |
} |
|
651 |
case SDT_MANYOFMANY: { |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
652 |
unsigned long r = lookup_manyofmany(desc->many, str); |
2923
272d1b0962bc
(svn r3479) -Fix: fixed warnings on 64bit platforms (anyway, most 64bit platforms)
truelight
parents:
2919
diff
changeset
|
653 |
if (r != (unsigned long)-1) return (void*)r; |
0 | 654 |
ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); |
655 |
return 0; |
|
656 |
} |
|
657 |
case SDT_BOOLX: |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
658 |
if (strcmp(str, "true") == 0 || strcmp(str, "on") == 0 || strcmp(str, "1") == 0) |
0 | 659 |
return (void*)true; |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
660 |
if (strcmp(str, "false") == 0 || strcmp(str, "off") == 0 || strcmp(str, "0") == 0) |
0 | 661 |
return (void*)false; |
662 |
ShowInfoF("ini: invalid setting value '%s' for '%s'", str, desc->name); |
|
663 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
664 |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
665 |
case SDT_STRING: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
666 |
case SDT_INTLIST: return str; |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
667 |
default: break; |
0 | 668 |
} |
669 |
||
670 |
return NULL; |
|
671 |
} |
|
672 |
||
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
673 |
/** Set the value of a setting and if needed clamp the value to |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
674 |
* the preset minimum and maximum. |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
675 |
* @param ptr the variable itself |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
* @param sd pointer to the 'information'-database of the variable |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
677 |
* @param val signed long version of the new value |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
* @pre SettingDesc is of type SDT_BOOLX, SDT_NUMX, |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
* SDT_ONEOFMANY or SDT_MANYOFMANY. Other types are not supported as of now */ |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
static void Write_ValidateSetting(void *ptr, const SettingDesc *sd, int32 val) |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
{ |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
682 |
const SettingDescBase *sdb = &sd->desc; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
683 |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
684 |
if (sdb->cmd != SDT_BOOLX && |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
685 |
sdb->cmd != SDT_NUMX && |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
686 |
sdb->cmd != SDT_ONEOFMANY && |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
687 |
sdb->cmd != SDT_MANYOFMANY) { |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
688 |
return; |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
689 |
} |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
|
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
691 |
/* We cannot know the maximum value of a bitset variable, so just have faith */ |
3352
49d580a11385
(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
|
692 |
if (sdb->cmd != SDT_MANYOFMANY) { |
49d580a11385
(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
|
693 |
/* We need to take special care of the uint32 type as we receive from the function |
49d580a11385
(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
|
694 |
* a signed integer. While here also bail out on 64-bit settings as those are not |
49d580a11385
(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
|
695 |
* supported. Unsigned 8 and 16-bit variables are safe since they fit into a signed |
49d580a11385
(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
|
696 |
* 32-bit variable |
49d580a11385
(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
|
697 |
* TODO: Support 64-bit settings/variables */ |
49d580a11385
(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
|
698 |
switch (GetVarMemType(sd->save.conv)) { |
49d580a11385
(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
|
699 |
case SLE_VAR_BL: |
49d580a11385
(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
|
700 |
case SLE_VAR_I8: |
49d580a11385
(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
|
701 |
case SLE_VAR_U8: |
49d580a11385
(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
|
702 |
case SLE_VAR_I16: |
49d580a11385
(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
|
703 |
case SLE_VAR_U16: |
49d580a11385
(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
|
704 |
case SLE_VAR_I32: { |
49d580a11385
(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
|
705 |
/* Override the minimum value. No value below sdb->min, except special value 0 */ |
49d580a11385
(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
|
706 |
int32 min = ((sdb->flags & SGF_0ISDISABLED) && val <= sdb->min) ? 0 : sdb->min; |
8418
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8397
diff
changeset
|
707 |
val = Clamp(val, min, sdb->max); |
3352
49d580a11385
(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
|
708 |
} break; |
49d580a11385
(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
|
709 |
case SLE_VAR_U32: { |
49d580a11385
(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
|
710 |
/* Override the minimum value. No value below sdb->min, except special value 0 */ |
49d580a11385
(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
|
711 |
uint min = ((sdb->flags & SGF_0ISDISABLED) && (uint)val <= (uint)sdb->min) ? 0 : sdb->min; |
8418
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8397
diff
changeset
|
712 |
WriteValue(ptr, SLE_VAR_U32, (int64)ClampU(val, min, sdb->max)); |
3352
49d580a11385
(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
|
713 |
return; |
49d580a11385
(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
|
714 |
} |
49d580a11385
(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
|
715 |
case SLE_VAR_I64: |
49d580a11385
(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
|
716 |
case SLE_VAR_U64: |
49d580a11385
(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
|
717 |
default: NOT_REACHED(); break; |
49d580a11385
(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
|
718 |
} |
49d580a11385
(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
|
719 |
} |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
720 |
|
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
721 |
WriteValue(ptr, sd->save.conv, (int64)val); |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
722 |
} |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
723 |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
724 |
/** Load values from a group of an IniFile structure into the internal representation |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
725 |
* @param ini pointer to IniFile structure that holds administrative information |
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
726 |
* @param sd pointer to SettingDesc structure whose internally pointed variables will |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
727 |
* be given values |
6979
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
728 |
* @param grpname the group of the IniFile to search in for the new values |
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
729 |
* @param object pointer to the object been loaded */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
730 |
static void ini_load_settings(IniFile *ini, const SettingDesc *sd, const char *grpname, void *object) |
0 | 731 |
{ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
732 |
IniGroup *group; |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
733 |
IniGroup *group_def = ini_getgroup(ini, grpname); |
0 | 734 |
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
|
735 |
const void *p; |
0 | 736 |
void *ptr; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
737 |
const char *s; |
0 | 738 |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
739 |
for (; sd->save.cmd != SL_END; sd++) { |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
740 |
const SettingDescBase *sdb = &sd->desc; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
741 |
const SaveLoad *sld = &sd->save; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
742 |
|
3117
8066b8d0802b
(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
|
743 |
if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue; |
8066b8d0802b
(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
|
744 |
|
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
745 |
/* For patches.xx.yy load the settings from [xx] yy = ? */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
746 |
s = strchr(sdb->name, '.'); |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
747 |
if (s != NULL) { |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
group = ini_getgroup(ini, sdb->name, s - sdb->name); |
0 | 749 |
s++; |
750 |
} else { |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
s = sdb->name; |
0 | 752 |
group = group_def; |
753 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
754 |
|
0 | 755 |
item = ini_getitem(group, s, false); |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
756 |
if (item == NULL && group != group_def) { |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
757 |
/* For patches.xx.yy load the settings from [patches] yy = ? in case the previous |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
758 |
* did not exist (e.g. loading old config files with a [patches] section */ |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
759 |
item = ini_getitem(group_def, s, false); |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
760 |
} |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
761 |
if (item == NULL) { |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
762 |
/* For patches.xx.zz.yy load the settings from [zz] yy = ? in case the previous |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
763 |
* did not exist (e.g. loading old config files with a [yapf] section */ |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
764 |
const char *sc = strchr(s, '.'); |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
765 |
if (sc != NULL) item = ini_getitem(ini_getgroup(ini, s, sc - s), sc + 1, false); |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
766 |
} |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
767 |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
768 |
p = (item == NULL) ? sdb->def : string_to_val(sdb, item->value); |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
769 |
ptr = GetVariableAddress(object, sld); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
770 |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
771 |
switch (sdb->cmd) { |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
772 |
case SDT_BOOLX: /* All four are various types of (integer) numbers */ |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
773 |
case SDT_NUMX: |
0 | 774 |
case SDT_ONEOFMANY: |
775 |
case SDT_MANYOFMANY: |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
Write_ValidateSetting(ptr, sd, (unsigned long)p); break; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
777 |
|
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
778 |
case SDT_STRING: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
779 |
switch (GetVarMemType(sld->conv)) { |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SLE_VAR_STRB: |
4255
5cb4bcf7c83f
(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
|
781 |
case SLE_VAR_STRBQ: |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
782 |
if (p != NULL) ttd_strlcpy((char*)ptr, (const char*)p, sld->length); |
4255
5cb4bcf7c83f
(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
|
783 |
break; |
5cb4bcf7c83f
(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
|
784 |
case SLE_VAR_STR: |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SLE_VAR_STRQ: |
4255
5cb4bcf7c83f
(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
|
786 |
if (p != NULL) { |
5cb4bcf7c83f
(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
|
787 |
free(*(char**)ptr); |
5cb4bcf7c83f
(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
|
788 |
*(char**)ptr = strdup((const char*)p); |
5cb4bcf7c83f
(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
|
789 |
} |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
break; |
3192
5ac5072bf4b6
(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
|
791 |
case SLE_VAR_CHAR: *(char*)ptr = *(char*)p; break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
792 |
default: NOT_REACHED(); break; |
0 | 793 |
} |
794 |
break; |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
|
0 | 796 |
case SDT_INTLIST: { |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
797 |
if (!load_intlist((const char*)p, ptr, sld->length, GetVarMemType(sld->conv))) { |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
ShowInfoF("ini: error in array '%s'", sdb->name); |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
799 |
} else if (sd->desc.proc_cnvt != NULL) { |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
800 |
sd->desc.proc_cnvt((const char*)p); |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
801 |
} |
0 | 802 |
break; |
803 |
} |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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: NOT_REACHED(); break; |
0 | 805 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
806 |
} |
0 | 807 |
} |
808 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
809 |
/** Save the values of settings to the inifile. |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
* @param ini pointer to IniFile structure |
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
811 |
* @param sd read-only SettingDesc structure which contains the unmodified, |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
812 |
* loaded values of the configuration file and various information about it |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
813 |
* @param grpname holds the name of the group (eg. [network]) where these will be saved |
6979
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
814 |
* @param object pointer to the object been saved |
4000
bab1ebc37da0
(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
|
815 |
* The function works as follows: for each item in the SettingDesc structure we |
bab1ebc37da0
(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
|
816 |
* have a look if the value has changed since we started the game (the original |
bab1ebc37da0
(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
|
817 |
* values are reloaded when saving). If settings indeed have changed, we get |
bab1ebc37da0
(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
|
818 |
* these and save them. |
bab1ebc37da0
(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
|
819 |
*/ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
static void ini_save_settings(IniFile *ini, const SettingDesc *sd, const char *grpname, void *object) |
0 | 821 |
{ |
822 |
IniGroup *group_def = NULL, *group; |
|
823 |
IniItem *item; |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
824 |
char buf[512]; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
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
|
826 |
void *ptr; |
0 | 827 |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
828 |
for (; sd->save.cmd != SL_END; sd++) { |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
829 |
const SettingDescBase *sdb = &sd->desc; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
830 |
const SaveLoad *sld = &sd->save; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
|
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
832 |
/* If the setting is not saved to the configuration |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
833 |
* file, just continue with the next setting */ |
3117
8066b8d0802b
(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
|
834 |
if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
835 |
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
|
836 |
|
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
837 |
/* XXX - wtf is this?? (group override?) */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
838 |
s = strchr(sdb->name, '.'); |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
839 |
if (s != NULL) { |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
840 |
group = ini_getgroup(ini, sdb->name, s - sdb->name); |
0 | 841 |
s++; |
842 |
} else { |
|
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
843 |
if (group_def == NULL) group_def = ini_getgroup(ini, grpname); |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
844 |
s = sdb->name; |
0 | 845 |
group = group_def; |
846 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
847 |
|
0 | 848 |
item = ini_getitem(group, s, true); |
5141
05a806850445
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
849 |
ptr = GetVariableAddress(object, sld); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
188
diff
changeset
|
850 |
|
0 | 851 |
if (item->value != NULL) { |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
852 |
/* check if the value is the same as the old value */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
853 |
const void *p = string_to_val(sdb, item->value); |
0 | 854 |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
855 |
/* The main type of a variable/setting is in bytes 8-15 |
4549
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4511
diff
changeset
|
856 |
* The subtype (what kind of numbers do we have there) is in 0-7 */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
857 |
switch (sdb->cmd) { |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
858 |
case SDT_BOOLX: |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
859 |
case SDT_NUMX: |
0 | 860 |
case SDT_ONEOFMANY: |
861 |
case SDT_MANYOFMANY: |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
switch (GetVarMemType(sld->conv)) { |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
863 |
case SLE_VAR_BL: |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
864 |
if (*(bool*)ptr == (p != NULL)) continue; |
5066
72aa68614963
(svn r7124) -Fix (r37xx): sizeof(bool) = 4 for (certain) OSX do not assume it is 1. This would break
Darkvater
parents:
5052
diff
changeset
|
865 |
break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SLE_VAR_I8: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SLE_VAR_U8: |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
868 |
if (*(byte*)ptr == (byte)(unsigned long)p) continue; |
0 | 869 |
break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
870 |
case SLE_VAR_I16: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
871 |
case SLE_VAR_U16: |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
872 |
if (*(uint16*)ptr == (uint16)(unsigned long)p) continue; |
0 | 873 |
break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
874 |
case SLE_VAR_I32: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SLE_VAR_U32: |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
876 |
if (*(uint32*)ptr == (uint32)(unsigned long)p) continue; |
0 | 877 |
break; |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
878 |
default: NOT_REACHED(); |
0 | 879 |
} |
880 |
break; |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
881 |
default: break; /* Assume the other types are always changed */ |
0 | 882 |
} |
883 |
} |
|
884 |
||
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
885 |
/* Value has changed, get the new value and put it into a buffer */ |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
886 |
switch (sdb->cmd) { |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
887 |
case SDT_BOOLX: |
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
888 |
case SDT_NUMX: |
0 | 889 |
case SDT_ONEOFMANY: |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SDT_MANYOFMANY: { |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
891 |
uint32 i = (uint32)ReadValue(ptr, sld->conv); |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
|
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
switch (sdb->cmd) { |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SDT_BOOLX: strcpy(buf, (i != 0) ? "true" : "false"); break; |
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
895 |
case SDT_NUMX: sprintf(buf, IsSignedVarMemType(sld->conv) ? "%d" : "%u", i); break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SDT_ONEOFMANY: make_oneofmany(buf, sdb->many, i); break; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SDT_MANYOFMANY: make_manyofmany(buf, sdb->many, i); break; |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
898 |
default: NOT_REACHED(); |
0 | 899 |
} |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
900 |
} break; |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
901 |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
902 |
case SDT_STRING: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
switch (GetVarMemType(sld->conv)) { |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SLE_VAR_STRB: strcpy(buf, (char*)ptr); break; |
4255
5cb4bcf7c83f
(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
|
905 |
case SLE_VAR_STRBQ:sprintf(buf, "\"%s\"", (char*)ptr); break; |
5cb4bcf7c83f
(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
|
906 |
case SLE_VAR_STR: strcpy(buf, *(char**)ptr); break; |
5cb4bcf7c83f
(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
|
907 |
case SLE_VAR_STRQ: sprintf(buf, "\"%s\"", *(char**)ptr); break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SLE_VAR_CHAR: sprintf(buf, "\"%c\"", *(char*)ptr); break; |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
909 |
default: NOT_REACHED(); |
0 | 910 |
} |
911 |
break; |
|
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
912 |
|
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
case SDT_INTLIST: |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
make_intlist(buf, ptr, sld->length, GetVarMemType(sld->conv)); |
0 | 915 |
break; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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 |
default: NOT_REACHED(); |
0 | 917 |
} |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. 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 |
|
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
919 |
/* The value is different, that means we have to write it to the ini */ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
920 |
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
|
921 |
} |
0 | 922 |
} |
923 |
||
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
924 |
/** Loads all items from a 'grpname' section into a list |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
925 |
* The list parameter can be a NULL pointer, in this case nothing will be |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
926 |
* saved and a callback function should be defined that will take over the |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
927 |
* list-handling and store the data itself somewhere. |
6979
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
928 |
* @param ini IniFile handle to the ini file with the source data |
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
929 |
* @param grpname character string identifying the section-header of the ini |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
930 |
* file that will be parsed |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
931 |
* @param list pointer to an string(pointer) array that will store the parsed |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
932 |
* entries of the given section |
3628
bd4a6601e5a2
(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
|
933 |
* @param len the maximum number of items available for the above list |
bd4a6601e5a2
(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
|
934 |
* @param proc callback function that can override how the values are stored |
bd4a6601e5a2
(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
|
935 |
* inside the list */ |
bd4a6601e5a2
(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
|
936 |
static void ini_load_setting_list(IniFile *ini, const char *grpname, char **list, uint len, SettingListCallbackProc proc) |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
937 |
{ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
938 |
IniGroup *group = ini_getgroup(ini, grpname); |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
939 |
IniItem *item; |
3628
bd4a6601e5a2
(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
|
940 |
const char *entry; |
bd4a6601e5a2
(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
|
941 |
uint i, j; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
942 |
|
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
943 |
if (group == NULL) return; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
944 |
|
3628
bd4a6601e5a2
(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
|
945 |
for (i = j = 0, item = group->item; item != NULL; item = item->next) { |
bd4a6601e5a2
(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
|
946 |
entry = (proc != NULL) ? proc(item, i++) : item->name; |
bd4a6601e5a2
(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
|
947 |
|
bd4a6601e5a2
(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
|
948 |
if (entry == NULL || list == NULL) continue; |
bd4a6601e5a2
(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
|
949 |
|
bd4a6601e5a2
(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
|
950 |
if (j == len) break; |
bd4a6601e5a2
(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
|
951 |
list[j++] = strdup(entry); |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
952 |
} |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
953 |
} |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
954 |
|
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
955 |
/** Saves all items from a list into the 'grpname' section |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
956 |
* The list parameter can be a NULL pointer, in this case a callback function |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
957 |
* should be defined that will provide the source data to be saved. |
6984
045168d13eef
(svn r9669) -Documentation: some more doxygen fixes
belugas
parents:
6982
diff
changeset
|
958 |
* @param ini IniFile handle to the ini file where the destination data is saved |
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
959 |
* @param grpname character string identifying the section-header of the ini file |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
960 |
* @param list pointer to an string(pointer) array that will be used as the |
6984
045168d13eef
(svn r9669) -Documentation: some more doxygen fixes
belugas
parents:
6982
diff
changeset
|
961 |
* source to be saved into the relevant ini section |
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
962 |
* @param len the maximum number of items available for the above list |
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
963 |
* @param proc callback function that can will provide the source data if defined */ |
3628
bd4a6601e5a2
(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
|
964 |
static void ini_save_setting_list(IniFile *ini, const char *grpname, char **list, uint len, SettingListCallbackProc proc) |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
965 |
{ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
966 |
IniGroup *group = ini_getgroup(ini, grpname); |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
967 |
IniItem *item = NULL; |
3628
bd4a6601e5a2
(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
|
968 |
const char *entry; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
969 |
uint i; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
970 |
bool first = true; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
971 |
|
3628
bd4a6601e5a2
(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
|
972 |
if (proc == NULL && list == NULL) return; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
973 |
if (group == NULL) return; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
974 |
group->item = NULL; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
975 |
|
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
976 |
for (i = 0; i != len; i++) { |
3628
bd4a6601e5a2
(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
|
977 |
entry = (proc != NULL) ? proc(NULL, i) : list[i]; |
bd4a6601e5a2
(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
|
978 |
|
bd4a6601e5a2
(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
|
979 |
if (entry == NULL || *entry == '\0') continue; |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
980 |
|
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
981 |
if (first) { // add first item to the head of the group |
3628
bd4a6601e5a2
(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
|
982 |
item = ini_item_alloc(group, entry, strlen(entry)); |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
983 |
item->value = item->name; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
984 |
group->item = item; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
985 |
first = false; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
986 |
} else { // all other items are attached to the previous one |
3628
bd4a6601e5a2
(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
|
987 |
item->next = ini_item_alloc(group, entry, strlen(entry)); |
3115
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
988 |
item = item->next; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
989 |
item->value = item->name; |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
990 |
} |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
991 |
} |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
992 |
} |
1f4949f5dc5d
(svn r3719) - [1/4] Present the game with a unified structure for the configuration-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
|
993 |
|
0 | 994 |
//*************************** |
2972
f9fcee7f3815
(svn r3547) - [Patches]: do some general cleanup, commentarization before starting actual work. This patch contains no functional changes (I hope). It might break GPMI-builds though when trying to join a trunk/ network game or vice versa. To solve, you can change the order of the first 8 enums in SettingDescType. I think that'll work.
Darkvater
parents:
2969
diff
changeset
|
995 |
// OTTD specific INI stuff |
0 | 996 |
//*************************** |
997 |
||
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
998 |
/** Settings-macro usage: |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
999 |
* The list might look daunting at first, but is in general easy to understand. |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1000 |
* We have two types of list: |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* 1. SDTG_something |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* 2. SDT_something |
4000
bab1ebc37da0
(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
|
1003 |
* The 'G' stands for global, so this is the one you will use for a |
bab1ebc37da0
(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
|
1004 |
* SettingDescGlobVarList section meaning global variables. The other uses a |
6953
6b62ce182e3e
(svn r9616) -Cleanup: Remove the NS setting type since it causes desyncs in multiplayer mode and only serves to confuse patch authors.
maedhros
parents:
6950
diff
changeset
|
1005 |
* Base/Offset and runtime variable selection mechanism, known from the saveload |
6b62ce182e3e
(svn r9616) -Cleanup: Remove the NS setting type since it causes desyncs in multiplayer mode and only serves to confuse patch authors.
maedhros
parents:
6950
diff
changeset
|
1006 |
* convention (it also has global so it should not be hard). |
4000
bab1ebc37da0
(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
|
1007 |
* Of each type there are again two versions, the normal one and one prefixed |
bab1ebc37da0
(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
|
1008 |
* with 'COND'. |
bab1ebc37da0
(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
|
1009 |
* COND means that the setting is only valid in certain savegame versions |
bab1ebc37da0
(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
|
1010 |
* (since patches are saved to the savegame, this bookkeeping is necessary. |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* Now there are a lot of types. Easy ones are: |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1012 |
* - VAR: any number type, 'type' field specifies what number. eg int8 or uint32 |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* - BOOL: a boolean number type |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* - STR: a string or character. 'type' field specifies what string. Normal, string, or quoted |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1015 |
* A bit more difficult to use are MMANY (meaning ManyOfMany) and OMANY (OneOfMany) |
4000
bab1ebc37da0
(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
|
1016 |
* These are actually normal numbers, only bitmasked. In MMANY several bits can |
bab1ebc37da0
(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
|
1017 |
* be set, in the other only one. |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* The most complex type is INTLIST. This is basically an array of numbers. If |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* the intlist is only valid in certain savegame versions because for example |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* it has grown in size its length cannot be automatically be calculated so |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* use SDT(G)_CONDLISTO() meaning Old. |
4000
bab1ebc37da0
(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
|
1022 |
* If nothing fits you, you can use the GENERAL macros, but it exposes the |
bab1ebc37da0
(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
|
1023 |
* internal structure somewhat so it needs a little looking. There are _NULL() |
bab1ebc37da0
(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
|
1024 |
* macros as well, these fill up space so you can add more patches there (in |
6681
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1025 |
* place) and you DON'T have to increase the savegame version. |
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1026 |
* |
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1027 |
* While reading values from openttd.cfg, some values may not be converted |
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1028 |
* properly, for any kind of reasons. In order to allow a process of self-cleaning |
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1029 |
* mechanism, a callback procedure is made available. You will have to supply the function, which |
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1030 |
* will work on a string, one function per patch. And of course, enable the callback param |
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1031 |
* on the appropriate macro. |
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1032 |
*/ |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
|
6681
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1034 |
#define NSD_GENERAL(name, def, cmd, guiflags, min, max, interval, many, str, proc, load)\ |
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1035 |
{name, (const void*)(def), {cmd}, {guiflags}, min, max, interval, many, str, proc, load} |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1036 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1037 |
/* Macros for various objects to go in the configuration file. |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1038 |
* This section is for global variables */ |
4431
7468c1484d20
(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
|
1039 |
#define SDTG_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, var, length, def, min, max, interval, full, str, proc, from, to)\ |
6681
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1040 |
{NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, proc, NULL), SLEG_GENERAL(sle_cmd, var, type | flags, length, from, to)} |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
|
4431
7468c1484d20
(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
|
1042 |
#define SDTG_CONDVAR(name, type, flags, guiflags, var, def, min, max, interval, str, proc, from, to)\ |
7468c1484d20
(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
|
1043 |
SDTG_GENERAL(name, SDT_NUMX, SL_VAR, type, flags, guiflags, var, 0, def, min, max, interval, NULL, str, proc, from, to) |
7468c1484d20
(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
|
1044 |
#define SDTG_VAR(name, type, flags, guiflags, var, def, min, max, interval, str, proc)\ |
7468c1484d20
(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
|
1045 |
SDTG_CONDVAR(name, type, flags, guiflags, var, def, min, max, interval, str, proc, 0, SL_MAX_VERSION) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
#define SDTG_CONDBOOL(name, flags, guiflags, var, def, str, proc, from, to)\ |
6309
8b9b549655dc
(svn r8684) -Fix [FS#483] (r3720): a bool (uint32 in PPC) was written to as a uint8. Later those bools are used as index into an array as they expect the value to be 0 or 1.
rubidium
parents:
5939
diff
changeset
|
1048 |
SDTG_GENERAL(name, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, var, 0, def, 0, 1, 0, NULL, str, proc, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 SDTG_BOOL(name, flags, guiflags, var, def, str, proc)\ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
SDTG_CONDBOOL(name, flags, guiflags, var, def, str, proc, 0, SL_MAX_VERSION) |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 SDTG_CONDLIST(name, type, length, flags, guiflags, var, def, str, proc, from, to)\ |
4431
7468c1484d20
(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
|
1053 |
SDTG_GENERAL(name, SDT_INTLIST, SL_ARR, type, flags, guiflags, var, length, def, 0, 0, 0, NULL, str, proc, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
#define SDTG_LIST(name, type, flags, guiflags, var, def, str, proc)\ |
4431
7468c1484d20
(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
|
1055 |
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
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1056 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1057 |
#define SDTG_CONDSTR(name, type, length, flags, guiflags, var, def, str, proc, from, to)\ |
4431
7468c1484d20
(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
|
1058 |
SDTG_GENERAL(name, SDT_STRING, SL_STR, type, flags, guiflags, var, length, def, 0, 0, 0, NULL, str, proc, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1059 |
#define SDTG_STR(name, type, flags, guiflags, var, def, str, proc)\ |
4431
7468c1484d20
(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
|
1060 |
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
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1061 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1062 |
#define SDTG_CONDOMANY(name, type, flags, guiflags, var, def, max, full, str, proc, from, to)\ |
4431
7468c1484d20
(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
|
1063 |
SDTG_GENERAL(name, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, var, 0, def, 0, max, 0, full, str, proc, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1064 |
#define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, proc)\ |
7024
f767928cffd6
(svn r9716) -Add: server_lang in [network] section of openttd.cfg, so dedicated servers can have the little lang flag.
glx
parents:
6987
diff
changeset
|
1065 |
SDTG_CONDOMANY(name, type, flags, guiflags, var, def, max, full, str, proc, 0, SL_MAX_VERSION) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1066 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1067 |
#define SDTG_CONDMMANY(name, type, flags, guiflags, var, def, full, str, proc, from, to)\ |
4431
7468c1484d20
(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
|
1068 |
SDTG_GENERAL(name, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, var, 0, def, 0, 0, 0, full, str, proc, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1069 |
#define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, proc)\ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1070 |
SDTG_CONDMMANY(name, type, flags, guiflags, var, def, full, str, proc, 0, SL_MAX_VERSION) |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1071 |
|
3222
8bfed4267cba
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater
parents:
3210
diff
changeset
|
1072 |
#define SDTG_CONDNULL(length, from, to)\ |
6681
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1073 |
{{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLEG_CONDNULL(length, from, to)} |
3222
8bfed4267cba
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater
parents:
3210
diff
changeset
|
1074 |
|
6681
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1075 |
#define SDTG_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLEG_END()} |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1076 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1077 |
/* Macros for various objects to go in the configuration file. |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1078 |
* This section is for structures where their various members are saved */ |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1079 |
#define SDT_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, base, var, length, def, min, max, interval, full, str, proc, load, from, to)\ |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1080 |
{NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, proc, load), SLE_GENERAL(sle_cmd, base, var, type | flags, length, from, to)} |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1081 |
|
4431
7468c1484d20
(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
|
1082 |
#define SDT_CONDVAR(base, var, type, from, to, flags, guiflags, def, min, max, interval, str, proc)\ |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1083 |
SDT_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, base, var, 1, def, min, max, interval, NULL, str, proc, NULL, from, to) |
4431
7468c1484d20
(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
|
1084 |
#define SDT_VAR(base, var, type, flags, guiflags, def, min, max, interval, str, proc)\ |
7468c1484d20
(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
|
1085 |
SDT_CONDVAR(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, min, max, interval, str, proc) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1086 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1087 |
#define SDT_CONDBOOL(base, var, from, to, flags, guiflags, def, str, proc)\ |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1088 |
SDT_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, base, var, 1, def, 0, 1, 0, NULL, str, proc, NULL, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1089 |
#define SDT_BOOL(base, var, flags, guiflags, def, str, proc)\ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1090 |
SDT_CONDBOOL(base, var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1091 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1092 |
#define SDT_CONDLIST(base, var, type, from, to, flags, guiflags, def, str, proc)\ |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1093 |
SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, NULL, str, proc, NULL, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1094 |
#define SDT_LIST(base, var, type, flags, guiflags, def, str, proc)\ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1095 |
SDT_CONDLIST(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1096 |
#define SDT_CONDLISTO(base, var, length, type, from, to, flags, guiflags, def, str, proc, load)\ |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1097 |
SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, length, def, 0, 0, 0, NULL, str, proc, load, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1098 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1099 |
#define SDT_CONDSTR(base, var, type, from, to, flags, guiflags, def, str, proc)\ |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1100 |
SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, NULL, str, proc, NULL, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1101 |
#define SDT_STR(base, var, type, flags, guiflags, def, str, proc)\ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1102 |
SDT_CONDSTR(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1103 |
#define SDT_CONDSTRO(base, var, length, type, from, to, flags, def, str, proc)\ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1104 |
SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, 0, base, var, length, def, 0, 0, NULL, str, proc, from, to) |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1105 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1106 |
#define SDT_CONDCHR(base, var, from, to, flags, guiflags, def, str, proc)\ |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1107 |
SDT_GENERAL(#var, SDT_STRING, SL_VAR, SLE_CHAR, flags, guiflags, base, var, 1, def, 0, 0, 0, NULL, str, proc, NULL, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1108 |
#define SDT_CHR(base, var, flags, guiflags, def, str, proc)\ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1109 |
SDT_CONDCHR(base, var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1110 |
|
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1111 |
#define SDT_CONDOMANY(base, var, type, from, to, flags, guiflags, def, max, full, str, proc, load)\ |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1112 |
SDT_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, max, 0, full, str, proc, load, from, to) |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1113 |
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, proc, load)\ |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1114 |
SDT_CONDOMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, max, full, str, proc, load) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1115 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1116 |
#define SDT_CONDMMANY(base, var, type, from, to, flags, guiflags, def, full, str, proc)\ |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1117 |
SDT_GENERAL(#var, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, 0, 0, full, str, proc, NULL, from, to) |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1118 |
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, proc)\ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1119 |
SDT_CONDMMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, full, str, proc) |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1120 |
|
3222
8bfed4267cba
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater
parents:
3210
diff
changeset
|
1121 |
#define SDT_CONDNULL(length, from, to)\ |
6681
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1122 |
{{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLE_CONDNULL(length, from, to)} |
3222
8bfed4267cba
(svn r3895) - Add proper SLE(G)_CONDNULL macros for the empty space reservation in savegames and update where used
Darkvater
parents:
3210
diff
changeset
|
1123 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1124 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1125 |
#define SDTC_CONDVAR(var, type, from, to, flags, guiflags, def, min, max, interval, str, proc)\ |
10782
a3d1b7a71e75
(svn r13332) -Fix (r13325): network games got somewhat broken.
rubidium
parents:
10775
diff
changeset
|
1126 |
SDTG_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, _settings_client.var, 1, def, min, max, interval, NULL, str, proc, from, to) |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1127 |
#define SDTC_VAR(var, type, flags, guiflags, def, min, max, interval, str, proc)\ |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1128 |
SDTC_CONDVAR(var, type, 0, SL_MAX_VERSION, flags, guiflags, def, min, max, interval, str, proc) |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1129 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1130 |
#define SDTC_CONDBOOL(var, from, to, flags, guiflags, def, str, proc)\ |
10782
a3d1b7a71e75
(svn r13332) -Fix (r13325): network games got somewhat broken.
rubidium
parents:
10775
diff
changeset
|
1131 |
SDTG_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, _settings_client.var, 1, def, 0, 1, 0, NULL, str, proc, from, to) |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1132 |
#define SDTC_BOOL(var, flags, guiflags, def, str, proc)\ |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1133 |
SDTC_CONDBOOL(var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc) |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1134 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1135 |
#define SDTC_CONDLIST(var, type, length, flags, guiflags, def, str, proc, from, to)\ |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1136 |
SDTG_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, _settings_client.var, length, def, 0, 0, 0, NULL, str, proc, from, to) |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1137 |
#define SDTC_LIST(var, type, flags, guiflags, def, str, proc)\ |
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1138 |
SDTG_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, _settings_client.var, lengthof(_settings_client.var), def, 0, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION) |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1139 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1140 |
#define SDTC_CONDSTR(var, type, length, flags, guiflags, def, str, proc, from, to)\ |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1141 |
SDTG_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, _settings_client.var, length, def, 0, 0, 0, NULL, str, proc, from, to) |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1142 |
#define SDTC_STR(var, type, flags, guiflags, def, str, proc)\ |
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1143 |
SDTG_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, _settings_client.var, lengthof(_settings_client.var), def, 0, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION) |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1144 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1145 |
#define SDTC_CONDOMANY(var, type, from, to, flags, guiflags, def, max, full, str, proc)\ |
10782
a3d1b7a71e75
(svn r13332) -Fix (r13325): network games got somewhat broken.
rubidium
parents:
10775
diff
changeset
|
1146 |
SDTG_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, _settings_client.var, 1, def, 0, max, 0, full, str, proc, from, to) |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1147 |
#define SDTC_OMANY(var, type, flags, guiflags, def, max, full, str, proc)\ |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1148 |
SDTC_CONDOMANY(var, type, 0, SL_MAX_VERSION, flags, guiflags, def, max, full, str, proc) |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1149 |
|
6681
deffef3f69f5
(svn r9398) -Feature: Allow for a conversion callback system while reading configuration file, in case of wrong value.
belugas
parents:
6664
diff
changeset
|
1150 |
#define SDT_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLE_END()} |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1151 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1152 |
/* Shortcuts for macros below. Logically if we don't save the value |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1153 |
* we also don't sync it in a network game */ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1154 |
#define S SLF_SAVE_NO | SLF_NETWORK_NO |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1155 |
#define C SLF_CONFIG_NO |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1156 |
#define N SLF_NETWORK_NO |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1158 |
#define D0 SGF_0ISDISABLED |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1159 |
#define NC SGF_NOCOMMA |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1160 |
#define MS SGF_MULTISTRING |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1161 |
#define NO SGF_NETWORK_ONLY |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1162 |
#define CR SGF_CURRENCY |
8397
81b06437cfab
(svn r11452) -Change: do not allow configuration changes, that NewGRFs can directly use to change their behaviour, during network games as this can cause desyncs.
rubidium
parents:
8345
diff
changeset
|
1163 |
#define NN SGF_NO_NETWORK |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1164 |
#define NG SGF_NEWGAME_ONLY |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1165 |
|
3131
e856656f99a9
(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
|
1166 |
/* Begin - Callback Functions for the various settings */ |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6706
diff
changeset
|
1167 |
/* virtual PositionMainToolbar function, calls the right one.*/ |
3131
e856656f99a9
(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
|
1168 |
static int32 v_PositionMainToolbar(int32 p1) |
e856656f99a9
(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
|
1169 |
{ |
e856656f99a9
(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
|
1170 |
if (_game_mode != GM_MENU) PositionMainToolbar(NULL); |
e856656f99a9
(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
|
1171 |
return 0; |
e856656f99a9
(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
|
1172 |
} |
e856656f99a9
(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
|
1173 |
|
e856656f99a9
(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
|
1174 |
static int32 AiNew_PatchActive_Warning(int32 p1) |
e856656f99a9
(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
|
1175 |
{ |
e856656f99a9
(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
|
1176 |
if (p1 == 1) ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_ACTIVATED, 0, 0); |
e856656f99a9
(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
|
1177 |
return 0; |
e856656f99a9
(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
|
1178 |
} |
e856656f99a9
(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
|
1179 |
|
e856656f99a9
(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
|
1180 |
static int32 Ai_In_Multiplayer_Warning(int32 p1) |
e856656f99a9
(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
|
1181 |
{ |
e856656f99a9
(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
|
1182 |
if (p1 == 1) { |
e856656f99a9
(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
|
1183 |
ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_MULTIPLAYER, 0, 0); |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1184 |
_settings_game.ai.ainew_active = true; |
3131
e856656f99a9
(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
|
1185 |
} |
e856656f99a9
(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
|
1186 |
return 0; |
e856656f99a9
(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
|
1187 |
} |
e856656f99a9
(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
|
1188 |
|
e856656f99a9
(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
|
1189 |
static int32 PopulationInLabelActive(int32 p1) |
e856656f99a9
(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
|
1190 |
{ |
e856656f99a9
(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
|
1191 |
Town* t; |
e856656f99a9
(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
|
1192 |
|
4346
3f00094f2670
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
1193 |
FOR_ALL_TOWNS(t) UpdateTownVirtCoord(t); |
3f00094f2670
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
1194 |
|
3131
e856656f99a9
(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
|
1195 |
return 0; |
e856656f99a9
(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
|
1196 |
} |
e856656f99a9
(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
|
1197 |
|
4082
172b5f3598fa
(svn r5397) -Fix: Redraw the screen, when switching the signal side
tron
parents:
4077
diff
changeset
|
1198 |
static int32 RedrawScreen(int32 p1) |
3131
e856656f99a9
(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
|
1199 |
{ |
e856656f99a9
(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
|
1200 |
MarkWholeScreenDirty(); |
e856656f99a9
(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
|
1201 |
return 0; |
e856656f99a9
(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
|
1202 |
} |
e856656f99a9
(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
|
1203 |
|
e856656f99a9
(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
|
1204 |
static int32 InValidateDetailsWindow(int32 p1) |
e856656f99a9
(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
|
1205 |
{ |
e856656f99a9
(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
|
1206 |
InvalidateWindowClasses(WC_VEHICLE_DETAILS); |
e856656f99a9
(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
|
1207 |
return 0; |
e856656f99a9
(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
|
1208 |
} |
e856656f99a9
(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
|
1209 |
|
e856656f99a9
(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
|
1210 |
static int32 InvalidateStationBuildWindow(int32 p1) |
e856656f99a9
(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
|
1211 |
{ |
e856656f99a9
(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
|
1212 |
InvalidateWindow(WC_BUILD_STATION, 0); |
e856656f99a9
(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
|
1213 |
return 0; |
e856656f99a9
(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
|
1214 |
} |
e856656f99a9
(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
|
1215 |
|
10516
b5a97c512d02
(svn r13060) -Codechange: update build industry window when raw_industry_construction setting is modified
glx
parents:
10495
diff
changeset
|
1216 |
static int32 InvalidateBuildIndustryWindow(int32 p1) |
b5a97c512d02
(svn r13060) -Codechange: update build industry window when raw_industry_construction setting is modified
glx
parents:
10495
diff
changeset
|
1217 |
{ |
b5a97c512d02
(svn r13060) -Codechange: update build industry window when raw_industry_construction setting is modified
glx
parents:
10495
diff
changeset
|
1218 |
InvalidateWindowData(WC_BUILD_INDUSTRY, 0); |
b5a97c512d02
(svn r13060) -Codechange: update build industry window when raw_industry_construction setting is modified
glx
parents:
10495
diff
changeset
|
1219 |
return 0; |
b5a97c512d02
(svn r13060) -Codechange: update build industry window when raw_industry_construction setting is modified
glx
parents:
10495
diff
changeset
|
1220 |
} |
b5a97c512d02
(svn r13060) -Codechange: update build industry window when raw_industry_construction setting is modified
glx
parents:
10495
diff
changeset
|
1221 |
|
10495
34d0afdd3d5d
(svn r13038) -Fix: When switching the signal gui patch to off, delete the signal window accordingly
belugas
parents:
10473
diff
changeset
|
1222 |
static int32 CloseSignalGUI(int32 p1) |
34d0afdd3d5d
(svn r13038) -Fix: When switching the signal gui patch to off, delete the signal window accordingly
belugas
parents:
10473
diff
changeset
|
1223 |
{ |
34d0afdd3d5d
(svn r13038) -Fix: When switching the signal gui patch to off, delete the signal window accordingly
belugas
parents:
10473
diff
changeset
|
1224 |
if (p1 == 0) { |
34d0afdd3d5d
(svn r13038) -Fix: When switching the signal gui patch to off, delete the signal window accordingly
belugas
parents:
10473
diff
changeset
|
1225 |
DeleteWindowByClass(WC_BUILD_SIGNAL); |
34d0afdd3d5d
(svn r13038) -Fix: When switching the signal gui patch to off, delete the signal window accordingly
belugas
parents:
10473
diff
changeset
|
1226 |
} |
34d0afdd3d5d
(svn r13038) -Fix: When switching the signal gui patch to off, delete the signal window accordingly
belugas
parents:
10473
diff
changeset
|
1227 |
return 0; |
34d0afdd3d5d
(svn r13038) -Fix: When switching the signal gui patch to off, delete the signal window accordingly
belugas
parents:
10473
diff
changeset
|
1228 |
} |
34d0afdd3d5d
(svn r13038) -Fix: When switching the signal gui patch to off, delete the signal window accordingly
belugas
parents:
10473
diff
changeset
|
1229 |
|
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1230 |
static int32 InvalidateTownViewWindow(int32 p1) |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1231 |
{ |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1232 |
InvalidateWindowClassesData(WC_TOWN_VIEW, p1); |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1233 |
return 0; |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1234 |
} |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1235 |
|
8249
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1236 |
static int32 UpdateConsists(int32 p1) |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1237 |
{ |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1238 |
Vehicle *v; |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1239 |
FOR_ALL_VEHICLES(v) { |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1240 |
/* Update the consist of all trains so the maximum speed is set correctly. */ |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1241 |
if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged(v); |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1242 |
} |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1243 |
return 0; |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1244 |
} |
67f9410ee71e
(svn r11291) -Fix [FS#1345]: changing the wagon_speed_limits patch option caused desyncs.
rubidium
parents:
8238
diff
changeset
|
1245 |
|
3131
e856656f99a9
(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
|
1246 |
/* Check service intervals of vehicles, p1 is value of % or day based servicing */ |
e856656f99a9
(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
|
1247 |
static int32 CheckInterval(int32 p1) |
e856656f99a9
(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
|
1248 |
{ |
e856656f99a9
(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
|
1249 |
bool warning; |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1250 |
const VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings_game.vehicle; |
3131
e856656f99a9
(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
|
1251 |
|
e856656f99a9
(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
|
1252 |
if (p1) { |
8450
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8427
diff
changeset
|
1253 |
warning = ( (IsInsideMM(ptc->servint_trains, 5, 90 + 1) || ptc->servint_trains == 0) && |
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8427
diff
changeset
|
1254 |
(IsInsideMM(ptc->servint_roadveh, 5, 90 + 1) || ptc->servint_roadveh == 0) && |
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8427
diff
changeset
|
1255 |
(IsInsideMM(ptc->servint_aircraft, 5, 90 + 1) || ptc->servint_aircraft == 0) && |
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8427
diff
changeset
|
1256 |
(IsInsideMM(ptc->servint_ships, 5, 90 + 1) || ptc->servint_ships == 0) ); |
3131
e856656f99a9
(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
|
1257 |
} else { |
8450
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8427
diff
changeset
|
1258 |
warning = ( (IsInsideMM(ptc->servint_trains, 30, 800 + 1) || ptc->servint_trains == 0) && |
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8427
diff
changeset
|
1259 |
(IsInsideMM(ptc->servint_roadveh, 30, 800 + 1) || ptc->servint_roadveh == 0) && |
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8427
diff
changeset
|
1260 |
(IsInsideMM(ptc->servint_aircraft, 30, 800 + 1) || ptc->servint_aircraft == 0) && |
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8427
diff
changeset
|
1261 |
(IsInsideMM(ptc->servint_ships, 30, 800 + 1) || ptc->servint_ships == 0) ); |
3131
e856656f99a9
(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
|
1262 |
} |
e856656f99a9
(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
|
1263 |
|
e856656f99a9
(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
|
1264 |
if (!warning) |
e856656f99a9
(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
|
1265 |
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0); |
e856656f99a9
(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
|
1266 |
|
e856656f99a9
(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
|
1267 |
return InValidateDetailsWindow(0); |
e856656f99a9
(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
|
1268 |
} |
e856656f99a9
(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
|
1269 |
|
e856656f99a9
(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
|
1270 |
static int32 EngineRenewUpdate(int32 p1) |
e856656f99a9
(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
|
1271 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1272 |
DoCommandP(0, 0, _settings_client.gui.autorenew, NULL, CMD_SET_AUTOREPLACE); |
3131
e856656f99a9
(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
|
1273 |
return 0; |
e856656f99a9
(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
|
1274 |
} |
e856656f99a9
(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
|
1275 |
|
e856656f99a9
(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
|
1276 |
static int32 EngineRenewMonthsUpdate(int32 p1) |
e856656f99a9
(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
|
1277 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1278 |
DoCommandP(0, 1, _settings_client.gui.autorenew_months, NULL, CMD_SET_AUTOREPLACE); |
3131
e856656f99a9
(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
|
1279 |
return 0; |
e856656f99a9
(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
|
1280 |
} |
e856656f99a9
(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
|
1281 |
|
e856656f99a9
(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
|
1282 |
static int32 EngineRenewMoneyUpdate(int32 p1) |
e856656f99a9
(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
|
1283 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1284 |
DoCommandP(0, 2, _settings_client.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE); |
3131
e856656f99a9
(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
|
1285 |
return 0; |
e856656f99a9
(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
|
1286 |
} |
7067
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1287 |
|
9192
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1288 |
static int32 RealisticAccelerationChanged(int32 p1) |
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1289 |
{ |
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1290 |
Vehicle *v; |
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1291 |
|
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1292 |
FOR_ALL_VEHICLES(v) { |
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1293 |
if (v->type == VEH_TRAIN && IsFrontEngine(v)) UpdateTrainAcceleration(v); |
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1294 |
} |
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1295 |
|
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1296 |
return 0; |
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1297 |
} |
7e4b0b777375
(svn r12369) -Fix (r1681): reset train speed limits when _patches.realistic_acceleration changes
smatz
parents:
9191
diff
changeset
|
1298 |
|
9306
01a397b0b8ba
(svn r12553) -Fix (r11547): redraw the signal GUI when the signal drag density changes in the patch settings and vice versa
smatz
parents:
9305
diff
changeset
|
1299 |
static int32 DragSignalsDensityChanged(int32) |
01a397b0b8ba
(svn r12553) -Fix (r11547): redraw the signal GUI when the signal drag density changes in the patch settings and vice versa
smatz
parents:
9305
diff
changeset
|
1300 |
{ |
10434
d6accd017341
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
rubidium
parents:
10402
diff
changeset
|
1301 |
SetWindowDirty(FindWindowById(WC_BUILD_SIGNAL, 0)); |
9306
01a397b0b8ba
(svn r12553) -Fix (r11547): redraw the signal GUI when the signal drag density changes in the patch settings and vice versa
smatz
parents:
9305
diff
changeset
|
1302 |
|
01a397b0b8ba
(svn r12553) -Fix (r11547): redraw the signal GUI when the signal drag density changes in the patch settings and vice versa
smatz
parents:
9305
diff
changeset
|
1303 |
return 0; |
01a397b0b8ba
(svn r12553) -Fix (r11547): redraw the signal GUI when the signal drag density changes in the patch settings and vice versa
smatz
parents:
9305
diff
changeset
|
1304 |
} |
01a397b0b8ba
(svn r12553) -Fix (r11547): redraw the signal GUI when the signal drag density changes in the patch settings and vice versa
smatz
parents:
9305
diff
changeset
|
1305 |
|
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1306 |
/* |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1307 |
* A: competitors |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1308 |
* B: start time in months / 3 |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1309 |
* C: town count (3 = high, 0 = very low) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1310 |
* D: industry count (4 = high, 0 = none) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1311 |
* E: inital loan (in GBP) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1312 |
* F: interest rate |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1313 |
* G: running costs (0 = low, 2 = high) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1314 |
* H: construction speed of competitors (0 = very slow, 4 = very fast) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1315 |
* I: intelligence (0-2) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1316 |
* J: breakdowns (0 = off, 2 = normal) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1317 |
* K: subsidy multiplier (0 = 1.5, 3 = 4.0) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1318 |
* L: construction cost (0-2) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1319 |
* M: terrain type (0 = very flat, 3 = mountainous) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1320 |
* N: amount of water (0 = very low, 3 = high) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1321 |
* O: economy (0 = steady, 1 = fluctuating) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1322 |
* P: Train reversing (0 = end of line + stations, 1 = end of line) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1323 |
* Q: disasters |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1324 |
* R: area restructuring (0 = permissive, 2 = hostile) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1325 |
* S: the difficulty level |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1326 |
*/ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1327 |
static const DifficultySettings _default_game_diff[3] = { /* |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1328 |
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S*/ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1329 |
{2, 2, 2, 4, 300000, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0, 0}, ///< easy |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1330 |
{4, 1, 2, 3, 150000, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1}, ///< medium |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1331 |
{7, 0, 3, 3, 100000, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2, 2}, ///< hard |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1332 |
}; |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1333 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1334 |
void SetDifficultyLevel(int mode, DifficultySettings *gm_opt) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1335 |
{ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1336 |
assert(mode <= 3); |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1337 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1338 |
if (mode != 3) { |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1339 |
*gm_opt = _default_game_diff[mode]; |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1340 |
} else { |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1341 |
gm_opt->diff_level = 3; |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1342 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1343 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1344 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1345 |
/** |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1346 |
* Checks the difficulty levels read from the configuration and |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1347 |
* forces them to be correct when invalid. |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1348 |
*/ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1349 |
void CheckDifficultyLevels() |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1350 |
{ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1351 |
if (_settings_newgame.difficulty.diff_level != 3) { |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1352 |
SetDifficultyLevel(_settings_newgame.difficulty.diff_level, &_settings_newgame.difficulty); |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1353 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1354 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1355 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1356 |
static int32 DifficultyReset(int32 level) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1357 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1358 |
SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty); |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1359 |
return 0; |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1360 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1361 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1362 |
static int32 DifficultyChange(int32) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1363 |
{ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1364 |
if (_game_mode == GM_MENU) { |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1365 |
_settings_newgame.difficulty.diff_level = 3; |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1366 |
} else { |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1367 |
_settings_game.difficulty.diff_level = 3; |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1368 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1369 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1370 |
/* If we are a network-client, update the difficult setting (if it is open). |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1371 |
* Use this instead of just dirtying the window because we need to load in |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1372 |
* the new difficulty settings */ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1373 |
if (_networking && FindWindowById(WC_GAME_OPTIONS, 0) != NULL) { |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1374 |
ShowGameDifficulty(); |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1375 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1376 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1377 |
return 0; |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1378 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1379 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1380 |
static int32 DifficultyNoiseChange(int32 i) |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1381 |
{ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1382 |
if (_game_mode == GM_NORMAL) { |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1383 |
UpdateAirportsNoise(); |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1384 |
if (_settings_game.economy.station_noise_level) { |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1385 |
InvalidateWindowClassesData(WC_TOWN_VIEW, 0); |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1386 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1387 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1388 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1389 |
return DifficultyChange(i); |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1390 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1391 |
|
7067
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1392 |
/** |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1393 |
* Check for right TownLayout usage in editor mode. |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1394 |
* The No Road mode is not desirable since towns have to be |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1395 |
* able to grow. If a user desires to have a town with no road, |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1396 |
* he can easily remove them himself. This would create less confusion |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1397 |
* @param p1 unused |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1398 |
* @return always 0 |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1399 |
*/ |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1400 |
static int32 CheckTownLayout(int32 p1) |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1401 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1402 |
if (_settings_game.economy.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) { |
7067
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1403 |
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_TOWN_LAYOUT_INVALID, 0, 0); |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1404 |
_settings_game.economy.town_layout = TL_ORIGINAL; |
7067
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1405 |
} |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1406 |
return 0; |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1407 |
} |
ea55b6046015
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
7039
diff
changeset
|
1408 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1409 |
/** Conversion callback for _gameopt_settings_game.landscape |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1410 |
* It converts (or try) between old values and the new ones, |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1411 |
* without loosing initial setting of the user |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1412 |
* @param value that was read from config file |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1413 |
* @return the "hopefully" converted value |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1414 |
*/ |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1415 |
static int32 ConvertLandscape(const char *value) |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1416 |
{ |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1417 |
/* try with the old values */ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
1418 |
return lookup_oneofmany("normal|hilly|desert|candy", value); |
6682
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1419 |
} |
fc13ce6cb743
(svn r9399) -Feature: Openttd.cfg will now present landscape patch entry as been temperate, arctic, tropic or toyland.
belugas
parents:
6681
diff
changeset
|
1420 |
|
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1421 |
/** |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1422 |
* Check for decent values been supplied by the user for the noise tolerance setting. |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1423 |
* The primary idea is to avoid division by zero in game mode. |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1424 |
* The secondary idea is to make it so the values will be somewhat sane and that towns will |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1425 |
* not be overcrowed with airports. It would be easy to abuse such a feature |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1426 |
* So basically, 200, 400, 800 are the lowest allowed values */ |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1427 |
static int32 CheckNoiseToleranceLevel(const char *value) |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1428 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1429 |
GameSettings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1430 |
for (uint16 i = 0; i < lengthof(s->economy.town_noise_population); i++) { |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1431 |
s->economy.town_noise_population[i] = max(uint16(200 * (i + 1)), s->economy.town_noise_population[i]); |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1432 |
} |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1433 |
return 0; |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1434 |
} |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10516
diff
changeset
|
1435 |
|
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1436 |
#ifdef ENABLE_NETWORK |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1437 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1438 |
static int32 UpdateMinPlayers(int32 p1) |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1439 |
{ |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1440 |
CheckMinPlayers(); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1441 |
return 0; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1442 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1443 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1444 |
static int32 UpdatePlayerName(int32 p1) |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1445 |
{ |
10792
95b6eb9fcc9e
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium
parents:
10790
diff
changeset
|
1446 |
NetworkUpdatePlayerName(); |
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1447 |
return 0; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1448 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1449 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1450 |
static int32 UpdateServerName(int32 p1) |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1451 |
{ |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1452 |
ttd_strlcpy(_network_game_info.server_name, _settings_client.network.server_name, sizeof(_network_game_info.server_name)); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1453 |
return 0; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1454 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1455 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1456 |
static int32 UpdateServerPassword(int32 p1) |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1457 |
{ |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1458 |
if (strcmp(_settings_client.network.server_password, "*") == 0) { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1459 |
_settings_client.network.server_password[0] = '\0'; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1460 |
_network_game_info.use_password = false; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1461 |
} else { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1462 |
ttd_strlcpy(_network_game_info.server_password, _settings_client.network.server_password, sizeof(_network_game_info.server_password)); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1463 |
_network_game_info.use_password = true; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1464 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1465 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1466 |
return 0; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1467 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1468 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1469 |
static int32 UpdateRconPassword(int32 p1) |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1470 |
{ |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1471 |
if (strcmp(_settings_client.network.rcon_password, "*") == 0) { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1472 |
_settings_client.network.rcon_password[0] = '\0'; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1473 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1474 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1475 |
ttd_strlcpy(_network_game_info.rcon_password, _settings_client.network.rcon_password, sizeof(_network_game_info.rcon_password)); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1476 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1477 |
return 0; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1478 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1479 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1480 |
#endif /* ENABLE_NETWORK */ |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1481 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1482 |
|
3131
e856656f99a9
(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
|
1483 |
/* End - Callback Functions */ |
e856656f99a9
(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
|
1484 |
|
1584
aa7fe51c4368
(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
|
1485 |
#ifndef EXTERNAL_PLAYER |
aa7fe51c4368
(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
|
1486 |
#define EXTERNAL_PLAYER "timidity" |
aa7fe51c4368
(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
|
1487 |
#endif |
aa7fe51c4368
(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
|
1488 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1489 |
static const SettingDesc _music_settings[] = { |
4431
7468c1484d20
(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
|
1490 |
SDT_VAR(MusicFileSettings, playlist, SLE_UINT8, S, 0, 0, 0, 5, 1, STR_NULL, NULL), |
7468c1484d20
(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
|
1491 |
SDT_VAR(MusicFileSettings, music_vol, SLE_UINT8, S, 0, 128, 0, 100, 1, STR_NULL, NULL), |
7468c1484d20
(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
|
1492 |
SDT_VAR(MusicFileSettings, effect_vol, SLE_UINT8, S, 0, 128, 0, 100, 1, STR_NULL, NULL), |
4344
5d0e40cd67b9
(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
|
1493 |
SDT_LIST(MusicFileSettings, custom_1, SLE_UINT8, S, 0, NULL, STR_NULL, NULL), |
5d0e40cd67b9
(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
|
1494 |
SDT_LIST(MusicFileSettings, custom_2, SLE_UINT8, S, 0, NULL, STR_NULL, NULL), |
5d0e40cd67b9
(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
|
1495 |
SDT_BOOL(MusicFileSettings, playing, S, 0, true, STR_NULL, NULL), |
5d0e40cd67b9
(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
|
1496 |
SDT_BOOL(MusicFileSettings, shuffle, S, 0, false, STR_NULL, NULL), |
5d0e40cd67b9
(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
|
1497 |
SDT_STR(MusicFileSettings, extmidi, SLE_STRB, S, 0, EXTERNAL_PLAYER, STR_NULL, NULL), |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
SDT_END() |
0 | 1499 |
}; |
1500 |
||
3051
16f6e40c67eb
(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
|
1501 |
/* win32_v.c only settings */ |
16f6e40c67eb
(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
|
1502 |
#ifdef WIN32 |
7374
54c06f06ecc8
(svn r10121) -Codechange: split renderer from rest of code; no longer any code directly accesses the video-buffer
truelight
parents:
7348
diff
changeset
|
1503 |
extern bool _force_full_redraw, _window_maximize; |
3051
16f6e40c67eb
(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
|
1504 |
extern uint _display_hz, _fullscreen_bpp; |
16f6e40c67eb
(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
|
1505 |
|
3124
60f74c9c90e3
(svn r3732) - Fix two warnings. Stupid MSVC didn't even complain :s (Thank Tron and peter1138)
Darkvater
parents:
3121
diff
changeset
|
1506 |
static const SettingDescGlobVarList _win32_settings[] = { |
4431
7468c1484d20
(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
|
1507 |
SDTG_VAR("display_hz", SLE_UINT, S, 0, _display_hz, 0, 0, 120, 0, STR_NULL, NULL), |
7468c1484d20
(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
|
1508 |
SDTG_BOOL("force_full_redraw", S, 0, _force_full_redraw,false, STR_NULL, NULL), |
7468c1484d20
(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
|
1509 |
SDTG_VAR("fullscreen_bpp", SLE_UINT, S, 0, _fullscreen_bpp, 8, 8, 32, 0, STR_NULL, NULL), |
7468c1484d20
(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
|
1510 |
SDTG_BOOL("window_maximize", S, 0, _window_maximize, false, STR_NULL, NULL), |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1511 |
SDTG_END() |
0 | 1512 |
}; |
3051
16f6e40c67eb
(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
|
1513 |
#endif /* WIN32 */ |
0 | 1514 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1515 |
static const SettingDescGlobVarList _misc_settings[] = { |
7192
51486fdadd13
(svn r9928) -Fix (r9805): Default display options were not set correctly.
peter1138
parents:
7170
diff
changeset
|
1516 |
SDTG_MMANY("display_opt", SLE_UINT8, S, 0, _display_opt, (1 << DO_SHOW_TOWN_NAMES | 1 << DO_SHOW_STATION_NAMES | 1 << DO_SHOW_SIGNS | 1 << DO_FULL_ANIMATION | 1 << DO_FULL_DETAIL | 1 << DO_WAYPOINTS), "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION||FULL_DETAIL|WAYPOINTS", STR_NULL, NULL), |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1517 |
SDTG_BOOL("news_ticker_sound", S, 0, _news_ticker_sound, true, STR_NULL, NULL), |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1518 |
SDTG_BOOL("fullscreen", S, 0, _fullscreen, false, STR_NULL, NULL), |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1519 |
SDTG_STR("videodriver", SLE_STRB,C|S,0, _ini_videodriver, NULL, STR_NULL, NULL), |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1520 |
SDTG_STR("musicdriver", SLE_STRB,C|S,0, _ini_musicdriver, NULL, STR_NULL, NULL), |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1521 |
SDTG_STR("sounddriver", SLE_STRB,C|S,0, _ini_sounddriver, NULL, STR_NULL, NULL), |
8063
0e907a0b5add
(svn r11092) -Add: allow 'blitter=<value>' in openttd.cfg to set the blitter (so you don't have to keep on doing 'openttd -b 32bpp-optimized'..)
truelight
parents:
8043
diff
changeset
|
1522 |
SDTG_STR("blitter", SLE_STRB,C|S,0, _ini_blitter, NULL, STR_NULL, NULL), |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1523 |
SDTG_STR("language", SLE_STRB, S, 0, _dynlang.curr_file, NULL, STR_NULL, NULL), |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1524 |
SDTG_LIST("resolution", SLE_UINT16, S, 0, _cur_resolution, "640,480", STR_NULL, NULL), |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1525 |
SDTG_STR("screenshot_format",SLE_STRB, S, 0, _screenshot_format_name,NULL, STR_NULL, NULL), |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1526 |
SDTG_STR("savegame_format", SLE_STRB, S, 0, _savegame_format, NULL, STR_NULL, NULL), |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1527 |
SDTG_BOOL("rightclick_emulate", S, 0, _rightclick_emulate, false, STR_NULL, NULL), |
5108
dc67d70b5a45
(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
|
1528 |
#ifdef WITH_FREETYPE |
dc67d70b5a45
(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
|
1529 |
SDTG_STR("small_font", SLE_STRB, S, 0, _freetype.small_font, NULL, STR_NULL, NULL), |
dc67d70b5a45
(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
|
1530 |
SDTG_STR("medium_font", SLE_STRB, S, 0, _freetype.medium_font, NULL, STR_NULL, NULL), |
dc67d70b5a45
(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
|
1531 |
SDTG_STR("large_font", SLE_STRB, S, 0, _freetype.large_font, NULL, STR_NULL, NULL), |
dc67d70b5a45
(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
|
1532 |
SDTG_VAR("small_size", SLE_UINT, S, 0, _freetype.small_size, 6, 0, 72, 0, STR_NULL, NULL), |
dc67d70b5a45
(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
|
1533 |
SDTG_VAR("medium_size", SLE_UINT, S, 0, _freetype.medium_size, 10, 0, 72, 0, STR_NULL, NULL), |
dc67d70b5a45
(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
|
1534 |
SDTG_VAR("large_size", SLE_UINT, S, 0, _freetype.large_size, 16, 0, 72, 0, STR_NULL, NULL), |
7409
4f631b495a5b
(svn r10166) -Feature(tte): Add support for antialiased typefaces via FreeType. This is configurable for each font size in the configuration settings and requires using the 32bpp blitter and suitable fonts.
peter1138
parents:
7374
diff
changeset
|
1535 |
SDTG_BOOL("small_aa", S, 0, _freetype.small_aa, false, STR_NULL, NULL), |
4f631b495a5b
(svn r10166) -Feature(tte): Add support for antialiased typefaces via FreeType. This is configurable for each font size in the configuration settings and requires using the 32bpp blitter and suitable fonts.
peter1138
parents:
7374
diff
changeset
|
1536 |
SDTG_BOOL("medium_aa", S, 0, _freetype.medium_aa, false, STR_NULL, NULL), |
4f631b495a5b
(svn r10166) -Feature(tte): Add support for antialiased typefaces via FreeType. This is configurable for each font size in the configuration settings and requires using the 32bpp blitter and suitable fonts.
peter1138
parents:
7374
diff
changeset
|
1537 |
SDTG_BOOL("large_aa", S, 0, _freetype.large_aa, false, STR_NULL, NULL), |
5108
dc67d70b5a45
(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
|
1538 |
#endif |
7348
becce3f57dc7
(svn r10092) -Codechange: code-seperated the spriteloader and blitter from the rest of the code
truelight
parents:
7299
diff
changeset
|
1539 |
SDTG_VAR("sprite_cache_size",SLE_UINT, S, 0, _sprite_cache_size, 4, 1, 64, 0, STR_NULL, NULL), |
8230
7b40f75cba12
(svn r11269) -Feature: user customisable faces. Patch by BigBB.
rubidium
parents:
8153
diff
changeset
|
1540 |
SDTG_VAR("player_face", SLE_UINT32, S, 0, _player_face, 0,0,0xFFFFFFFF,0, STR_NULL, NULL), |
9025
2f0d4cf64ebc
(svn r12104) -Fix (r12103): remember loading indicators transparency settings and make in switchable by Ctrl+9
smatz
parents:
9024
diff
changeset
|
1541 |
SDTG_VAR("transparency_options", SLE_UINT, S, 0, _transparency_opt, 0,0,0x1FF,0, STR_NULL, NULL), |
2f0d4cf64ebc
(svn r12104) -Fix (r12103): remember loading indicators transparency settings and make in switchable by Ctrl+9
smatz
parents:
9024
diff
changeset
|
1542 |
SDTG_VAR("transparency_locks", SLE_UINT, S, 0, _transparency_lock, 0,0,0x1FF,0, STR_NULL, NULL), |
9302
4aa3c4a44b16
(svn r12547) -Feature: invisibility options to make objects invisible instead of transparent
smatz
parents:
9259
diff
changeset
|
1543 |
SDTG_VAR("invisibility_options", SLE_UINT, S, 0, _invisibility_opt, 0,0, 0xFF,0, STR_NULL, NULL), |
9233
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9226
diff
changeset
|
1544 |
SDTG_STR("keyboard", SLE_STRB, S, 0, _keyboard_opt[0], NULL, STR_NULL, NULL), |
4daa9bb8dbf7
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
9226
diff
changeset
|
1545 |
SDTG_STR("keyboard_caps", SLE_STRB, S, 0, _keyboard_opt[1], NULL, STR_NULL, NULL), |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1546 |
SDTG_END() |
0 | 1547 |
}; |
1548 |
||
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1549 |
static const uint GAME_DIFFICULTY_NUM = 18; |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1550 |
uint16 _old_diff_custom[GAME_DIFFICULTY_NUM]; |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1551 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1552 |
static const SettingDesc _gameopt_settings[] = { |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1553 |
/* In version 4 a new difficulty setting has been added to the difficulty settings, |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1554 |
* town attitude towards demolishing. Needs special handling because some dimwit thought |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1555 |
* it funny to have the GameDifficulty struct be an array while it is a struct of |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1556 |
* same-sized members |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1557 |
* XXX - To save file-space and since values are never bigger than about 10? only |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1558 |
* save the first 16 bits in the savegame. Question is why the values are still int32 |
8878
5762124eec25
(svn r11951) -Fix (r11279): loading of very old savegames was broken
smatz
parents:
8772
diff
changeset
|
1559 |
* and why not byte for example? |
5762124eec25
(svn r11951) -Fix (r11279): loading of very old savegames was broken
smatz
parents:
8772
diff
changeset
|
1560 |
* 'SLE_FILE_I16 | SLE_VAR_U16' in "diff_custom" is needed to get around SlArray() hack |
5762124eec25
(svn r11951) -Fix (r11279): loading of very old savegames was broken
smatz
parents:
8772
diff
changeset
|
1561 |
* for savegames version 0 - though it is an array, it has to go through the byteswap process */ |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1562 |
SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_FILE_I16 | SLE_VAR_U16, C, 0, _old_diff_custom, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, 0, 3), |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1563 |
SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_UINT16, C, 0, _old_diff_custom, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, 4, 96), |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1564 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1565 |
SDT_VAR(GameSettings, difficulty.diff_level, SLE_UINT8, 0, 0, 0, 0, 3, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1566 |
SDTC_OMANY( gui.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), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1567 |
SDTC_OMANY( gui.units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL), |
7452
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
1568 |
/* There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI. */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1569 |
SDT_OMANY(GameSettings, game_creation.town_name, SLE_UINT8, 0, 0, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1570 |
SDT_OMANY(GameSettings, game_creation.landscape, SLE_UINT8, 0, 0, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1571 |
SDT_VAR(GameSettings, game_creation.snow_line, SLE_UINT8, 0, 0, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL), |
10786
37391f4d3312
(svn r13336) -Fix: loading old savegames, e.g. the intro game, would reset the autosave settings.
rubidium
parents:
10784
diff
changeset
|
1572 |
SDT_CONDNULL( 1, 0, 22), |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1573 |
SDTC_CONDOMANY( gui.autosave, SLE_UINT8, 23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1574 |
SDT_OMANY(GameSettings, vehicle.road_side, SLE_UINT8, 0, 0, 1, 1, "left|right", STR_NULL, NULL, NULL), |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1575 |
SDT_END() |
0 | 1576 |
}; |
1577 |
||
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
/* Some patches do not need to be synchronised when playing in multiplayer. |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1579 |
* These include for example the GUI settings and will not be saved with the |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* savegame. |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
* It is also a bit tricky since you would think that service_interval |
4000
bab1ebc37da0
(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
|
1582 |
* for example doesn't need to be synched. Every client assigns the |
bab1ebc37da0
(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
|
1583 |
* service_interval value to the v->service_interval, meaning that every client |
bab1ebc37da0
(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
|
1584 |
* assigns his value. If the setting was player-based, that would mean that |
bab1ebc37da0
(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
|
1585 |
* vehicles could decide on different moments that they are heading back to a |
bab1ebc37da0
(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
|
1586 |
* service depot, causing desyncs on a massive scale. */ |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1587 |
const SettingDesc _patch_settings[] = { |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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 |
/***************************************************************************/ |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1589 |
/* Saved patch variables. */ |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1590 |
/* Do not ADD or REMOVE something in this "difficulty.XXX" table or before it. It breaks savegame compatability. */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1591 |
SDT_CONDVAR(GameSettings, difficulty.max_no_competitors, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 2, 0, 7, 1, STR_NULL, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1592 |
SDT_CONDVAR(GameSettings, difficulty.competitor_start_time, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 2, 0, 3, 1, STR_6830_IMMEDIATE, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1593 |
SDT_CONDVAR(GameSettings, difficulty.number_towns, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 2, 0, 3, 1, STR_NUM_VERY_LOW, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1594 |
SDT_CONDVAR(GameSettings, difficulty.number_industries, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 4, 0, 4, 1, STR_NONE, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1595 |
SDT_CONDVAR(GameSettings, difficulty.max_loan, SLE_UINT32, 97, SL_MAX_VERSION, 0,NG|CR,300000,100000,500000,50000,STR_NULL, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1596 |
SDT_CONDVAR(GameSettings, difficulty.initial_interest, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 2, 2, 4, 1, STR_NULL, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1597 |
SDT_CONDVAR(GameSettings, difficulty.vehicle_costs, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 2, 1, STR_6820_LOW, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1598 |
SDT_CONDVAR(GameSettings, difficulty.competitor_speed, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 2, 0, 4, 1, STR_681B_VERY_SLOW, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1599 |
SDT_CONDVAR(GameSettings, difficulty.competitor_intelligence, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 2, 1, STR_6820_LOW, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1600 |
SDT_CONDVAR(GameSettings, difficulty.vehicle_breakdowns, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 1, 0, 2, 1, STR_6823_NONE, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1601 |
SDT_CONDVAR(GameSettings, difficulty.subsidy_multiplier, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 2, 0, 3, 1, STR_6826_X1_5, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1602 |
SDT_CONDVAR(GameSettings, difficulty.construction_cost, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 0, 0, 2, 1, STR_6820_LOW, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1603 |
SDT_CONDVAR(GameSettings, difficulty.terrain_type, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 1, 0, 3, 1, STR_682A_VERY_FLAT, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1604 |
SDT_CONDVAR(GameSettings, difficulty.quantity_sea_lakes, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 0, 0, 3, 1, STR_VERY_LOW, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1605 |
SDT_CONDVAR(GameSettings, difficulty.economy, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 1, 1, STR_682E_STEADY, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1606 |
SDT_CONDVAR(GameSettings, difficulty.line_reverse_mode, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 1, 1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1607 |
SDT_CONDVAR(GameSettings, difficulty.disasters, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 1, 1, STR_6836_OFF, DifficultyChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1608 |
SDT_CONDVAR(GameSettings, difficulty.town_council_tolerance, SLE_UINT8, 97, SL_MAX_VERSION, 0, 0, 0, 0, 2, 1, STR_PERMISSIVE, DifficultyNoiseChange), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1609 |
SDT_CONDVAR(GameSettings, difficulty.diff_level, SLE_UINT8, 97, SL_MAX_VERSION, 0,NG, 0, 0, 3, 0, STR_NULL, DifficultyReset), |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1610 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1611 |
/* There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI. */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1612 |
SDT_CONDOMANY(GameSettings, game_creation.town_name, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1613 |
SDT_CONDOMANY(GameSettings, game_creation.landscape, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1614 |
SDT_CONDVAR(GameSettings, game_creation.snow_line, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1615 |
SDT_CONDOMANY(GameSettings, vehicle.road_side, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 1, 1, "left|right", STR_NULL, NULL, NULL), |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1616 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1617 |
SDT_BOOL(GameSettings, construction.build_on_slopes, 0,NN, true, STR_CONFIG_PATCHES_BUILDONSLOPES, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1618 |
SDT_CONDBOOL(GameSettings, construction.autoslope, 75, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_AUTOSLOPE, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1619 |
SDT_BOOL(GameSettings, construction.extra_dynamite, 0, 0, false, STR_CONFIG_PATCHES_EXTRADYNAMITE, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1620 |
SDT_BOOL(GameSettings, construction.longbridges, 0,NN, true, STR_CONFIG_PATCHES_LONGBRIDGES, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1621 |
SDT_BOOL(GameSettings, construction.signal_side, N,NN, true, STR_CONFIG_PATCHES_SIGNALSIDE, RedrawScreen), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1622 |
SDT_BOOL(GameSettings, station.always_small_airport, 0,NN, false, STR_CONFIG_PATCHES_SMALL_AIRPORTS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1623 |
SDT_CONDVAR(GameSettings, economy.town_layout, SLE_UINT8, 59, SL_MAX_VERSION, 0,MS,TL_ORIGINAL,TL_NO_ROADS,NUM_TLS-1,1, STR_CONFIG_PATCHES_TOWN_LAYOUT, CheckTownLayout), |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1624 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1625 |
SDT_BOOL(GameSettings, vehicle.realistic_acceleration, 0, 0, false, STR_CONFIG_PATCHES_REALISTICACCEL, RealisticAccelerationChanged), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1626 |
SDT_BOOL(GameSettings, pf.forbid_90_deg, 0, 0, false, STR_CONFIG_PATCHES_FORBID_90_DEG, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1627 |
SDT_BOOL(GameSettings, vehicle.mammoth_trains, 0,NN, true, STR_CONFIG_PATCHES_MAMMOTHTRAINS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1628 |
SDT_BOOL(GameSettings, order.gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1629 |
SDT_BOOL(GameSettings, pf.roadveh_queue, 0, 0, true, STR_CONFIG_PATCHES_ROADVEH_QUEUE, NULL), |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1630 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1631 |
SDT_CONDBOOL(GameSettings, pf.new_pathfinding_all, 0, 86, 0, 0, false, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1632 |
SDT_CONDBOOL(GameSettings, pf.yapf.ship_use_yapf, 28, 86, 0, 0, false, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1633 |
SDT_CONDBOOL(GameSettings, pf.yapf.road_use_yapf, 28, 86, 0, 0, true, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1634 |
SDT_CONDBOOL(GameSettings, pf.yapf.rail_use_yapf, 28, 86, 0, 0, true, STR_NULL, NULL), |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1635 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1636 |
SDT_CONDVAR(GameSettings, pf.pathfinder_for_trains, SLE_UINT8, 87, SL_MAX_VERSION, 0, MS, 2, 0, 2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1637 |
SDT_CONDVAR(GameSettings, pf.pathfinder_for_roadvehs, SLE_UINT8, 87, SL_MAX_VERSION, 0, MS, 2, 0, 2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1638 |
SDT_CONDVAR(GameSettings, pf.pathfinder_for_ships, SLE_UINT8, 87, SL_MAX_VERSION, 0, MS, 0, 0, 2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS, NULL), |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1639 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1640 |
SDT_BOOL(GameSettings, vehicle.never_expire_vehicles, 0,NN, false, STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1641 |
SDT_VAR(GameSettings, vehicle.max_trains, SLE_UINT16, 0, 0, 500, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_TRAINS, RedrawScreen), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1642 |
SDT_VAR(GameSettings, vehicle.max_roadveh, SLE_UINT16, 0, 0, 500, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_ROADVEH, RedrawScreen), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1643 |
SDT_VAR(GameSettings, vehicle.max_aircraft, SLE_UINT16, 0, 0, 200, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, RedrawScreen), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1644 |
SDT_VAR(GameSettings, vehicle.max_ships, SLE_UINT16, 0, 0, 300, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS, RedrawScreen), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1645 |
SDT_BOOL(GameSettings, vehicle.servint_ispercent, 0, 0, false, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, CheckInterval), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1646 |
SDT_VAR(GameSettings, vehicle.servint_trains, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS, InValidateDetailsWindow), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1647 |
SDT_VAR(GameSettings, vehicle.servint_roadveh, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH, InValidateDetailsWindow), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1648 |
SDT_VAR(GameSettings, vehicle.servint_ships, SLE_UINT16, 0,D0, 360, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS, InValidateDetailsWindow), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1649 |
SDT_VAR(GameSettings, vehicle.servint_aircraft, SLE_UINT16, 0,D0, 100, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, InValidateDetailsWindow), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1650 |
SDT_BOOL(GameSettings, order.no_servicing_if_no_breakdowns, 0, 0, false, STR_CONFIG_PATCHES_NOSERVICE, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1651 |
SDT_BOOL(GameSettings, vehicle.wagon_speed_limits, 0,NN, true, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, UpdateConsists), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1652 |
SDT_CONDBOOL(GameSettings, vehicle.disable_elrails, 38, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_PATCHES_DISABLE_ELRAILS, SettingsDisableElrail), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1653 |
SDT_CONDVAR(GameSettings, vehicle.freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0,NN, 1, 1, 255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1654 |
SDT_CONDBOOL(GameSettings, order.timetabling, 67, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_TIMETABLE_ALLOW, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1655 |
SDT_CONDVAR(GameSettings, vehicle.plane_speed, SLE_UINT8, 90, SL_MAX_VERSION, 0, 0, 4, 1, 4, 0, STR_CONFIG_PATCHES_PLANE_SPEED, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1656 |
SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines, 95, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_PATCHES_DYNAMIC_ENGINES, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1657 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1658 |
SDT_BOOL(GameSettings, station.join_stations, 0, 0, true, STR_CONFIG_PATCHES_JOINSTATIONS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1659 |
SDTC_CONDBOOL( gui.sg_full_load_any, 0, 92, 0, 0 , true, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1660 |
SDT_BOOL(GameSettings, order.improved_load, 0,NN, true, STR_CONFIG_PATCHES_IMPROVEDLOAD, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1661 |
SDT_BOOL(GameSettings, order.selectgoods, 0, 0, true, STR_CONFIG_PATCHES_SELECTGOODS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1662 |
SDTC_CONDBOOL( gui.sg_new_nonstop, 0, 92, 0, 0, false, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1663 |
SDT_BOOL(GameSettings, station.nonuniform_stations, 0,NN, true, STR_CONFIG_PATCHES_NONUNIFORM_STATIONS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1664 |
SDT_VAR(GameSettings, station.station_spread, SLE_UINT8, 0, 0, 12, 4, 64, 0, STR_CONFIG_PATCHES_STATION_SPREAD, InvalidateStationBuildWindow), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1665 |
SDT_BOOL(GameSettings, order.serviceathelipad, 0, 0, true, STR_CONFIG_PATCHES_SERVICEATHELIPAD, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1666 |
SDT_BOOL(GameSettings, station.modified_catchment, 0, 0, true, STR_CONFIG_PATCHES_CATCHMENT, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1667 |
SDT_CONDBOOL(GameSettings, order.gradual_loading, 40, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_GRADUAL_LOADING, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1668 |
SDT_CONDBOOL(GameSettings, construction.road_stop_on_town_road, 47, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1669 |
SDT_CONDBOOL(GameSettings, station.adjacent_stations, 62, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_ADJACENT_STATIONS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1670 |
SDT_CONDBOOL(GameSettings, economy.station_noise_level, 96, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_PATCHES_NOISE_LEVEL, InvalidateTownViewWindow), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1671 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1672 |
SDT_BOOL(GameSettings, economy.inflation, 0, 0, true, STR_CONFIG_PATCHES_INFLATION, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1673 |
SDT_VAR(GameSettings, construction.raw_industry_construction, SLE_UINT8, 0,MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD, InvalidateBuildIndustryWindow), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1674 |
SDT_BOOL(GameSettings, economy.multiple_industry_per_town, 0, 0, false, STR_CONFIG_PATCHES_MULTIPINDTOWN, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1675 |
SDT_BOOL(GameSettings, economy.same_industry_close, 0, 0, false, STR_CONFIG_PATCHES_SAMEINDCLOSE, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1676 |
SDT_BOOL(GameSettings, economy.bribe, 0, 0, true, STR_CONFIG_PATCHES_BRIBE, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1677 |
SDT_CONDBOOL(GameSettings, economy.exclusive_rights, 79, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1678 |
SDT_CONDBOOL(GameSettings, economy.give_money, 79, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1679 |
SDT_VAR(GameSettings, game_creation.snow_line_height, SLE_UINT8, 0, 0, 7, 2, 13, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1680 |
SDTC_VAR( gui.colored_news_year, SLE_INT32, 0,NC, 2000,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_COLORED_NEWS_YEAR, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1681 |
SDT_VAR(GameSettings, game_creation.starting_year, SLE_INT32, 0,NC, 1950,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_STARTING_YEAR, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1682 |
SDTC_VAR( gui.ending_year, SLE_INT32, 0,NC|NO,2051,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_ENDING_YEAR, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1683 |
SDT_BOOL(GameSettings, economy.smooth_economy, 0, 0, true, STR_CONFIG_PATCHES_SMOOTH_ECONOMY, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1684 |
SDT_BOOL(GameSettings, economy.allow_shares, 0, 0, false, STR_CONFIG_PATCHES_ALLOW_SHARES, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1685 |
SDT_CONDVAR(GameSettings, economy.town_growth_rate, SLE_UINT8, 54, SL_MAX_VERSION, 0, MS, 2, 0, 4, 0, STR_CONFIG_PATCHES_TOWN_GROWTH, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1686 |
SDT_CONDVAR(GameSettings, economy.larger_towns, SLE_UINT8, 54, SL_MAX_VERSION, 0, D0, 4, 0, 255, 1, STR_CONFIG_PATCHES_LARGER_TOWNS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1687 |
SDT_CONDVAR(GameSettings, economy.initial_city_size, SLE_UINT8, 56, SL_MAX_VERSION, 0, 0, 2, 1, 10, 1, STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1688 |
SDT_CONDBOOL(GameSettings, economy.mod_road_rebuild, 77, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_MODIFIED_ROAD_REBUILD, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1689 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1690 |
SDT_BOOL(GameSettings, ai.ainew_active, 0, 0, false, STR_CONFIG_PATCHES_AINEW_ACTIVE, AiNew_PatchActive_Warning), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1691 |
SDT_BOOL(GameSettings, ai.ai_in_multiplayer, 0, 0, false, STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER, Ai_In_Multiplayer_Warning), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1692 |
SDT_BOOL(GameSettings, ai.ai_disable_veh_train, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_TRAINS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1693 |
SDT_BOOL(GameSettings, ai.ai_disable_veh_roadveh, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1694 |
SDT_BOOL(GameSettings, ai.ai_disable_veh_aircraft, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1695 |
SDT_BOOL(GameSettings, ai.ai_disable_veh_ship, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_SHIPS, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1696 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1697 |
SDT_VAR(GameSettings, vehicle.extend_vehicle_life, SLE_UINT8, 0, 0, 0, 0, 100, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1698 |
SDT_VAR(GameSettings, economy.dist_local_authority, SLE_UINT8, 0, 0, 20, 5, 60, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1699 |
SDT_VAR(GameSettings, pf.wait_oneway_signal, SLE_UINT8, 0, 0, 15, 2, 100, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1700 |
SDT_VAR(GameSettings, pf.wait_twoway_signal, SLE_UINT8, 0, 0, 41, 2, 100, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1701 |
SDT_CONDLISTO(GameSettings, economy.town_noise_population, 3, SLE_UINT16, 96, SL_MAX_VERSION, 0,D0, "800,2000,4000", STR_NULL, NULL, CheckNoiseToleranceLevel), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1702 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1703 |
SDT_VAR(GameSettings, pf.opf.pf_maxlength, SLE_UINT16, 0, 0, 4096, 64, 65535, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1704 |
SDT_VAR(GameSettings, pf.opf.pf_maxdepth, SLE_UINT8, 0, 0, 48, 4, 255, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1705 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1706 |
SDT_VAR(GameSettings, pf.npf.npf_max_search_nodes, SLE_UINT, 0, 0, 10000, 500, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1707 |
SDT_VAR(GameSettings, pf.npf.npf_rail_firstred_penalty, SLE_UINT, 0, 0, ( 10 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1708 |
SDT_VAR(GameSettings, pf.npf.npf_rail_firstred_exit_penalty, SLE_UINT, 0, 0, (100 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1709 |
SDT_VAR(GameSettings, pf.npf.npf_rail_lastred_penalty, SLE_UINT, 0, 0, ( 10 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1710 |
SDT_VAR(GameSettings, pf.npf.npf_rail_station_penalty, SLE_UINT, 0, 0, ( 1 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1711 |
SDT_VAR(GameSettings, pf.npf.npf_rail_slope_penalty, SLE_UINT, 0, 0, ( 1 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1712 |
SDT_VAR(GameSettings, pf.npf.npf_rail_curve_penalty, SLE_UINT, 0, 0, 1, 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1713 |
SDT_VAR(GameSettings, pf.npf.npf_rail_depot_reverse_penalty, SLE_UINT, 0, 0, ( 50 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1714 |
SDT_VAR(GameSettings, pf.npf.npf_buoy_penalty, SLE_UINT, 0, 0, ( 2 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1715 |
SDT_VAR(GameSettings, pf.npf.npf_water_curve_penalty, SLE_UINT, 0, 0, (NPF_TILE_LENGTH / 4), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1716 |
SDT_VAR(GameSettings, pf.npf.npf_road_curve_penalty, SLE_UINT, 0, 0, 1, 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1717 |
SDT_VAR(GameSettings, pf.npf.npf_crossing_penalty, SLE_UINT, 0, 0, ( 3 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1718 |
SDT_CONDVAR(GameSettings, pf.npf.npf_road_drive_through_penalty, SLE_UINT, 47, SL_MAX_VERSION, 0, 0, ( 8 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL), |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1719 |
|
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1720 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1721 |
SDT_CONDBOOL(GameSettings, pf.yapf.disable_node_optimization, 28, SL_MAX_VERSION, 0, 0, false, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1722 |
SDT_CONDVAR(GameSettings, pf.yapf.max_search_nodes, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10000, 500, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1723 |
SDT_CONDBOOL(GameSettings, pf.yapf.rail_firstred_twoway_eol, 28, SL_MAX_VERSION, 0, 0, true, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1724 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_firstred_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1725 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_firstred_exit_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 100 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1726 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_lastred_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1727 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_lastred_exit_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 100 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1728 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_station_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 30 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1729 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_slope_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 2 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1730 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_curve45_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 1 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1731 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_curve90_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 6 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1732 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_depot_reverse_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 50 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1733 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_crossing_penalty, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 3 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1734 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_max_signals, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10, 1, 100, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1735 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p0, SLE_INT, 28, SL_MAX_VERSION, 0, 0, 500, -1000000, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1736 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p1, SLE_INT, 28, SL_MAX_VERSION, 0, 0, -100, -1000000, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1737 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p2, SLE_INT, 28, SL_MAX_VERSION, 0, 0, 5, -1000000, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1738 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_longer_platform_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 8 * YAPF_TILE_LENGTH, 0, 20000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1739 |
SDT_CONDVAR(GameSettings, pf.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), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1740 |
SDT_CONDVAR(GameSettings, pf.yapf.rail_shorter_platform_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 40 * YAPF_TILE_LENGTH, 0, 20000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1741 |
SDT_CONDVAR(GameSettings, pf.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), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1742 |
SDT_CONDVAR(GameSettings, pf.yapf.road_slope_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 2 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1743 |
SDT_CONDVAR(GameSettings, pf.yapf.road_curve_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 1 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1744 |
SDT_CONDVAR(GameSettings, pf.yapf.road_crossing_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 3 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1745 |
SDT_CONDVAR(GameSettings, pf.yapf.road_stop_penalty, SLE_UINT, 47, SL_MAX_VERSION, 0, 0, 8 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL), |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1746 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1747 |
SDT_CONDVAR(GameSettings, game_creation.land_generator, SLE_UINT8, 30, SL_MAX_VERSION, 0,MS, 1, 0, 1, 0, STR_CONFIG_PATCHES_LAND_GENERATOR, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1748 |
SDT_CONDVAR(GameSettings, game_creation.oil_refinery_limit, SLE_UINT8, 30, SL_MAX_VERSION, 0, 0, 32, 12, 48, 0, STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1749 |
SDT_CONDVAR(GameSettings, game_creation.tgen_smoothness, SLE_UINT8, 30, SL_MAX_VERSION, 0,MS, 1, 0, 3, 0, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1750 |
SDT_CONDVAR(GameSettings, game_creation.generation_seed, SLE_UINT32, 30, SL_MAX_VERSION, 0, 0, GENERATE_NEW_SEED, 0, UINT32_MAX, 0, STR_NULL, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1751 |
SDT_CONDVAR(GameSettings, game_creation.tree_placer, SLE_UINT8, 30, SL_MAX_VERSION, 0,MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_TREE_PLACER, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1752 |
SDT_VAR(GameSettings, game_creation.heightmap_rotation, SLE_UINT8, S,MS, 0, 0, 1, 0, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1753 |
SDT_VAR(GameSettings, game_creation.se_flat_world_height, SLE_UINT8, S, 0, 0, 0, 15, 0, STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT, NULL), |
1218 | 1754 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1755 |
SDT_VAR(GameSettings, game_creation.map_x, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_X, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1756 |
SDT_VAR(GameSettings, game_creation.map_y, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_Y, NULL), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1757 |
|
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1758 |
SDTC_CONDOMANY( gui.currency, SLE_UINT8, 97, SL_MAX_VERSION, 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), |
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1759 |
SDTC_CONDOMANY( gui.units, SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL), |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1760 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1761 |
/***************************************************************************/ |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
1762 |
/* Unsaved patch variables. */ |
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1763 |
SDTC_OMANY(gui.autosave, SLE_UINT8, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1764 |
SDTC_BOOL(gui.vehicle_speed, S, 0, true, STR_CONFIG_PATCHES_VEHICLESPEED, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1765 |
SDTC_BOOL(gui.status_long_date, S, 0, true, STR_CONFIG_PATCHES_LONGDATE, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1766 |
SDTC_BOOL(gui.show_finances, S, 0, true, STR_CONFIG_PATCHES_SHOWFINANCES, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1767 |
SDTC_BOOL(gui.autoscroll, S, 0, false, STR_CONFIG_PATCHES_AUTOSCROLL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1768 |
SDTC_BOOL(gui.reverse_scroll, S, 0, false, STR_CONFIG_PATCHES_REVERSE_SCROLLING, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1769 |
SDTC_BOOL(gui.smooth_scroll, S, 0, false, STR_CONFIG_PATCHES_SMOOTH_SCROLLING, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1770 |
SDTC_BOOL(gui.measure_tooltip, S, 0, false, STR_CONFIG_PATCHES_MEASURE_TOOLTIP, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1771 |
SDTC_VAR(gui.errmsg_duration, SLE_UINT8, S, 0, 5, 0, 20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1772 |
SDTC_VAR(gui.toolbar_pos, SLE_UINT8, S, MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS, v_PositionMainToolbar), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1773 |
SDTC_VAR(gui.window_snap_radius, SLE_UINT8, S, D0, 10, 1, 32, 0, STR_CONFIG_PATCHES_SNAP_RADIUS, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1774 |
SDTC_BOOL(gui.population_in_label, S, 0, true, STR_CONFIG_PATCHES_POPULATION_IN_LABEL, PopulationInLabelActive), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1775 |
SDTC_BOOL(gui.link_terraform_toolbar, S, 0, false, STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1776 |
SDTC_VAR(gui.liveries, SLE_UINT8, S, MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_LIVERIES, RedrawScreen), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1777 |
SDTC_BOOL(gui.prefer_teamchat, S, 0, false, STR_CONFIG_PATCHES_PREFER_TEAMCHAT, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1778 |
SDTC_VAR(gui.scrollwheel_scrolling, SLE_UINT8, S, MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1779 |
SDTC_VAR(gui.scrollwheel_multiplier, SLE_UINT8, S, 0, 5, 1, 15, 1, STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1780 |
SDTC_BOOL(gui.pause_on_newgame, S, 0, false, STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1781 |
SDTC_VAR(gui.advanced_vehicle_list, SLE_UINT8, S, MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1782 |
SDTC_BOOL(gui.timetable_in_ticks, S, 0, false, STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1783 |
SDTC_VAR(gui.loading_indicators, SLE_UINT8, S, MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_LOADING_INDICATORS, RedrawScreen), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1784 |
SDTC_VAR(gui.default_rail_type, SLE_UINT8, S, MS, 4, 0, 6, 0, STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1785 |
SDTC_BOOL(gui.enable_signal_gui, S, 0, false, STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI, CloseSignalGUI), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1786 |
SDTC_VAR(gui.drag_signals_density, SLE_UINT8, S, 0, 4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY, DragSignalsDensityChanged), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1787 |
SDTC_VAR(gui.semaphore_build_before, SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, ResetSignalVariant), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1788 |
SDTC_BOOL(gui.train_income_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_INCOME_LESS, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1789 |
SDTC_VAR(gui.order_review_system, SLE_UINT8, S, MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_ORDER_REVIEW, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1790 |
SDTC_BOOL(gui.lost_train_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_LOST_TRAIN, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1791 |
SDTC_BOOL(gui.autorenew, S, 0, false, STR_CONFIG_PATCHES_AUTORENEW_VEHICLE, EngineRenewUpdate), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1792 |
SDTC_VAR(gui.autorenew_months, SLE_INT16, S, 0, 6, -12, 12, 0, STR_CONFIG_PATCHES_AUTORENEW_MONTHS, EngineRenewMonthsUpdate), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1793 |
SDTC_VAR(gui.autorenew_money, SLE_UINT, S, CR,100000, 0, 2000000, 0, STR_CONFIG_PATCHES_AUTORENEW_MONEY, EngineRenewMoneyUpdate), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1794 |
SDTC_BOOL(gui.always_build_infrastructure, S, 0, false, STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE, RedrawScreen), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1795 |
SDTC_BOOL(gui.new_nonstop, S, 0, false, STR_CONFIG_PATCHES_NEW_NONSTOP, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1796 |
SDTC_BOOL(gui.keep_all_autosave, S, 0, false, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1797 |
SDTC_BOOL(gui.autosave_on_exit, S, 0, false, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1798 |
SDTC_VAR(gui.max_num_autosaves, SLE_UINT8, S, 0, 16, 0, 255, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1799 |
SDTC_BOOL(gui.bridge_pillars, S, 0, true, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1800 |
SDTC_BOOL(gui.auto_euro, S, 0, true, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1801 |
SDTC_VAR(gui.news_message_timeout, SLE_UINT8, S, 0, 2, 1, 255, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1802 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1803 |
#ifdef ENABLE_NETWORK |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1804 |
SDTC_VAR(network.sync_freq, SLE_UINT16,C|S,NO, 100, 0, 100, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1805 |
SDTC_VAR(network.frame_freq, SLE_UINT8,C|S,NO, 0, 0, 100, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1806 |
SDTC_VAR(network.max_join_time, SLE_UINT16, S, NO, 500, 0, 32000, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1807 |
SDTC_BOOL(network.pause_on_join, S, NO, true, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1808 |
SDTC_STR(network.server_bind_ip, SLE_STRB, S, NO, "0.0.0.0", STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1809 |
SDTC_VAR(network.server_port, SLE_UINT16, S, NO,NETWORK_DEFAULT_PORT,0,65535,0,STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1810 |
SDTC_BOOL(network.server_advertise, S, NO, false, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1811 |
SDTC_VAR(network.lan_internet, SLE_UINT8, S, NO, 0, 0, 1, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1812 |
SDTC_STR(network.player_name, SLE_STRB, S, 0, NULL, STR_NULL, UpdatePlayerName), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1813 |
SDTC_STR(network.server_password, SLE_STRB, S, NO, NULL, STR_NULL, UpdateServerPassword), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1814 |
SDTC_STR(network.rcon_password, SLE_STRB, S, NO, NULL, STR_NULL, UpdateRconPassword), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1815 |
SDTC_STR(network.default_company_pass, SLE_STRB, S, 0, NULL, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1816 |
SDTC_STR(network.server_name, SLE_STRB, S, NO, NULL, STR_NULL, UpdateServerName), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1817 |
SDTC_STR(network.connect_to_ip, SLE_STRB, S, 0, NULL, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1818 |
SDTC_STR(network.network_id, SLE_STRB, S, NO, NULL, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1819 |
SDTC_BOOL(network.autoclean_companies, S, NO, false, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1820 |
SDTC_VAR(network.autoclean_unprotected, SLE_UINT8, S, NO, 12, 0, 60, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1821 |
SDTC_VAR(network.autoclean_protected, SLE_UINT8, S, NO, 36, 0, 180, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1822 |
SDTC_VAR(network.max_companies, SLE_UINT8, S, NO, 8, 1, MAX_PLAYERS, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1823 |
SDTC_VAR(network.max_clients, SLE_UINT8, S, NO, 10, 2, MAX_CLIENTS, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1824 |
SDTC_VAR(network.max_spectators, SLE_UINT8, S, NO, 10, 0, MAX_CLIENTS, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1825 |
SDTC_VAR(network.restart_game_year, SLE_INT32, S,D0|NO|NC,0, MIN_YEAR, MAX_YEAR, 1, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1826 |
SDTC_VAR(network.min_players, SLE_UINT8, S, NO, 0, 0, 10, 0, STR_NULL, UpdateMinPlayers), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1827 |
SDTC_OMANY(network.server_lang, SLE_UINT8, S, NO, 0, 35, "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN|AFRIKAANS|CROATIAN|CATALAN|ESTONIAN|GALICIAN|GREEK|LATVIAN", STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1828 |
SDTC_BOOL(network.reload_cfg, S, NO, false, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1829 |
SDTC_STR(network.last_host, SLE_STRB, S, 0, "0.0.0.0", STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1830 |
SDTC_VAR(network.last_port, SLE_UINT16, S, 0, 0, 0, UINT16_MAX, 0, STR_NULL, NULL), |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
1831 |
#endif /* ENABLE_NETWORK */ |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4293
diff
changeset
|
1832 |
|
8625
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1833 |
/* |
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1834 |
* Since the network code (CmdChangePatchSetting and friends) use the index in this array to decide |
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1835 |
* which patch the server is talking about all conditional compilation of this array must be at the |
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1836 |
* end. This isn't really the best solution, the patches the server can tell the client about should |
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1837 |
* either use a seperate array or some other form of identifier. |
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1838 |
*/ |
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1839 |
|
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1840 |
#ifdef __APPLE__ |
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1841 |
/* We might need to emulate a right mouse button on mac */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1842 |
SDTC_VAR(gui.right_mouse_btn_emulation, SLE_UINT8, S, MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL), |
8625
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1843 |
#endif |
917bf7147a48
(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
egladil
parents:
8617
diff
changeset
|
1844 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1845 |
SDT_END() |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1846 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
1847 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1848 |
static const SettingDesc _currency_settings[] = { |
4431
7468c1484d20
(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
|
1849 |
SDT_VAR(CurrencySpec, rate, SLE_UINT16, S, 0, 1, 0, 100, 0, STR_NULL, NULL), |
7468c1484d20
(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
|
1850 |
SDT_CHR(CurrencySpec, separator, S, 0, ".", STR_NULL, NULL), |
6987
b0f13039bda2
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6984
diff
changeset
|
1851 |
SDT_VAR(CurrencySpec, to_euro, SLE_INT32, S, 0, 0, 0, 3000, 0, STR_NULL, NULL), |
4431
7468c1484d20
(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
|
1852 |
SDT_STR(CurrencySpec, prefix, SLE_STRBQ, S, 0, NULL, STR_NULL, NULL), |
7468c1484d20
(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
|
1853 |
SDT_STR(CurrencySpec, suffix, SLE_STRBQ, S, 0, " credits", STR_NULL, NULL), |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1854 |
SDT_END() |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
1855 |
}; |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
738
diff
changeset
|
1856 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1857 |
/* Undefine for the shortcut macros above */ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1858 |
#undef S |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1859 |
#undef C |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1860 |
#undef N |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1861 |
|
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1862 |
#undef D0 |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1863 |
#undef NC |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1864 |
#undef MS |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1865 |
#undef NO |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1866 |
#undef CR |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
1867 |
|
10759
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1868 |
/** |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1869 |
* Prepare for reading and old diff_custom by zero-ing the memory. |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1870 |
*/ |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1871 |
static void PrepareOldDiffCustom() |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1872 |
{ |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1873 |
memset(_old_diff_custom, 0, sizeof(_old_diff_custom)); |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1874 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1875 |
|
10759
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1876 |
/** |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1877 |
* Reading of the old diff_custom array and transforming it to the new format. |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1878 |
* @param savegame is it read from the config or savegame. In the latter case |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1879 |
* we are sure there is an array; in the former case we have |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1880 |
* to check that. |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1881 |
*/ |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1882 |
static void HandleOldDiffCustom(bool savegame) |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1883 |
{ |
10759
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1884 |
uint options_to_load = GAME_DIFFICULTY_NUM - ((savegame && CheckSavegameVersion(4)) ? 1 : 0); |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1885 |
|
10759
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1886 |
if (!savegame) { |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1887 |
/* If we did read to old_diff_custom, then at least one value must be non 0. */ |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1888 |
bool old_diff_custom_used = false; |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1889 |
for (uint i = 0; i < options_to_load && !old_diff_custom_used; i++) { |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1890 |
old_diff_custom_used = (_old_diff_custom[i] != 0); |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1891 |
} |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1892 |
|
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
1893 |
if (!old_diff_custom_used) return; |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1894 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1895 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1896 |
for (uint i = 0; i < options_to_load; i++) { |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1897 |
const SettingDesc *sd = &_patch_settings[i]; |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
1898 |
void *var = GetVariableAddress(savegame ? &_settings_game : &_settings_newgame, &sd->save); |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1899 |
Write_ValidateSetting(var, sd, (int32)((i == 4 ? 1000 : 1) * _old_diff_custom[i])); |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1900 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1901 |
} |
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1902 |
|
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
1903 |
|
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
1904 |
static void NewsDisplayLoadConfig(IniFile *ini, const char *grpname) |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1905 |
{ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
1906 |
IniGroup *group = ini_getgroup(ini, grpname); |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1907 |
IniItem *item; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1908 |
|
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
1909 |
/* If no group exists, return */ |
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
1910 |
if (group == NULL) return; |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1911 |
|
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1912 |
for (item = group->item; item != NULL; item = item->next) { |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1913 |
int news_item = -1; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1914 |
for (int i = 0; i < NT_END; i++) { |
10253
1627c1fef7c8
(svn r12785) -Codechange: put all news-type related constants in the same array. Patch by cirdan.
rubidium
parents:
10229
diff
changeset
|
1915 |
if (strcasecmp(item->name, _news_type_data[i].name) == 0) { |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1916 |
news_item = i; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1917 |
break; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1918 |
} |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1919 |
} |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1920 |
if (news_item == -1) { |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1921 |
DEBUG(misc, 0, "Invalid display option: %s", item->name); |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1922 |
continue; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1923 |
} |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1924 |
|
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1925 |
if (strcasecmp(item->value, "full") == 0) { |
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
1926 |
_news_type_data[news_item].display = ND_FULL; |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1927 |
} else if (strcasecmp(item->value, "off") == 0) { |
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
1928 |
_news_type_data[news_item].display = ND_OFF; |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1929 |
} else if (strcasecmp(item->value, "summarized") == 0) { |
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
1930 |
_news_type_data[news_item].display = ND_SUMMARY; |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1931 |
} else { |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1932 |
DEBUG(misc, 0, "Invalid display value: %s", item->value); |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1933 |
continue; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1934 |
} |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1935 |
} |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1936 |
} |
3628
bd4a6601e5a2
(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
|
1937 |
|
5329
2b117d8652f0
(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
|
1938 |
/* Load a GRF configuration from the given group name */ |
2b117d8652f0
(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
|
1939 |
static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_static) |
2b117d8652f0
(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
|
1940 |
{ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
1941 |
IniGroup *group = ini_getgroup(ini, grpname); |
5329
2b117d8652f0
(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
|
1942 |
IniItem *item; |
2b117d8652f0
(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
|
1943 |
GRFConfig *first = NULL; |
2b117d8652f0
(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
|
1944 |
GRFConfig **curr = &first; |
3628
bd4a6601e5a2
(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
|
1945 |
|
5329
2b117d8652f0
(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
|
1946 |
if (group == NULL) return NULL; |
2b117d8652f0
(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
|
1947 |
|
2b117d8652f0
(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
|
1948 |
for (item = group->item; item != NULL; item = item->next) { |
5860
7fdc9b423ba1
(svn r8066) - Codechange: MallocT(), CallocT(), ReallocT() now return the pointer to allocated memory instead of modifying the pointer given as parameter
KUDr
parents:
5852
diff
changeset
|
1949 |
GRFConfig *c = CallocT<GRFConfig>(1); |
7530
31257d744079
(svn r10298) -Fix [FS#903]: show the subdirectory below the default data directory in this filename in the newgrf list. The directory was removed in r9560 because then it used to full path instead of the path relative to the data directory, but since the inclusion of "search paths" that is not necessary anymore.
rubidium
parents:
7494
diff
changeset
|
1950 |
c->filename = strdup(item->name); |
5329
2b117d8652f0
(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
|
1951 |
|
2b117d8652f0
(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
|
1952 |
/* Parse parameters */ |
2b117d8652f0
(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
|
1953 |
if (*item->value != '\0') { |
2b117d8652f0
(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
|
1954 |
c->num_params = parse_intlist(item->value, (int*)c->param, lengthof(c->param)); |
2b117d8652f0
(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
|
1955 |
if (c->num_params == (byte)-1) { |
2b117d8652f0
(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
|
1956 |
ShowInfoF("ini: error in array '%s'", item->name); |
2b117d8652f0
(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
|
1957 |
c->num_params = 0; |
2b117d8652f0
(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
|
1958 |
} |
2b117d8652f0
(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
|
1959 |
} |
2b117d8652f0
(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
|
1960 |
|
2b117d8652f0
(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
|
1961 |
/* Check if item is valid */ |
2b117d8652f0
(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
|
1962 |
if (!FillGRFDetails(c, is_static)) { |
2b117d8652f0
(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
|
1963 |
const char *msg; |
2b117d8652f0
(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
|
1964 |
|
6555
c27c9d5b459f
(svn r9031) -Codechange: Introduce grfconfig->status, and use it for states that are
maedhros
parents:
6338
diff
changeset
|
1965 |
if (c->status == GCS_NOT_FOUND) { |
5329
2b117d8652f0
(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
|
1966 |
msg = "not found"; |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8423
diff
changeset
|
1967 |
} else if (HasBit(c->flags, GCF_UNSAFE)) { |
5329
2b117d8652f0
(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
|
1968 |
msg = "unsafe for static use"; |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8423
diff
changeset
|
1969 |
} else if (HasBit(c->flags, GCF_SYSTEM)) { |
5329
2b117d8652f0
(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
|
1970 |
msg = "system NewGRF"; |
2b117d8652f0
(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
|
1971 |
} else { |
2b117d8652f0
(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
|
1972 |
msg = "unknown"; |
2b117d8652f0
(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
|
1973 |
} |
2b117d8652f0
(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
|
1974 |
|
2b117d8652f0
(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
|
1975 |
ShowInfoF("ini: ignoring invalid NewGRF '%s': %s", item->name, msg); |
5346
0d7cc9cefd2b
(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
|
1976 |
ClearGRFConfig(&c); |
5329
2b117d8652f0
(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
|
1977 |
continue; |
2b117d8652f0
(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
|
1978 |
} |
2b117d8652f0
(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
|
1979 |
|
2b117d8652f0
(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
|
1980 |
/* Mark file as static to avoid saving in savegame. */ |
8427
143b0be22af1
(svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
skidd13
parents:
8424
diff
changeset
|
1981 |
if (is_static) SetBit(c->flags, GCF_STATIC); |
5329
2b117d8652f0
(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
|
1982 |
|
2b117d8652f0
(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
|
1983 |
/* Add item to list */ |
2b117d8652f0
(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
|
1984 |
*curr = c; |
2b117d8652f0
(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
|
1985 |
curr = &c->next; |
5307
3e336ae5724a
(svn r7463) -Codechange: Don't load invalid NewGRF files from the configuration file; instead show a warning.
peter1138
parents:
5228
diff
changeset
|
1986 |
} |
3631
33532b85cce9
(svn r4530) - Fix [NewGRF]: don't spew a warning when a grf file has no parameters.
Darkvater
parents:
3628
diff
changeset
|
1987 |
|
5329
2b117d8652f0
(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
|
1988 |
return first; |
3628
bd4a6601e5a2
(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
|
1989 |
} |
0 | 1990 |
|
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
1991 |
static void NewsDisplaySaveConfig(IniFile *ini, const char *grpname) |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1992 |
{ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
1993 |
IniGroup *group = ini_getgroup(ini, grpname); |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1994 |
IniItem **item; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1995 |
|
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1996 |
if (group == NULL) return; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1997 |
group->item = NULL; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1998 |
item = &group->item; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
1999 |
|
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
2000 |
for (int i = 0; i < NT_END; i++) { |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
2001 |
const char *value; |
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
2002 |
int v = _news_type_data[i].display; |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
2003 |
|
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
2004 |
value = (v == ND_OFF ? "off" : (v == ND_SUMMARY ? "summarized" : "full")); |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
2005 |
|
10253
1627c1fef7c8
(svn r12785) -Codechange: put all news-type related constants in the same array. Patch by cirdan.
rubidium
parents:
10229
diff
changeset
|
2006 |
*item = ini_item_alloc(group, _news_type_data[i].name, strlen(_news_type_data[i].name)); |
6609
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
2007 |
(*item)->value = (char*)pool_strdup(&ini->pool, value, strlen(value)); |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
2008 |
item = &(*item)->next; |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
2009 |
} |
7c466c7c850a
(svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents:
6574
diff
changeset
|
2010 |
} |
5329
2b117d8652f0
(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
|
2011 |
|
9243
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2012 |
/** |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2013 |
* Save the version of OpenTTD to the ini file. |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2014 |
* @param ini the ini to write to |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2015 |
*/ |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2016 |
static void SaveVersionInConfig(IniFile *ini) |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2017 |
{ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
2018 |
IniGroup *group = ini_getgroup(ini, "version"); |
9243
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2019 |
|
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2020 |
if (group == NULL) return; |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2021 |
group->item = NULL; |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2022 |
IniItem **item = &group->item; |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2023 |
|
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2024 |
char version[9]; |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2025 |
snprintf(version, lengthof(version), "%08X", _openttd_newgrf_version); |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2026 |
|
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2027 |
const char *versions[][2] = { |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2028 |
{ "version_string", _openttd_revision }, |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2029 |
{ "version_number", version } |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2030 |
}; |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2031 |
|
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2032 |
for (uint i = 0; i < lengthof(versions); i++) { |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2033 |
*item = ini_item_alloc(group, versions[i][0], strlen(versions[i][0])); |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2034 |
(*item)->value = (char*)pool_strdup(&ini->pool, versions[i][1], strlen(versions[i][1])); |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2035 |
item = &(*item)->next; |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2036 |
} |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2037 |
} |
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2038 |
|
5329
2b117d8652f0
(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
|
2039 |
/* Save a GRF configuration to the given group name */ |
5309
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2040 |
static void GRFSaveConfig(IniFile *ini, const char *grpname, const GRFConfig *list) |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2041 |
{ |
10471
719adbfbd39a
(svn r13014) -Fix (r13008): mingw revealed some signed/unsigned warnings
glx
parents:
10465
diff
changeset
|
2042 |
IniGroup *group = ini_getgroup(ini, grpname); |
5309
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2043 |
IniItem **item; |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2044 |
const GRFConfig *c; |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2045 |
|
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2046 |
if (group == NULL) return; |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2047 |
group->item = NULL; |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2048 |
item = &group->item; |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2049 |
|
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2050 |
for (c = list; c != NULL; c = c->next) { |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2051 |
char params[512]; |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2052 |
GRFBuildParamList(params, c, lastof(params)); |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2053 |
|
7530
31257d744079
(svn r10298) -Fix [FS#903]: show the subdirectory below the default data directory in this filename in the newgrf list. The directory was removed in r9560 because then it used to full path instead of the path relative to the data directory, but since the inclusion of "search paths" that is not necessary anymore.
rubidium
parents:
7494
diff
changeset
|
2054 |
*item = ini_item_alloc(group, c->filename, strlen(c->filename)); |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
2055 |
(*item)->value = (char*)pool_strdup(&ini->pool, params, strlen(params)); |
5309
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2056 |
item = &(*item)->next; |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2057 |
} |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2058 |
} |
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2059 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2060 |
/* Common handler for saving/loading variables to the configuration file */ |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2061 |
static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescProcList *proc_list) |
0 | 2062 |
{ |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2063 |
proc(ini, (const SettingDesc*)_misc_settings, "misc", NULL); |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2064 |
proc(ini, (const SettingDesc*)_music_settings, "music", &msf); |
3051
16f6e40c67eb
(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
|
2065 |
#ifdef WIN32 |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2066 |
proc(ini, (const SettingDesc*)_win32_settings, "win32", NULL); |
3051
16f6e40c67eb
(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
|
2067 |
#endif /* WIN32 */ |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2068 |
|
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2069 |
proc(ini, _patch_settings, "patches", &_settings_newgame); |
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2070 |
proc(ini, _currency_settings,"currency", &_custom_currency); |
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2071 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
2072 |
#ifdef ENABLE_NETWORK |
3628
bd4a6601e5a2
(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
|
2073 |
proc_list(ini, "servers", _network_host_list, lengthof(_network_host_list), NULL); |
bd4a6601e5a2
(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
|
2074 |
proc_list(ini, "bans", _network_ban_list, lengthof(_network_ban_list), NULL); |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
523
diff
changeset
|
2075 |
#endif /* ENABLE_NETWORK */ |
0 | 2076 |
} |
2077 |
||
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2078 |
/** Load the values from the configuration files */ |
6573 | 2079 |
void LoadFromConfig() |
0 | 2080 |
{ |
2081 |
IniFile *ini = ini_load(_config_file); |
|
6705
d3fb7785c0a4
(svn r9467) -Fix(FS#703,6108): When resetting the array of currencies, the custom currency was reset too, thus loosing the setting a user could have used for it.(glx)
belugas
parents:
6704
diff
changeset
|
2082 |
ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one |
10759
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
2083 |
|
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
2084 |
PrepareOldDiffCustom(); |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
2085 |
ini_load_settings(ini, _gameopt_settings, "gameopt", &_settings_newgame); |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
2086 |
HandleOldDiffCustom(false); |
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
2087 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2088 |
HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list); |
5329
2b117d8652f0
(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
|
2089 |
_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false); |
2b117d8652f0
(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
|
2090 |
_grfconfig_static = GRFLoadConfig(ini, "newgrf-static", true); |
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
2091 |
NewsDisplayLoadConfig(ini, "news_display"); |
6704
1d7e67bc3f7c
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium
parents:
6682
diff
changeset
|
2092 |
CheckDifficultyLevels(); |
0 | 2093 |
ini_free(ini); |
2094 |
} |
|
2095 |
||
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2096 |
/** Save the values to the configuration file */ |
6573 | 2097 |
void SaveToConfig() |
0 | 2098 |
{ |
2099 |
IniFile *ini = ini_load(_config_file); |
|
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2100 |
|
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2101 |
/* Remove some obsolete groups. These have all been loaded into other groups. */ |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2102 |
ini_removegroup(ini, "patches"); |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2103 |
ini_removegroup(ini, "yapf"); |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
2104 |
ini_removegroup(ini, "gameopt"); |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2105 |
|
3116
031230112b25
(svn r3720) - [2/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. This second part gets rid of the old SettingDesc structures and updates 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
|
2106 |
HandleSettingDescs(ini, ini_save_settings, ini_save_setting_list); |
5309
02416fe4b891
(svn r7465) -Codechange: Save the default GRF configuration.
peter1138
parents:
5307
diff
changeset
|
2107 |
GRFSaveConfig(ini, "newgrf", _grfconfig_newgame); |
5329
2b117d8652f0
(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
|
2108 |
GRFSaveConfig(ini, "newgrf-static", _grfconfig_static); |
10273
248661824a1e
(svn r12805) -Codechange: remove some bit magic related to the news display states. Patch by cirdan.
rubidium
parents:
10253
diff
changeset
|
2109 |
NewsDisplaySaveConfig(ini, "news_display"); |
9243
3cac8fe1bd25
(svn r12443) -Add: OpenTTDs version to openttd.cfg, just so we do not need to keep to ask people for their version number because it's likely they give you the wrong answer anyway.
rubidium
parents:
9233
diff
changeset
|
2110 |
SaveVersionInConfig(ini); |
0 | 2111 |
ini_save(_config_file, ini); |
2112 |
ini_free(ini); |
|
2113 |
} |
|
1688
787400219027
(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
|
2114 |
|
3247
4e70e64adbb8
(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
|
2115 |
static const SettingDesc *GetSettingDescription(uint index) |
3118
99926945ccb1
(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
|
2116 |
{ |
99926945ccb1
(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
|
2117 |
if (index >= lengthof(_patch_settings)) return NULL; |
99926945ccb1
(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
|
2118 |
return &_patch_settings[index]; |
99926945ccb1
(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
|
2119 |
} |
99926945ccb1
(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
|
2120 |
|
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2121 |
/** Network-safe changing of patch-settings (server-only). |
6979
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
2122 |
* @param tile unused |
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
2123 |
* @param flags operation to perform |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2124 |
* @param p1 the index of the patch in the SettingDesc array which identifies it |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2125 |
* @param p2 the new value for the patch |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2126 |
* The new value is properly clamped to its minimum/maximum when setting |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2127 |
* @see _patch_settings |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2128 |
*/ |
7439
0c0e2945c890
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents:
7409
diff
changeset
|
2129 |
CommandCost CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2130 |
{ |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2131 |
const SettingDesc *sd = GetSettingDescription(p1); |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2132 |
|
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2133 |
if (sd == NULL) return CMD_ERROR; |
3223
abf18a71767b
(svn r3896) - [Patches] Fix: Honour any conditional settings when retrieving the setting entries.
Darkvater
parents:
3222
diff
changeset
|
2134 |
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) return CMD_ERROR; |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2135 |
|
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2136 |
if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking && _game_mode != GM_MENU) return CMD_ERROR; |
8397
81b06437cfab
(svn r11452) -Change: do not allow configuration changes, that NewGRFs can directly use to change their behaviour, during network games as this can cause desyncs.
rubidium
parents:
8345
diff
changeset
|
2137 |
if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return CMD_ERROR; |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
2138 |
if ((sd->desc.flags & SGF_NEWGAME_ONLY) && _game_mode != GM_MENU) return CMD_ERROR; |
8397
81b06437cfab
(svn r11452) -Change: do not allow configuration changes, that NewGRFs can directly use to change their behaviour, during network games as this can cause desyncs.
rubidium
parents:
8345
diff
changeset
|
2139 |
|
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2140 |
if (flags & DC_EXEC) { |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2141 |
GameSettings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2142 |
void *var = GetVariableAddress(s, &sd->save); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2143 |
Write_ValidateSetting(var, sd, (int32)p2); |
5113
5626f4b8b46e
(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
|
2144 |
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2145 |
|
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2146 |
InvalidateWindow(WC_GAME_OPTIONS, 0); |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2147 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2148 |
|
7446
1c4d469f986e
(svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents:
7439
diff
changeset
|
2149 |
return CommandCost(); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2150 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2151 |
|
3615
59b36aaa050a
(svn r4512) - Codechange: Sprinkle some doxygen magic over settings.c
Darkvater
parents:
3606
diff
changeset
|
2152 |
/** Top function to save the new value of an element of the Patches struct |
3118
99926945ccb1
(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
|
2153 |
* @param index offset in the SettingDesc array of the Patches struct which |
99926945ccb1
(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
|
2154 |
* identifies the patch member we want to change |
99926945ccb1
(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
|
2155 |
* @param object pointer to a valid patches struct that has its settings change. |
99926945ccb1
(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
|
2156 |
* This only affects patch-members that are not needed to be the same on all |
99926945ccb1
(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
|
2157 |
* clients in a network game. |
99926945ccb1
(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
|
2158 |
* @param value new value of the patch */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2159 |
bool SetPatchValue(uint index, int32 value) |
3118
99926945ccb1
(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
|
2160 |
{ |
99926945ccb1
(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
|
2161 |
const SettingDesc *sd = &_patch_settings[index]; |
99926945ccb1
(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
|
2162 |
/* If an item is player-based, we do not send it over the network |
99926945ccb1
(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
|
2163 |
* (if any) to change. Also *hack*hack* we update the _newgame version |
99926945ccb1
(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
|
2164 |
* of patches because changing a player-based setting in a game also |
99926945ccb1
(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
|
2165 |
* changes its defaults. At least that is the convention we have chosen */ |
99926945ccb1
(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
|
2166 |
if (sd->save.conv & SLF_NETWORK_NO) { |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2167 |
void *var = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save); |
3118
99926945ccb1
(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
|
2168 |
Write_ValidateSetting(var, sd, value); |
3121
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2169 |
|
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2170 |
if (_game_mode != GM_MENU) { |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2171 |
void *var2 = GetVariableAddress(&_settings_newgame, &sd->save); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4065
diff
changeset
|
2172 |
Write_ValidateSetting(var2, sd, value); |
3121
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2173 |
} |
5113
5626f4b8b46e
(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
|
2174 |
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); |
4600
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
2175 |
InvalidateWindow(WC_GAME_OPTIONS, 0); |
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
2176 |
return true; |
3118
99926945ccb1
(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
|
2177 |
} |
4600
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
2178 |
|
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
2179 |
/* send non-player-based settings over the network */ |
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
2180 |
if (!_networking || (_networking && _network_server)) { |
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
2181 |
return DoCommandP(0, index, value, NULL, CMD_CHANGE_PATCH_SETTING); |
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
2182 |
} |
c3d1ca65a598
(svn r6450) -Feature: Make the 'patch' console command available for offline use and for
Darkvater
parents:
4590
diff
changeset
|
2183 |
return false; |
3118
99926945ccb1
(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
|
2184 |
} |
99926945ccb1
(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
|
2185 |
|
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2186 |
/** |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2187 |
* Set a patch value with a string. |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2188 |
* @param index the patch settings index. |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2189 |
* @param value the value to write |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2190 |
* @note CANNOT BE SAVED IN THE SAVEGAME. |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2191 |
*/ |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2192 |
bool SetPatchValue(uint index, const char *value) |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2193 |
{ |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2194 |
const SettingDesc *sd = &_patch_settings[index]; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2195 |
assert(sd->save.conv & SLF_NETWORK_NO); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2196 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2197 |
char *var = (char*)GetVariableAddress(NULL, &sd->save); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2198 |
ttd_strlcpy(var, value, sd->save.length); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2199 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2200 |
return true; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2201 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2202 |
|
3247
4e70e64adbb8
(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
|
2203 |
const SettingDesc *GetPatchFromName(const char *name, uint *i) |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2204 |
{ |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2205 |
const SettingDesc *sd; |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2206 |
|
10710
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2207 |
/* First check all full names */ |
3131
e856656f99a9
(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
|
2208 |
for (*i = 0, sd = _patch_settings; sd->save.cmd != SL_END; sd++, (*i)++) { |
3223
abf18a71767b
(svn r3896) - [Patches] Fix: Honour any conditional settings when retrieving the setting entries.
Darkvater
parents:
3222
diff
changeset
|
2209 |
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; |
3210
c77ce9799650
(svn r3880) - just do a string compare without length restrictions; followup for r3875
Darkvater
parents:
3207
diff
changeset
|
2210 |
if (strcmp(sd->desc.name, name) == 0) return sd; |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2211 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2212 |
|
10710
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2213 |
/* Then check the shortcut variant of the name. */ |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2214 |
for (*i = 0, sd = _patch_settings; sd->save.cmd != SL_END; sd++, (*i)++) { |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2215 |
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2216 |
const char *short_name = strchr(sd->desc.name, '.'); |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2217 |
if (short_name != NULL) { |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2218 |
short_name++; |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2219 |
if (strcmp(short_name, name) == 0) return sd; |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2220 |
} |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2221 |
} |
c824cdf28454
(svn r13258) -Codechange: add support for using (most) of the old patch names in the console.
rubidium
parents:
10708
diff
changeset
|
2222 |
|
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2223 |
return NULL; |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2224 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2225 |
|
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2226 |
/* Those 2 functions need to be here, else we have to make some stuff non-static |
4278
0025a4267abe
(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
|
2227 |
* and besides, it is also better to keep stuff like this at the same place */ |
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2228 |
void IConsoleSetPatchSetting(const char *name, const char *value) |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2229 |
{ |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2230 |
uint index; |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2231 |
const SettingDesc *sd = GetPatchFromName(name, &index); |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2232 |
|
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2233 |
if (sd == NULL) { |
10685
955ddec7961e
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
10684
diff
changeset
|
2234 |
IConsolePrintF(CC_WARNING, "'%s' is an unknown patch setting.", name); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2235 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2236 |
|
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2237 |
bool success; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2238 |
if (sd->desc.cmd == SDT_STRING) { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2239 |
success = SetPatchValue(index, value); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2240 |
} else { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2241 |
uint32 val; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2242 |
extern bool GetArgumentInteger(uint32 *value, const char *arg); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2243 |
success = GetArgumentInteger(&val, value); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2244 |
if (success) success = SetPatchValue(index, val); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2245 |
} |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2246 |
|
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2247 |
if (!success) { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2248 |
if (_network_server) { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2249 |
IConsoleError("This command/variable is not available during network games."); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2250 |
} else { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2251 |
IConsoleError("This command/variable is only available to a network server."); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2252 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2253 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2254 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2255 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2256 |
void IConsoleSetPatchSetting(const char *name, int value) |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2257 |
{ |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2258 |
uint index; |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2259 |
const SettingDesc *sd = GetPatchFromName(name, &index); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2260 |
assert(sd != NULL); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2261 |
SetPatchValue(index, value); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2262 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2263 |
|
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2264 |
void IConsoleGetPatchSetting(const char *name) |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2265 |
{ |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2266 |
char value[20]; |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2267 |
uint index; |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2268 |
const SettingDesc *sd = GetPatchFromName(name, &index); |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2269 |
const void *ptr; |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2270 |
|
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2271 |
if (sd == NULL) { |
10685
955ddec7961e
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
10684
diff
changeset
|
2272 |
IConsolePrintF(CC_WARNING, "'%s' is an unknown patch setting.", name); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2273 |
return; |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2274 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2275 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2276 |
ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2277 |
|
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2278 |
if (sd->desc.cmd == SDT_STRING) { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2279 |
IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s'", name, (const char *)ptr); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2280 |
} else { |
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2281 |
if (sd->desc.cmd == SDT_BOOLX) { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2282 |
snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off"); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2283 |
} else { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2284 |
snprintf(value, sizeof(value), "%d", (int32)ReadValue(ptr, sd->save.conv)); |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2285 |
} |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2286 |
|
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2287 |
IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s' (min: %s%d, max: %d)", |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2288 |
name, value, (sd->desc.flags & SGF_0ISDISABLED) ? "(0) " : "", sd->desc.min, sd->desc.max); |
3119
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2289 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2290 |
} |
08471cfc4ef8
(svn r3723) - [5/6] Move over the console commands from settings_gui to settings where they rather belong.
Darkvater
parents:
3118
diff
changeset
|
2291 |
|
6925
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2292 |
void IConsoleListPatches() |
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2293 |
{ |
10685
955ddec7961e
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
10684
diff
changeset
|
2294 |
IConsolePrintF(CC_WARNING, "All patches with their current value:"); |
6925
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2295 |
|
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2296 |
for (const SettingDesc *sd = _patch_settings; sd->save.cmd != SL_END; sd++) { |
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2297 |
char value[80]; |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2298 |
const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save); |
6925
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2299 |
|
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2300 |
if (sd->desc.cmd == SDT_BOOLX) { |
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2301 |
snprintf(value, lengthof(value), (*(bool*)ptr == 1) ? "on" : "off"); |
10790
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2302 |
} else if (sd->desc.cmd == SDT_STRING) { |
9f507561b6a5
(svn r13341) -Codechange: make most of the network settings configurable via the patch command.
rubidium
parents:
10786
diff
changeset
|
2303 |
snprintf(value, sizeof(value), "%s", (const char *)ptr); |
6925
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2304 |
} else { |
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2305 |
snprintf(value, lengthof(value), "%d", (uint32)ReadValue(ptr, sd->save.conv)); |
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2306 |
} |
10685
955ddec7961e
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
10684
diff
changeset
|
2307 |
IConsolePrintF(CC_DEFAULT, "%s = %s", sd->desc.name, value); |
6925
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2308 |
} |
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2309 |
|
10685
955ddec7961e
(svn r13229) -Codechange: replace some global variables that are only initialised once and always with the same value with enums.
rubidium
parents:
10684
diff
changeset
|
2310 |
IConsolePrintF(CC_WARNING, "Use 'patch' command to change a value"); |
6925
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2311 |
} |
dc349ff2d657
(svn r9565) -Feature: Add list_patches console command. This shows all patches along with their current values. Based on patch by madman2003/GrimRC.
peter1138
parents:
6923
diff
changeset
|
2312 |
|
3117
8066b8d0802b
(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
|
2313 |
/** Save and load handler for patches/settings |
8066b8d0802b
(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
|
2314 |
* @param osd SettingDesc struct containing all information |
8066b8d0802b
(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
|
2315 |
* @param object can be either NULL in which case we load global variables or |
8066b8d0802b
(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
|
2316 |
* a pointer to a struct which is getting saved */ |
8066b8d0802b
(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
|
2317 |
static void LoadSettings(const SettingDesc *osd, void *object) |
8066b8d0802b
(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
|
2318 |
{ |
8066b8d0802b
(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
|
2319 |
for (; osd->save.cmd != SL_END; osd++) { |
8066b8d0802b
(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
|
2320 |
const SaveLoad *sld = &osd->save; |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2321 |
void *ptr = GetVariableAddress(object, sld); |
3117
8066b8d0802b
(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
|
2322 |
|
8066b8d0802b
(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
|
2323 |
if (!SlObjectMember(ptr, sld)) continue; |
8066b8d0802b
(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
|
2324 |
} |
8066b8d0802b
(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
|
2325 |
} |
8066b8d0802b
(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
|
2326 |
|
8066b8d0802b
(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
|
2327 |
/** Loadhandler for a list of global variables |
6979
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
2328 |
* @param sdg pointer for the global variable list SettingDescGlobVarList |
3117
8066b8d0802b
(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
|
2329 |
* @note this is actually a stub for LoadSettings with the |
8066b8d0802b
(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
|
2330 |
* object pointer set to NULL */ |
8066b8d0802b
(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
|
2331 |
static inline void LoadSettingsGlobList(const SettingDescGlobVarList *sdg) |
8066b8d0802b
(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
|
2332 |
{ |
8066b8d0802b
(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
|
2333 |
LoadSettings((const SettingDesc*)sdg, NULL); |
8066b8d0802b
(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
|
2334 |
} |
8066b8d0802b
(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
|
2335 |
|
8066b8d0802b
(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
|
2336 |
/** Save and load handler for patches/settings |
6979
d194d25020e7
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas
parents:
6953
diff
changeset
|
2337 |
* @param sd SettingDesc struct containing all information |
3117
8066b8d0802b
(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
|
2338 |
* @param object can be either NULL in which case we load global variables or |
8066b8d0802b
(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
|
2339 |
* a pointer to a struct which is getting saved */ |
8066b8d0802b
(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
|
2340 |
static void SaveSettings(const SettingDesc *sd, void *object) |
8066b8d0802b
(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
|
2341 |
{ |
8066b8d0802b
(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
|
2342 |
/* We need to write the CH_RIFF header, but unfortunately can't call |
8066b8d0802b
(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
|
2343 |
* SlCalcLength() because we have a different format. So do this manually */ |
8066b8d0802b
(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
|
2344 |
const SettingDesc *i; |
8066b8d0802b
(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
|
2345 |
size_t length = 0; |
8066b8d0802b
(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
|
2346 |
for (i = sd; i->save.cmd != SL_END; i++) { |
5142
d423c895a5b4
(svn r7232) -Codechange: Also allow for the save/load of non pre-allocated strings inside structs.
Darkvater
parents:
5141
diff
changeset
|
2347 |
const void *ptr = GetVariableAddress(object, &i->save); |
d423c895a5b4
(svn r7232) -Codechange: Also allow for the save/load of non pre-allocated strings inside structs.
Darkvater
parents:
5141
diff
changeset
|
2348 |
length += SlCalcObjMemberLength(ptr, &i->save); |
3117
8066b8d0802b
(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
|
2349 |
} |
8066b8d0802b
(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
|
2350 |
SlSetLength(length); |
8066b8d0802b
(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
|
2351 |
|
8066b8d0802b
(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
|
2352 |
for (i = sd; i->save.cmd != SL_END; i++) { |
5141
05a806850445
(svn r7231) -Codechange: rename ini_get_variable to GetVariableAddress for use both in settings.c
Darkvater
parents:
5116
diff
changeset
|
2353 |
void *ptr = GetVariableAddress(object, &i->save); |
3117
8066b8d0802b
(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
|
2354 |
SlObjectMember(ptr, &i->save); |
8066b8d0802b
(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
|
2355 |
} |
8066b8d0802b
(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
|
2356 |
} |
8066b8d0802b
(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
|
2357 |
|
8066b8d0802b
(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
|
2358 |
/** Savehandler for a list of global variables |
8066b8d0802b
(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
|
2359 |
* @note this is actually a stub for SaveSettings with the |
8066b8d0802b
(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
|
2360 |
* object pointer set to NULL */ |
8066b8d0802b
(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
|
2361 |
static inline void SaveSettingsGlobList(const SettingDescGlobVarList *sdg) |
8066b8d0802b
(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
|
2362 |
{ |
8066b8d0802b
(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
|
2363 |
SaveSettings((const SettingDesc*)sdg, NULL); |
8066b8d0802b
(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
|
2364 |
} |
8066b8d0802b
(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
|
2365 |
|
6573 | 2366 |
static void Load_OPTS() |
3117
8066b8d0802b
(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
|
2367 |
{ |
8066b8d0802b
(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
|
2368 |
/* Copy over default setting since some might not get loaded in |
8066b8d0802b
(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
|
2369 |
* a networking environment. This ensures for example that the local |
8066b8d0802b
(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
|
2370 |
* autosave-frequency stays when joining a network-server */ |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
2371 |
PrepareOldDiffCustom(); |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2372 |
LoadSettings(_gameopt_settings, &_settings_game); |
10759
2feb4dca75b2
(svn r13309) -Fix: the difficulty settings from the savegame would be reset by the ones of the intro game.
rubidium
parents:
10727
diff
changeset
|
2373 |
HandleOldDiffCustom(true); |
3117
8066b8d0802b
(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
|
2374 |
} |
8066b8d0802b
(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
|
2375 |
|
6573 | 2376 |
static void Load_PATS() |
3121
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2377 |
{ |
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2378 |
/* Copy over default setting since some might not get loaded in |
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2379 |
* a networking environment. This ensures for example that the local |
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2380 |
* signal_side stays when joining a network-server */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2381 |
LoadSettings(_patch_settings, &_settings_game); |
3121
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2382 |
} |
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2383 |
|
6573 | 2384 |
static void Save_PATS() |
3121
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2385 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10767
diff
changeset
|
2386 |
SaveSettings(_patch_settings, &_settings_game); |
3121
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2387 |
} |
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2388 |
|
6573 | 2389 |
void CheckConfig() |
1688
787400219027
(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
|
2390 |
{ |
10727
90bd6932d6ff
(svn r13277) -Fix: opntitle 'jumping' to the temperate climate when closing the NewGRF settings window.
rubidium
parents:
10710
diff
changeset
|
2391 |
/* |
90bd6932d6ff
(svn r13277) -Fix: opntitle 'jumping' to the temperate climate when closing the NewGRF settings window.
rubidium
parents:
10710
diff
changeset
|
2392 |
* Increase old default values for pf_maxdepth and pf_maxlength |
90bd6932d6ff
(svn r13277) -Fix: opntitle 'jumping' to the temperate climate when closing the NewGRF settings window.
rubidium
parents:
10710
diff
changeset
|
2393 |
* to support big networks. |
90bd6932d6ff
(svn r13277) -Fix: opntitle 'jumping' to the temperate climate when closing the NewGRF settings window.
rubidium
parents:
10710
diff
changeset
|
2394 |
*/ |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2395 |
if (_settings_newgame.pf.opf.pf_maxdepth == 16 && _settings_newgame.pf.opf.pf_maxlength == 512) { |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2396 |
_settings_newgame.pf.opf.pf_maxdepth = 48; |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10699
diff
changeset
|
2397 |
_settings_newgame.pf.opf.pf_maxlength = 4096; |
2044
68ec4a2f2d79
(svn r2553) - Fix: [pathfinding] Remove old-old train pathfinder. Enhanced old pathfinder.
ludde
parents:
2008
diff
changeset
|
2398 |
} |
1688
787400219027
(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
|
2399 |
} |
3112
05a599216d83
(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
|
2400 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
2401 |
extern const ChunkHandler _setting_chunk_handlers[] = { |
10708
5f1e9cffcfa5
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium
parents:
10707
diff
changeset
|
2402 |
{ 'OPTS', NULL, Load_OPTS, CH_RIFF}, |
3121
2e50f731567a
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents:
3119
diff
changeset
|
2403 |
{ 'PATS', Save_PATS, Load_PATS, CH_RIFF | CH_LAST}, |
3112
05a599216d83
(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
|
2404 |
}; |
3900
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2405 |
|
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2406 |
static bool IsSignedVarMemType(VarType vt) |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2407 |
{ |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2408 |
switch (GetVarMemType(vt)) { |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2409 |
case SLE_VAR_I8: |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2410 |
case SLE_VAR_I16: |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2411 |
case SLE_VAR_I32: |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2412 |
case SLE_VAR_I64: |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2413 |
return true; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2414 |
} |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2415 |
return false; |
4984308f9125
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
3874
diff
changeset
|
2416 |
} |