1
0
Fork 0

Fix #7692: Added industry tile to GetOrderCmdFromTile() (#7709)

Sending order command to an industry tile now checks if a neutral_station is available and sends the order to that station
pull/7743/head
JMcKiern 2019-09-04 21:47:21 +01:00 committed by Charles Pigott
parent c70d12ee38
commit 8afc1a7253
1 changed files with 13 additions and 4 deletions

View File

@ -24,6 +24,7 @@
#include "tilehighlight_func.h"
#include "network/network.h"
#include "station_base.h"
#include "industry.h"
#include "waypoint_base.h"
#include "core/geometry_func.hpp"
#include "hotkeys.h"
@ -389,11 +390,18 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
return order;
}
if (IsTileType(tile, MP_STATION)) {
StationID st_index = GetStationIndex(tile);
const Station *st = Station::Get(st_index);
/* check for station or industry with neutral station */
if (IsTileType(tile, MP_STATION) || IsTileType(tile, MP_INDUSTRY)) {
const Station *st = nullptr;
if (st->owner == _local_company || st->owner == OWNER_NONE) {
if (IsTileType(tile, MP_INDUSTRY)) {
const Industry *in = Industry::GetByTile(tile);
tile = in->location.tile;
}
if (IsTileType(tile, MP_STATION)) st = Station::GetByTile(tile);
if (st != nullptr && (st->owner == _local_company || st->owner == OWNER_NONE)) {
byte facil;
(facil = FACIL_DOCK, v->type == VEH_SHIP) ||
(facil = FACIL_TRAIN, v->type == VEH_TRAIN) ||
@ -401,6 +409,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
(facil = FACIL_BUS_STOP, v->type == VEH_ROAD && RoadVehicle::From(v)->IsBus()) ||
(facil = FACIL_TRUCK_STOP, 1);
if (st->facilities & facil) {
StationID st_index = GetStationIndex(st->xy);
order.MakeGoToStation(st_index);
if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY);
if (_settings_client.gui.new_nonstop && v->IsGroundVehicle()) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);