use nested map for SDF names to save stack space.

Update semantics of the SDF array to (row, column) form to match
the picker space

Fix #674
This commit is contained in:
2025-03-05 09:24:50 -06:00
committed by Celtic Minstrel
parent 3d48cb14e7
commit 90d5e1b778
8 changed files with 52 additions and 38 deletions

View File

@@ -605,3 +605,11 @@ std::string cScenario::get_feature_flag(std::string flag) {
if(iter == this->feature_flags.end()) return "";
return iter->second;
}
std::string cScenario::get_sdf_name(int row, int col) {
if(sdf_names.find(row) == sdf_names.end())
return "";
if(sdf_names[row].find(col) == sdf_names[row].end())
return "";
return sdf_names[row][col];
}

View File

@@ -39,10 +39,6 @@ struct scenario_header_flags {
enum eContentRating {G, PG, R, NC17};
// TODO: Duplicated in party.hpp
template<typename T, size_t x, size_t y>
using array2d = std::array<std::array<T, y>, x>;
// Used for finding town entrances in the outdoors
struct town_entrance_t {
location out_sec;
@@ -107,7 +103,9 @@ public:
std::vector<std::string> evt_names;
std::vector<std::string> ic_names;
std::vector<std::string> itf_names;
array2d<std::string, 350, 50> sdf_names;
std::map<int, std::map<int, std::string>> sdf_names;
std::string get_sdf_name(int row, int col);
bool adjust_diff;
bool is_legacy;
fs::path scen_file; // transient