author | Medo <smaxein@googlemail.com> |
Tue, 10 Jul 2012 19:33:57 +0200 | |
changeset 7320 | e704706008d4 |
parent 7316 | project_files/frontlib/model/cfg.c@f7b49b2c5d84 |
child 7482 | d70a5b0d1190 |
permissions | -rw-r--r-- |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
1 |
/* |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
3 |
* Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com> |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
4 |
* |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
6 |
* modify it under the terms of the GNU General Public License |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
7 |
* as published by the Free Software Foundation; either version 2 |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
8 |
* of the License, or (at your option) any later version. |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
9 |
* |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
13 |
* GNU General Public License for more details. |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
14 |
* |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
18 |
*/ |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
19 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
20 |
#include "scheme.h" |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
21 |
|
7179
f84805e6df03
Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents:
7177
diff
changeset
|
22 |
#include "../util/inihelper.h" |
f84805e6df03
Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents:
7177
diff
changeset
|
23 |
#include "../util/logging.h" |
f84805e6df03
Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents:
7177
diff
changeset
|
24 |
#include "../util/util.h" |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
25 |
#include "../util/refcounter.h" |
7175
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 |
#include <stdio.h> |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
28 |
#include <stdlib.h> |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
29 |
#include <limits.h> |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
30 |
#include <string.h> |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
31 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
32 |
static void flib_metascheme_destroy(flib_metascheme *meta) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
33 |
if(meta) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
34 |
if(meta->settings) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
35 |
for(int i=0; i<meta->settingCount; i++) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
36 |
free(meta->settings[i].name); |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
37 |
free(meta->settings[i].engineCommand); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
38 |
} |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
39 |
free(meta->settings); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
40 |
} |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
41 |
if(meta->mods) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
42 |
for(int i=0; i<meta->modCount; i++) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
43 |
free(meta->mods[i].name); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
44 |
} |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
45 |
free(meta->mods); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
46 |
} |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
47 |
free(meta); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
48 |
} |
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 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
51 |
static void flib_scheme_destroy(flib_scheme* scheme) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
52 |
if(scheme) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
53 |
flib_metascheme_release(scheme->meta); |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
54 |
free(scheme->mods); |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
55 |
free(scheme->settings); |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
56 |
free(scheme->name); |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
57 |
free(scheme); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
58 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
59 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
60 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
61 |
static flib_metascheme *flib_metascheme_from_ini_handleError(flib_metascheme *result, flib_ini *ini) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
62 |
flib_metascheme_destroy(result); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
63 |
flib_ini_destroy(ini); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
64 |
return NULL; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
65 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
66 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
67 |
static int readMetaSettingSections(flib_ini *ini, flib_metascheme *result, int limit) { |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
68 |
while(result->settingCount<limit) { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
69 |
char sectionName[32]; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
70 |
if(snprintf(sectionName, sizeof(sectionName), "setting%i", result->settingCount) <= 0) { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
71 |
return -1; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
72 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
73 |
if(!flib_ini_enter_section(ini, sectionName)) { |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
74 |
flib_metascheme_setting *metasetting = &result->settings[result->settingCount]; |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
75 |
result->settingCount++; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
76 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
77 |
bool error = false; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
78 |
error |= flib_ini_get_str(ini, &metasetting->name, "name"); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
79 |
error |= flib_ini_get_str_opt(ini, &metasetting->engineCommand, "command", NULL); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
80 |
error |= flib_ini_get_bool(ini, &metasetting->times1000, "times1000"); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
81 |
error |= flib_ini_get_bool(ini, &metasetting->maxMeansInfinity, "maxmeansinfinity"); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
82 |
error |= flib_ini_get_int(ini, &metasetting->min, "min"); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
83 |
error |= flib_ini_get_int(ini, &metasetting->max, "max"); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
84 |
error |= flib_ini_get_int(ini, &metasetting->def, "default"); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
85 |
if(error) { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
86 |
flib_log_e("Missing or malformed ini parameter in metaconfig, section %s", sectionName); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
87 |
return -1; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
88 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
89 |
} else { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
90 |
return 0; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
91 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
92 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
93 |
return 0; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
94 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
95 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
96 |
static int readMetaModSections(flib_ini *ini, flib_metascheme *result, int limit) { |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
97 |
while(result->modCount<limit) { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
98 |
char sectionName[32]; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
99 |
if(snprintf(sectionName, sizeof(sectionName), "mod%i", result->modCount) <= 0) { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
100 |
return -1; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
101 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
102 |
if(!flib_ini_enter_section(ini, sectionName)) { |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
103 |
flib_metascheme_mod *metamod = &result->mods[result->modCount]; |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
104 |
result->modCount++; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
105 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
106 |
bool error = false; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
107 |
error |= flib_ini_get_str(ini, &metamod->name, "name"); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
108 |
error |= flib_ini_get_int(ini, &metamod->bitmaskIndex, "bitmaskIndex"); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
109 |
if(error) { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
110 |
flib_log_e("Missing or malformed ini parameter in metaconfig, section %s", sectionName); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
111 |
return -1; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
112 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
113 |
} else { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
114 |
return 0; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
115 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
116 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
117 |
return 0; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
118 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
119 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
120 |
flib_metascheme *flib_metascheme_from_ini(const char *filename) { |
7316
f7b49b2c5d84
frontlib: Improved and unified parameter checking, moved the cmdlineClient out
Medo <smaxein@googlemail.com>
parents:
7314
diff
changeset
|
121 |
if(log_badargs_if(filename==NULL)) { |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
122 |
return NULL; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
123 |
} |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
124 |
flib_metascheme *result = flib_metascheme_retain(flib_calloc(1, sizeof(flib_metascheme))); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
125 |
flib_ini *ini = flib_ini_load(filename); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
126 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
127 |
if(!result || !ini) { |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
128 |
return flib_metascheme_from_ini_handleError(result, ini); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
129 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
130 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
131 |
// We're overallocating here for simplicity |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
132 |
int sectionCount = flib_ini_get_sectioncount(ini); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
133 |
result->settingCount = 0; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
134 |
result->modCount = 0; |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
135 |
result->settings = flib_calloc(sectionCount, sizeof(flib_metascheme_setting)); |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
136 |
result->mods = flib_calloc(sectionCount, sizeof(flib_metascheme_mod)); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
137 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
138 |
if(!result->settings || !result->mods) { |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
139 |
return flib_metascheme_from_ini_handleError(result, ini); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
140 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
141 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
142 |
if(readMetaSettingSections(ini, result, sectionCount) || readMetaModSections(ini, result, sectionCount)) { |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
143 |
return flib_metascheme_from_ini_handleError(result, ini); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
144 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
145 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
146 |
if(result->settingCount+result->modCount != sectionCount) { |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
147 |
flib_log_e("Unknown or non-contiguous sections headers in metaconfig."); |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
148 |
return flib_metascheme_from_ini_handleError(result, ini); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
149 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
150 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
151 |
flib_ini_destroy(ini); |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
152 |
return result; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
153 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
154 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
155 |
flib_metascheme *flib_metascheme_retain(flib_metascheme *metainfo) { |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
156 |
if(metainfo) { |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
157 |
flib_retain(&metainfo->_referenceCount, "flib_metascheme"); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
158 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
159 |
return metainfo; |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
160 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
161 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
162 |
void flib_metascheme_release(flib_metascheme *meta) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
163 |
if(meta && flib_release(&meta->_referenceCount, "flib_metascheme")) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
164 |
flib_metascheme_destroy(meta); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
165 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
166 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
167 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
168 |
flib_scheme *flib_scheme_create(flib_metascheme *meta, const char *schemeName) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
169 |
flib_scheme *result = flib_scheme_retain(flib_calloc(1, sizeof(flib_scheme))); |
7316
f7b49b2c5d84
frontlib: Improved and unified parameter checking, moved the cmdlineClient out
Medo <smaxein@googlemail.com>
parents:
7314
diff
changeset
|
170 |
if(log_badargs_if2(meta==NULL, schemeName==NULL) || result==NULL) { |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
171 |
return NULL; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
172 |
} |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
173 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
174 |
result->meta = flib_metascheme_retain(meta); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
175 |
result->name = flib_strdupnull(schemeName); |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
176 |
result->mods = flib_calloc(meta->modCount, sizeof(*result->mods)); |
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
177 |
result->settings = flib_calloc(meta->settingCount, sizeof(*result->settings)); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
178 |
|
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
179 |
if(!result->mods || !result->settings || !result->name) { |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
180 |
flib_scheme_destroy(result); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
181 |
return NULL; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
182 |
} |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
183 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
184 |
for(int i=0; i<meta->settingCount; i++) { |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
185 |
result->settings[i] = meta->settings[i].def; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
186 |
} |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
187 |
return result; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
188 |
} |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
189 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
190 |
flib_scheme *flib_scheme_copy(const flib_scheme *scheme) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
191 |
flib_scheme *result = NULL; |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
192 |
if(scheme) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
193 |
result = flib_scheme_create(scheme->meta, scheme->name); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
194 |
if(result) { |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
195 |
memcpy(result->mods, scheme->mods, scheme->meta->modCount * sizeof(*scheme->mods)); |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
196 |
memcpy(result->settings, scheme->settings, scheme->meta->settingCount * sizeof(*scheme->settings)); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
197 |
} |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
198 |
} |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
199 |
return result; |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
200 |
} |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
201 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
202 |
flib_scheme *flib_scheme_retain(flib_scheme *scheme) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
203 |
if(scheme) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
204 |
flib_retain(&scheme->_referenceCount, "flib_scheme"); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
205 |
} |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
206 |
return scheme; |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
207 |
} |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
7227
diff
changeset
|
208 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
209 |
void flib_scheme_release(flib_scheme *scheme) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
210 |
if(scheme && flib_release(&scheme->_referenceCount, "flib_scheme")) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
211 |
flib_scheme_destroy(scheme); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
212 |
} |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
213 |
} |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
214 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
215 |
bool flib_scheme_get_mod(flib_scheme *scheme, const char *name) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
216 |
if(!log_badargs_if2(scheme==NULL, name==NULL)) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
217 |
for(int i=0; i<scheme->meta->modCount; i++) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
218 |
if(!strcmp(scheme->meta->mods[i].name, name)) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
219 |
return scheme->mods[i]; |
7316
f7b49b2c5d84
frontlib: Improved and unified parameter checking, moved the cmdlineClient out
Medo <smaxein@googlemail.com>
parents:
7314
diff
changeset
|
220 |
} |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
221 |
} |
7316
f7b49b2c5d84
frontlib: Improved and unified parameter checking, moved the cmdlineClient out
Medo <smaxein@googlemail.com>
parents:
7314
diff
changeset
|
222 |
flib_log_e("Unable to find game mod %s", name); |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
223 |
} |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
224 |
return false; |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
225 |
} |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
226 |
|
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
227 |
int flib_scheme_get_setting(flib_scheme *scheme, const char *name, int def) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
228 |
if(!log_badargs_if2(scheme==NULL, name==NULL)) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
229 |
for(int i=0; i<scheme->meta->settingCount; i++) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
230 |
if(!strcmp(scheme->meta->settings[i].name, name)) { |
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
231 |
return scheme->settings[i]; |
7316
f7b49b2c5d84
frontlib: Improved and unified parameter checking, moved the cmdlineClient out
Medo <smaxein@googlemail.com>
parents:
7314
diff
changeset
|
232 |
} |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
233 |
} |
7316
f7b49b2c5d84
frontlib: Improved and unified parameter checking, moved the cmdlineClient out
Medo <smaxein@googlemail.com>
parents:
7314
diff
changeset
|
234 |
flib_log_e("Unable to find game setting %s", name); |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
235 |
} |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
236 |
return def; |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
237 |
} |