Codechange: Replace FOR_ALL_TOWNS with range-based for loops

This commit is contained in:
glx
2019-12-17 22:04:09 +01:00
committed by Niels Martin Hansen
parent 0b489f9924
commit ee7a8eebca
17 changed files with 39 additions and 88 deletions

View File

@@ -302,8 +302,6 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
assert(old_owner != _local_company);
}
Town *t;
assert(old_owner != new_owner);
{
@@ -357,7 +355,7 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
if (new_owner == INVALID_OWNER) RebuildSubsidisedSourceAndDestinationCache();
/* Take care of rating and transport rights in towns */
FOR_ALL_TOWNS(t) {
for (Town *t : Town::Iterate()) {
/* If a company takes over, give the ratings to that company. */
if (new_owner != INVALID_OWNER) {
if (HasBit(t->have_ratings, old_owner)) {