Merge branch 'tracerestrict-sx' into jgrpp
This commit is contained in:
@@ -221,10 +221,14 @@ private:
|
|||||||
TileIndex tile = v->tile;
|
TileIndex tile = v->tile;
|
||||||
Trackdir trackdir = v->GetVehicleTrackdir();
|
Trackdir trackdir = v->GetVehicleTrackdir();
|
||||||
|
|
||||||
CFollowTrackRail ft(v);
|
|
||||||
|
|
||||||
TileIndex candidate_tile = INVALID_TILE;
|
TileIndex candidate_tile = INVALID_TILE;
|
||||||
|
|
||||||
|
if (IsRailDepotTile(v->tile)) {
|
||||||
|
candidate_tile = v->tile;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFollowTrackRail ft(v);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, trackdir)) {
|
if (IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, trackdir)) {
|
||||||
if (HasPbsSignalOnTrackdir(tile, trackdir)) {
|
if (HasPbsSignalOnTrackdir(tile, trackdir)) {
|
||||||
|
@@ -423,6 +423,10 @@ Train *GetTrainForReservation(TileIndex tile, Track track)
|
|||||||
*/
|
*/
|
||||||
TileIndex VehiclePosTraceRestrictPreviousSignalCallback(const Train *v, const void *)
|
TileIndex VehiclePosTraceRestrictPreviousSignalCallback(const Train *v, const void *)
|
||||||
{
|
{
|
||||||
|
if (IsRailDepotTile(v->tile)) {
|
||||||
|
return v->tile;
|
||||||
|
}
|
||||||
|
|
||||||
// scan forwards from vehicle position, for the case that train is waiting at/approaching PBS signal
|
// scan forwards from vehicle position, for the case that train is waiting at/approaching PBS signal
|
||||||
|
|
||||||
TileIndex tile = v->tile;
|
TileIndex tile = v->tile;
|
||||||
|
@@ -1439,21 +1439,25 @@ public:
|
|||||||
TraceRestrictItem item = GetSelected();
|
TraceRestrictItem item = GetSelected();
|
||||||
if (GetTraceRestrictTypeProperties(item).value_type != TRVT_TILE_INDEX) return;
|
if (GetTraceRestrictTypeProperties(item).value_type != TRVT_TILE_INDEX) return;
|
||||||
|
|
||||||
if (!IsPlainRailTile(tile)) {
|
|
||||||
ShowErrorMessage(error_message, STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, WL_INFO);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetPresentSignals(tile) == 0) {
|
|
||||||
ShowErrorMessage(error_message, STR_ERROR_THERE_ARE_NO_SIGNALS, WL_INFO);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsTileOwner(tile, _local_company)) {
|
if (!IsTileOwner(tile, _local_company)) {
|
||||||
ShowErrorMessage(error_message, STR_ERROR_AREA_IS_OWNED_BY_ANOTHER, WL_INFO);
|
ShowErrorMessage(error_message, STR_ERROR_AREA_IS_OWNED_BY_ANOTHER, WL_INFO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsRailDepotTile(tile)) {
|
||||||
|
// OK
|
||||||
|
} else {
|
||||||
|
if (!IsPlainRailTile(tile)) {
|
||||||
|
ShowErrorMessage(error_message, STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, WL_INFO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetPresentSignals(tile) == 0) {
|
||||||
|
ShowErrorMessage(error_message, STR_ERROR_THERE_ARE_NO_SIGNALS, WL_INFO);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TraceRestrictDoCommandP(this->tile, this->track, TRDCT_MODIFY_DUAL_ITEM, this->selected_instruction - 1, tile, STR_TRACE_RESTRICT_ERROR_CAN_T_MODIFY_ITEM);
|
TraceRestrictDoCommandP(this->tile, this->track, TRDCT_MODIFY_DUAL_ITEM, this->selected_instruction - 1, tile, STR_TRACE_RESTRICT_ERROR_CAN_T_MODIFY_ITEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user