Merge pull request #4068 from ab9rf/owned_buildings

change `unitst::owned_buildings` to `vector<building_civzonest*>`
develop
Myk 2023-11-28 22:59:18 -08:00 committed by GitHub
commit 82cbff4e11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

@ -357,17 +357,15 @@ bool Buildings::setOwner(df::building_civzonest *bld, df::unit *unit)
if (bld->assigned_unit == unit)
return true;
df::building * pbld = virtual_cast<df::building>(bld);
if (bld->assigned_unit)
{
auto &blist = bld->assigned_unit->owned_buildings;
vector_erase_at(blist, linear_index(blist, pbld));
vector_erase_at(blist, linear_index(blist, bld));
if (auto spouse = df::unit::find(bld->assigned_unit->relationship_ids[df::unit_relationship_type::Spouse]))
{
auto &blist = spouse->owned_buildings;
vector_erase_at(blist, linear_index(blist, pbld));
vector_erase_at(blist, linear_index(blist, bld));
}
}
@ -381,7 +379,7 @@ bool Buildings::setOwner(df::building_civzonest *bld, df::unit *unit)
if (auto spouse = df::unit::find(unit->relationship_ids[df::unit_relationship_type::Spouse]))
{
auto &blist = spouse->owned_buildings;
if (bld->canUseSpouseRoom() && linear_index(blist, pbld) < 0)
if (bld->canUseSpouseRoom() && linear_index(blist, bld) < 0)
blist.push_back(bld);
}
}

@ -1 +1 @@
Subproject commit 6d246b716bbaf7de5ff9633293a859732c741d8c
Subproject commit ab028aa9fe8c75eb56c5e1a80cbd14d2a897bfc4