Tunnel/bridge signal simulation spacing is now a company setting
This commit is contained in:
@@ -3574,6 +3574,12 @@ bool AfterLoadGame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (SlXvIsFeaturePresent(XSLFI_SIG_TUNNEL_BRIDGE, 1, 7)) {
|
||||||
|
/* spacing setting moved to company settings */
|
||||||
|
for (Company *c : Company::Iterate()) {
|
||||||
|
c->settings.simulated_wormhole_signals = _settings_game.construction.old_simulated_wormhole_signals;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (SlXvIsFeatureMissing(XSLFI_CUSTOM_BRIDGE_HEADS)) {
|
if (SlXvIsFeatureMissing(XSLFI_CUSTOM_BRIDGE_HEADS)) {
|
||||||
/* ensure that previously unused custom bridge-head bits are cleared */
|
/* ensure that previously unused custom bridge-head bits are cleared */
|
||||||
|
@@ -81,7 +81,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
|||||||
{ XSLFI_DEPARTURE_BOARDS, XSCF_IGNORABLE_UNKNOWN, 1, 1, "departure_boards", nullptr, nullptr, nullptr },
|
{ XSLFI_DEPARTURE_BOARDS, XSCF_IGNORABLE_UNKNOWN, 1, 1, "departure_boards", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_TIMETABLES_START_TICKS, XSCF_NULL, 2, 2, "timetable_start_ticks", nullptr, nullptr, nullptr },
|
{ XSLFI_TIMETABLES_START_TICKS, XSCF_NULL, 2, 2, "timetable_start_ticks", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_TOWN_CARGO_ADJ, XSCF_IGNORABLE_UNKNOWN, 2, 2, "town_cargo_adj", nullptr, nullptr, nullptr },
|
{ XSLFI_TOWN_CARGO_ADJ, XSCF_IGNORABLE_UNKNOWN, 2, 2, "town_cargo_adj", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_SIG_TUNNEL_BRIDGE, XSCF_NULL, 7, 7, "signal_tunnel_bridge", nullptr, nullptr, "XBSS" },
|
{ XSLFI_SIG_TUNNEL_BRIDGE, XSCF_NULL, 8, 8, "signal_tunnel_bridge", nullptr, nullptr, "XBSS" },
|
||||||
{ XSLFI_IMPROVED_BREAKDOWNS, XSCF_NULL, 6, 6, "improved_breakdowns", nullptr, nullptr, nullptr },
|
{ XSLFI_IMPROVED_BREAKDOWNS, XSCF_NULL, 6, 6, "improved_breakdowns", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_CONSIST_BREAKDOWN_FLAG, XSCF_NULL, 1, 1, "consist_breakdown_flag", nullptr, nullptr, nullptr },
|
{ XSLFI_CONSIST_BREAKDOWN_FLAG, XSCF_NULL, 1, 1, "consist_breakdown_flag", nullptr, nullptr, nullptr },
|
||||||
{ XSLFI_TT_WAIT_IN_DEPOT, XSCF_NULL, 1, 1, "tt_wait_in_depot", nullptr, nullptr, nullptr },
|
{ XSLFI_TT_WAIT_IN_DEPOT, XSCF_NULL, 1, 1, "tt_wait_in_depot", nullptr, nullptr, nullptr },
|
||||||
|
@@ -1649,7 +1649,6 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
SettingsPage *construction = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION));
|
SettingsPage *construction = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION));
|
||||||
{
|
{
|
||||||
construction->Add(new SettingEntry("gui.link_terraform_toolbar"));
|
construction->Add(new SettingEntry("gui.link_terraform_toolbar"));
|
||||||
construction->Add(new SettingEntry("construction.simulated_wormhole_signals"));
|
|
||||||
construction->Add(new SettingEntry("gui.enable_signal_gui"));
|
construction->Add(new SettingEntry("gui.enable_signal_gui"));
|
||||||
construction->Add(new SettingEntry("gui.persistent_buildingtools"));
|
construction->Add(new SettingEntry("gui.persistent_buildingtools"));
|
||||||
construction->Add(new SettingEntry("gui.quick_goto"));
|
construction->Add(new SettingEntry("gui.quick_goto"));
|
||||||
@@ -1792,6 +1791,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
company->Add(new SettingEntry("company.infra_others_buy_in_depot[3]"));
|
company->Add(new SettingEntry("company.infra_others_buy_in_depot[3]"));
|
||||||
company->Add(new SettingEntry("company.advance_order_on_clone"));
|
company->Add(new SettingEntry("company.advance_order_on_clone"));
|
||||||
company->Add(new SettingEntry("company.copy_clone_add_to_group"));
|
company->Add(new SettingEntry("company.copy_clone_add_to_group"));
|
||||||
|
company->Add(new SettingEntry("company.simulated_wormhole_signals"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
|
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));
|
||||||
|
@@ -382,7 +382,6 @@ struct ConstructionSettings {
|
|||||||
bool trees_around_snow_line_enabled; ///< enable mixed and arctic forest around snowline, and no trees above snowline
|
bool trees_around_snow_line_enabled; ///< enable mixed and arctic forest around snowline, and no trees above snowline
|
||||||
uint8 command_pause_level; ///< level/amount of commands that can't be executed while paused
|
uint8 command_pause_level; ///< level/amount of commands that can't be executed while paused
|
||||||
uint16 maximum_signal_evaluations; ///< maximum number of programmable pre-signals which may be evaluated in one pass
|
uint16 maximum_signal_evaluations; ///< maximum number of programmable pre-signals which may be evaluated in one pass
|
||||||
byte simulated_wormhole_signals; ///< simulate signals in tunnel
|
|
||||||
bool enable_build_river; ///< enable building rivers in-game
|
bool enable_build_river; ///< enable building rivers in-game
|
||||||
bool enable_remove_water; ///< enable removing sea and rivers in-game
|
bool enable_remove_water; ///< enable removing sea and rivers in-game
|
||||||
uint8 road_custom_bridge_heads; ///< allow construction of road custom bridge heads
|
uint8 road_custom_bridge_heads; ///< allow construction of road custom bridge heads
|
||||||
@@ -406,6 +405,8 @@ struct ConstructionSettings {
|
|||||||
uint32 build_object_per_64k_frames; ///< how many tiles may, over a long period, have objects built on them per 65536 frames?
|
uint32 build_object_per_64k_frames; ///< how many tiles may, over a long period, have objects built on them per 65536 frames?
|
||||||
uint16 build_object_frame_burst; ///< how many tiles may, over a short period, have objects built on them?
|
uint16 build_object_frame_burst; ///< how many tiles may, over a short period, have objects built on them?
|
||||||
uint8 tree_growth_rate; ///< tree growth rate
|
uint8 tree_growth_rate; ///< tree growth rate
|
||||||
|
|
||||||
|
byte old_simulated_wormhole_signals; ///< moved to company settings: simulate signals in tunnel
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Settings related to the AI. */
|
/** Settings related to the AI. */
|
||||||
@@ -662,6 +663,7 @@ struct CompanySettings {
|
|||||||
uint16 timetable_autofill_rounding; ///< round up timetable times to be a multiple of this number of ticks
|
uint16 timetable_autofill_rounding; ///< round up timetable times to be a multiple of this number of ticks
|
||||||
bool advance_order_on_clone; ///< when cloning a vehicle or copying/sharing an order list, advance the current order to a suitable point
|
bool advance_order_on_clone; ///< when cloning a vehicle or copying/sharing an order list, advance the current order to a suitable point
|
||||||
bool copy_clone_add_to_group; ///< whether to add cloned vehicles to the source vehicle's group, when cloning a vehicle without sharing orders
|
bool copy_clone_add_to_group; ///< whether to add cloned vehicles to the source vehicle's group, when cloning a vehicle without sharing orders
|
||||||
|
byte simulated_wormhole_signals; ///< tunnel/bridge signal simulation spacing
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Debug settings. */
|
/** Debug settings. */
|
||||||
|
@@ -11,6 +11,7 @@ static bool UpdateIntervalTrains(int32 p1);
|
|||||||
static bool UpdateIntervalRoadVeh(int32 p1);
|
static bool UpdateIntervalRoadVeh(int32 p1);
|
||||||
static bool UpdateIntervalShips(int32 p1);
|
static bool UpdateIntervalShips(int32 p1);
|
||||||
static bool UpdateIntervalAircraft(int32 p1);
|
static bool UpdateIntervalAircraft(int32 p1);
|
||||||
|
static bool SimulatedWormholeSignalsChanged(int32 p1);
|
||||||
|
|
||||||
static const SettingDesc _company_settings[] = {
|
static const SettingDesc _company_settings[] = {
|
||||||
[post-amble]
|
[post-amble]
|
||||||
@@ -255,6 +256,20 @@ str = STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP
|
|||||||
strhelp = STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP_HELPTEXT
|
||||||
patxname = ""copy_clone_add_to_group""
|
patxname = ""copy_clone_add_to_group""
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
base = CompanySettings
|
||||||
|
var = simulated_wormhole_signals
|
||||||
|
type = SLE_UINT8
|
||||||
|
guiflags = SGF_PER_COMPANY
|
||||||
|
def = 4
|
||||||
|
min = 1
|
||||||
|
max = 16
|
||||||
|
str = STR_CONFIG_SETTING_SIMULATE_SIGNALS
|
||||||
|
strval = STR_CONFIG_SETTING_SIMULATE_SIGNALS_VALUE
|
||||||
|
proc = SimulatedWormholeSignalsChanged
|
||||||
|
cat = SC_ADVANCED
|
||||||
|
patxname = ""simulated_wormhole_signals""
|
||||||
|
|
||||||
[SDT_END]
|
[SDT_END]
|
||||||
|
|
||||||
|
|
||||||
|
@@ -50,7 +50,6 @@ static bool MaxVehiclesChanged(int32 p1);
|
|||||||
static bool InvalidateShipPathCache(int32 p1);
|
static bool InvalidateShipPathCache(int32 p1);
|
||||||
static bool ImprovedBreakdownsSettingChanged(int32 p1);
|
static bool ImprovedBreakdownsSettingChanged(int32 p1);
|
||||||
static bool DayLengthChanged(int32 p1);
|
static bool DayLengthChanged(int32 p1);
|
||||||
static bool SimulatedWormholeSignalsChanged(int32 p1);
|
|
||||||
static bool EnableSingleVehSharedOrderGuiChanged(int32 p1);
|
static bool EnableSingleVehSharedOrderGuiChanged(int32 p1);
|
||||||
static bool CheckYapfRailSignalPenalties(int32 p1);
|
static bool CheckYapfRailSignalPenalties(int32 p1);
|
||||||
static bool ViewportMapShowTunnelModeChanged(int32 p1);
|
static bool ViewportMapShowTunnelModeChanged(int32 p1);
|
||||||
@@ -707,11 +706,11 @@ strval = STR_CONFIG_SETTING_TILE_LENGTH
|
|||||||
|
|
||||||
[SDT_XREF]
|
[SDT_XREF]
|
||||||
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_SPRINGPP, 2)
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_SPRINGPP, 2)
|
||||||
xref = ""construction.simulated_wormhole_signals""
|
xref = ""construction.old_simulated_wormhole_signals""
|
||||||
|
|
||||||
[SDT_XREF]
|
[SDT_XREF]
|
||||||
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_JOKERPP)
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_JOKERPP)
|
||||||
xref = ""construction.simulated_wormhole_signals""
|
xref = ""construction.old_simulated_wormhole_signals""
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = GameSettings
|
base = GameSettings
|
||||||
@@ -758,7 +757,7 @@ patxname = ""chunnel.construction.chunnel""
|
|||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = construction.simulated_wormhole_signals
|
var = construction.old_simulated_wormhole_signals
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
flags = 0
|
flags = 0
|
||||||
def = 2
|
def = 2
|
||||||
@@ -766,8 +765,8 @@ min = 1
|
|||||||
max = 16
|
max = 16
|
||||||
str = STR_CONFIG_SETTING_SIMULATE_SIGNALS
|
str = STR_CONFIG_SETTING_SIMULATE_SIGNALS
|
||||||
strval = STR_CONFIG_SETTING_SIMULATE_SIGNALS_VALUE
|
strval = STR_CONFIG_SETTING_SIMULATE_SIGNALS_VALUE
|
||||||
proc = SimulatedWormholeSignalsChanged
|
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_SIG_TUNNEL_BRIDGE, 1, 7)
|
||||||
patxname = ""signal_tunnel_bridge.construction.simulated_wormhole_signals""
|
patxname = ""signal_tunnel_bridge.construction.simulated_wormhole_signals""
|
||||||
|
|
||||||
[SDT_XREF]
|
[SDT_XREF]
|
||||||
|
@@ -2742,7 +2742,7 @@ static void HandleLastTunnelBridgeSignals(TileIndex tile, TileIndex end, DiagDir
|
|||||||
/* Clearing last bridge signal. */
|
/* Clearing last bridge signal. */
|
||||||
int signal_offset = GetAndClearLastBridgeEntranceSetSignalIndex(end);
|
int signal_offset = GetAndClearLastBridgeEntranceSetSignalIndex(end);
|
||||||
if (signal_offset) {
|
if (signal_offset) {
|
||||||
TileIndex last_signal_tile = end + (TileOffsByDiagDir(dir) * _settings_game.construction.simulated_wormhole_signals * signal_offset);
|
TileIndex last_signal_tile = end + (TileOffsByDiagDir(dir) * GetTunnelBridgeSignalSimulationSpacing(tile) * signal_offset);
|
||||||
MarkTileDirtyByTile(last_signal_tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(last_signal_tile, VMDF_NOT_MAP_MODE);
|
||||||
}
|
}
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
||||||
@@ -3973,16 +3973,18 @@ static bool CheckTrainStayInWormHole(Train *t, TileIndex tile)
|
|||||||
|
|
||||||
static void HandleSignalBehindTrain(Train *v, int signal_number)
|
static void HandleSignalBehindTrain(Train *v, int signal_number)
|
||||||
{
|
{
|
||||||
|
const uint simulated_wormhole_signals = GetTunnelBridgeSignalSimulationSpacing(v->tile);
|
||||||
|
|
||||||
TileIndex tile;
|
TileIndex tile;
|
||||||
switch (v->direction) {
|
switch (v->direction) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case DIR_NE: tile = TileVirtXY(v->x_pos + (TILE_SIZE * _settings_game.construction.simulated_wormhole_signals), v->y_pos); break;
|
case DIR_NE: tile = TileVirtXY(v->x_pos + (TILE_SIZE * simulated_wormhole_signals), v->y_pos); break;
|
||||||
case DIR_SE: tile = TileVirtXY(v->x_pos, v->y_pos - (TILE_SIZE * _settings_game.construction.simulated_wormhole_signals) ); break;
|
case DIR_SE: tile = TileVirtXY(v->x_pos, v->y_pos - (TILE_SIZE * simulated_wormhole_signals) ); break;
|
||||||
case DIR_SW: tile = TileVirtXY(v->x_pos - (TILE_SIZE * _settings_game.construction.simulated_wormhole_signals), v->y_pos); break;
|
case DIR_SW: tile = TileVirtXY(v->x_pos - (TILE_SIZE * simulated_wormhole_signals), v->y_pos); break;
|
||||||
case DIR_NW: tile = TileVirtXY(v->x_pos, v->y_pos + (TILE_SIZE * _settings_game.construction.simulated_wormhole_signals)); break;
|
case DIR_NW: tile = TileVirtXY(v->x_pos, v->y_pos + (TILE_SIZE * simulated_wormhole_signals)); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tile == v->tile) {
|
if (tile == v->tile) {
|
||||||
/* Flip signal on ramp. */
|
/* Flip signal on ramp. */
|
||||||
if (IsTunnelBridgeSignalSimulationEntrance(tile) && GetTunnelBridgeEntranceSignalState(tile) == SIGNAL_STATE_RED) {
|
if (IsTunnelBridgeSignalSimulationEntrance(tile) && GetTunnelBridgeEntranceSignalState(tile) == SIGNAL_STATE_RED) {
|
||||||
SetTunnelBridgeEntranceSignalState(tile, SIGNAL_STATE_GREEN);
|
SetTunnelBridgeEntranceSignalState(tile, SIGNAL_STATE_GREEN);
|
||||||
@@ -4343,16 +4345,17 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
|||||||
/* Handle signal simulation on tunnel/bridge. */
|
/* Handle signal simulation on tunnel/bridge. */
|
||||||
TileIndex old_tile = TileVirtXY(v->x_pos, v->y_pos);
|
TileIndex old_tile = TileVirtXY(v->x_pos, v->y_pos);
|
||||||
if (old_tile != gp.new_tile && IsTunnelBridgeWithSignalSimulation(v->tile) && (v->IsFrontEngine() || v->Next() == nullptr)) {
|
if (old_tile != gp.new_tile && IsTunnelBridgeWithSignalSimulation(v->tile) && (v->IsFrontEngine() || v->Next() == nullptr)) {
|
||||||
|
const uint simulated_wormhole_signals = GetTunnelBridgeSignalSimulationSpacing(v->tile);
|
||||||
if (old_tile == v->tile) {
|
if (old_tile == v->tile) {
|
||||||
if (v->IsFrontEngine() && v->force_proceed == 0 && IsTunnelBridgeSignalSimulationExitOnly(v->tile)) goto invalid_rail;
|
if (v->IsFrontEngine() && v->force_proceed == 0 && IsTunnelBridgeSignalSimulationExitOnly(v->tile)) goto invalid_rail;
|
||||||
/* Entered wormhole set counters. */
|
/* Entered wormhole set counters. */
|
||||||
v->wait_counter = (TILE_SIZE * _settings_game.construction.simulated_wormhole_signals) - TILE_SIZE;
|
v->wait_counter = (TILE_SIZE * simulated_wormhole_signals) - TILE_SIZE;
|
||||||
v->tunnel_bridge_signal_num = 0;
|
v->tunnel_bridge_signal_num = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint distance = v->wait_counter;
|
uint distance = v->wait_counter;
|
||||||
bool leaving = false;
|
bool leaving = false;
|
||||||
if (distance == 0) v->wait_counter = (TILE_SIZE * _settings_game.construction.simulated_wormhole_signals);
|
if (distance == 0) v->wait_counter = (TILE_SIZE * simulated_wormhole_signals);
|
||||||
|
|
||||||
if (v->IsFrontEngine()) {
|
if (v->IsFrontEngine()) {
|
||||||
/* Check if track in front is free and see if we can leave wormhole. */
|
/* Check if track in front is free and see if we can leave wormhole. */
|
||||||
@@ -4378,7 +4381,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (v->Next() == nullptr) {
|
if (v->Next() == nullptr) {
|
||||||
if (v->tunnel_bridge_signal_num > 0 && distance == (TILE_SIZE * _settings_game.construction.simulated_wormhole_signals) - TILE_SIZE) HandleSignalBehindTrain(v, v->tunnel_bridge_signal_num - 2);
|
if (v->tunnel_bridge_signal_num > 0 && distance == (TILE_SIZE * simulated_wormhole_signals) - TILE_SIZE) HandleSignalBehindTrain(v, v->tunnel_bridge_signal_num - 2);
|
||||||
DiagDirection tunnel_bridge_dir = GetTunnelBridgeDirection(v->tile);
|
DiagDirection tunnel_bridge_dir = GetTunnelBridgeDirection(v->tile);
|
||||||
Axis axis = DiagDirToAxis(tunnel_bridge_dir);
|
Axis axis = DiagDirToAxis(tunnel_bridge_dir);
|
||||||
DiagDirection axial_dir = DirToDiagDirAlongAxis(v->direction, axis);
|
DiagDirection axial_dir = DirToDiagDirAlongAxis(v->direction, axis);
|
||||||
@@ -4421,7 +4424,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
|||||||
TrainApproachingLineEnd(v, true, false);
|
TrainApproachingLineEnd(v, true, false);
|
||||||
}
|
}
|
||||||
} else if (v->wait_counter == 0) {
|
} else if (v->wait_counter == 0) {
|
||||||
if (IsTooCloseBehindTrain(v, next_tile, TILE_SIZE * _settings_game.construction.simulated_wormhole_signals, true)) {
|
if (IsTooCloseBehindTrain(v, next_tile, TILE_SIZE * GetTunnelBridgeSignalSimulationSpacing(v->tile), true)) {
|
||||||
TrainApproachingLineEnd(v, true, false);
|
TrainApproachingLineEnd(v, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "map_func.h"
|
#include "map_func.h"
|
||||||
#include "tile_map.h"
|
#include "tile_map.h"
|
||||||
|
|
||||||
|
uint GetTunnelBridgeSignalSimulationSpacing(TileIndex tile);
|
||||||
uint GetTunnelBridgeSignalSimulationSignalCount(TileIndex begin, TileIndex end);
|
uint GetTunnelBridgeSignalSimulationSignalCount(TileIndex begin, TileIndex end);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -127,6 +127,16 @@ void MarkBridgeOrTunnelDirtyOnReservationChange(TileIndex tile, ViewportMarkDirt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint GetTunnelBridgeSignalSimulationSpacing(TileIndex tile)
|
||||||
|
{
|
||||||
|
Owner owner = GetTileOwner(tile);
|
||||||
|
if (Company::IsValidID(owner)) {
|
||||||
|
return Company::Get(owner)->settings.simulated_wormhole_signals;
|
||||||
|
} else {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get number of signals on bridge or tunnel with signal simulation.
|
* Get number of signals on bridge or tunnel with signal simulation.
|
||||||
* @param begin The begin of the tunnel or bridge.
|
* @param begin The begin of the tunnel or bridge.
|
||||||
@@ -135,7 +145,7 @@ void MarkBridgeOrTunnelDirtyOnReservationChange(TileIndex tile, ViewportMarkDirt
|
|||||||
*/
|
*/
|
||||||
uint GetTunnelBridgeSignalSimulationSignalCount(TileIndex begin, TileIndex end)
|
uint GetTunnelBridgeSignalSimulationSignalCount(TileIndex begin, TileIndex end)
|
||||||
{
|
{
|
||||||
uint result = 2 + (GetTunnelBridgeLength(begin, end) / _settings_game.construction.simulated_wormhole_signals);
|
uint result = 2 + (GetTunnelBridgeLength(begin, end) / GetTunnelBridgeSignalSimulationSpacing(begin));
|
||||||
if (IsTunnelBridgeSignalSimulationBidirectional(begin)) result *= 2;
|
if (IsTunnelBridgeSignalSimulationBidirectional(begin)) result *= 2;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1657,10 +1667,11 @@ static void DrawBridgeSignalOnMiddlePart(const TileInfo *ti, TileIndex bridge_st
|
|||||||
uint bridge_signal_position = 0;
|
uint bridge_signal_position = 0;
|
||||||
int m2_position = 0;
|
int m2_position = 0;
|
||||||
|
|
||||||
uint bridge_section = GetTunnelBridgeLength(ti->tile, bridge_start_tile) + 1;
|
const uint bridge_section = GetTunnelBridgeLength(ti->tile, bridge_start_tile) + 1;
|
||||||
|
const uint simulated_wormhole_signals = GetTunnelBridgeSignalSimulationSpacing(bridge_start_tile);
|
||||||
|
|
||||||
while (bridge_signal_position <= bridge_section) {
|
while (bridge_signal_position <= bridge_section) {
|
||||||
bridge_signal_position += _settings_game.construction.simulated_wormhole_signals;
|
bridge_signal_position += simulated_wormhole_signals;
|
||||||
if (bridge_signal_position == bridge_section) {
|
if (bridge_signal_position == bridge_section) {
|
||||||
bool side = (_settings_game.vehicle.road_side != 0) && _settings_game.construction.train_signal_side;
|
bool side = (_settings_game.vehicle.road_side != 0) && _settings_game.construction.train_signal_side;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user