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

This commit is contained in:
Jonathan G Rennison
2018-10-06 13:01:01 +01:00
parent 79f1c2b97b
commit 92a5e59165
4 changed files with 28 additions and 0 deletions

View File

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