diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-16 15:21:59 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-16 15:21:59 -0400 |
commit | 534e0aae81261990c1160378a085e2aeac9a6b7a (patch) | |
tree | 95be44ff0920bd3d60fb7ea8088068b6b77ab9dd /src/subway_map.cpp | |
parent | a40d5a90a4759ecb03fe4591878c011d3c8c07be (diff) | |
download | lingo-ap-tracker-534e0aae81261990c1160378a085e2aeac9a6b7a.tar.gz lingo-ap-tracker-534e0aae81261990c1160378a085e2aeac9a6b7a.tar.bz2 lingo-ap-tracker-534e0aae81261990c1160378a085e2aeac9a6b7a.zip |
Fixed undefined behavior in GetRealSubwayDoor
Diffstat (limited to 'src/subway_map.cpp')
-rw-r--r-- | src/subway_map.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/subway_map.cpp b/src/subway_map.cpp index 044e6fa..9bfedf9 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp | |||
@@ -19,7 +19,6 @@ enum class ItemDrawType { kNone, kBox, kOwl }; | |||
19 | namespace { | 19 | namespace { |
20 | 20 | ||
21 | std::optional<int> GetRealSubwayDoor(const SubwayItem subway_item) { | 21 | std::optional<int> GetRealSubwayDoor(const SubwayItem subway_item) { |
22 | std::optional<int> subway_door = subway_item.door; | ||
23 | if (AP_IsSunwarpShuffle() && subway_item.sunwarp && | 22 | if (AP_IsSunwarpShuffle() && subway_item.sunwarp && |
24 | subway_item.sunwarp->type != SubwaySunwarpType::kFinal) { | 23 | subway_item.sunwarp->type != SubwaySunwarpType::kFinal) { |
25 | int sunwarp_index = subway_item.sunwarp->dots - 1; | 24 | int sunwarp_index = subway_item.sunwarp->dots - 1; |
@@ -29,12 +28,12 @@ std::optional<int> GetRealSubwayDoor(const SubwayItem subway_item) { | |||
29 | 28 | ||
30 | for (const auto &[start_index, mapping] : AP_GetSunwarpMapping()) { | 29 | for (const auto &[start_index, mapping] : AP_GetSunwarpMapping()) { |
31 | if (start_index == sunwarp_index || mapping.exit_index == sunwarp_index) { | 30 | if (start_index == sunwarp_index || mapping.exit_index == sunwarp_index) { |
32 | subway_door = GD_GetSunwarpDoors().at(mapping.dots - 1); | 31 | return GD_GetSunwarpDoors().at(mapping.dots - 1); |
33 | } | 32 | } |
34 | } | 33 | } |
35 | |||
36 | return subway_door; | ||
37 | } | 34 | } |
35 | |||
36 | return subway_item.door; | ||
38 | } | 37 | } |
39 | 38 | ||
40 | } // namespace | 39 | } // namespace |