summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-05-06 11:37:43 +0000
committerfrosch <frosch@openttd.org>2012-05-06 11:37:43 +0000
commit3e7642abe5c8e91d1eac77586fe2f3e3c4dc97e9 (patch)
tree430fd0f3817fdf54c3f7db9efc7d51aa07ffd6eb /src
parent16e913505e3453a6f13e24954509ef733a11c9e1 (diff)
downloadopenttd-3e7642abe5c8e91d1eac77586fe2f3e3c4dc97e9.tar.xz
(svn r24204) -Fix: If a company is taken over or bankrupts, transfer exclusive transport rights to the new owner resp. cancel them.
Diffstat (limited to 'src')
-rw-r--r--src/economy.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index e449465f8..2311015da 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -360,7 +360,7 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_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 old_owner, Owner new_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;
+ }
+ }
}
{