Codechange: replace magic numbers and C-style arrays with C++-style array for share owners
This commit is contained in:
@@ -1755,10 +1755,9 @@ bool AfterLoadGame()
|
||||
* 2) shares that are owned by inactive companies or self
|
||||
* (caused by cheating clients in earlier revisions) */
|
||||
for (Company *c : Company::Iterate()) {
|
||||
for (uint i = 0; i < 4; i++) {
|
||||
CompanyID company = c->share_owners[i];
|
||||
if (company == INVALID_COMPANY) continue;
|
||||
if (!Company::IsValidID(company) || company == c->index) c->share_owners[i] = INVALID_COMPANY;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user