remove the features feature; we can do it with quickfort properties

develop
Myk Taylor 2023-06-12 10:59:13 -07:00
parent 37b07bcee6
commit e90de61cc1
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
6 changed files with 3 additions and 76 deletions

@ -2,7 +2,7 @@ stockpiles
========== ==========
.. dfhack-tool:: .. dfhack-tool::
:summary: Import, export, or modify stockpile settings and features. :summary: Import, export, or modify stockpile settings.
:tags: fort design productivity stockpiles :tags: fort design productivity stockpiles
Commands act upon the stockpile selected in the UI unless another stockpile Commands act upon the stockpile selected in the UI unless another stockpile
@ -94,7 +94,6 @@ file are:
:types: The elements below the categories, which include the sub-categories, the :types: The elements below the categories, which include the sub-categories, the
specific item types, and any toggles the category might have (like Prepared specific item types, and any toggles the category might have (like Prepared
meals for the Food category). meals for the Food category).
:features: DFHack `logistics` features.
.. _stockpiles-library: .. _stockpiles-library:

@ -80,7 +80,7 @@ local function get_sp_id(opts)
return nil return nil
end end
local included_elements = {containers=1, general=2, categories=4, types=8, features=16} local included_elements = {containers=1, general=2, categories=4, types=8}
function export_stockpile(name, opts) function export_stockpile(name, opts)
assert_safe_name(name) assert_safe_name(name)
@ -207,15 +207,6 @@ function parse_commandline(args)
return true return true
end end
function get_stockpile_features(stockpile_number)
local config = logistics.logistics_getStockpileConfigs(stockpile_number)[1]
return config.melt, config.trade, config.dump, config.train
end
function set_stockpile_features(stockpile_number, melt, trade, dump, train)
logistics.logistics_setStockpileConfig(stockpile_number, melt, trade, dump, train)
end
-------------------- --------------------
-- dialogs -- dialogs
-------------------- --------------------
@ -240,7 +231,6 @@ function StockpilesExport:init()
initial_option=false, initial_option=false,
}, widgets.ToggleHotkeyLabel{frame={t=6, l=0}, label='Categories', initial_option=true}, }, widgets.ToggleHotkeyLabel{frame={t=6, l=0}, label='Categories', initial_option=true},
widgets.ToggleHotkeyLabel{frame={t=7, l=0}, label='Subtypes', initial_option=true}, widgets.ToggleHotkeyLabel{frame={t=7, l=0}, label='Subtypes', initial_option=true},
widgets.ToggleHotkeyLabel{frame={t=8, l=0}, label='DFHack features', initial_option=true},
widgets.HotkeyLabel{ widgets.HotkeyLabel{
frame={t=10, l=0}, frame={t=10, l=0},
label='export', label='export',

@ -770,8 +770,6 @@ void StockpileSettingsSerializer::write(color_ostream& out, uint32_t includedEle
} }
void StockpileSerializer::write(color_ostream& out, uint32_t includedElements) { void StockpileSerializer::write(color_ostream& out, uint32_t includedElements) {
if (includedElements & INCLUDED_ELEMENTS_FEATURES)
write_features(out);
if (includedElements & INCLUDED_ELEMENTS_CONTAINERS) if (includedElements & INCLUDED_ELEMENTS_CONTAINERS)
write_containers(out); write_containers(out);
@ -808,7 +806,6 @@ void StockpileSettingsSerializer::read(color_ostream &out, DeserializeMode mode,
} }
void StockpileSerializer::read(color_ostream &out, DeserializeMode mode, const vector<string>& filters) { void StockpileSerializer::read(color_ostream &out, DeserializeMode mode, const vector<string>& filters) {
read_features(out, mode);
read_containers(out, mode); read_containers(out, mode);
StockpileSettingsSerializer::read(out, mode, filters); StockpileSettingsSerializer::read(out, mode, filters);
} }
@ -911,56 +908,6 @@ void StockpileSerializer::read_general(color_ostream& out, DeserializeMode mode)
mPile->use_links_only); mPile->use_links_only);
} }
void StockpileSerializer::write_features(color_ostream& out) {
DEBUG(log, out).print("writing feature settings\n");
if (!call_stockpiles_lua(&out, "get_stockpile_features", 1, 4,
[&](lua_State* L) {
Lua::Push(L, mPile->stockpile_number);
},
[&](lua_State* L) {
mBuffer.set_melt(0 != lua_toboolean(L, -1));
mBuffer.set_trade(0 != lua_toboolean(L, -2));
mBuffer.set_dump(0 != lua_toboolean(L, -3));
mBuffer.set_train(0 != lua_toboolean(L, -4));
})) {
WARN(log, out).print("failed to get logistics features of stockpile number %d\n", mPile->stockpile_number);
}
}
void StockpileSerializer::read_features(color_ostream &out, DeserializeMode mode) {
int32_t melt = -1, trade = -1, dump = -1, train = -1;
read_elem<int32_t, bool>(out, "melt", mode,
std::bind(&StockpileSettings::has_melt, mBuffer),
std::bind(&StockpileSettings::melt, mBuffer),
melt);
read_elem<int32_t, bool>(out, "trade", mode,
std::bind(&StockpileSettings::has_trade, mBuffer),
std::bind(&StockpileSettings::trade, mBuffer),
trade);
read_elem<int32_t, bool>(out, "dump", mode,
std::bind(&StockpileSettings::has_dump, mBuffer),
std::bind(&StockpileSettings::dump, mBuffer),
dump);
read_elem<int32_t, bool>(out, "train", mode,
std::bind(&StockpileSettings::has_train, mBuffer),
std::bind(&StockpileSettings::train, mBuffer),
train);
if (melt != -1 || trade != -1 || dump != -1 || train != -1) {
if (!call_stockpiles_lua(&out, "set_stockpile_features", 4, 0,
[&](lua_State* L) {
Lua::Push(L, mPile->stockpile_number);
Lua::Push(L, melt == 1);
Lua::Push(L, trade == 1);
Lua::Push(L, dump == 1);
Lua::Push(L, train == 1);
})) {
WARN(log, out).print("failed to set logistics features of stockpile number %d\n", mPile->stockpile_number);
}
}
}
static bool ammo_mat_is_allowed(const MaterialInfo& mi) { static bool ammo_mat_is_allowed(const MaterialInfo& mi) {
return mi.isValid() && mi.material && mi.material->flags.is_set(material_flags::IS_METAL); return mi.isValid() && mi.material && mi.material->flags.is_set(material_flags::IS_METAL);
} }

