From 1a940c24e3f0689320cb1047ae13a119b75594d3 Mon Sep 17 00:00:00 2001 From: smatz Date: Thu, 26 Feb 2009 14:10:57 +0000 Subject: [PATCH] (svn r15589) -Fix: drawing of waypoints with invalid owner was broken -Change: don't take over waypoints without owner, it could belong to a bankrupted company (and the code was broken) - savegame conversion code is a bit more liberal now, too --- src/waypoint.cpp | 2 +- src/waypoint_gui.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/waypoint.cpp b/src/waypoint.cpp index 81bc5cd86e..e34e0c0635 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -133,7 +133,7 @@ static Waypoint *FindDeletedWaypointCloseTo(TileIndex tile) uint thres = 8; FOR_ALL_WAYPOINTS(wp) { - if (wp->deleted && (wp->owner == OWNER_NONE || wp->owner == _current_company)) { + if (wp->deleted && wp->owner == _current_company) { uint cur_dist = DistanceManhattan(tile, wp->xy); if (cur_dist < thres) { diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index f9cb86a000..91222f3acd 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -36,7 +36,7 @@ public: WaypointWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) { this->wp = GetWaypoint(this->window_number); - this->owner = this->wp->owner; + if (this->wp->owner != OWNER_NONE) this->owner = this->wp->owner; this->flags4 |= WF_DISABLE_VP_SCROLL; InitializeWindowViewport(this, 3, 17, 254, 86, this->wp->xy, ZOOM_LVL_MIN); @@ -53,6 +53,9 @@ public: { /* You can only change your own waypoints */ this->SetWidgetDisabledState(WAYPVW_RENAME, this->wp->owner != _local_company); + /* Disable the widget for waypoints with no owner (after company bankrupt) */ + this->SetWidgetDisabledState(WAYPVW_SHOW_TRAINS, this->wp->owner == OWNER_NONE); + SetDParam(0, this->wp->index); this->DrawWidgets();