diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game_data.cpp | 181 |
1 files changed, 99 insertions, 82 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index 5204262..8f237b0 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
@@ -98,16 +98,14 @@ struct GameData { | |||
98 | 98 | ||
99 | for (const auto &room_it : lingo_config) { | 99 | for (const auto &room_it : lingo_config) { |
100 | int room_id = AddOrGetRoom(room_it.first.as<std::string>()); | 100 | int room_id = AddOrGetRoom(room_it.first.as<std::string>()); |
101 | Room &room_obj = rooms_[room_id]; | ||
102 | 101 | ||
103 | for (const auto &entrance_it : room_it.second["entrances"]) { | 102 | for (const auto &entrance_it : room_it.second["entrances"]) { |
104 | int from_room_id = AddOrGetRoom(entrance_it.first.as<std::string>()); | 103 | int from_room_id = AddOrGetRoom(entrance_it.first.as<std::string>()); |
105 | Room &from_room_obj = rooms_[from_room_id]; | ||
106 | 104 | ||
107 | switch (entrance_it.second.Type()) { | 105 | switch (entrance_it.second.Type()) { |
108 | case YAML::NodeType::Scalar: { | 106 | case YAML::NodeType::Scalar: { |
109 | // This is just "true". | 107 | // This is just "true". |
110 | from_room_obj.exits.push_back({.destination_room = room_id}); | 108 | rooms_[from_room_id].exits.push_back({.destination_room = room_id}); |
111 | break; | 109 | break; |
112 | } | 110 | } |
113 | case YAML::NodeType::Map: { | 111 | case YAML::NodeType::Map: { |
@@ -115,7 +113,7 @@ struct GameData { | |||
115 | exit_obj.destination_room = room_id; | 113 | exit_obj.destination_room = room_id; |
116 | 114 | ||
117 | if (entrance_it.second["door"]) { | 115 | if (entrance_it.second["door"]) { |
118 | std::string door_room = room_obj.name; | 116 | std::string door_room = rooms_[room_id].name; |
119 | if (entrance_it.second["room"]) { | 117 | if (entrance_it.second["room"]) { |
120 | door_room = entrance_it.second["room"].as<std::string>(); | 118 | door_room = entrance_it.second["room"].as<std::string>(); |
121 | } | 119 | } |
@@ -127,7 +125,7 @@ struct GameData { | |||
127 | exit_obj.painting = entrance_it.second["painting"].as<bool>(); | 125 | exit_obj.painting = entrance_it.second["painting"].as<bool>(); |
128 | } | 126 | } |
129 | 127 | ||
130 | from_room_obj.exits.push_back(exit_obj); | 128 | rooms_[from_room_id].exits.push_back(exit_obj); |
131 | break; | 129 | break; |
132 | } | 130 | } |
133 | case YAML::NodeType::Sequence: { | 131 | case YAML::NodeType::Sequence: { |
@@ -135,7 +133,7 @@ struct GameData { | |||
135 | Exit exit_obj; | 133 | Exit exit_obj; |
136 | exit_obj.destination_room = room_id; | 134 | exit_obj.destination_room = room_id; |
137 | 135 | ||
138 | std::string door_room = room_obj.name; | 136 | std::string door_room = rooms_[room_id].name; |
139 | if (option["room"]) { | 137 | if (option["room"]) { |
140 | door_room = option["room"].as<std::string>(); | 138 | door_room = option["room"].as<std::string>(); |
141 | } | 139 | } |
@@ -146,7 +144,7 @@ struct GameData { | |||
146 | exit_obj.painting = option["painting"].as<bool>(); | 144 | exit_obj.painting = option["painting"].as<bool>(); |
147 | } | 145 | } |
148 | 146 | ||
149 | from_room_obj.exits.push_back(exit_obj); | 147 | rooms_[from_room_id].exits.push_back(exit_obj); |
150 | } | 148 | } |
151 | 149 | ||
152 | break; | 150 | break; |
@@ -162,18 +160,17 @@ struct GameData { | |||
162 | 160 | ||
163 | if (room_it.second["panels"]) { | 161 | if (room_it.second["panels"]) { |
164 | for (const auto &panel_it : room_it.second["panels"]) { | 162 | for (const auto &panel_it : room_it.second["panels"]) { |
165 | int panel_id = | 163 | int panel_id = AddOrGetPanel(rooms_[room_id].name, |
166 | AddOrGetPanel(room_obj.name, panel_it.first.as<std::string>()); | 164 | panel_it.first.as<std::string>()); |
167 | Panel &panel_obj = panels_[panel_id]; | 165 | rooms_[room_id].panels.push_back(panel_id); |
168 | room_obj.panels.push_back(panel_id); | ||
169 | 166 | ||
170 | if (panel_it.second["colors"]) { | 167 | if (panel_it.second["colors"]) { |
171 | if (panel_it.second["colors"].IsScalar()) { | 168 | if (panel_it.second["colors"].IsScalar()) { |
172 | panel_obj.colors.push_back(GetColorForString( | 169 | panels_[panel_id].colors.push_back(GetColorForString( |
173 | panel_it.second["colors"].as<std::string>())); | 170 | panel_it.second["colors"].as<std::string>())); |
174 | } else { | 171 | } else { |
175 | for (const auto &color_node : panel_it.second["colors"]) { | 172 | for (const auto &color_node : panel_it.second["colors"]) { |
176 | panel_obj.colors.push_back( | 173 | panels_[panel_id].colors.push_back( |
177 | GetColorForString(color_node.as<std::string>())); | 174 | GetColorForString(color_node.as<std::string>())); |
178 | } | 175 | } |
179 | } | 176 | } |
@@ -181,11 +178,11 @@ struct GameData { | |||
181 | 178 | ||
182 | if (panel_it.second["required_room"]) { | 179 | if (panel_it.second["required_room"]) { |
183 | if (panel_it.second["required_room"].IsScalar()) { | 180 | if (panel_it.second["required_room"].IsScalar()) { |
184 | panel_obj.required_rooms.push_back(AddOrGetRoom( | 181 | panels_[panel_id].required_rooms.push_back(AddOrGetRoom( |
185 | panel_it.second["required_room"].as<std::string>())); | 182 | panel_it.second["required_room"].as<std::string>())); |
186 | } else { | 183 | } else { |
187 | for (const auto &rr_node : panel_it.second["required_room"]) { | 184 | for (const auto &rr_node : panel_it.second["required_room"]) { |
188 | panel_obj.required_rooms.push_back( | 185 | panels_[panel_id].required_rooms.push_back( |
189 | AddOrGetRoom(rr_node.as<std::string>())); | 186 | AddOrGetRoom(rr_node.as<std::string>())); |
190 | } | 187 | } |
191 | } | 188 | } |
@@ -193,23 +190,22 @@ struct GameData { | |||
193 | 190 | ||
194 | if (panel_it.second["required_door"]) { | 191 | if (panel_it.second["required_door"]) { |
195 | if (panel_it.second["required_door"].IsMap()) { | 192 | if (panel_it.second["required_door"].IsMap()) { |
196 | std::string rd_room = room_obj.name; | 193 | std::string rd_room = rooms_[room_id].name; |
197 | if (panel_it.second["required_door"]["room"]) { | 194 | if (panel_it.second["required_door"]["room"]) { |
198 | rd_room = | 195 | rd_room = |
199 | panel_it.second["required_door"]["room"].as<std::string>(); | 196 | panel_it.second["required_door"]["room"].as<std::string>(); |
200 | } | 197 | } |
201 | 198 | ||
202 | panel_obj.required_doors.push_back(AddOrGetDoor( | 199 | panels_[panel_id].required_doors.push_back(AddOrGetDoor( |
203 | rd_room, | 200 | rd_room, |
204 | panel_it.second["required_door"]["door"].as<std::string>())); | 201 | panel_it.second["required_door"]["door"].as<std::string>())); |
205 | } else { | 202 | } else { |
206 | for (const auto &rr_node : panel_it.second["required_door"]) { | 203 | for (const auto &rr_node : panel_it.second["required_door"]) { |
207 | std::string rd_room = room_obj.name; | 204 | std::string rd_room = rooms_[room_id].name; |
208 | if (rr_node["room"]) { | 205 | if (rr_node["room"]) { |
209 | rd_room = rr_node["room"].as<std::string>(); | 206 | rd_room = rr_node["room"].as<std::string>(); |
210 | } | 207 | }; |
211 | 208 | panels_[panel_id].required_doors.push_back( | |
212 | panel_obj.required_doors.push_back( | ||
213 | AddOrGetDoor(rd_room, rr_node["door"].as<std::string>())); | 209 | AddOrGetDoor(rd_room, rr_node["door"].as<std::string>())); |
214 | } | 210 | } |
215 | } | 211 | } |
@@ -217,61 +213,68 @@ struct GameData { | |||
217 | 213 | ||
218 | if (panel_it.second["required_panel"]) { | 214 | if (panel_it.second["required_panel"]) { |
219 | if (panel_it.second["required_panel"].IsMap()) { | 215 | if (panel_it.second["required_panel"].IsMap()) { |
220 | std::string rp_room = room_obj.name; | 216 | std::string rp_room = rooms_[room_id].name; |
221 | if (panel_it.second["required_panel"]["room"]) { | 217 | if (panel_it.second["required_panel"]["room"]) { |
222 | rp_room = | 218 | rp_room = |
223 | panel_it.second["required_panel"]["room"].as<std::string>(); | 219 | panel_it.second["required_panel"]["room"].as<std::string>(); |
224 | } | 220 | } |
225 | 221 | ||
226 | panel_obj.required_panels.push_back(AddOrGetPanel( | 222 | int rp_id = AddOrGetPanel( |
227 | rp_room, panel_it.second["required_panel"]["panel"] | 223 | rp_room, |
228 | .as<std::string>())); | 224 | panel_it.second["required_panel"]["panel"].as<std::string>()); |
225 | panels_[panel_id].required_panels.push_back(rp_id); | ||
229 | } else { | 226 | } else { |
230 | for (const auto &rp_node : panel_it.second["required_panel"]) { | 227 | for (const auto &rp_node : panel_it.second["required_panel"]) { |
231 | std::string rp_room = room_obj.name; | 228 | std::string rp_room = rooms_[room_id].name; |
232 | if (rp_node["room"]) { | 229 | if (rp_node["room"]) { |
233 | rp_room = rp_node["room"].as<std::string>(); | 230 | rp_room = rp_node["room"].as<std::string>(); |
234 | } | 231 | } |
235 | 232 | ||
236 | panel_obj.required_panels.push_back( | 233 | int rp_id = |
237 | AddOrGetPanel(rp_room, rp_node["panel"].as<std::string>())); | 234 | AddOrGetPanel(rp_room, rp_node["panel"].as<std::string>()); |
235 | panels_[panel_id].required_panels.push_back(rp_id); | ||
238 | } | 236 | } |
239 | } | 237 | } |
240 | } | 238 | } |
241 | 239 | ||
242 | if (panel_it.second["check"]) { | 240 | if (panel_it.second["check"]) { |
243 | panel_obj.check = panel_it.second["check"].as<bool>(); | 241 | panels_[panel_id].check = panel_it.second["check"].as<bool>(); |
244 | } | 242 | } |
245 | 243 | ||
246 | if (panel_it.second["achievement"]) { | 244 | if (panel_it.second["achievement"]) { |
247 | panel_obj.achievement = true; | 245 | panels_[panel_id].achievement = true; |
248 | panel_obj.achievement_name = | 246 | panels_[panel_id].achievement_name = |
249 | panel_it.second["achievement"].as<std::string>(); | 247 | panel_it.second["achievement"].as<std::string>(); |
250 | 248 | ||
251 | achievement_panels_.push_back(panel_id); | 249 | achievement_panels_.push_back(panel_id); |
252 | } | 250 | } |
253 | 251 | ||
254 | if (panel_it.second["hunt"]) { | 252 | if (panel_it.second["hunt"]) { |
255 | panel_obj.hunt = panel_it.second["hunt"].as<bool>(); | 253 | panels_[panel_id].hunt = panel_it.second["hunt"].as<bool>(); |
256 | } | 254 | } |
257 | 255 | ||
258 | if (panel_it.second["exclude_reduce"]) { | 256 | if (panel_it.second["exclude_reduce"]) { |
259 | panel_obj.exclude_reduce = | 257 | panels_[panel_id].exclude_reduce = |
260 | panel_it.second["exclude_reduce"].as<bool>(); | 258 | panel_it.second["exclude_reduce"].as<bool>(); |
261 | } | 259 | } |
262 | 260 | ||
263 | if (panel_it.second["non_counting"]) { | 261 | if (panel_it.second["non_counting"]) { |
264 | panel_obj.non_counting = panel_it.second["non_counting"].as<bool>(); | 262 | panels_[panel_id].non_counting = |
263 | panel_it.second["non_counting"].as<bool>(); | ||
265 | } | 264 | } |
266 | 265 | ||
267 | if (ids_config["panels"] && ids_config["panels"][room_obj.name] && | 266 | if (ids_config["panels"] && |
268 | ids_config["panels"][room_obj.name][panel_obj.name]) { | 267 | ids_config["panels"][rooms_[room_id].name] && |
269 | panel_obj.ap_location_id = | 268 | ids_config["panels"][rooms_[room_id].name] |
270 | ids_config["panels"][room_obj.name][panel_obj.name].as<int>(); | 269 | [panels_[panel_id].name]) { |
270 | panels_[panel_id].ap_location_id = | ||
271 | ids_config["panels"][rooms_[room_id].name] | ||
272 | [panels_[panel_id].name] | ||
273 | .as<int>(); | ||
271 | } else { | 274 | } else { |
272 | std::ostringstream errmsg; | 275 | std::ostringstream errmsg; |
273 | errmsg << "Missing AP location ID for panel " << room_obj.name | 276 | errmsg << "Missing AP location ID for panel " |
274 | << " - " << panel_obj.name; | 277 | << rooms_[room_id].name << " - " << panels_[panel_id].name; |
275 | TrackerLog(errmsg.str()); | 278 | TrackerLog(errmsg.str()); |
276 | } | 279 | } |
277 | } | 280 | } |
@@ -279,10 +282,9 @@ struct GameData { | |||
279 | 282 | ||
280 | if (room_it.second["doors"]) { | 283 | if (room_it.second["doors"]) { |
281 | for (const auto &door_it : room_it.second["doors"]) { | 284 | for (const auto &door_it : room_it.second["doors"]) { |
282 | int door_id = | 285 | int door_id = AddOrGetDoor(rooms_[room_id].name, |
283 | AddOrGetDoor(room_obj.name, door_it.first.as<std::string>()); | 286 | door_it.first.as<std::string>()); |
284 | door_definition_order_.push_back(door_id); | 287 | door_definition_order_.push_back(door_id); |
285 | Door &door_obj = doors_[door_id]; | ||
286 | 288 | ||
287 | bool has_external_panels = false; | 289 | bool has_external_panels = false; |
288 | std::vector<std::string> panel_names; | 290 | std::vector<std::string> panel_names; |
@@ -290,103 +292,117 @@ struct GameData { | |||
290 | for (const auto &panel_node : door_it.second["panels"]) { | 292 | for (const auto &panel_node : door_it.second["panels"]) { |
291 | if (panel_node.IsScalar()) { | 293 | if (panel_node.IsScalar()) { |
292 | panel_names.push_back(panel_node.as<std::string>()); | 294 | panel_names.push_back(panel_node.as<std::string>()); |
293 | door_obj.panels.push_back( | 295 | doors_[door_id].panels.push_back(AddOrGetPanel( |
294 | AddOrGetPanel(room_obj.name, panel_node.as<std::string>())); | 296 | rooms_[room_id].name, panel_node.as<std::string>())); |
295 | } else { | 297 | } else { |
296 | has_external_panels = true; | 298 | has_external_panels = true; |
297 | panel_names.push_back(panel_node["panel"].as<std::string>()); | 299 | panel_names.push_back(panel_node["panel"].as<std::string>()); |
298 | door_obj.panels.push_back( | 300 | doors_[door_id].panels.push_back( |
299 | AddOrGetPanel(panel_node["room"].as<std::string>(), | 301 | AddOrGetPanel(panel_node["room"].as<std::string>(), |
300 | panel_node["panel"].as<std::string>())); | 302 | panel_node["panel"].as<std::string>())); |
301 | } | 303 | } |
302 | } | 304 | } |
303 | 305 | ||
304 | if (door_it.second["skip_location"]) { | 306 | if (door_it.second["skip_location"]) { |
305 | door_obj.skip_location = door_it.second["skip_location"].as<bool>(); | 307 | doors_[door_id].skip_location = |
308 | door_it.second["skip_location"].as<bool>(); | ||
306 | } | 309 | } |
307 | 310 | ||
308 | if (door_it.second["skip_item"]) { | 311 | if (door_it.second["skip_item"]) { |
309 | door_obj.skip_item = door_it.second["skip_item"].as<bool>(); | 312 | doors_[door_id].skip_item = door_it.second["skip_item"].as<bool>(); |
310 | } | 313 | } |
311 | 314 | ||
312 | if (door_it.second["event"]) { | 315 | if (door_it.second["event"]) { |
313 | door_obj.skip_location = door_it.second["event"].as<bool>(); | 316 | doors_[door_id].skip_location = door_it.second["event"].as<bool>(); |
314 | door_obj.skip_item = door_it.second["event"].as<bool>(); | 317 | doors_[door_id].skip_item = door_it.second["event"].as<bool>(); |
315 | door_obj.is_event = door_it.second["event"].as<bool>(); | 318 | doors_[door_id].is_event = door_it.second["event"].as<bool>(); |
316 | } | 319 | } |
317 | 320 | ||
318 | if (door_it.second["item_name"]) { | 321 | if (door_it.second["item_name"]) { |
319 | door_obj.item_name = door_it.second["item_name"].as<std::string>(); | 322 | doors_[door_id].item_name = |
323 | door_it.second["item_name"].as<std::string>(); | ||
320 | } else if (!door_it.second["skip_item"] && !door_it.second["event"]) { | 324 | } else if (!door_it.second["skip_item"] && !door_it.second["event"]) { |
321 | door_obj.item_name = room_obj.name + " - " + door_obj.name; | 325 | doors_[door_id].item_name = |
326 | rooms_[room_id].name + " - " + doors_[door_id].name; | ||
322 | } | 327 | } |
323 | 328 | ||
324 | if (!door_it.second["skip_item"] && !door_it.second["event"]) { | 329 | if (!door_it.second["skip_item"] && !door_it.second["event"]) { |
325 | if (ids_config["doors"] && ids_config["doors"][room_obj.name] && | 330 | if (ids_config["doors"] && |
326 | ids_config["doors"][room_obj.name][door_obj.name] && | 331 | ids_config["doors"][rooms_[room_id].name] && |
327 | ids_config["doors"][room_obj.name][door_obj.name]["item"]) { | 332 | ids_config["doors"][rooms_[room_id].name] |
328 | door_obj.ap_item_id = | 333 | [doors_[door_id].name] && |
329 | ids_config["doors"][room_obj.name][door_obj.name]["item"] | 334 | ids_config["doors"][rooms_[room_id].name][doors_[door_id].name] |
330 | .as<int>(); | 335 | ["item"]) { |
336 | doors_[door_id].ap_item_id = | ||
337 | ids_config["doors"][rooms_[room_id].name] | ||
338 | [doors_[door_id].name]["item"] | ||
339 | .as<int>(); | ||
331 | } else { | 340 | } else { |
332 | std::ostringstream errmsg; | 341 | std::ostringstream errmsg; |
333 | errmsg << "Missing AP item ID for door " << room_obj.name << " - " | 342 | errmsg << "Missing AP item ID for door " << rooms_[room_id].name |
334 | << door_obj.name; | 343 | << " - " << doors_[door_id].name; |
335 | TrackerLog(errmsg.str()); | 344 | TrackerLog(errmsg.str()); |
336 | } | 345 | } |
337 | } | 346 | } |
338 | 347 | ||
339 | if (door_it.second["group"]) { | 348 | if (door_it.second["group"]) { |
340 | door_obj.group_name = door_it.second["group"].as<std::string>(); | 349 | doors_[door_id].group_name = |
350 | door_it.second["group"].as<std::string>(); | ||
341 | 351 | ||
342 | if (ids_config["door_groups"] && | 352 | if (ids_config["door_groups"] && |
343 | ids_config["door_groups"][door_obj.group_name]) { | 353 | ids_config["door_groups"][doors_[door_id].group_name]) { |
344 | door_obj.group_ap_item_id = | 354 | doors_[door_id].group_ap_item_id = |
345 | ids_config["door_groups"][door_obj.group_name].as<int>(); | 355 | ids_config["door_groups"][doors_[door_id].group_name] |
356 | .as<int>(); | ||
346 | } else { | 357 | } else { |
347 | std::ostringstream errmsg; | 358 | std::ostringstream errmsg; |
348 | errmsg << "Missing AP item ID for door group " | 359 | errmsg << "Missing AP item ID for door group " |
349 | << door_obj.group_name; | 360 | << doors_[door_id].group_name; |
350 | TrackerLog(errmsg.str()); | 361 | TrackerLog(errmsg.str()); |
351 | } | 362 | } |
352 | } | 363 | } |
353 | 364 | ||
354 | if (door_it.second["location_name"]) { | 365 | if (door_it.second["location_name"]) { |
355 | door_obj.location_name = | 366 | doors_[door_id].location_name = |
356 | door_it.second["location_name"].as<std::string>(); | 367 | door_it.second["location_name"].as<std::string>(); |
357 | } else if (!door_it.second["skip_location"] && | 368 | } else if (!door_it.second["skip_location"] && |
358 | !door_it.second["event"]) { | 369 | !door_it.second["event"]) { |
359 | if (has_external_panels) { | 370 | if (has_external_panels) { |
360 | std::ostringstream errmsg; | 371 | std::ostringstream errmsg; |
361 | errmsg | 372 | errmsg |
362 | << room_obj.name << " - " << door_obj.name | 373 | << rooms_[room_id].name << " - " << doors_[door_id].name |
363 | << " has panels from other rooms but does not have an " | 374 | << " has panels from other rooms but does not have an " |
364 | "explicit " | 375 | "explicit " |
365 | "location name and is not marked skip_location or event"; | 376 | "location name and is not marked skip_location or event"; |
366 | TrackerLog(errmsg.str()); | 377 | TrackerLog(errmsg.str()); |
367 | } | 378 | } |
368 | 379 | ||
369 | door_obj.location_name = | 380 | doors_[door_id].location_name = |
370 | room_obj.name + " - " + hatkirby::implode(panel_names, ", "); | 381 | rooms_[room_id].name + " - " + |
382 | hatkirby::implode(panel_names, ", "); | ||
371 | } | 383 | } |
372 | 384 | ||
373 | if (!door_it.second["skip_location"] && !door_it.second["event"]) { | 385 | if (!door_it.second["skip_location"] && !door_it.second["event"]) { |
374 | if (ids_config["doors"] && ids_config["doors"][room_obj.name] && | 386 | if (ids_config["doors"] && |
375 | ids_config["doors"][room_obj.name][door_obj.name] && | 387 | ids_config["doors"][rooms_[room_id].name] && |
376 | ids_config["doors"][room_obj.name][door_obj.name]["location"]) { | 388 | ids_config["doors"][rooms_[room_id].name] |
377 | door_obj.ap_location_id = | 389 | [doors_[door_id].name] && |
378 | ids_config["doors"][room_obj.name][door_obj.name]["location"] | 390 | ids_config["doors"][rooms_[room_id].name][doors_[door_id].name] |
379 | .as<int>(); | 391 | ["location"]) { |
392 | doors_[door_id].ap_location_id = | ||
393 | ids_config["doors"][rooms_[room_id].name] | ||
394 | [doors_[door_id].name]["location"] | ||
395 | .as<int>(); | ||
380 | } else { | 396 | } else { |
381 | std::ostringstream errmsg; | 397 | std::ostringstream errmsg; |
382 | errmsg << "Missing AP location ID for door " << room_obj.name | 398 | errmsg << "Missing AP location ID for door " |
383 | << " - " << door_obj.name; | 399 | << rooms_[room_id].name << " - " << doors_[door_id].name; |
384 | TrackerLog(errmsg.str()); | 400 | TrackerLog(errmsg.str()); |
385 | } | 401 | } |
386 | } | 402 | } |
387 | 403 | ||
388 | if (door_it.second["include_reduce"]) { | 404 | if (door_it.second["include_reduce"]) { |
389 | door_obj.exclude_reduce = | 405 | doors_[door_id].exclude_reduce = |
390 | !door_it.second["include_reduce"].as<bool>(); | 406 | !door_it.second["include_reduce"].as<bool>(); |
391 | } | 407 | } |
392 | } | 408 | } |
@@ -402,7 +418,7 @@ struct GameData { | |||
402 | painting_exit.id = painting_id; | 418 | painting_exit.id = painting_id; |
403 | 419 | ||
404 | if (painting["required_door"]) { | 420 | if (painting["required_door"]) { |
405 | std::string rd_room = room_obj.name; | 421 | std::string rd_room = rooms_[room_id].name; |
406 | if (painting["required_door"]["room"]) { | 422 | if (painting["required_door"]["room"]) { |
407 | rd_room = painting["required_door"]["room"].as<std::string>(); | 423 | rd_room = painting["required_door"]["room"].as<std::string>(); |
408 | } | 424 | } |
@@ -411,7 +427,7 @@ struct GameData { | |||
411 | rd_room, painting["required_door"]["door"].as<std::string>()); | 427 | rd_room, painting["required_door"]["door"].as<std::string>()); |
412 | } | 428 | } |
413 | 429 | ||
414 | room_obj.paintings.push_back(painting_exit); | 430 | rooms_[room_id].paintings.push_back(painting_exit); |
415 | } | 431 | } |
416 | } | 432 | } |
417 | } | 433 | } |
@@ -438,7 +454,8 @@ struct GameData { | |||
438 | int door_id = -1; | 454 | int door_id = -1; |
439 | 455 | ||
440 | if (stage.IsScalar()) { | 456 | if (stage.IsScalar()) { |
441 | door_id = AddOrGetDoor(room_obj.name, stage.as<std::string>()); | 457 | door_id = |
458 | AddOrGetDoor(rooms_[room_id].name, stage.as<std::string>()); | ||
442 | } else { | 459 | } else { |
443 | door_id = AddOrGetDoor(stage["room"].as<std::string>(), | 460 | door_id = AddOrGetDoor(stage["room"].as<std::string>(), |
444 | stage["door"].as<std::string>()); | 461 | stage["door"].as<std::string>()); |