gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / lierolibre-newer-libconfig.patch
CommitLineData
ffed9eab
MB
1Fix compatibility with newer libconfig.
2
3Patch copied from upstream source repository:
4
5https://gitlab.com/lierolibre/lierolibre/commit/b27e3604aa6bfbfcc50db1000b394d06c87ae2f2
6
7diff --git a/src/common.cpp b/src/common.cpp
8index 2d6ada5..4942b05 100644
9--- a/src/common.cpp
10+++ b/src/common.cpp
11@@ -162,7 +162,7 @@ void Texts::loadFromCFG(std::string cfgFilePath)
12 const libconfig::Setting &sgmodes = texts["gameModes"];
13 for(int i = 0; i < 4; ++i)
14 {
15- gameModes[i] = (char const*)sgmodes["gameModes" + to_string(i)];
16+ gameModes[i] = (char const*)sgmodes[("gameModes" + to_string(i)).c_str()];
17 }
18
19 const libconfig::Setting &sgmspec = texts["gameModeSpec"];
20@@ -181,13 +181,13 @@ void Texts::loadFromCFG(std::string cfgFilePath)
21 const libconfig::Setting &swstates = texts["weapStates"];
22 for(int i = 0; i < 3; ++i)
23 {
24- weapStates[i] = (char const*)swstates["weapStates" + to_string(i)];
25+ weapStates[i] = (char const*)swstates[("weapStates" + to_string(i)).c_str()];
26 }
27
28 const libconfig::Setting &sknames = texts["keyNames"];
29 for(int i = 1; i < 177; ++i) // First key starts at 1
30 {
31- keyNames[i] = (char const*)sknames["keyNames" + to_string(i)];
32+ keyNames[i] = (char const*)sknames[("keyNames" + to_string(i)).c_str()];
33 }
34
35 selWeap = (char const*)texts["selWeap"];
36@@ -315,8 +315,8 @@ void Common::loadPaletteFromCFG(std::string cfgFilePath)
37 const libconfig::Setting &scanim = palette["colorAnim"];
38 for(int i = 0; i < 4; ++i)
39 {
40- colorAnim[i].from = (int)scanim["colorAnim" + to_string(i) + "from"];
41- colorAnim[i].to = (int)scanim["colorAnim" + to_string(i) + "to"];
42+ colorAnim[i].from = (int)scanim[("colorAnim" + to_string(i) + "from").c_str()];
43+ colorAnim[i].to = (int)scanim[("colorAnim" + to_string(i) + "to").c_str()];
44 }
45 }
46
47@@ -383,7 +383,7 @@ void Common::loadMaterialsFromCFG(std::string cfgFilePath)
48
49 for(int i = 0; i < 256; ++i)
50 {
51- const libconfig::Setting &smflags = smaterials["flags" + to_string(i)];
52+ const libconfig::Setting &smflags = smaterials[("flags" + to_string(i)).c_str()];
53 materials[i].flags = smflags;
54 }
55 }
56diff --git a/src/configCompat.cpp b/src/configCompat.cpp
57index 1aeb262..a72c40f 100644
58--- a/src/configCompat.cpp
59+++ b/src/configCompat.cpp
60@@ -160,19 +160,19 @@ void Common::loadConstantsFromCFGVer0(string cfgFilePath)
61 const Setting &vconstants = constants["Values"];
62 for(int i = 0; i < MaxC; ++i)
63 {
64- C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i]];
65+ C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i].c_str()];
66 }
67
68 const Setting &sconstants = constants["Strings"];
69 for(int i = 0; i < MaxS; ++i)
70 {
71- S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i]];
72+ S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i].c_str()];
73 }
74
75 const Setting &hconstants = constants["Hacks"];
76 for(int i = 0; i < MaxH; ++i)
77 {
78- H[i] = (bool)hconstants[hackConstantsNamesVer0[i]];
79+ H[i] = (bool)hconstants[hackConstantsNamesVer0[i].c_str()];
80 }
81 }
82
83diff --git a/src/configHelper.cpp b/src/configHelper.cpp
84index fcd1f3f..a63bddc 100644
85--- a/src/configHelper.cpp
86+++ b/src/configHelper.cpp
87@@ -54,15 +54,11 @@ template Uint8 ConfigHelper::getValue<Uint8, const Setting, int>(const Setting &
88
89 template Uint8 ConfigHelper::getValue<Uint8, const Setting, char const*>(const Setting &node, char const* index);
90
91-template Uint8 ConfigHelper::getValue<Uint8, const Setting, string>(const Setting &node, string index);
92-
93 // Non-const
94 template Uint8 ConfigHelper::getValue<Uint8, Setting, int>(Setting &node, int index);
95
96 template Uint8 ConfigHelper::getValue<Uint8, Setting, char const*>(Setting &node, char const* index);
97
98-template Uint8 ConfigHelper::getValue<Uint8, Setting, string>(Setting &node, string index);
99-
100
101 // Since we still need specialisation per value type (Setting::Type),
102 // no need to templateify these
103@@ -72,7 +68,7 @@ void ConfigHelper::put(Setting &node, string variable, string value)
104 {
105 node.add(variable, Setting::TypeString) = value;
106 } else {
107- Setting &var = node[variable];
108+ Setting &var = node[variable.c_str()];
109 var = value;
110 }
111 }
112@@ -83,7 +79,7 @@ void ConfigHelper::put(Setting &node, string variable, int value)
113 {
114 node.add(variable, Setting::TypeInt) = value;
115 } else {
116- Setting &var = node[variable];
117+ Setting &var = node[variable.c_str()];
118 var = value;
119 }
120 }
121@@ -94,7 +90,7 @@ void ConfigHelper::put(Setting &node, string variable, Uint8 value)
122 {
123 node.add(variable, Setting::TypeInt) = value;
124 } else {
125- Setting &var = node[variable];
126+ Setting &var = node[variable.c_str()];
127 var = value;
128 }
129 }
130@@ -105,7 +101,7 @@ void ConfigHelper::put(Setting &node, string variable, bool value)
131 {
132 node.add(variable, Setting::TypeBoolean) = value;
133 } else {
134- Setting &var = node[variable];
135+ Setting &var = node[variable.c_str()];
136 var = value;
137 }
138 }
139@@ -135,6 +131,6 @@ Setting& ConfigHelper::getSubgroup(Setting &node, string groupName)
140 {
141 node.add(groupName, Setting::TypeGroup);
142 }
143- return node[groupName];
144+ return node[groupName.c_str()];
145 }
146
147diff --git a/src/constants.cpp b/src/constants.cpp
148index 7fced6a..cf7bbfc 100644
149--- a/src/constants.cpp
150+++ b/src/constants.cpp
151@@ -523,19 +523,19 @@ void Common::loadConstantsFromCFG(std::string cfgFilePath)
152 const libconfig::Setting &vconstants = constants["Values"];
153 for(int i = 0; i < MaxC; ++i)
154 {
155- C[i] = (int)vconstants[valueConstantsNames[i]];
156+ C[i] = (int)vconstants[valueConstantsNames[i].c_str()];
157 }
158
159 const libconfig::Setting &sconstants = constants["Strings"];
160 for(int i = 0; i < MaxS; ++i)
161 {
162- S[i]= (char const*)sconstants[stringConstantsNames[i]];
163+ S[i]= (char const*)sconstants[stringConstantsNames[i].c_str()];
164 }
165
166 const libconfig::Setting &hconstants = constants["Hacks"];
167 for(int i = 0; i < MaxH; ++i)
168 {
169- H[i] = (bool)hconstants[hackConstantsNames[i]];
170+ H[i] = (bool)hconstants[hackConstantsNames[i].c_str()];
171 }
172 }
173
174diff --git a/src/gfx/palette.cpp b/src/gfx/palette.cpp
175index 3fd08c4..3d3bf22 100644
176--- a/src/gfx/palette.cpp
177+++ b/src/gfx/palette.cpp
178@@ -124,9 +124,9 @@ void Palette::readFromCFG(std::string cfgFilePath)
179
180 for(int i = 0; i < 256; ++i)
181 {
182- entries[i].r = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "r");
183- entries[i].g = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "g");
184- entries[i].b = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "b");
185+ entries[i].r = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "r").c_str());
186+ entries[i].g = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "g").c_str());
187+ entries[i].b = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "b").c_str());
188 }
189 }
190