From e339ea6d0ecdc854630881240531f74b36c65b5c Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Mon, 25 Aug 2025 12:00:30 -0500 Subject: [PATCH] editor hint for short once dialog, story dialog --- src/scenario/special.cpp | 23 +++++++++++++++++++++++ test/replays/scenarios/meta.xml | 1 + 2 files changed, 24 insertions(+) create mode 100644 test/replays/scenarios/meta.xml diff --git a/src/scenario/special.cpp b/src/scenario/special.cpp index 29ab0f9a7..db9c5ce20 100644 --- a/src/scenario/special.cpp +++ b/src/scenario/special.cpp @@ -539,6 +539,11 @@ std::string cSpecial::editor_hint(cUniverse& univ) const { eSpecCtxType cur_type = static_cast(univ.scenario.editor_state.special_editing_mode); std::string preposition = "to"; + auto str = [&univ, cur_type](int which) { + std::string s; + univ.get_str(s, cur_type, which); + return s; + }; auto first_of_six_str = [&univ, cur_type](int start) { std::array strs; univ.get_strs(strs, cur_type, start); @@ -550,8 +555,26 @@ std::string cSpecial::editor_hint(cUniverse& univ) const { } return std::string{""}; }; + auto first_of_many_str = [&univ, cur_type](int title, int start, int end) { + std::string s; + univ.get_str(s, cur_type, title); + boost::algorithm::trim(s); + if(!s.empty()) return s; + for(int i = start; i <= end; ++i){ + univ.get_str(s, cur_type, i); + boost::algorithm::trim(s); + if(!s.empty()) return s; + } + return std::string{""}; + }; switch(type){ + case eSpecType::ONCE_DISPLAY_MSG: + hint += fmt::format(": '{}'", str(m1)); + break; + case eSpecType::STORY_DIALOG: + hint += fmt::format(": '{}'", first_of_many_str(m1, m2, m3)); + break; case eSpecType::ONCE_DIALOG: hint += fmt::format(": '{}'", first_of_six_str(m1)); break; diff --git a/test/replays/scenarios/meta.xml b/test/replays/scenarios/meta.xml new file mode 100644 index 000000000..9c5ae95ec --- /dev/null +++ b/test/replays/scenarios/meta.xml @@ -0,0 +1 @@ +