Zoning: Add mode to show restricted signals.

pull/3/head
Jonathan G Rennison 9 years ago
parent a1b60bcc85
commit 34ce418b63

@ -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

@ -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
};
/**

@ -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;
}
}

@ -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)

Loading…
Cancel
Save