support recording stockpiles in blueprints

develop
Myk Taylor 2023-05-20 16:00:59 -07:00
parent af1ba12031
commit d06118ad8e
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
4 changed files with 19 additions and 26 deletions

@ -55,7 +55,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- Terminal console no longer appears in front of the game window on startup - Terminal console no longer appears in front of the game window on startup
- `gui/control-panel`: new preference for whether filters in lists search for substrings in the middle of words (e.g. if set to true, then "ee" will match "steel") - `gui/control-panel`: new preference for whether filters in lists search for substrings in the middle of words (e.g. if set to true, then "ee" will match "steel")
- `gui/design`: Improved performance for drawing shapes - `gui/design`: Improved performance for drawing shapes
- Dreamfort: improve traffic patterns throughout the fortress (stockpiles and zones are still not working, pending updates in `quickfort`) - Dreamfort: improve traffic patterns throughout the fortress
- `gui/blueprint`: recording of stockpile layouts and categories is now supported. note that detailed stockpile configurations will *not* be saved (yet)
- Core: For debugging purposes, you can now pass ``--disable-dfhack`` on the Dwarf Fortress commandline or specify ``DFHACK_DISABLE=1`` in the environment to disable DFHack for the current session. - Core: For debugging purposes, you can now pass ``--disable-dfhack`` on the Dwarf Fortress commandline or specify ``DFHACK_DISABLE=1`` in the environment to disable DFHack for the current session.
- `overlay`: added links to the quickstart guide and the control panel on the DF title screen - `overlay`: added links to the quickstart guide and the control panel on the DF title screen
- `gui/autodump`: fort-mode keybinding: Ctrl-H - `gui/autodump`: fort-mode keybinding: Ctrl-H

