MCPcopy Create free account
hub / github.com/DFHack/dfhack / load_associations

Function load_associations

plugins/preserve-rooms.cpp:171–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171static void load_associations(unordered_map<int32_t, vector<int32_t>> * data, const char * suffix) {
172 PersistentDataItem c = get_config(suffix);
173 if (!c.isValid())
174 return;
175
176 vector<string> elems;
177 split_string(&elems, c.get_str(), ",");
178 for (auto elem : elems) {
179 vector<string> combined;
180 split_string(&combined, elem, "/");
181 if (combined.size() <= 1)
182 continue;
183 int32_t key = string_to_int(combined.back(), -1);
184 combined.pop_back();
185 vector<int32_t> vals;
186 for (auto str : combined)
187 vals.push_back(string_to_int(str, -1));
188 data->emplace(key, vals);
189 }
190}
191
192static string serialize_noble_map(const unordered_map<int32_t, vector<string>> & data) {
193 vector<string> elems;

Callers 1

Calls 5

get_configFunction · 0.85
split_stringFunction · 0.85
string_to_intFunction · 0.85
isValidMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected