# HG changeset patch # User frosch # Date 2012-05-06 11:37:43 # Node ID d474b0c4882c94617f6b1cbcb65c2609720a079a # Parent 5341de857679a16bd957e425a47b9a3e41813cad (svn r24204) -Fix: If a company is taken over or bankrupts, transfer exclusive transport rights to the new owner resp. cancel them. diff --git a/src/economy.cpp b/src/economy.cpp --- a/src/economy.cpp +++ b/src/economy.cpp @@ -360,7 +360,7 @@ void ChangeOwnershipOfCompanyItems(Owner } if (new_owner == INVALID_OWNER) RebuildSubsidisedSourceAndDestinationCache(); - /* Take care of rating in towns */ + /* Take care of rating and transport rights in towns */ FOR_ALL_TOWNS(t) { /* If a company takes over, give the ratings to that company. */ if (new_owner != INVALID_OWNER) { @@ -378,6 +378,16 @@ void ChangeOwnershipOfCompanyItems(Owner /* Reset the ratings for the old owner */ t->ratings[old_owner] = RATING_INITIAL; ClrBit(t->have_ratings, old_owner); + + /* Transfer exclusive rights */ + if (t->exclusive_counter > 0 && t->exclusivity == old_owner) { + if (new_owner != INVALID_OWNER) { + t->exclusivity = new_owner; + } else { + t->exclusive_counter = 0; + t->exclusivity = INVALID_COMPANY; + } + } } {