diff --git a/src/scenario/special.cpp b/src/scenario/special.cpp index 05bb0d5a..631ae258 100644 --- a/src/scenario/special.cpp +++ b/src/scenario/special.cpp @@ -21,6 +21,7 @@ #include "skills_traits.hpp" #include "damage.hpp" #include "fields.hpp" +#include "scenario.hpp" bool cTimer::is_valid() const { if(time < 0) return false; @@ -529,6 +530,21 @@ void cSpecial::import_legacy(legacy::special_node_type& old){ } } +// In the editor node list, be as helpful as possible about what the specific node instance does +std::string cSpecial::editor_hint(const cScenario& scenario) const { + std::string hint = (*type).name(); + + switch(type){ + case eSpecType::TOWN_STAIR: + case eSpecType::TOWN_GENERIC_STAIR: + hint += " to "; + if(ex2a < scenario.towns.size()) hint += scenario.towns[ex2a]->loc_str(loc(ex1a, ex1b)); + else hint += "INVALID TOWN"; + default: break; + } + return hint; +} + static eSpecCat getNodeCategory(eSpecType node) { for(int i = 0; i <= int(eSpecCat::OUTDOOR); i++) { eSpecCat cat = eSpecCat(i); diff --git a/src/scenario/special.hpp b/src/scenario/special.hpp index 34683ed1..6f9427a0 100644 --- a/src/scenario/special.hpp +++ b/src/scenario/special.hpp @@ -16,6 +16,7 @@ #include "dialogxml/widgets/pictypes.hpp" namespace legacy { struct special_node_type; }; +class cScenario; static const short SDF_COMPLETE = 250; @@ -108,6 +109,7 @@ public: return true; } bool operator!=(const cSpecial& other) const { return !(*this == other); } + std::string editor_hint(const cScenario& scenario) const; }; enum class eSpecCtxType { diff --git a/src/scenedit/scen.graphics.cpp b/src/scenedit/scen.graphics.cpp index 40f5bad0..f0d1a1a5 100644 --- a/src/scenedit/scen.graphics.cpp +++ b/src/scenedit/scen.graphics.cpp @@ -535,15 +535,15 @@ static void apply_mode_buttons() { std::ostringstream strb; switch(mode) { case 0: - strb << i << " - " << (*scenario.scen_specials[i].type).name(); + strb << i << " - " << scenario.scen_specials[i].editor_hint(scenario); set_rb(i,RB_SCEN_SPEC, i, strb.str()); break; case 1: - strb << i << " - " << (*current_terrain->specials[i].type).name(); + strb << i << " - " << current_terrain->specials[i].editor_hint(scenario); set_rb(i,RB_OUT_SPEC, i, strb.str()); break; case 2: - strb << i << " - " << (*town->specials[i].type).name(); + strb << i << " - " << town->specials[i].editor_hint(scenario); set_rb(i,RB_TOWN_SPEC, i, strb.str()); break; }