Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Template for new versions:

## API
- add flexible casting to ``enum_field`` to enable explicit casting to more types
- Handle units without current soul in ``Units::getFocusPenalty``

## Lua

Expand Down
3 changes: 3 additions & 0 deletions library/modules/Units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2027,6 +2027,9 @@ int32_t Units::getFocusPenalty(df::unit* unit, need_type_set need_types) {
CHECK_NULL_POINTER(unit);

int max_penalty = INT_MAX;
if (!unit->status.current_soul) {
return max_penalty;
}
auto& needs = unit->status.current_soul->personality.needs;
for (auto const need : needs) {
if (need_types.test(need->id)) {
Expand Down
Loading