Re-add company shares

This commit is contained in:
Jonathan G Rennison
2023-05-30 18:57:42 +01:00
parent 6297abdb3b
commit bac8f032da
80 changed files with 1297 additions and 13 deletions

View File

@@ -2116,6 +2116,21 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionBefore(SLV_84)) {
/* Set all share owners to INVALID_COMPANY for
* 1) all inactive companies
* (when inactive companies were stored in the savegame - TTD, TTDP and some
* *really* old revisions of OTTD; else it is already set in InitializeCompanies())
* 2) shares that are owned by inactive companies or self
* (caused by cheating clients in earlier revisions) */
for (Company *c : Company::Iterate()) {
for (auto &share_owner : c->share_owners) {
if (share_owner == INVALID_COMPANY) continue;
if (!Company::IsValidID(share_owner) || share_owner == c->index) share_owner = INVALID_COMPANY;
}
}
}
/* The water class was moved/unified. */
if (IsSavegameVersionBefore(SLV_146)) {
for (TileIndex t = 0; t < map_size; t++) {