Allow ctrl-clicking other company trains on own track to start/stop
See: #392
This commit is contained in:
@@ -3426,7 +3426,7 @@ void CcStartStopVehicle(const CommandCost &result, TileIndex tile, uint32 p1, ui
|
|||||||
if (result.Failed()) return;
|
if (result.Failed()) return;
|
||||||
|
|
||||||
const Vehicle *v = Vehicle::GetIfValid(p1);
|
const Vehicle *v = Vehicle::GetIfValid(p1);
|
||||||
if (v == nullptr || !v->IsPrimaryVehicle() || v->owner != _local_company) return;
|
if (v == nullptr || !v->IsPrimaryVehicle()) return;
|
||||||
|
|
||||||
StringID msg = (v->vehstatus & VS_STOPPED) ? STR_VEHICLE_COMMAND_STOPPED : STR_VEHICLE_COMMAND_STARTED;
|
StringID msg = (v->vehstatus & VS_STOPPED) ? STR_VEHICLE_COMMAND_STOPPED : STR_VEHICLE_COMMAND_STARTED;
|
||||||
Point pt = RemapCoords(v->x_pos, v->y_pos, v->z_pos);
|
Point pt = RemapCoords(v->x_pos, v->y_pos, v->z_pos);
|
||||||
|
@@ -111,6 +111,7 @@
|
|||||||
#include "blitter/32bpp_base.hpp"
|
#include "blitter/32bpp_base.hpp"
|
||||||
#include "object_map.h"
|
#include "object_map.h"
|
||||||
#include "newgrf_object.h"
|
#include "newgrf_object.h"
|
||||||
|
#include "infrastructure_func.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -4557,7 +4558,7 @@ HandleViewportClickedResult HandleViewportClicked(const Viewport *vp, int x, int
|
|||||||
if (IsCompanyBuildableVehicleType(v)) {
|
if (IsCompanyBuildableVehicleType(v)) {
|
||||||
v = v->First();
|
v = v->First();
|
||||||
WindowClass wc = _thd.GetCallbackWnd()->window_class;
|
WindowClass wc = _thd.GetCallbackWnd()->window_class;
|
||||||
if (_ctrl_pressed && v->owner == _local_company) {
|
if (_ctrl_pressed && IsVehicleControlAllowed(v, _local_company)) {
|
||||||
StartStopVehicle(v, true);
|
StartStopVehicle(v, true);
|
||||||
} else if (wc != WC_CREATE_TEMPLATE && wc != WC_TEMPLATEGUI_MAIN) {
|
} else if (wc != WC_CREATE_TEMPLATE && wc != WC_TEMPLATEGUI_MAIN) {
|
||||||
ShowVehicleViewWindow(v);
|
ShowVehicleViewWindow(v);
|
||||||
|
Reference in New Issue
Block a user