diff --git a/src/scenario/scenario.cpp b/src/scenario/scenario.cpp index aa12e8fc7..495d93b68 100644 --- a/src/scenario/scenario.cpp +++ b/src/scenario/scenario.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "oldstructs.hpp" #include "mathutil.hpp" @@ -654,6 +655,18 @@ std::string cScenario::get_sdf_name(int row, int col) const { return sdf_names.at(row).at(col); } +std::string cScenario::sdf_display_name(int row, int col, bool always_coords) const { + std::string name = get_sdf_name(row, col); + if(!name.empty()){ + name = fmt::format("'{}'", name); + if(always_coords) name += " "; + } + if(name.empty() || always_coords){ + name += fmt::format("({}, {})", row, col); + } + return name; +} + bool cScenario::cItemStorage::operator==(const cScenario::cItemStorage& other) const { CHECK_EQ(other, ter_type); CHECK_EQ(other, property); diff --git a/src/scenario/scenario.hpp b/src/scenario/scenario.hpp index fc1aa9f60..c00a40529 100644 --- a/src/scenario/scenario.hpp +++ b/src/scenario/scenario.hpp @@ -141,6 +141,7 @@ public: std::vector itf_names; std::map> sdf_names; std::string get_sdf_name(int row, int col) const; + std::string sdf_display_name(int row, int col, bool always_coords = false) const; bool adjust_diff; bool is_legacy;