summary refs log tree commit diff
path: root/gnu/packages/patches/lierolibre-newer-libconfig.patch
blob: 662d0f90fa525492ffe01632b26e7fe459d9ce0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
Fix compatibility with newer libconfig.

Patch copied from upstream source repository:

https://gitlab.com/lierolibre/lierolibre/commit/b27e3604aa6bfbfcc50db1000b394d06c87ae2f2

diff --git a/src/common.cpp b/src/common.cpp
index 2d6ada5..4942b05 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -162,7 +162,7 @@ void Texts::loadFromCFG(std::string cfgFilePath)
 	const libconfig::Setting &sgmodes = texts["gameModes"];
 	for(int i = 0; i < 4; ++i)
 	{
-		gameModes[i] = (char const*)sgmodes["gameModes" + to_string(i)];
+		gameModes[i] = (char const*)sgmodes[("gameModes" + to_string(i)).c_str()];
 	}
 
 	const libconfig::Setting &sgmspec = texts["gameModeSpec"];
@@ -181,13 +181,13 @@ void Texts::loadFromCFG(std::string cfgFilePath)
 	const libconfig::Setting &swstates = texts["weapStates"];
 	for(int i = 0; i < 3; ++i)
 	{
-		 weapStates[i] = (char const*)swstates["weapStates" + to_string(i)];
+		 weapStates[i] = (char const*)swstates[("weapStates" + to_string(i)).c_str()];
 	}
 
 	const libconfig::Setting &sknames = texts["keyNames"];
 	for(int i = 1; i < 177; ++i) // First key starts at 1
 	{
-		keyNames[i] = (char const*)sknames["keyNames" + to_string(i)];
+		keyNames[i] = (char const*)sknames[("keyNames" + to_string(i)).c_str()];
 	}
 
 	selWeap = (char const*)texts["selWeap"];
@@ -315,8 +315,8 @@ void Common::loadPaletteFromCFG(std::string cfgFilePath)
 	const libconfig::Setting &scanim = palette["colorAnim"];
 	for(int i = 0; i < 4; ++i)
 	{
-		colorAnim[i].from = (int)scanim["colorAnim" + to_string(i) + "from"];
-		colorAnim[i].to = (int)scanim["colorAnim" + to_string(i) + "to"];
+		colorAnim[i].from = (int)scanim[("colorAnim" + to_string(i) + "from").c_str()];
+		colorAnim[i].to = (int)scanim[("colorAnim" + to_string(i) + "to").c_str()];
 	}
 }
 
@@ -383,7 +383,7 @@ void Common::loadMaterialsFromCFG(std::string cfgFilePath)
 
 	for(int i = 0; i < 256; ++i)
 	{
-		const libconfig::Setting &smflags = smaterials["flags" + to_string(i)];
+		const libconfig::Setting &smflags = smaterials[("flags" + to_string(i)).c_str()];
 		materials[i].flags = smflags;
 	}
 }
diff --git a/src/configCompat.cpp b/src/configCompat.cpp
index 1aeb262..a72c40f 100644
--- a/src/configCompat.cpp
+++ b/src/configCompat.cpp
@@ -160,19 +160,19 @@ void Common::loadConstantsFromCFGVer0(string cfgFilePath)
 	const Setting &vconstants = constants["Values"];
 	for(int i = 0; i < MaxC; ++i)
 	{
-		C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i]];
+		C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i].c_str()];
 	}
 
 	const Setting &sconstants = constants["Strings"];
 	for(int i = 0; i < MaxS; ++i)
 	{
-		S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i]];
+		S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i].c_str()];
 	}
 
 	const Setting &hconstants = constants["Hacks"];
 	for(int i = 0; i < MaxH; ++i)
 	{
-		H[i] = (bool)hconstants[hackConstantsNamesVer0[i]];
+		H[i] = (bool)hconstants[hackConstantsNamesVer0[i].c_str()];
 	}
 }
 
