From 012871f24c4bb2207c1423f9b2eff9bbbc1b7c64 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 12 May 2012 07:46:05 +0000 Subject: [PATCH] (svn r24231) [1.2] -Backport from trunk: - Fix: Immediately do the cargo payment on vehicle crashes instead of when they are cleared [FS#5152] (r24219) - Fix: The confirmation window to abort world generation was hidden during world generation, so actually you could not abort it [FS#5159] (r24214) - Fix: If a company is taken over or bankrupts, transfer exclusive transport rights to the new owner respectively cancel them (r24204) --- src/economy.cpp | 12 +++++++++++- src/vehicle.cpp | 3 +++ src/window.cpp | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index e449465f8c..2311015da7 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; + } + } } { diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 4851a4529e..7dababb228 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -194,6 +194,9 @@ uint Vehicle::Crash(bool flooded) SetWindowDirty(WC_VEHICLE_DETAILS, this->index); SetWindowDirty(WC_VEHICLE_DEPOT, this->tile); + delete this->cargo_payment; + this->cargo_payment = NULL; + return pass; } diff --git a/src/window.cpp b/src/window.cpp index 2ea83c9ff1..c171545dbb 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -557,7 +557,7 @@ static bool MayBeShown(const Window *w) switch (w->window_class) { case WC_MAIN_WINDOW: ///< The background, i.e. the game. case WC_MODAL_PROGRESS: ///< The actual progress window. - case WC_QUERY_STRING: ///< The abort window. + case WC_CONFIRM_POPUP_QUERY: ///< The abort window. return true; default: