Zoning: Add modes to show 2x2 and 3x3 town road grids

pull/73/head
Jonathan G Rennison 6 years ago
parent 79f1c2b97b
commit 92a5e59165

@ -5948,6 +5948,8 @@ STR_ZONING_STA_CATCH_OPEN :Station catchme
STR_ZONING_BUL_UNSER :Unserved buildings
STR_ZONING_IND_UNSER :Unserved industries
STR_ZONING_TRACERESTRICT :Restricted signals
STR_ZONING_2x2_GRID :2x2 town road grid
STR_ZONING_3x3_GRID :3x3 town road grid
STR_TMPL_RPL_TITLE :{WHITE}Template Replacement
STR_TMPL_TEMPLATE_REPLACEMENT :Template Replacement

@ -27,6 +27,8 @@ enum ZoningEvaluationMode {
ZEM_BUL_UNSER, ///< Check for unserved buildings
ZEM_IND_UNSER, ///< Check for unserved industries
ZEM_TRACERESTRICT, ///< Check for restricted signals
ZEM_2x2_GRID, ///< Show 2x2 town road grid
ZEM_3x3_GRID, ///< Show 3x3 town road grid
};
/**

@ -317,6 +317,24 @@ SpriteID TileZoneCheckTraceRestrictEvaluation(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
*/
inline SpriteID TileZoneCheckRoadGridEvaluation(TileIndex tile, uint grid_size)
{
const bool x_grid = (TileX(tile) % grid_size == 0);
const bool y_grid = (TileY(tile) % grid_size == 0);
if (x_grid || y_grid) {
return SPR_ZONING_INNER_HIGHLIGHT_LIGHT_BLUE;
} else {
return ZONING_INVALID_SPRITE_ID;
}
}
/**
* General evaluation function; calls all the other functions depending on
* evaluation mode.
@ -339,6 +357,8 @@ SpriteID TileZoningSpriteEvaluation(TileIndex tile, Owner owner, ZoningEvaluatio
case ZEM_BUL_UNSER: return TileZoneCheckUnservedBuildingsEvaluation(tile, owner);
case ZEM_IND_UNSER: return TileZoneCheckUnservedIndustriesEvaluation(tile, owner);
case ZEM_TRACERESTRICT: return TileZoneCheckTraceRestrictEvaluation(tile, owner);
case ZEM_2x2_GRID: return TileZoneCheckRoadGridEvaluation(tile, 3);
case ZEM_3x3_GRID: return TileZoneCheckRoadGridEvaluation(tile, 4);
default: return ZONING_INVALID_SPRITE_ID;
}
}

@ -42,6 +42,8 @@ static const StringID _zone_type_strings[] = {
STR_ZONING_BUL_UNSER,
STR_ZONING_IND_UNSER,
STR_ZONING_TRACERESTRICT,
STR_ZONING_2x2_GRID,
STR_ZONING_3x3_GRID,
INVALID_STRING_ID
};
@ -54,6 +56,8 @@ static const ZoningEvaluationMode _zone_type_modes[] = {
ZEM_BUL_UNSER,
ZEM_IND_UNSER,
ZEM_TRACERESTRICT,
ZEM_2x2_GRID,
ZEM_3x3_GRID,
};
static ZoningEvaluationMode DropDownIndexToZoningEvaluationMode(int index)

Loading…
Cancel
Save