From 34ce418b631781829bfd95438be1f323667c2137 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 15 Oct 2015 00:23:46 +0100 Subject: [PATCH] Zoning: Add mode to show restricted signals. --- src/lang/english.txt | 1 + src/zoning.h | 1 + src/zoning_cmd.cpp | 18 ++++++++++++++++++ src/zoning_gui.cpp | 2 ++ 4 files changed, 22 insertions(+) diff --git a/src/lang/english.txt b/src/lang/english.txt index 222c7a2884..f907a1812d 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -5531,3 +5531,4 @@ STR_ZONING_CAN_BUILD :Where I can't b STR_ZONING_STA_CATCH :Station catchment STR_ZONING_BUL_UNSER :Unserved buildings STR_ZONING_IND_UNSER :Unserved industries +STR_ZONING_TRACERESTRICT :Restricted signals diff --git a/src/zoning.h b/src/zoning.h index bfea293342..9fd33ef76b 100644 --- a/src/zoning.h +++ b/src/zoning.h @@ -25,6 +25,7 @@ enum ZoningEvaluationMode { ZEM_STA_CATCH, ///< Check catchment area for stations ZEM_BUL_UNSER, ///< Check for unserved buildings ZEM_IND_UNSER, ///< Check for unserved industries + ZEM_TRACERESTRICT, ///< Check for restricted signals }; /** diff --git a/src/zoning_cmd.cpp b/src/zoning_cmd.cpp index 5f9240d76c..d7d308a4c0 100644 --- a/src/zoning_cmd.cpp +++ b/src/zoning_cmd.cpp @@ -23,6 +23,7 @@ #include "station_func.h" #include "station_map.h" #include "town.h" +#include "tracerestrict.h" #include "zoning.h" Zoning _zoning; @@ -286,6 +287,22 @@ SpriteID TileZoneCheckUnservedIndustriesEvaluation(TileIndex tile, Owner owner) return ZONING_INVALID_SPRITE_ID; } +/** + * Detect whether a tile is a restricted signal tile + * + * @param TileIndex tile + * @param Owner owner + * @return red if a restricted signal, nothing otherwise + */ +SpriteID TileZoneCheckTraceRestrictEvaluation(TileIndex tile, Owner owner) +{ + if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile) && IsRestrictedSignal(tile)) { + return SPR_ZONING_INNER_HIGHLIGHT_RED; + } + + return ZONING_INVALID_SPRITE_ID; +} + /** * General evaluation function; calls all the other functions depending on * evaluation mode. @@ -306,6 +323,7 @@ SpriteID TileZoningSpriteEvaluation(TileIndex tile, Owner owner, ZoningEvaluatio case ZEM_STA_CATCH: return TileZoneCheckStationCatchmentEvaluation(tile, owner); case ZEM_BUL_UNSER: return TileZoneCheckUnservedBuildingsEvaluation(tile, owner); case ZEM_IND_UNSER: return TileZoneCheckUnservedIndustriesEvaluation(tile, owner); + case ZEM_TRACERESTRICT: return TileZoneCheckTraceRestrictEvaluation(tile, owner); default: return ZONING_INVALID_SPRITE_ID; } } diff --git a/src/zoning_gui.cpp b/src/zoning_gui.cpp index 74be21b8f6..6a15a9bd8a 100644 --- a/src/zoning_gui.cpp +++ b/src/zoning_gui.cpp @@ -40,6 +40,7 @@ static const StringID _zone_type_strings[] = { STR_ZONING_STA_CATCH, STR_ZONING_BUL_UNSER, STR_ZONING_IND_UNSER, + STR_ZONING_TRACERESTRICT, INVALID_STRING_ID }; @@ -50,6 +51,7 @@ static const ZoningEvaluationMode _zone_type_modes[] = { ZEM_STA_CATCH, ZEM_BUL_UNSER, ZEM_IND_UNSER, + ZEM_TRACERESTRICT, }; static ZoningEvaluationMode DropDownIndexToZoningEvaluationMode(int index)