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: