make get_sdf_name() const

This commit is contained in:
2025-08-24 20:15:57 -05:00
parent 6e13a9eae0
commit 591387c3dc
2 changed files with 4 additions and 4 deletions

View File

@@ -643,15 +643,15 @@ std::string cScenario::get_feature_flag(std::string flag) {
return iter->second; return iter->second;
} }
std::string cScenario::get_sdf_name(int row, int col) { std::string cScenario::get_sdf_name(int row, int col) const {
if(row < 0 || row >= SDF_ROWS || col < 0 || col >= SDF_COLUMNS){ if(row < 0 || row >= SDF_ROWS || col < 0 || col >= SDF_COLUMNS){
throw "Tried to access SDF name for out-of-bounds flag (" + std::to_string(row) + ", " + std::to_string(col) + ")"; throw "Tried to access SDF name for out-of-bounds flag (" + std::to_string(row) + ", " + std::to_string(col) + ")";
} }
if(sdf_names.find(row) == sdf_names.end()) if(sdf_names.find(row) == sdf_names.end())
return ""; return "";
if(sdf_names[row].find(col) == sdf_names[row].end()) if(sdf_names.at(row).find(col) == sdf_names.at(row).end())
return ""; return "";
return sdf_names[row][col]; return sdf_names.at(row).at(col);
} }
bool cScenario::cItemStorage::operator==(const cScenario::cItemStorage& other) const { bool cScenario::cItemStorage::operator==(const cScenario::cItemStorage& other) const {

View File

@@ -139,7 +139,7 @@ public:
std::vector<std::string> ic_names; std::vector<std::string> ic_names;
std::vector<std::string> itf_names; std::vector<std::string> itf_names;
std::map<int, std::map<int, std::string>> sdf_names; std::map<int, std::map<int, std::string>> sdf_names;
std::string get_sdf_name(int row, int col); std::string get_sdf_name(int row, int col) const;
bool adjust_diff; bool adjust_diff;
bool is_legacy; bool is_legacy;