From 21883d1004bde99f03cdbc82307207d5dd681a8a Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 8 Jun 2024 11:24:13 -0400 Subject: Fixed broken paintings and window repainting --- src/game_data.cpp | 16 ++++++++++------ src/game_data.h | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') 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 { if (room_it.second["paintings"]) { for (const auto &painting : room_it.second["paintings"]) { std::string internal_id = painting["id"].as(); + int painting_id = AddOrGetPainting(internal_id); + PaintingExit &painting_exit = paintings_[painting_id]; + painting_exit.room = room_id; if ((!painting["exit_only"] || !painting["exit_only"].as()) && (!painting["disable"] || !painting["disable"].as())) { - int painting_id = AddOrGetPainting(internal_id); - PaintingExit &painting_exit = paintings_[painting_id]; - painting_exit.room = room_id; + painting_exit.entrance = true; if (painting["required_door"]) { std::string rd_room = rooms_[room_id].name; @@ -443,9 +444,9 @@ struct GameData { painting_exit.door = AddOrGetDoor( rd_room, painting["required_door"]["door"].as()); } - - rooms_[room_id].paintings.push_back(painting_exit.id); } + + rooms_[room_id].paintings.push_back(painting_exit.id); } } @@ -627,7 +628,10 @@ struct GameData { MapArea &map_area = map_areas_[area_id]; for (int painting_id : room.paintings) { - map_area.paintings.push_back(painting_id); + const PaintingExit &painting_obj = paintings_.at(painting_id); + if (painting_obj.entrance) { + map_area.paintings.push_back(painting_id); + } } } } 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 { int room; std::string internal_id; std::optional door; + bool entrance = false; }; struct Room { -- cgit 1.4.1