about summary refs log tree commit diff stats
path: root/src/game_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_data.cpp')
-rw-r--r--src/game_data.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index e75170e..7b805df 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp
@@ -109,6 +109,7 @@ struct GameData {
109 auto process_single_entrance = 109 auto process_single_entrance =
110 [this, room_id, from_room_id](const YAML::Node &option) { 110 [this, room_id, from_room_id](const YAML::Node &option) {
111 Exit exit_obj; 111 Exit exit_obj;
112 exit_obj.source_room = from_room_id;
112 exit_obj.destination_room = room_id; 113 exit_obj.destination_room = room_id;
113 114
114 if (option["door"]) { 115 if (option["door"]) {
@@ -143,7 +144,7 @@ struct GameData {
143 switch (entrance_it.second.Type()) { 144 switch (entrance_it.second.Type()) {
144 case YAML::NodeType::Scalar: { 145 case YAML::NodeType::Scalar: {
145 // This is just "true". 146 // This is just "true".
146 rooms_[from_room_id].exits.push_back({.destination_room = room_id}); 147 rooms_[from_room_id].exits.push_back({.source_room = from_room_id, .destination_room = room_id});
147 break; 148 break;
148 } 149 }
149 case YAML::NodeType::Map: { 150 case YAML::NodeType::Map: {
@@ -264,6 +265,11 @@ struct GameData {
264 panel_it.second["location_name"].as<std::string>(); 265 panel_it.second["location_name"].as<std::string>();
265 } 266 }
266 267
268 if (panel_it.second["id"]) {
269 panels_[panel_id].nodepath =
270 panel_it.second["id"].as<std::string>();
271 }
272
267 if (panel_it.second["hunt"]) { 273 if (panel_it.second["hunt"]) {
268 panels_[panel_id].hunt = panel_it.second["hunt"].as<bool>(); 274 panels_[panel_id].hunt = panel_it.second["hunt"].as<bool>();
269 } 275 }
@@ -563,7 +569,8 @@ struct GameData {
563 .room = panel.room, 569 .room = panel.room,
564 .panels = {panel.id}, 570 .panels = {panel.id},
565 .classification = classification, 571 .classification = classification,
566 .hunt = panel.hunt}); 572 .hunt = panel.hunt,
573 .single_panel = panel.id});
567 locations_by_name[location_name] = {area_id, 574 locations_by_name[location_name] = {area_id,
568 map_area.locations.size() - 1}; 575 map_area.locations.size() - 1};
569 } 576 }
@@ -616,6 +623,7 @@ struct GameData {
616 for (const Location &location : map_area.locations) { 623 for (const Location &location : map_area.locations) {
617 map_area.classification |= location.classification; 624 map_area.classification |= location.classification;
618 map_area.hunt |= location.hunt; 625 map_area.hunt |= location.hunt;
626 map_area.has_single_panel |= location.single_panel.has_value();
619 } 627 }
620 } 628 }
621 629
@@ -673,6 +681,18 @@ struct GameData {
673 } 681 }
674 } 682 }
675 683
684 if (subway_it["entrances"]) {
685 for (const auto &entrance_it : subway_it["entrances"]) {
686 subway_item.entrances.push_back(entrance_it.as<std::string>());
687 }
688 }
689
690 if (subway_it["exits"]) {
691 for (const auto &exit_it : subway_it["exits"]) {
692 subway_item.exits.push_back(exit_it.as<std::string>());
693 }
694 }
695
676 if (subway_it["sunwarp"]) { 696 if (subway_it["sunwarp"]) {
677 SubwaySunwarp sunwarp; 697 SubwaySunwarp sunwarp;
678 sunwarp.dots = subway_it["sunwarp"]["dots"].as<int>(); 698 sunwarp.dots = subway_it["sunwarp"]["dots"].as<int>();
@@ -784,6 +804,11 @@ GameData &GetState() {
784 804
785} // namespace 805} // namespace
786 806
807bool SubwayItem::HasWarps() const {
808 return !(this->tags.empty() && this->entrances.empty() &&
809 this->exits.empty());
810}
811
787bool SubwaySunwarp::operator<(const SubwaySunwarp &rhs) const { 812bool SubwaySunwarp::operator<(const SubwaySunwarp &rhs) const {
788 return std::tie(dots, type) < std::tie(rhs.dots, rhs.type); 813 return std::tie(dots, type) < std::tie(rhs.dots, rhs.type);
789} 814}