diff --git a/NEWS.rst b/NEWS.rst index 97daeee32..0715ccae4 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -41,6 +41,10 @@ New Scripts ----------- - `load-save`: loads a save non-interactively +Fixes +----- +- Buildings::setOwner() changes now persist properly when saved + DFHack 0.43.03-r1 ================= diff --git a/library/modules/Buildings.cpp b/library/modules/Buildings.cpp index b7933f6ef..9d672cd58 100644 --- a/library/modules/Buildings.cpp +++ b/library/modules/Buildings.cpp @@ -239,6 +239,7 @@ bool Buildings::setOwner(df::building *bld, df::unit *unit) if (unit) { + bld->owner_id = unit->id; unit->owned_buildings.push_back(bld); if (auto spouse = df::unit::find(unit->relationship_ids[df::unit_relationship_type::Spouse])) @@ -248,6 +249,10 @@ bool Buildings::setOwner(df::building *bld, df::unit *unit) blist.push_back(bld); } } + else + { + bld->owner_id = -1; + } return true; }