about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-06-08 11:24:13 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-06-08 11:24:13 -0400
commit21883d1004bde99f03cdbc82307207d5dd681a8a (patch)
tree8240f8710e519cafde163932a5bd862547393691
parent5f458fdee31b06a0fbebdd2542188fc5afec9245 (diff)
downloadlingo-ap-tracker-21883d1004bde99f03cdbc82307207d5dd681a8a.tar.gz
lingo-ap-tracker-21883d1004bde99f03cdbc82307207d5dd681a8a.tar.bz2
lingo-ap-tracker-21883d1004bde99f03cdbc82307207d5dd681a8a.zip
Fixed broken paintings and window repainting
-rw-r--r--src/game_data.cpp16
-rw-r--r--src/game_data.h1
2 files changed, 11 insertions, 6 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index 5776c6c..6f1a2e4 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp
@@ -427,12 +427,13 @@ struct GameData {
427 if (room_it.second["paintings"]) { 427 if (room_it.second["paintings"]) {
428 for (const auto &painting : room_it.second["paintings"]) { 428 for (const auto &painting : room_it.second["paintings"]) {
429 std::string internal_id = painting["id"].as<std::string>(); 429 std::string internal_id = painting["id"].as<std::string>();
430 int painting_id = AddOrGetPainting(internal_id);
431 PaintingExit &painting_exit = paintings_[painting_id];
432 painting_exit.room = room_id;
430 433
431 if ((!painting["exit_only"] || !painting["exit_only"].as<bool>()) && 434 if ((!painting["exit_only"] || !painting["exit_only"].as<bool>()) &&
432 (!painting["disable"] || !painting["disable"].as<bool>())) { 435 (!painting["disable"] || !painting["disable"].as<bool>())) {
433 int painting_id = AddOrGetPainting(internal_id); 436 painting_exit.entrance = true;
434 PaintingExit &painting_exit = paintings_[painting_id];
435 painting_exit.room = room_id;
436 437
437 if (painting["required_door"]) { 438 if (painting["required_door"]) {
438 std::string rd_room = rooms_[room_id].name; 439 std::string rd_room = rooms_[room_id].name;
@@ -443,9 +444,9 @@ struct GameData {
443 painting_exit.door = AddOrGetDoor( 444 painting_exit.door = AddOrGetDoor(
444 rd_room, painting["required_door"]["door"].as<std::string>()); 445 rd_room, painting["required_door"]["door"].as<std::string>());
445 } 446 }
446
447 rooms_[room_id].paintings.push_back(painting_exit.id);
448 } 447 }
448
449 rooms_[room_id].paintings.push_back(painting_exit.id);
449 } 450 }
450 } 451 }
451 452
@@ -627,7 +628,10 @@ struct GameData {
627 MapArea &map_area = map_areas_[area_id]; 628 MapArea &map_area = map_areas_[area_id];
628 629
629 for (int painting_id : room.paintings) { 630 for (int painting_id : room.paintings) {
630 map_area.paintings.push_back(painting_id); 631 const PaintingExit &painting_obj = paintings_.at(painting_id);
632 if (painting_obj.entrance) {
633 map_area.paintings.push_back(painting_id);
634 }
631 } 635 }
632 } 636 }
633 } 637 }
diff --git a/src/game_data.h b/src/game_data.h index a5d5699..e37c276 100644 --- a/src/game_data.h +++ b/src/game_data.h
@@ -92,6 +92,7 @@ struct PaintingExit {
92 int room; 92 int room;
93 std::string internal_id; 93 std::string internal_id;
94 std::optional<int> door; 94 std::optional<int> door;
95 bool entrance = false;
95}; 96};
96 97
97struct Room { 98struct Room {