diff options
Diffstat (limited to 'generator.cpp')
-rw-r--r-- | generator.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/generator.cpp b/generator.cpp index 6b6c1be..8334904 100644 --- a/generator.cpp +++ b/generator.cpp | |||
@@ -654,6 +654,30 @@ void Generator::GenerateCrossTower( | |||
654 | SavePanel(west_other_name3, sets[3][3], sets[3][3]); | 654 | SavePanel(west_other_name3, sets[3][3], sets[3][3]); |
655 | } | 655 | } |
656 | 656 | ||
657 | void Generator::GeneratePaintingPuzzle(std::string panel_name, std::string painting_name) { | ||
658 | std::string node_name; | ||
659 | std::string answer; | ||
660 | int resource_id = 0; | ||
661 | |||
662 | for (;;) { | ||
663 | std::tie(node_name, answer, resource_id) = paintings_->GetPainting(rng_); | ||
664 | if (!used_paintings_.count(node_name)) { | ||
665 | break; | ||
666 | } | ||
667 | } | ||
668 | |||
669 | used_paintings_.insert(node_name); | ||
670 | |||
671 | SavePanel(panel_name, "painting", answer, {}); | ||
672 | |||
673 | std::string resource_path = std::string("res://nodes/paintings/") + node_name + ".tscn"; | ||
674 | if (resource_id == 0) { | ||
675 | resources_.emplace_back(resource_path, "PackedScene"); | ||
676 | } | ||
677 | |||
678 | replace_nodes_[painting_name] = {resource_path, resource_id}; | ||
679 | } | ||
680 | |||
657 | void Generator::SavePanel(std::string name, std::string question, std::string answer, GenerateOptions options) { | 681 | void Generator::SavePanel(std::string name, std::string question, std::string answer, GenerateOptions options) { |
658 | if (options.save_for_later) { | 682 | if (options.save_for_later) { |
659 | reusable_.push_back(answer); | 683 | reusable_.push_back(answer); |