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

Function get_stockpile_config

plugins/logistics.cpp:711–731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709}
710
711static unordered_map<string, int> get_stockpile_config(int32_t stockpile_number) {
712 unordered_map<string, int> stockpile_config;
713 stockpile_config.emplace("stockpile_number", stockpile_number);
714 if (watched_stockpiles.count(stockpile_number)) {
715 PersistentDataItem &c = watched_stockpiles[stockpile_number];
716 stockpile_config.emplace("melt", c.get_bool(STOCKPILE_CONFIG_MELT));
717 stockpile_config.emplace("melt_masterworks", c.get_bool(STOCKPILE_CONFIG_MELT_MASTERWORKS));
718 stockpile_config.emplace("trade", c.get_bool(STOCKPILE_CONFIG_TRADE));
719 stockpile_config.emplace("dump", c.get_bool(STOCKPILE_CONFIG_DUMP));
720 stockpile_config.emplace("train", c.get_bool(STOCKPILE_CONFIG_TRAIN));
721 stockpile_config.emplace("forbid", c.get_int(STOCKPILE_CONFIG_FORBID));
722 } else {
723 stockpile_config.emplace("melt", false);
724 stockpile_config.emplace("melt_masterworks", false);
725 stockpile_config.emplace("trade", false);
726 stockpile_config.emplace("dump", false);
727 stockpile_config.emplace("train", false);
728 stockpile_config.emplace("forbid", STOCKPILE_CONFIG_FORBID_OFF);
729 }
730 return stockpile_config;
731}
732
733static int logistics_getStockpileConfigs(lua_State *L) {
734 color_ostream *out = Lua::GetOutput(L);

Callers 1

Calls 1

countMethod · 0.45

Tested by

no test coverage detected