diff options
-rw-r--r-- | src/game_data.cpp | 10 | ||||
-rw-r--r-- | src/game_data.h | 2 | ||||
-rw-r--r-- | src/subway_map.cpp | 10 |
3 files changed, 12 insertions, 10 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index 6f1a2e4..85f7f51 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
@@ -839,13 +839,11 @@ const SubwayItem &GD_GetSubwayItem(int id) { | |||
839 | return GetState().subway_items_.at(id); | 839 | return GetState().subway_items_.at(id); |
840 | } | 840 | } |
841 | 841 | ||
842 | int GD_GetSubwayItemForPainting(const std::string &painting_id) { | 842 | std::optional<int> GD_GetSubwayItemForPainting(const std::string &painting_id) { |
843 | #ifndef NDEBUG | 843 | if (GetState().subway_item_by_painting_.count(painting_id)) { |
844 | if (!GetState().subway_item_by_painting_.count(painting_id)) { | 844 | return GetState().subway_item_by_painting_.at(painting_id); |
845 | wxLogError("No subway item for painting %s", painting_id); | ||
846 | } | 845 | } |
847 | #endif | 846 | return std::nullopt; |
848 | return GetState().subway_item_by_painting_.at(painting_id); | ||
849 | } | 847 | } |
850 | 848 | ||
851 | int GD_GetSubwayItemForSunwarp(const SubwaySunwarp &sunwarp) { | 849 | int GD_GetSubwayItemForSunwarp(const SubwaySunwarp &sunwarp) { |
diff --git a/src/game_data.h b/src/game_data.h index e37c276..66f3e0e 100644 --- a/src/game_data.h +++ b/src/game_data.h | |||
@@ -164,7 +164,7 @@ const std::vector<int>& GD_GetSunwarpDoors(); | |||
164 | int GD_GetRoomForSunwarp(int index); | 164 | int GD_GetRoomForSunwarp(int index); |
165 | const std::vector<SubwayItem>& GD_GetSubwayItems(); | 165 | const std::vector<SubwayItem>& GD_GetSubwayItems(); |
166 | const SubwayItem& GD_GetSubwayItem(int id); | 166 | const SubwayItem& GD_GetSubwayItem(int id); |
167 | int GD_GetSubwayItemForPainting(const std::string& painting_id); | 167 | std::optional<int> GD_GetSubwayItemForPainting(const std::string& painting_id); |
168 | int GD_GetSubwayItemForSunwarp(const SubwaySunwarp& sunwarp); | 168 | int GD_GetSubwayItemForSunwarp(const SubwaySunwarp& sunwarp); |
169 | 169 | ||
170 | #endif /* end of include guard: GAME_DATA_H_9C42AC51 */ | 170 | #endif /* end of include guard: GAME_DATA_H_9C42AC51 */ |
diff --git a/src/subway_map.cpp b/src/subway_map.cpp index 408c4f0..5c99567 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp | |||
@@ -147,9 +147,13 @@ void SubwayMap::UpdateIndicators() { | |||
147 | checked_paintings_.insert(painting_id); | 147 | checked_paintings_.insert(painting_id); |
148 | 148 | ||
149 | if (AP_GetPaintingMapping().count(painting_id)) { | 149 | if (AP_GetPaintingMapping().count(painting_id)) { |
150 | networks_.AddLink(GD_GetSubwayItemForPainting(painting_id), | 150 | std::optional<int> from_id = GD_GetSubwayItemForPainting(painting_id); |
151 | GD_GetSubwayItemForPainting( | 151 | std::optional<int> to_id = GD_GetSubwayItemForPainting( |
152 | AP_GetPaintingMapping().at(painting_id))); | 152 | AP_GetPaintingMapping().at(painting_id)); |
153 | |||
154 | if (from_id && to_id) { | ||
155 | networks_.AddLink(*from_id, *to_id); | ||
156 | } | ||
153 | } | 157 | } |
154 | } | 158 | } |
155 | } | 159 | } |