|
@@ -32,25 +32,25 @@
|
|
|
#include "date_func.h"
|
|
|
#include "strings_func.h"
|
|
|
#include "company_gui.h"
|
|
|
#include "object_map.h"
|
|
|
|
|
|
#include "table/strings.h"
|
|
|
#include "table/railtypes.h"
|
|
|
#include "table/track_land.h"
|
|
|
|
|
|
#include "safeguards.h"
|
|
|
|
|
|
/** Helper type for lists/vectors of trains */
|
|
|
typedef SmallVector<Train *, 16> TrainList;
|
|
|
typedef std::vector<Train *> TrainList;
|
|
|
|
|
|
RailtypeInfo _railtypes[RAILTYPE_END];
|
|
|
RailType _sorted_railtypes[RAILTYPE_END];
|
|
|
uint8 _sorted_railtypes_size;
|
|
|
RailTypes _railtypes_hidden_mask;
|
|
|
|
|
|
/** Enum holding the signal offset in the sprite sheet according to the side it is representing. */
|
|
|
enum SignalOffsets {
|
|
|
SIGNAL_TO_SOUTHWEST,
|
|
|
SIGNAL_TO_NORTHEAST,
|
|
|
SIGNAL_TO_SOUTHEAST,
|
|
|
SIGNAL_TO_NORTHWEST,
|
|
@@ -1594,25 +1594,25 @@ CommandCost CmdConvertRail(TileIndex til
|
|
|
RailType type = GetRailType(tile);
|
|
|
|
|
|
/* Converting to the same type or converting 'hidden' elrail -> rail */
|
|
|
if (type == totype || (_settings_game.vehicle.disable_elrails && totype == RAILTYPE_RAIL && type == RAILTYPE_ELECTRIC)) continue;
|
|
|
|
|
|
/* Trying to convert other's rail */
|
|
|
CommandCost ret = CheckTileOwnership(tile);
|
|
|
if (ret.Failed()) {
|
|
|
error = ret;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
SmallVector<Train *, 2> vehicles_affected;
|
|
|
std::vector<Train *> vehicles_affected;
|
|
|
|
|
|
/* Vehicle on the tile when not converting Rail <-> ElRail
|
|
|
* Tunnels and bridges have special check later */
|
|
|
if (tt != MP_TUNNELBRIDGE) {
|
|
|
if (!IsCompatibleRail(type, totype)) {
|
|
|
CommandCost ret = IsPlainRailTile(tile) ? EnsureNoTrainOnTrackBits(tile, GetTrackBits(tile)) : EnsureNoVehicleOnGround(tile);
|
|
|
if (ret.Failed()) {
|
|
|
error = ret;
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
if (flags & DC_EXEC) { // we can safely convert, too
|