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

Function validate_stockpile_configs

plugins/logistics.cpp:129–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129static void validate_stockpile_configs(color_ostream& out,
130 unordered_map<df::building_stockpilest *, PersistentDataItem> &cache) {
131 vector<int> to_remove;
132 for (auto& entry : watched_stockpiles) {
133 int stockpile_number = entry.first;
134 PersistentDataItem &c = entry.second;
135 auto bld = find_stockpile(stockpile_number);
136 if (!bld || (
137 !c.get_bool(STOCKPILE_CONFIG_MELT) &&
138 !c.get_bool(STOCKPILE_CONFIG_TRADE) &&
139 !c.get_bool(STOCKPILE_CONFIG_DUMP) &&
140 !c.get_bool(STOCKPILE_CONFIG_TRAIN) &&
141 !(c.get_int(STOCKPILE_CONFIG_FORBID) > STOCKPILE_CONFIG_FORBID_OFF))) {
142 to_remove.push_back(stockpile_number);
143 continue;
144 }
145 cache.emplace(bld, c);
146 }
147 for (int stockpile_number : to_remove)
148 remove_stockpile_config(out, stockpile_number);
149}
150
151// remove this function once saves from 50.08 are no longer compatible
152static void migrate_old_keys(color_ostream &out) {

Callers 3

do_cycleFunction · 0.85

Calls 2

find_stockpileFunction · 0.85
remove_stockpile_configFunction · 0.85

Tested by

no test coverage detected