Skip to content

Commit

Permalink
Merge pull request DFHack#4954 from myk002/myk_is_gay
Browse files Browse the repository at this point in the history
[Units] fix regression in Units::isGay()
  • Loading branch information
myk002 authored Sep 22, 2024
2 parents 6e9f689 + 91a40ba commit 0ad1fd5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Template for new versions:

## Fixes
- `preserve-rooms`: don't reserve a room for citizens that you expel from the fort
- `autobutcher`: fix regression in ordering of butcherable animals

## Misc Improvements

Expand Down
6 changes: 3 additions & 3 deletions library/modules/Units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ bool Units::isGay(df::unit *unit) {
if (!unit->status.current_soul)
return false;

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

bool Units::isNaked(df::unit *unit, bool no_items) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/autobutcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static void doMarkForSlaughter(df::unit *unit) {
unit->flags2.bits.slaughter = 1;
}

// returns true if a should be butchered before b
// returns true if b should be butchered before a
static bool compareKids(df::unit *a, df::unit *b) {
if (isHighPriority(a) != isHighPriority(b))
return isHighPriority(b);
Expand All @@ -222,7 +222,7 @@ static bool compareKids(df::unit *a, df::unit *b) {
return Units::getAge(a, true) > Units::getAge(b, true);
}

// returns true if a should be butchered before b
// returns true if b should be butchered before a
static bool compareAdults(df::unit* a, df::unit* b) {
if (isHighPriority(a) != isHighPriority(b))
return isHighPriority(b);
Expand Down

0 comments on commit 0ad1fd5

Please sign in to comment.