@ -21,7 +21,6 @@ enum IncludedElements {
INCLUDED_ELEMENTS_GENERAL = 0x02, INCLUDED_ELEMENTS_GENERAL = 0x02,
INCLUDED_ELEMENTS_CATEGORIES = 0x04, INCLUDED_ELEMENTS_CATEGORIES = 0x04,
INCLUDED_ELEMENTS_TYPES = 0x08, INCLUDED_ELEMENTS_TYPES = 0x08,
INCLUDED_ELEMENTS_FEATURES = 0x10,
}; };
enum DeserializeMode { enum DeserializeMode {
@ -169,6 +168,4 @@ private:
void write_containers(DFHack::color_ostream& out); void write_containers(DFHack::color_ostream& out);
void read_containers(DFHack::color_ostream& out, DeserializeMode mode); void read_containers(DFHack::color_ostream& out, DeserializeMode mode);
void write_features(DFHack::color_ostream& out);
void read_features(DFHack::color_ostream &out, DeserializeMode mode);
}; };

@ -183,12 +183,6 @@ message StockpileSettings {
optional WeaponsSet weapons = 16; optional WeaponsSet weapons = 16;
optional WoodSet wood = 15; optional WoodSet wood = 15;
// DFHack features
optional bool melt = 27;
optional bool trade = 28;
optional bool dump = 29;
optional bool train = 30;
// deprecated // deprecated
optional bool corpses = 24; // not marked as deprecated since we still read it optional bool corpses = 24; // not marked as deprecated since we still read it
optional OreSet ore = 7 [deprecated=true]; optional OreSet ore = 7 [deprecated=true];

@ -32,7 +32,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, vector<PluginComman
commands.push_back(PluginCommand( commands.push_back(PluginCommand(
plugin_name, plugin_name,
"Import, export, or modify stockpile settings and features.", "Import, export, or modify stockpile settings.",
do_command)); do_command));
return CR_OK; return CR_OK;