Skip to content

Commit 3876041

Browse files
authored
Merge branch 'DFHack:develop' into cleaners_etc
2 parents 961ceb8 + 5399d11 commit 3876041

8 files changed

Lines changed: 61 additions & 18 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ cmake_policy(SET CMP0074 NEW)
77
project(dfhack)
88

99
# set up versioning.
10-
set(DF_VERSION "50.13")
11-
set(DFHACK_RELEASE "r5")
10+
set(DF_VERSION "50.14")
11+
set(DFHACK_RELEASE "r1")
1212
set(DFHACK_PRERELEASE FALSE)
1313

1414
set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")

data/blueprints/dreamfort.csv

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,11 +2132,11 @@ build3/services_build3
21322132

21332133
"#zone label(services_zones) start(18; 18) hidden() message(Don't forget to assign a doctor to the hospital!
21342134
If you'd like to fill your wells via bucket brigade instead of routing water (e.g. with the aquifer_tap library blueprint), activate the inactive pond zones one level down from where the wells will be built.) garbage dump, hospital, taverrn, barracks, archery range, and pond zones"
2135-
,,,,,,,,,,,,,"j{name=""Jail 1""}(4x5)",,,,"j{name=""Jail 2""}(4x5)",,,,"j{name=""Jail 3""}(4x5)",,,,"j{name=""Jail 4""}(4x5)",,,,"j{name=""Jail 5""}(4x5)"
2136-
,"b{location=tavern/bigpub name=""Rented room 1""}(1x3)","b{location=tavern/bigpub name=""Rented room 2""}(1x3)","b{location=tavern/bigpub name=""Rented room 3""}(1x3)",,"b{location=tavern/bigpub name=""Rented room 4""}(1x3)","b{location=tavern/bigpub name=""Rented room 5""}(1x3)","b{location=tavern/bigpub name=""Rented room 6""}(1x3)",,"b{location=tavern/bigpub name=""Rented room 7""}(1x3)","b{location=tavern/bigpub name=""Rented room 8""}(1x3)","b{location=tavern/bigpub name=""Rented room 9""}(1x3)",,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
2137-
,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
2138-
,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
2139-
"h{location=tavern/bigpub allow=residents name=""Grand hall tavern""}(13x31)",,`,,,,`,,,,`,,,,`,,,,`,,,,`,,,,`,,,,`
2135+
,,,,,,,,,,,,j/jail1,"j/jail1{name=""Jail 1""}(4x5)",j/jail1,j/jail1,j/jail1,"j{name=""Jail 2""}(4x5)",,,,"j{name=""Jail 3""}(4x5)",,,,"j{name=""Jail 4""}(4x5)",,,,"j{name=""Jail 5""}(4x5)"
2136+
,"b{location=tavern/bigpub name=""Rented room 1""}(1x3)","b{location=tavern/bigpub name=""Rented room 2""}(1x3)","b{location=tavern/bigpub name=""Rented room 3""}(1x3)",,"b{location=tavern/bigpub name=""Rented room 4""}(1x3)","b{location=tavern/bigpub name=""Rented room 5""}(1x3)","b{location=tavern/bigpub name=""Rented room 6""}(1x3)",,"b{location=tavern/bigpub name=""Rented room 7""}(1x3)","b{location=tavern/bigpub name=""Rented room 8""}(1x3)","b{location=tavern/bigpub name=""Rented room 9""}(1x3)",j/jail1,j/jail1,j/jail1,j/jail1,j/jail1,`,`,`,,`,`,`,,`,`,`,,`,`,`
2137+
,`,`,`,,`,`,`,,`,`,`,j/jail1,j/jail1,j/jail1,j/jail1,j/jail1,`,`,`,,`,`,`,,`,`,`,,`,`,`
2138+
,`,`,`,,`,`,`,,`,`,`,j/jail1,j/jail1,j/jail1,j/jail1,j/jail1,`,`,`,,`,`,`,,`,`,`,,`,`,`
2139+
"h{location=tavern/bigpub allow=residents name=""Grand hall tavern""}(13x31)",,`,,,,`,,,,`,,,j/jail1,j/jail1,j/jail1,j/jail1,,`,,,,`,,,,`,,,,`
21402140
,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`
21412141
,`,`,`,`,`,`,`,`,`,`,`,,,,,,,,,,,,,,`,o/interrogation,o/interrogation,o/interrogation,o/interrogation,o/interrogation,o/interrogation,o/interrogation
21422142
,`,`,`,`,`,`,`,`,`,`,`,,"B{name=""Marksdwarf barracks""}a{name=""Shooting gallery"" shoot_from=""south""}",Ba,Ba,Ba,Ba,Ba,Ba,Ba,Ba,Ba,Ba,,`,o/interrogation,"j{name=""Drunk tank""}",j,j,j,j,o/interrogation
@@ -2360,7 +2360,7 @@ Assign a minecart to the training ammo quantum dump with ""assign-minecarts all"
23602360

