Skip to content

Commit d7dffbb

Browse files
authored
Merge pull request #1127 from myk002/myk_bld_updates
update to canonicalized structures
2 parents 01ae521 + 1335af6 commit d7dffbb

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

gui/advfort.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,11 +1430,11 @@ function track_stop_configure(bld) --TODO: dedicated widget with nice interface
14301430
else
14311431
dialog.showListPrompt("Dumping direction", "Choose dumping:",COLOR_WHITE,dump_choices,function ( index,choice)
14321432
if choice.x then
1433-
bld.use_dump=1 --??
1433+
bld.track_flags.use_dump=true
14341434
bld.dump_x_shift=choice.x
14351435
bld.dump_y_shift=choice.y
14361436
else
1437-
bld.use_dump=0
1437+
bld.track_flags.use_dump=false
14381438
end
14391439
end)
14401440
end

internal/quickfort/build.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ end
634634
local function make_trackstop_entry(direction, friction)
635635
local label, fields, transform = 'No Dump', {friction=friction}, nil
636636
if direction then
637-
fields.use_dump = 1
637+
ensure_key(fields, 'track_flags').use_dump = true
638638
for k,v in pairs(direction) do
639639
local trackstop_data_entry = trackstop_data[k][v]
640640
label = trackstop_data_entry.label

internal/quickfort/place.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ local function custom_stockpile(_, keys)
227227
props.wheelbarrows = nil
228228
end
229229
if props.links_only == 'true' then
230-
db_entry.props.use_links_only = 1
230+
ensure_key(db_entry.props, 'stockpile_flag').use_links_only = 1
231231
props.links_only = nil
232232
end
233233
if props.name then

internal/quickfort/zone.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ end
2323

2424
local function parse_gather_props(zone_data, props)
2525
if props.pick_trees == 'false' then
26-
ensure_keys(zone_data, 'zone_settings', 'gather').pick_trees = false
26+
ensure_keys(zone_data, 'zone_settings', 'gather', 'flags').pick_trees = false
2727
props.pick_trees = nil
2828
end
2929
if props.pick_shrubs == 'false' then
30-
ensure_keys(zone_data, 'zone_settings', 'gather').pick_shrubs = false
30+
ensure_keys(zone_data, 'zone_settings', 'gather', 'flags').pick_shrubs = false
3131
props.pick_shrubs = nil
3232
end
3333
if props.gather_fallen == 'false' then
34-
ensure_keys(zone_data, 'zone_settings', 'gather').gather_fallen = false
34+
ensure_keys(zone_data, 'zone_settings', 'gather', 'flags').gather_fallen = false
3535
props.gather_fallen = nil
3636
end
3737
end
@@ -105,9 +105,9 @@ local zone_db_raw = {
105105
b={label='Bedroom', default_data={type=df.civzone_type.Bedroom}},
106106
h={label='Dining Hall', default_data={type=df.civzone_type.DiningHall}},
107107
n={label='Pen/Pasture', default_data={type=df.civzone_type.Pen,
108-
assign={zone_settings={pen={unk=1}}}}},
108+
assign={zone_settings={pen={check_occupants=true}}}}},
109109
p={label='Pit/Pond', props_fn=parse_pit_pond_props, default_data={type=df.civzone_type.Pond,
110-
assign={zone_settings={pit_pond=df.building_civzonest.T_zone_settings.T_pit_pond.top_of_pit}}}},
110+
assign={zone_settings={pond={flag={keep_filled=true}}}}}},
111111
w={label='Water Source', default_data={type=df.civzone_type.WaterSource}},
112112
j={label='Dungeon', default_data={type=df.civzone_type.Dungeon}},
113113
f={label='Fishing', default_data={type=df.civzone_type.FishingArea}},
@@ -122,12 +122,13 @@ local zone_db_raw = {
122122
T={label='Tomb', props_fn=parse_tomb_props, default_data={type=df.civzone_type.Tomb,
123123
assign={zone_settings={tomb={whole=1}}}}},
124124
g={label='Gather/Pick Fruit', props_fn=parse_gather_props, default_data={type=df.civzone_type.PlantGathering,
125-
assign={zone_settings={gather={pick_trees=true, pick_shrubs=true, gather_fallen=true}}}}},
125+
assign={zone_settings={gather={flags={pick_trees=true, pick_shrubs=true, gather_fallen=true}}}}}},
126126
c={label='Clay', default_data={type=df.civzone_type.ClayCollection}},
127127
}
128128
for _, v in pairs(zone_db_raw) do
129129
utils.assign(v, zone_template)
130-
ensure_key(v.default_data, 'assign').is_active = 8 -- set to active by default
130+
-- set to active by default
131+
ensure_keys(v.default_data, 'assign', 'spec_sub_flag').active = true
131132
end
132133

133134
-- we may want to offer full name aliases for the single letter ones above
@@ -241,7 +242,7 @@ local function parse_zone_config(c, props)
241242
utils.assign(zone_data, db_entry.default_data)
242243
zone_data.location = parse_location_props(props)
243244
if props.active == 'false' then
244-
zone_data.is_active = 0
245+
ensure_key(zone_data, 'spec_sub_flag').active = false
245246
props.active = nil
246247
end
247248
if props.name then

trackstop.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ end
7575

7676
function TrackStopOverlay:getDumpDirection()
7777
local building = dfhack.gui.getSelectedBuilding()
78-
local use_dump = building.use_dump
78+
local use_dump = building.track_flags.use_dump
7979
local dump_x_shift = building.dump_x_shift
8080
local dump_y_shift = building.dump_y_shift
8181

82-
if use_dump == 0 then
82+
if not use_dump then
8383
return NONE
8484
else
8585
if dump_x_shift == 0 and dump_y_shift == -1 then
@@ -98,23 +98,23 @@ function TrackStopOverlay:setDumpDirection(direction)
9898
local building = dfhack.gui.getSelectedBuilding()
9999

100100
if direction == NONE then
101-
building.use_dump = 0
101+
building.track_flags.use_dump = false
102102
building.dump_x_shift = 0
103103
building.dump_y_shift = 0
104104
elseif direction == NORTH then
105-
building.use_dump = 1
105+
building.track_flags.use_dump = true
106106
building.dump_x_shift = 0
107107
building.dump_y_shift = -1
108108
elseif direction == EAST then
109-
building.use_dump = 1
109+
building.track_flags.use_dump = true
110110
building.dump_x_shift = 1
111111
building.dump_y_shift = 0
112112
elseif direction == SOUTH then
113-
building.use_dump = 1
113+
building.track_flags.use_dump = true
114114
building.dump_x_shift = 0
115115
building.dump_y_shift = 1
116116
elseif direction == WEST then
117-
building.use_dump = 1
117+
building.track_flags.use_dump = true
118118
building.dump_x_shift = -1
119119
building.dump_y_shift = 0
120120
end

0 commit comments

Comments
 (0)