function to get a display name for sdf
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "oldstructs.hpp"
|
||||
#include "mathutil.hpp"
|
||||
@@ -655,6 +656,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);
|
||||
|
||||
@@ -141,6 +141,7 @@ public:
|
||||
std::vector<std::string> itf_names;
|
||||
std::map<int, std::map<int, std::string>> 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;
|
||||
|
||||
Reference in New Issue
Block a user