diff --git a/src/configHelper.cpp b/src/configHelper.cpp
index fcd1f3f..a63bddc 100644
--- a/src/configHelper.cpp
+++ b/src/configHelper.cpp
@@ -54,15 +54,11 @@ template Uint8 ConfigHelper::getValue<Uint8, const Setting, int>(const Setting &
 
 template Uint8 ConfigHelper::getValue<Uint8, const Setting, char const*>(const Setting &node, char const* index);
 
-template Uint8 ConfigHelper::getValue<Uint8, const Setting, string>(const Setting &node, string index);
-
 // Non-const
 template Uint8 ConfigHelper::getValue<Uint8, Setting, int>(Setting &node, int index);
 
 template Uint8 ConfigHelper::getValue<Uint8, Setting, char const*>(Setting &node, char const* index);
 
-template Uint8 ConfigHelper::getValue<Uint8, Setting, string>(Setting &node, string index);
-
 
 // Since we still need specialisation per value type (Setting::Type),
 // no need to templateify these
@@ -72,7 +68,7 @@ void ConfigHelper::put(Setting &node, string variable, string value)
 	{
 		node.add(variable, Setting::TypeString) = value;
 	} else {
-		Setting &var = node[variable];
+		Setting &var = node[variable.c_str()];
 		var = value;
 	}
 }
@@ -83,7 +79,7 @@ void ConfigHelper::put(Setting &node, string variable, int value)
 	{
 		node.add(variable, Setting::TypeInt) = value;
 	} else {
-		Setting &var = node[variable];
+		Setting &var = node[variable.c_str()];
 		var = value;
 	}
 }
@@ -94,7 +90,7 @@ void ConfigHelper::put(Setting &node, string variable, Uint8 value)
 	{
 		node.add(variable, Setting::TypeInt) = value;
 	} else {
-		Setting &var = node[variable];
+		Setting &var = node[variable.c_str()];
 		var = value;
 	}
 }
@@ -105,7 +101,7 @@ void ConfigHelper::put(Setting &node, string variable, bool value)
 	{
 		node.add(variable, Setting::TypeBoolean) = value;
 	} else {
-		Setting &var = node[variable];
+		Setting &var = node[variable.c_str()];
 		var = value;
 	}
 }
@@ -135,6 +131,6 @@ Setting& ConfigHelper::getSubgroup(Setting &node, string groupName)
 	{
 		node.add(groupName, Setting::TypeGroup);
 	}
-	return node[groupName];
+	return node[groupName.c_str()];
 }
 
diff --git a/src/constants.cpp b/src/constants.cpp
index 7fced6a..cf7bbfc 100644
--- a/src/constants.cpp
+++ b/src/constants.cpp
@@ -523,19 +523,19 @@ void Common::loadConstantsFromCFG(std::string cfgFilePath)
 	const libconfig::Setting &vconstants = constants["Values"];
 	for(int i = 0; i < MaxC; ++i)
 	{
-		C[i] = (int)vconstants[valueConstantsNames[i]];
+		C[i] = (int)vconstants[valueConstantsNames[i].c_str()];
 	}
 
 	const libconfig::Setting &sconstants = constants["Strings"];
 	for(int i = 0; i < MaxS; ++i)
 	{
-		S[i]= (char const*)sconstants[stringConstantsNames[i]];
+		S[i]= (char const*)sconstants[stringConstantsNames[i].c_str()];
 	}
 
 	const libconfig::Setting &hconstants = constants["Hacks"];
 	for(int i = 0; i < MaxH; ++i)
 	{
-		H[i] = (bool)hconstants[hackConstantsNames[i]];
+		H[i] = (bool)hconstants[hackConstantsNames[i].c_str()];
 	}
 }
 
diff --git a/src/gfx/palette.cpp b/src/gfx/palette.cpp
index 3fd08c4..3d3bf22 100644
--- a/src/gfx/palette.cpp
+++ b/src/gfx/palette.cpp
@@ -124,9 +124,9 @@ void Palette::readFromCFG(std::string cfgFilePath)
 
 	for(int i = 0; i < 256; ++i)
 	{
-		entries[i].r = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "r");
-		entries[i].g = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "g");
-		entries[i].b = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "b");
+		entries[i].r = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "r").c_str());
+		entries[i].g = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "g").c_str());
+		entries[i].b = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "b").c_str());
 	}
 }