Mercurial > hg > openttd
changeset 19315:655c7ab28799 draft
(svn r24204) -Fix: If a company is taken over or bankrupts, transfer exclusive transport rights to the new owner resp. cancel them.
author | frosch <frosch@openttd.org> |
---|---|
date | Sun, 06 May 2012 11:37:43 +0000 |
parents | 30db7658c013 |
children | b9059120ab1d |
files | src/economy.cpp |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/economy.cpp +++ b/src/economy.cpp @@ -360,7 +360,7 @@ } 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 @@ /* 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; + } + } } {