@ -99,9 +99,9 @@ struct blueprint_options {
bool construct = false; bool construct = false;
bool build = false; bool build = false;
bool place = false; bool place = false;
bool zone = false; // bool zone = false;
bool query = false; // bool query = false;
bool rooms = false; // bool rooms = false;
static struct_identity _identity; static struct_identity _identity;
}; };
@ -125,9 +125,9 @@ static const struct_field_info blueprint_options_fields[] = {
{ struct_field_info::PRIMITIVE, "construct", offsetof(blueprint_options, construct), &df::identity_traits<bool>::identity, 0, 0 }, { struct_field_info::PRIMITIVE, "construct", offsetof(blueprint_options, construct), &df::identity_traits<bool>::identity, 0, 0 },
{ struct_field_info::PRIMITIVE, "build", offsetof(blueprint_options, build), &df::identity_traits<bool>::identity, 0, 0 }, { struct_field_info::PRIMITIVE, "build", offsetof(blueprint_options, build), &df::identity_traits<bool>::identity, 0, 0 },
{ struct_field_info::PRIMITIVE, "place", offsetof(blueprint_options, place), &df::identity_traits<bool>::identity, 0, 0 }, { struct_field_info::PRIMITIVE, "place", offsetof(blueprint_options, place), &df::identity_traits<bool>::identity, 0, 0 },
{ struct_field_info::PRIMITIVE, "zone", offsetof(blueprint_options, zone), &df::identity_traits<bool>::identity, 0, 0 }, // { struct_field_info::PRIMITIVE, "zone", offsetof(blueprint_options, zone), &df::identity_traits<bool>::identity, 0, 0 },
{ struct_field_info::PRIMITIVE, "query", offsetof(blueprint_options, query), &df::identity_traits<bool>::identity, 0, 0 }, // { struct_field_info::PRIMITIVE, "query", offsetof(blueprint_options, query), &df::identity_traits<bool>::identity, 0, 0 },
{ struct_field_info::PRIMITIVE, "rooms", offsetof(blueprint_options, rooms), &df::identity_traits<bool>::identity, 0, 0 }, // { struct_field_info::PRIMITIVE, "rooms", offsetof(blueprint_options, rooms), &df::identity_traits<bool>::identity, 0, 0 },
{ struct_field_info::END } { struct_field_info::END }
}; };
struct_identity blueprint_options::_identity(sizeof(blueprint_options), &df::allocator_fn<blueprint_options>, NULL, "blueprint_options", NULL, blueprint_options_fields); struct_identity blueprint_options::_identity(sizeof(blueprint_options), &df::allocator_fn<blueprint_options>, NULL, "blueprint_options", NULL, blueprint_options_fields);
@ -855,7 +855,6 @@ static const char * get_tile_build(const df::coord &pos,
return add_expansion_syntax(ctx, keys); return add_expansion_syntax(ctx, keys);
} }
/* TODO: understand how this changes for v50
static const char * get_place_keys(const tile_context &ctx) { static const char * get_place_keys(const tile_context &ctx) {
df::building_stockpilest* sp = df::building_stockpilest* sp =
virtual_cast<df::building_stockpilest>(ctx.b); virtual_cast<df::building_stockpilest>(ctx.b);
@ -908,6 +907,7 @@ static const char * get_tile_place(const df::coord &pos,
return add_expansion_syntax(ctx, get_place_keys(ctx)); return add_expansion_syntax(ctx, get_place_keys(ctx));
} }
/* TODO: understand how this changes for v50
static bool hospital_maximums_eq(const df::hospital_supplies &a, static bool hospital_maximums_eq(const df::hospital_supplies &a,
const df::hospital_supplies &b) { const df::hospital_supplies &b) {
return a.max_thread == b.max_thread && return a.max_thread == b.max_thread &&
@ -1333,23 +1333,15 @@ static bool do_transform(color_ostream &out,
get_tile_construct, ensure_building); get_tile_construct, ensure_building);
add_processor(processors, opts, "build", "build", opts.build, add_processor(processors, opts, "build", "build", opts.build,
get_tile_build, ensure_building); get_tile_build, ensure_building);
/* TODO: understand how this changes for v50
add_processor(processors, opts, "place", "place", opts.place, add_processor(processors, opts, "place", "place", opts.place,
get_tile_place, ensure_building); get_tile_place, ensure_building);
/* TODO: understand how this changes for v50
add_processor(processors, opts, "zone", "zone", opts.zone, get_tile_zone); add_processor(processors, opts, "zone", "zone", opts.zone, get_tile_zone);
add_processor(processors, opts, "query", "query", opts.query, add_processor(processors, opts, "query", "query", opts.query,
get_tile_query, ensure_building); get_tile_query, ensure_building);
add_processor(processors, opts, "query", "rooms", opts.rooms, add_processor(processors, opts, "query", "rooms", opts.rooms,
get_tile_rooms, ensure_building); get_tile_rooms, ensure_building);
*/ if (opts.place) */
out.printerr("'place' blueprints are not yet supported for the current version of DF\n");
if (opts.zone)
out.printerr("'zone' blueprints are not yet supported for the current version of DF\n");
if (opts.query)
out.printerr("'query' blueprints are not yet supported for the current version of DF\n");
if (opts.rooms)
out.printerr("'rooms' blueprints are not yet supported for the current version of DF\n");
if (processors.empty()) { if (processors.empty()) {
out.printerr("no phases requested! nothing to do!\n"); out.printerr("no phases requested! nothing to do!\n");
return false; return false;

@ -9,17 +9,17 @@ local valid_phase_list = {
'construct', 'construct',
'build', 'build',
'place', 'place',
'zone', -- 'zone',
'query', -- 'query',
'rooms', -- 'rooms',
} }
valid_phases = utils.invert(valid_phase_list) valid_phases = utils.invert(valid_phase_list)
local meta_phase_list = { local meta_phase_list = {
'build', 'build',
'place', 'place',
'zone', -- 'zone',
'query', -- 'query',
} }
meta_phases = utils.invert(meta_phase_list) meta_phases = utils.invert(meta_phase_list)
@ -167,7 +167,7 @@ end
function parse_commandline(opts, ...) function parse_commandline(opts, ...)
local positionals = process_args(opts, {...}) local positionals = process_args(opts, {...})
if opts.help then return end if not positionals or opts.help then return end
local width, height = tonumber(positionals[1]), tonumber(positionals[2]) local width, height = tonumber(positionals[1]), tonumber(positionals[2])
if is_bad_dim(width) or is_bad_dim(height) then if is_bad_dim(width) or is_bad_dim(height) then

@ -81,7 +81,7 @@ local included_elements = {
types=8, types=8,
} }
local function export_stockpile(name, opts) function export_stockpile(name, opts)
assert_safe_name(name) assert_safe_name(name)
name = STOCKPILES_DIR .. '/' .. name name = STOCKPILES_DIR .. '/' .. name
@ -101,7 +101,7 @@ local function export_stockpile(name, opts)
stockpiles_export(name, get_sp_id(opts), includedElements) stockpiles_export(name, get_sp_id(opts), includedElements)
end end
local function import_stockpile(name, opts) function import_stockpile(name, opts)
local is_library = false local is_library = false
if name:startswith('library/') then if name:startswith('library/') then
name = name:sub(9) name = name:sub(9)