Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Makeown-ing an enemy of civilization constantly producing vengeful thoughts #1212

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
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 changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Template for new versions:
## Fixes
- `advtools`: fix dfhack-added conversation options not appearing in the ask whereabouts conversation tree
- `gui/rename`: fix error when changing the language of a unit's name
- `makeown`: fix makeown-ing an enemy of your civilization (such as a giant) constantly giving everyone else vengeful thoughts about them

## Misc Improvements
- `assign-preferences`: new ``--show`` option to display the preferences of the selected unit
Expand Down
8 changes: 8 additions & 0 deletions makeown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ local function fix_histfig(unit)
entity_link(hf, eid, true, false, k)
::continue::
end
-- If you're makeown-ing an enemy of your civilization or group, people will feel vengeful without this
if el and df.histfig_entity_link_enemyst:is_instance(el) then
Copy link
Member

@myk002 myk002 Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not fix the problem. el can be a stale reference. the call to entity_link above can delete the memory that el points to.

local eid = el.entity_id
if eid == civ_id or eid == group_id then
hf.entity_links:erase(k)
el:delete()
end
end
end

-- add them to our civ/site if they aren't already
Expand Down