mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-02-03 18:08:14 +01:00
(svn r19995) [1.0] -Backport from trunk
- Fix: Owner of the Waypoint View window was not properly set (r19990) - Fix: Close list of vehicles with given oil rig in orders when the oil rig is deleted (r19956) - Fix: Close list of vehicles with given buoy/oil rig in orders when switching company (r19955) - Fix: Do not close list of waypoint's trains when the waypoint view is closed when it is sticky (r19952) - Fix: Close buoy's vehicle list when the buoy is deleted [FS#3869] (r19951) -Prepare: for 1.0.2
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "company_func.h"
|
||||
#include "company_base.h"
|
||||
#include "roadveh.h"
|
||||
#include "functions.h"
|
||||
#include "window_func.h"
|
||||
@@ -82,7 +83,10 @@ Station::~Station()
|
||||
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
|
||||
|
||||
DeleteWindowById(WC_STATION_VIEW, index);
|
||||
WindowNumber wno = (this->index << 16) | VLW_STATION_LIST | this->owner;
|
||||
|
||||
Owner owner = this->owner;
|
||||
if (!Company::IsValidID(owner)) owner = _local_company;
|
||||
WindowNumber wno = (this->index << 16) | VLW_STATION_LIST | owner;
|
||||
DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11));
|
||||
DeleteWindowById(WC_ROADVEH_LIST, wno | (VEH_ROAD << 11));
|
||||
DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11));
|
||||
|
||||
@@ -1190,33 +1190,12 @@ struct StationViewWindow : public Window {
|
||||
this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
|
||||
break;
|
||||
|
||||
case SVW_TRAINS: { // Show a list of scheduled trains to this station
|
||||
const Station *st = Station::Get(this->window_number);
|
||||
ShowVehicleListWindow(st->owner, VEH_TRAIN, (StationID)this->window_number);
|
||||
case SVW_TRAINS: // Show list of scheduled trains to this station
|
||||
case SVW_ROADVEHS: // Show list of scheduled road-vehicles to this station
|
||||
case SVW_PLANES: // Show list of scheduled aircraft to this station
|
||||
case SVW_SHIPS: // Show list of scheduled ships to this station
|
||||
ShowVehicleListWindow(this->owner, (VehicleType)(widget - SVW_TRAINS), (StationID)this->window_number);
|
||||
break;
|
||||
}
|
||||
|
||||
case SVW_ROADVEHS: { // Show a list of scheduled road-vehicles to this station
|
||||
const Station *st = Station::Get(this->window_number);
|
||||
ShowVehicleListWindow(st->owner, VEH_ROAD, (StationID)this->window_number);
|
||||
break;
|
||||
}
|
||||
|
||||
case SVW_PLANES: { // Show a list of scheduled aircraft to this station
|
||||
const Station *st = Station::Get(this->window_number);
|
||||
/* Since oilrigs have no owners, show the scheduled aircraft of local company */
|
||||
Owner owner = (st->owner == OWNER_NONE) ? _local_company : st->owner;
|
||||
ShowVehicleListWindow(owner, VEH_AIRCRAFT, (StationID)this->window_number);
|
||||
break;
|
||||
}
|
||||
|
||||
case SVW_SHIPS: { // Show a list of scheduled ships to this station
|
||||
const Station *st = Station::Get(this->window_number);
|
||||
/* Since oilrigs/bouys have no owners, show the scheduled ships of local company */
|
||||
Owner owner = (st->owner == OWNER_NONE) ? _local_company : st->owner;
|
||||
ShowVehicleListWindow(owner, VEH_SHIP, (StationID)this->window_number);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ enum StationViewWidgets {
|
||||
SVW_RENAME = 6, ///< 'Rename' button
|
||||
SVW_TRAINS = 7, ///< List of scheduled trains button
|
||||
SVW_ROADVEHS, ///< List of scheduled road vehs button
|
||||
SVW_PLANES, ///< List of scheduled planes button
|
||||
SVW_SHIPS, ///< List of scheduled ships button
|
||||
SVW_PLANES, ///< List of scheduled planes button
|
||||
};
|
||||
|
||||
/** Types of cargo to display for station coverage. */
|
||||
|
||||
@@ -1245,7 +1245,12 @@ static WindowDesc _vehicle_list_desc(
|
||||
|
||||
static void ShowVehicleListWindowLocal(CompanyID company, uint16 VLW_flag, VehicleType vehicle_type, uint16 unique_number)
|
||||
{
|
||||
if (!Company::IsValidID(company)) return;
|
||||
if (!Company::IsValidID(company)) {
|
||||
_vehicle_list_desc.flags |= WDF_CONSTRUCTION;
|
||||
company = _local_company;
|
||||
} else {
|
||||
_vehicle_list_desc.flags &= ~WDF_CONSTRUCTION;
|
||||
}
|
||||
|
||||
_vehicle_list_desc.cls = GetWindowClassForVehicleType(vehicle_type);
|
||||
WindowNumber num = (unique_number << 16) | (vehicle_type << 11) | VLW_flag | company;
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#include "window_func.h"
|
||||
#include "newgrf_station.h"
|
||||
#include "waypoint_base.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "company_func.h"
|
||||
#include "company_base.h"
|
||||
|
||||
/**
|
||||
* Draw a waypoint
|
||||
@@ -53,5 +56,11 @@ Waypoint::~Waypoint()
|
||||
DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
|
||||
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
|
||||
|
||||
Owner owner = this->owner;
|
||||
if (!Company::IsValidID(owner)) owner = _local_company;
|
||||
WindowNumber wno = (this->index << 16) | VLW_WAYPOINT_LIST | owner;
|
||||
DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11));
|
||||
DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11));
|
||||
|
||||
this->sign.MarkDirty();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "strings_func.h"
|
||||
#include "command_func.h"
|
||||
#include "company_func.h"
|
||||
#include "company_base.h"
|
||||
#include "window_func.h"
|
||||
#include "waypoint_base.h"
|
||||
|
||||
@@ -43,8 +44,6 @@ public:
|
||||
this->wp = Waypoint::Get(window_number);
|
||||
this->vt = (wp->string_id == STR_SV_STNAME_WAYPOINT) ? VEH_TRAIN : VEH_SHIP;
|
||||
|
||||
if (this->wp->owner != OWNER_NONE) this->owner = this->wp->owner;
|
||||
|
||||
this->CreateNestedTree(desc);
|
||||
if (this->vt == VEH_TRAIN) {
|
||||
this->GetWidget<NWidgetCore>(WAYPVW_SHOW_VEHICLES)->SetDataTip(STR_TRAIN, STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP);
|
||||
@@ -53,7 +52,9 @@ public:
|
||||
}
|
||||
this->FinishInitNested(desc, window_number);
|
||||
|
||||
if (this->wp->owner != OWNER_NONE) this->owner = this->wp->owner;
|
||||
this->flags4 |= WF_DISABLE_VP_SCROLL;
|
||||
|
||||
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WAYPVW_VIEWPORT);
|
||||
nvp->InitializeViewport(this, this->wp->xy, ZOOM_LVL_MIN);
|
||||
|
||||
@@ -62,7 +63,9 @@ public:
|
||||
|
||||
~WaypointWindow()
|
||||
{
|
||||
DeleteWindowById(GetWindowClassForVehicleType(this->vt), (this->window_number << 16) | (this->vt << 11) | VLW_WAYPOINT_LIST | this->wp->owner);
|
||||
Owner owner = this->owner;
|
||||
if (!Company::IsValidID(owner)) owner = _local_company;
|
||||
DeleteWindowById(GetWindowClassForVehicleType(this->vt), (this->window_number << 16) | (this->vt << 11) | VLW_WAYPOINT_LIST | owner, false);
|
||||
}
|
||||
|
||||
virtual void SetStringParameters(int widget) const
|
||||
@@ -92,7 +95,7 @@ public:
|
||||
break;
|
||||
|
||||
case WAYPVW_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders
|
||||
ShowVehicleListWindow((this->wp->owner == OWNER_NONE) ? _local_company : this->wp->owner, this->vt, this->wp);
|
||||
ShowVehicleListWindow(this->owner, this->vt, this->wp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user