starting with stairways, show more info in edit special list

This commit is contained in:
2025-08-11 12:34:50 -05:00
parent 54b89bbcff
commit ff80cfc516
3 changed files with 21 additions and 3 deletions

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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;
}