diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-02-22 12:18:21 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-02-22 12:18:21 -0500 |
commit | 386b136fb7d31d6424bd988d1d7c095626ceb393 (patch) | |
tree | ae3a988b3904056bb32b80a71795a1f81bab8d7f /generator.cpp | |
parent | 56abd4ed1d2a2adff01363f31ca2d0c81f3fbf53 (diff) | |
download | lingo-randomizer-386b136fb7d31d6424bd988d1d7c095626ceb393.tar.gz lingo-randomizer-386b136fb7d31d6424bd988d1d7c095626ceb393.tar.bz2 lingo-randomizer-386b136fb7d31d6424bd988d1d7c095626ceb393.zip |
Added painting room randomisation
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); |