author | Medo <smaxein@googlemail.com> |
Fri, 08 Jun 2012 19:52:24 +0200 | |
changeset 7177 | bf6cf4dd847a |
parent 7175 | 038e3415100a |
child 7224 | 5143861c83bd |
permissions | -rw-r--r-- |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
1 |
/** |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
2 |
* Data structures for game scheme information. |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
3 |
* |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
4 |
* Important conventions: |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
5 |
* - All data structures own what they point to. |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
6 |
* - Strings are never null pointers. |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
7 |
*/ |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
8 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
9 |
#ifndef CFG_H_ |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
10 |
#define CFG_H_ |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
11 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
12 |
#include <stdbool.h> |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
13 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
14 |
typedef struct { |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
15 |
char *iniName; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
16 |
char *title; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
17 |
char *engineCommand; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
18 |
char *image; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
19 |
int netplayIndex; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
20 |
bool checkOverMax; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
21 |
bool times1000; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
22 |
int def; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
23 |
int min; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
24 |
int max; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
25 |
} flib_cfg_setting_meta; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
26 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
27 |
typedef struct { |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
28 |
char *iniName; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
29 |
int bitmaskIndex; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
30 |
} flib_cfg_mod_meta; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
31 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
32 |
typedef struct { |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
33 |
int settingCount; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
34 |
int modCount; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
35 |
flib_cfg_setting_meta *settings; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
36 |
flib_cfg_mod_meta *mods; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
37 |
} flib_cfg_meta; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
38 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
39 |
typedef struct { |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
40 |
int settingCount; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
41 |
int modCount; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
42 |
char *schemeName; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
43 |
int *settings; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
44 |
bool *mods; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
45 |
} flib_cfg; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
46 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
47 |
flib_cfg_meta *flib_cfg_meta_from_ini(const char *settingpath, const char *modpath); |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
48 |
void flib_cfg_meta_destroy(flib_cfg_meta *metainfo); |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
49 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
50 |
flib_cfg *flib_cfg_create(const flib_cfg_meta *meta, const char *schemeName); |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
51 |
flib_cfg *flib_cfg_from_ini(const flib_cfg_meta *meta, const char *filename); |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
52 |
int flib_cfg_to_ini(const flib_cfg_meta *meta, const char *filename, const flib_cfg *config); |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
53 |
void flib_cfg_destroy(flib_cfg* cfg); |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
54 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
55 |
#endif /* CFG_H_ */ |