23612361
,`,b,`,,`,b,`,,`,b,`,,`,`,`,,`,`,`,,t,l,b,,`,`,`,,`,`,`
23622362
,`,h,`,,`,h,`,,`,h,`,,`,`,`,,`,`,`,,c,v,`,,`,`,`,,`,`,`
2363-
,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
2363+
,`,f,`,,`,f,`,,`,f,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
23642364
,,`,,,,`,,,,`,,,,`,,,,`,,,,d,,,,`,,,,`
23652365
,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`
23662366
,`,`,`,`,`,`,`,`,`,`,`,,,,,,,,,,,,,,`
@@ -2468,7 +2468,7 @@ Assign a minecart to the training ammo quantum dump with ""assign-minecarts all"
24682468

24692469
,b,~,b,,b,~,b,,b,~,b,,t,l,b,,t,l,b,,~,~,~,,t,l,b,,t,l,b
24702470
,h,~,h,,h,~,h,,h,~,h,,c,v,`,,c,v,`,,~,~,`,,c,v,`,,c,v,`
2471-
,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
2471+
,f,~,f,,f,~,f,,f,~,f,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
24722472
,,d,,,,d,,,,d,,,,d,,,,d,,,,~,,,,d,,,,d
24732473
,`,`,`,s,`,`,`,s,`,`,`,,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`
24742474
,`,`,`,`,`,`,`,`,`,`,`,,,,,,,,,,,,,,`

docs/changelog.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ Template for new versions:
7070

7171
## Removed
7272

73+
# 50.14-r1
74+
75+
## New Tools
76+
77+
## New Features
78+
79+
## Fixes
80+
- `preserve-rooms`: don't reserve a room for citizens that you expel from the fort
81+
- `autobutcher`: fix regression in ordering of butcherable animals
82+
83+
## Misc Improvements
84+
85+
## Documentation
86+
87+
## API
88+
89+
## Lua
90+
91+
## Removed
92+
7393
# 50.13-r5
7494

7595
## New Tools

library/modules/Gui.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ DEFINE_GET_FOCUS_STRING_HANDLER(world)
258258
}
259259

260260
static bool widget_is_visible(df::widget * w) {
261-
return w && w->visibility_flags.bits.WIDGET_VISIBILITY_VISIBLE;
261+
return w && w->flag.bits.WIDGET_VISIBILITY_VISIBLE;
262262
}
263263

264264
static size_t get_num_children(df::widget * w) {
@@ -700,7 +700,7 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
700700
newFocusString += "/ImageCreator";
701701
focusStrings.push_back(newFocusString);
702702
}
703-
if (game->main_interface.unit_selector.visibility_flags.bits.WIDGET_VISIBILITY_ACTIVE) {
703+
if (game->main_interface.unit_selector.flag.bits.WIDGET_VISIBILITY_ACTIVE) {
704704
newFocusString = baseFocus;
705705
newFocusString += "/UnitSelector/";
706706
newFocusString += enum_item_key(game->main_interface.unit_selector.context);

library/modules/Units.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ bool Units::isGay(df::unit *unit) {
312312
if (!unit->status.current_soul)
313313
return false;
314314

315-
auto &o_flag = unit->status.current_soul->orientation_flags;
316-
return (!isFemale(unit) || !(o_flag.bits.marry_male && o_flag.bits.romance_male))
317-
&& (!isMale(unit) || !(o_flag.bits.marry_female && o_flag.bits.romance_female));
315+
df::orientation_flags orientation = unit->status.current_soul->orientation_flags;
316+
return (!Units::isFemale(unit) || !(orientation.whole & (orientation.mask_marry_male | orientation.mask_romance_male)))
317+
&& (!Units::isMale(unit) || !(orientation.whole & (orientation.mask_marry_female | orientation.mask_romance_female)));
318318
}
319319

320320
bool Units::isNaked(df::unit *unit, bool no_items) {

plugins/autobutcher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static void doMarkForSlaughter(df::unit *unit) {
213213
unit->flags2.bits.slaughter = 1;
214214
}
215215

216-
// returns true if a should be butchered before b
216+
// returns true if b should be butchered before a
217217
static bool compareKids(df::unit *a, df::unit *b) {
218218
if (isHighPriority(a) != isHighPriority(b))
219219
return isHighPriority(b);
@@ -222,7 +222,7 @@ static bool compareKids(df::unit *a, df::unit *b) {
222222
return Units::getAge(a, true) > Units::getAge(b, true);
223223
}
224224

225-
// returns true if a should be butchered before b
225+
// returns true if b should be butchered before a
226226
static bool compareAdults(df::unit* a, df::unit* b) {
227227
if (isHighPriority(a) != isHighPriority(b))
228228
return isHighPriority(b);

plugins/preserve-rooms.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
#include "modules/Units.h"
1010
#include "modules/World.h"
1111

12+
#include "df/army.h"
13+
#include "df/army_controller.h"
1214
#include "df/building_civzonest.h"
1315
#include "df/historical_figure.h"
16+
#include "df/historical_figure_info.h"
1417
#include "df/histfig_hf_link.h"
18+
#include "df/state_profilest.h"
1519
#include "df/unit.h"
1620
#include "df/world.h"
1721

@@ -404,6 +408,15 @@ static void scrub_reservations(color_ostream &out) {
404408
pending_reassignment.erase(hfid);
405409
}
406410

411+
static bool was_expelled(df::historical_figure *hf) {
412+
if (!hf || !hf->info || !hf->info->whereabouts)
413+
return false;
414+
auto army = df::army::find(hf->info->whereabouts->army_id);
415+
if (!army || !army->controller)
416+
return false;
417+
return army->controller->goal == df::army_controller_goal_type::MOVE_TO_SITE;
418+
}
419+
407420
// handles when units disappear from their assignments compared to the last scan
408421
static void handle_missing_assignments(color_ostream &out,
409422
const unordered_set<int32_t> & active_unit_ids,
@@ -421,6 +434,10 @@ static void handle_missing_assignments(color_ostream &out,
421434
int32_t hfid = it->second.first;
422435
int32_t spouse_hfid = it->second.second;
423436
auto hf = df::historical_figure::find(hfid);
437+
if (!hf) {
438+
// if the historical figure was culled, bail
439+
continue;
440+
}
424441
auto unit = df::unit::find(hf->unit_id);
425442
if (!unit) {
426443
// if unit data is completely gone, then they're not likely to come back
@@ -430,8 +447,14 @@ static void handle_missing_assignments(color_ostream &out,
430447
// unit is still alive on the map; assume the unassigment was intentional/expected
431448
continue;
432449
}
433-
if (!Units::isCitizen(unit, true) && !Units::isResident(unit, true))
450+
if (!Units::isCitizen(unit, true) && !Units::isResident(unit, true)) {
451+
// ignore units that are not members of the fort
452+
continue;
453+
}
454+
if (was_expelled(hf)) {
455+
// ignore expelled units
434456
continue;
457+
}
435458
auto zone = virtual_cast<df::building_civzonest>(df::building::find(zone_id));
436459
if (!zone)
437460
continue;

0 commit comments

Comments
 (0)