diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-17 18:07:16 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-17 18:07:16 -0400 |
commit | 085531b53449dc28bc18739b06772641c5c82192 (patch) | |
tree | fcf1c0cfe0f7faa6f0fe4902b1731b3b8b9113c3 /src/game_data.cpp | |
parent | c0204878f7e4bf2240104a81a54943d7749d690a (diff) | |
download | lingo-ap-tracker-085531b53449dc28bc18739b06772641c5c82192.tar.gz lingo-ap-tracker-085531b53449dc28bc18739b06772641c5c82192.tar.bz2 lingo-ap-tracker-085531b53449dc28bc18739b06772641c5c82192.zip |
Handle panel location name config field
Diffstat (limited to 'src/game_data.cpp')
-rw-r--r-- | src/game_data.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index c98f532..be31b8f 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
@@ -254,6 +254,11 @@ struct GameData { | |||
254 | achievement_panels_.push_back(panel_id); | 254 | achievement_panels_.push_back(panel_id); |
255 | } | 255 | } |
256 | 256 | ||
257 | if (panel_it.second["location_name"]) { | ||
258 | panels_[panel_id].location_name = | ||
259 | panel_it.second["location_name"].as<std::string>(); | ||
260 | } | ||
261 | |||
257 | if (panel_it.second["hunt"]) { | 262 | if (panel_it.second["hunt"]) { |
258 | panels_[panel_id].hunt = panel_it.second["hunt"].as<bool>(); | 263 | panels_[panel_id].hunt = panel_it.second["hunt"].as<bool>(); |
259 | } | 264 | } |
@@ -521,8 +526,21 @@ struct GameData { | |||
521 | std::string room_name = rooms_[room_id].name; | 526 | std::string room_name = rooms_[room_id].name; |
522 | 527 | ||
523 | std::string area_name = room_name; | 528 | std::string area_name = room_name; |
524 | if (fold_areas.count(room_name)) { | 529 | std::string section_name = panel.name; |
525 | int fold_area_id = fold_areas[room_name]; | 530 | std::string location_name = room_name + " - " + panel.name; |
531 | |||
532 | if (!panel.location_name.empty()) { | ||
533 | location_name = panel.location_name; | ||
534 | |||
535 | size_t divider_pos = location_name.find(" - "); | ||
536 | if (divider_pos != std::string::npos) { | ||
537 | area_name = location_name.substr(0, divider_pos); | ||
538 | section_name = location_name.substr(divider_pos + 3); | ||
539 | } | ||
540 | } | ||
541 | |||
542 | if (fold_areas.count(area_name)) { | ||
543 | int fold_area_id = fold_areas[area_name]; | ||
526 | area_name = map_areas_[fold_area_id].name; | 544 | area_name = map_areas_[fold_area_id].name; |
527 | } | 545 | } |
528 | 546 | ||
@@ -538,15 +556,15 @@ struct GameData { | |||
538 | MapArea &map_area = map_areas_[area_id]; | 556 | MapArea &map_area = map_areas_[area_id]; |
539 | // room field should be the original room ID | 557 | // room field should be the original room ID |
540 | map_area.locations.push_back( | 558 | map_area.locations.push_back( |
541 | {.name = panel.name, | 559 | {.name = section_name, |
542 | .ap_location_name = room_name + " - " + panel.name, | 560 | .ap_location_name = location_name, |
543 | .ap_location_id = panel.ap_location_id, | 561 | .ap_location_id = panel.ap_location_id, |
544 | .room = panel.room, | 562 | .room = panel.room, |
545 | .panels = {panel.id}, | 563 | .panels = {panel.id}, |
546 | .classification = classification, | 564 | .classification = classification, |
547 | .hunt = panel.hunt}); | 565 | .hunt = panel.hunt}); |
548 | locations_by_name[map_area.locations.back().ap_location_name] = { | 566 | locations_by_name[location_name] = {area_id, |
549 | area_id, map_area.locations.size() - 1}; | 567 | map_area.locations.size() - 1}; |
550 | } | 568 | } |
551 | 569 | ||
552 | for (int door_id : door_definition_order_) { | 570 | for (int door_id : door_definition_order_) { |