author | Darkvater |
Sat, 04 Feb 2006 22:48:57 +0000 | |
changeset 2972 | f9fcee7f3815 |
parent 2307 | 63e18261a7e7 |
child 3020 | 87640f57ec0f |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
3 |
#ifndef SETTINGS_H |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
4 |
#define SETTINGS_H |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
5 |
|
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:
2307
diff
changeset
|
6 |
/* Convention/Type of settings. This will be merged mostly with the SaveLoad |
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:
2307
diff
changeset
|
7 |
* SLE_ enums. So it looks a bit strange. The layout is as follows: |
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:
2307
diff
changeset
|
8 |
* bits 0-7: the type (size) of the variable. Eg int8, uint8, bool, etc. Same as VarTypes |
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:
2307
diff
changeset
|
9 |
* bits 8-15: the generic variable type. Eg string, oneofmany, number, intlist |
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:
2307
diff
changeset
|
10 |
* bits 16-31: the size of a string, an intlist (which is an implicit array). */ |
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:
2307
diff
changeset
|
11 |
/* XXX - the GenericType will NOT be shifted in the final implementation, just for compatility */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
12 |
enum SettingDescType { |
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:
2307
diff
changeset
|
13 |
/* 4 bytes allocated a maximum of 16 types for GenericType */ |
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:
2307
diff
changeset
|
14 |
SDT_NUMX = 0 << 8, // value must be 0!!, refers to any number-type |
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:
2307
diff
changeset
|
15 |
SDT_BOOLX = 1 << 8, // a boolean number |
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:
2307
diff
changeset
|
16 |
SDT_ONEOFMANY = 2 << 8, // bitmasked number where only ONE bit may be set |
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:
2307
diff
changeset
|
17 |
SDT_MANYOFMANY = 3 << 8, // bitmasked number where MULTIPLE bits may be set |
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:
2307
diff
changeset
|
18 |
SDT_INTLIST = 4 << 8, // list of integers seperated by a comma ',' |
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:
2307
diff
changeset
|
19 |
SDT_STRING = 5 << 8, // string which is only a pointer, so needs dynamic allocation |
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:
2307
diff
changeset
|
20 |
SDT_STRINGBUF = 6 << 8, // string with a fixed length, preset buffer |
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:
2307
diff
changeset
|
21 |
SDT_STRINGQUOT = 7 << 8, // string with quotation marks around it (enables spaces in string) |
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:
2307
diff
changeset
|
22 |
SDT_CHAR = 8 << 8, // single character |
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:
2307
diff
changeset
|
23 |
/* 7 more possible primitives */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
24 |
|
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:
2307
diff
changeset
|
25 |
/* 4 bytes allocated a maximum of 16 types for NumberType */ |
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:
2307
diff
changeset
|
26 |
SDT_INT8 = 0 << 4, |
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:
2307
diff
changeset
|
27 |
SDT_UINT8 = 1 << 4, |
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:
2307
diff
changeset
|
28 |
SDT_INT16 = 2 << 4, |
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:
2307
diff
changeset
|
29 |
SDT_UINT16 = 3 << 4, |
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:
2307
diff
changeset
|
30 |
SDT_INT32 = 4 << 4, |
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:
2307
diff
changeset
|
31 |
SDT_UINT32 = 5 << 4, |
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:
2307
diff
changeset
|
32 |
SDT_INT64 = 6 << 4, |
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:
2307
diff
changeset
|
33 |
SDT_UINT64 = 7 << 4, |
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:
2307
diff
changeset
|
34 |
/* 8 more possible primitives */ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
35 |
|
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:
2307
diff
changeset
|
36 |
/* Shortcut 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:
2307
diff
changeset
|
37 |
SDT_BOOL = SDT_BOOLX | SDT_UINT8, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
38 |
SDT_UINT = SDT_UINT32, |
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:
2307
diff
changeset
|
39 |
SDT_INT = SDT_INT32, |
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:
2307
diff
changeset
|
40 |
SDT_STR = SDT_STRING, |
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:
2307
diff
changeset
|
41 |
SDT_STRB = SDT_STRINGBUF, |
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:
2307
diff
changeset
|
42 |
SDT_STRQ = SDT_STRINGQUOT, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
43 |
|
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:
2307
diff
changeset
|
44 |
/* The value is read from the configuration file but not saved */ |
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:
2307
diff
changeset
|
45 |
SDT_NOSAVE = 1 << 31, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
46 |
}; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
47 |
|
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:
543
diff
changeset
|
48 |
typedef enum { |
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:
543
diff
changeset
|
49 |
IGT_VARIABLES = 0, // values of the form "landscape = hilly" |
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:
543
diff
changeset
|
50 |
IGT_LIST = 1, // a list of values, seperated by \n and terminated by the next group block |
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:
543
diff
changeset
|
51 |
} IniGroupType; |
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:
543
diff
changeset
|
52 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
53 |
typedef struct SettingDesc { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
54 |
const char *name; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
55 |
int flags; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
56 |
const void *def; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
57 |
void *ptr; |
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:
2307
diff
changeset
|
58 |
const void *many; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
59 |
} SettingDesc; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
60 |
|
1739
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
759
diff
changeset
|
61 |
void IConsoleSetPatchSetting(const char *name, const char *value); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
759
diff
changeset
|
62 |
void IConsoleGetPatchSetting(const char *name); |
4f3082735fbc
(svn r2243) -Fix: Rework of console. Use 'help command|variable' to get help about it. You can assign variables with =, ++, --, or just new value. Console parser is now lenient towards typed spaces, and more robust in general (at least readable). Removed the 'set' command, instead implemented all such variables as 'variables'.
Darkvater
parents:
759
diff
changeset
|
63 |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
diff
changeset
|
64 |
#endif /* SETTINGS_H */ |