Skip to content

Commit 1989990

Browse files
committed
uniform-unstick print separator line in correct place
When the --all and --drop command-line parameters are used together, each unit's report should be separated by a blank line. Due to the print-code refactor in #1490, this separator line was moved between each unit's basic report and the unit's list of dropped items.
1 parent f805705 commit 1989990

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Template for new versions:
3535
- `uniform-unstick`: the ``--drop`` option now only evaluates clothing as possible items to drop
3636
- `uniform-unstick`: the ``--free`` option no longer redundantly reports an improperly assigned item when that item is removed from a uniform
3737
- `uniform-unstick`: the ``--drop`` and ``--free`` options now only drop items which are actually in a unit's inventory
38+
- `uniform-unstick`: the ``--all`` and ``--drop`` options, when used together, now print the separator line between each unit's report in the proper place
3839

3940
## Misc Improvements
4041

uniform-unstick.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ local function remove_item_from_position(squad_position, item_id)
111111
end
112112

113113
-- Will figure out which items need to be moved to the floor, returns an item_id:item map
114+
-- and a flag that indicates whether a separator line needs to be printed
114115
local function process(unit, args)
115116
local silent = args.all -- Don't print details if we're iterating through all dwarves
116117
local unit_name = dfhack.df2console(dfhack.units.getReadableName(unit))
@@ -266,15 +267,10 @@ local function process(unit, args)
266267
end
267268
end
268269

269-
-- add a spacing line if there was any output
270-
if printed then
271-
print()
272-
end
273-
274-
return to_drop
270+
return to_drop, printed
275271
end
276272

277-
local function do_drop(item_list)
273+
local function do_drop(item_list, printed)
278274
if not item_list then
279275
return
280276
end
@@ -295,6 +291,11 @@ local function do_drop(item_list)
295291
end
296292
end
297293
end
294+
295+
-- add a spacing line if there was any output
296+
if printed then
297+
print()
298+
end
298299
end
299300

300301
local function main(args)

0 commit comments

Comments
 (0)