about summary refs log tree commit diff stats
path: root/src/game_data.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-05-14 11:41:50 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-05-14 11:41:50 -0400
commit7f4b6b4f0cb276a7e0868c7e97d862b1feb468d3 (patch)
tree101ca3148d5470db821d1572c8f795dd5ad61759 /src/game_data.cpp
parent34133b1e330a7d3c2a3e6a6bcd36deb5f95e8f13 (diff)
downloadlingo-ap-tracker-7f4b6b4f0cb276a7e0868c7e97d862b1feb468d3.tar.gz
lingo-ap-tracker-7f4b6b4f0cb276a7e0868c7e97d862b1feb468d3.tar.bz2
lingo-ap-tracker-7f4b6b4f0cb276a7e0868c7e97d862b1feb468d3.zip
Hovered connections on subway map!
Diffstat (limited to 'src/game_data.cpp')
-rw-r--r--src/game_data.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index 4348967..74f872c 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp
@@ -62,6 +62,9 @@ struct GameData {
62 62
63 std::vector<int> sunwarp_doors_; 63 std::vector<int> sunwarp_doors_;
64 64
65 std::map<std::string, int> subway_item_by_painting_;
66 std::map<SubwaySunwarp, int> subway_item_by_sunwarp_;
67
65 bool loaded_area_data_ = false; 68 bool loaded_area_data_ = false;
66 std::set<std::string> malconfigured_areas_; 69 std::set<std::string> malconfigured_areas_;
67 70
@@ -624,7 +627,10 @@ struct GameData {
624 627
625 if (subway_it["paintings"]) { 628 if (subway_it["paintings"]) {
626 for (const auto &painting_it : subway_it["paintings"]) { 629 for (const auto &painting_it : subway_it["paintings"]) {
627 subway_item.paintings.push_back(painting_it.as<std::string>()); 630 std::string painting_id = painting_it.as<std::string>();
631
632 subway_item.paintings.push_back(painting_id);
633 subway_item_by_painting_[painting_id] = subway_item.id;
628 } 634 }
629 } 635 }
630 636
@@ -649,6 +655,11 @@ struct GameData {
649 } 655 }
650 656
651 subway_item.sunwarp = sunwarp; 657 subway_item.sunwarp = sunwarp;
658
659 subway_item_by_sunwarp_[sunwarp] = subway_item.id;
660
661 subway_item.door =
662 AddOrGetDoor("Sunwarps", std::to_string(sunwarp.dots) + " Sunwarp");
652 } 663 }
653 664
654 if (subway_it["special"]) { 665 if (subway_it["special"]) {
@@ -715,6 +726,10 @@ GameData &GetState() {
715 726
716} // namespace 727} // namespace
717 728
729bool SubwaySunwarp::operator<(const SubwaySunwarp& rhs) const {
730 return std::tie(dots, type) < std::tie(rhs.dots, rhs.type);
731}
732
718const std::vector<MapArea> &GD_GetMapAreas() { return GetState().map_areas_; } 733const std::vector<MapArea> &GD_GetMapAreas() { return GetState().map_areas_; }
719 734
720const MapArea &GD_GetMapArea(int id) { return GetState().map_areas_.at(id); } 735const MapArea &GD_GetMapArea(int id) { return GetState().map_areas_.at(id); }
@@ -764,3 +779,11 @@ const std::vector<SubwayItem> &GD_GetSubwayItems() {
764const SubwayItem &GD_GetSubwayItem(int id) { 779const SubwayItem &GD_GetSubwayItem(int id) {
765 return GetState().subway_items_.at(id); 780 return GetState().subway_items_.at(id);
766} 781}
782
783int GD_GetSubwayItemForPainting(const std::string& painting_id) {
784 return GetState().subway_item_by_painting_.at(painting_id);
785}
786
787int GD_GetSubwayItemForSunwarp(const SubwaySunwarp &sunwarp) {
788 return GetState().subway_item_by_sunwarp_.at(sunwarp);
789}