Don't draw highlights on void tiles
This commit is contained in:
@@ -471,7 +471,6 @@ void DrawTrainDepotSprite(SpriteID palette, const TileInfo *ti, RailType railtyp
|
|||||||
|
|
||||||
void DrawTrainStationSprite(SpriteID palette, const TileInfo *ti, RailType railtype, Axis axis, byte section) {
|
void DrawTrainStationSprite(SpriteID palette, const TileInfo *ti, RailType railtype, Axis axis, byte section) {
|
||||||
int32 total_offset = 0;
|
int32 total_offset = 0;
|
||||||
PaletteID pal = COMPANY_SPRITE_COLOUR(_local_company);
|
|
||||||
const DrawTileSprites *t = GetStationTileLayout(STATION_RAIL, section + (axis == AXIS_X ? 0 : 1));
|
const DrawTileSprites *t = GetStationTileLayout(STATION_RAIL, section + (axis == AXIS_X ? 0 : 1));
|
||||||
const RailtypeInfo *rti = nullptr;
|
const RailtypeInfo *rti = nullptr;
|
||||||
|
|
||||||
@@ -1028,9 +1027,9 @@ void CalcCBTownLimitBorder(TileHighlight &th, TileIndex tile, SpriteID border_pa
|
|||||||
if (in_zone) th.tint_all(ground_pal);
|
if (in_zone) th.tint_all(ground_pal);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileHighlight GetTileHighlight(const TileInfo *ti) {
|
TileHighlight GetTileHighlight(const TileInfo *ti, TileType tile_type) {
|
||||||
TileHighlight th;
|
TileHighlight th;
|
||||||
if (ti->tile == INVALID_TILE) return th;
|
if (ti->tile == INVALID_TILE || tile_type == MP_VOID) return th;
|
||||||
if (_zoning.outer == CHECKTOWNZONES) {
|
if (_zoning.outer == CHECKTOWNZONES) {
|
||||||
auto p = GetTownZoneBorder(ti->tile);
|
auto p = GetTownZoneBorder(ti->tile);
|
||||||
auto color = PAL_NONE;
|
auto color = PAL_NONE;
|
||||||
@@ -1133,7 +1132,8 @@ TileHighlight GetTileHighlight(const TileInfo *ti) {
|
|||||||
return th;
|
return th;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTileZoning(const TileInfo *ti, const TileHighlight &th) {
|
void DrawTileZoning(const TileInfo *ti, const TileHighlight &th, TileType tile_type) {
|
||||||
|
if (ti->tile == INVALID_TILE || tile_type == MP_VOID) return;
|
||||||
for (uint i = 0; i < th.border_count; i++)
|
for (uint i = 0; i < th.border_count; i++)
|
||||||
DrawBorderSprites(ti, th.border[i], th.border_color[i]);
|
DrawBorderSprites(ti, th.border[i], th.border_color[i]);
|
||||||
if (th.sprite) {
|
if (th.sprite) {
|
||||||
@@ -1147,6 +1147,7 @@ void DrawTileZoning(const TileInfo *ti, const TileHighlight &th) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DrawTileSelection(const TileInfo *ti, const TileHighlightType &tht) {
|
bool DrawTileSelection(const TileInfo *ti, const TileHighlightType &tht) {
|
||||||
|
if (ti->tile == INVALID_TILE || IsTileType(ti->tile, MP_VOID)) return false;
|
||||||
_thd.cm.Draw(ti);
|
_thd.cm.Draw(ti);
|
||||||
|
|
||||||
if (_thd.drawstyle == CM_HT_BLUEPRINT_PLACE) return true;
|
if (_thd.drawstyle == CM_HT_BLUEPRINT_PLACE) return true;
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ DECLARE_ENUM_AS_BIT_SET(ZoningBorder);
|
|||||||
bool CanBuild(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd);
|
bool CanBuild(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd);
|
||||||
bool CanBuild(const CommandContainer &cc);
|
bool CanBuild(const CommandContainer &cc);
|
||||||
|
|
||||||
TileHighlight GetTileHighlight(const TileInfo *ti);
|
TileHighlight GetTileHighlight(const TileInfo *ti, TileType tile_type);
|
||||||
void DrawTileZoning(const TileInfo *ti, const TileHighlight &th);
|
void DrawTileZoning(const TileInfo *ti, const TileHighlight &th, TileType tile_type);
|
||||||
bool DrawTileSelection(const TileInfo *ti, const TileHighlightType &tht);
|
bool DrawTileSelection(const TileInfo *ti, const TileHighlightType &tht);
|
||||||
|
|
||||||
void AllocateZoningMap(uint map_size);
|
void AllocateZoningMap(uint map_size);
|
||||||
|
|||||||
@@ -1312,13 +1312,13 @@ static void ViewportAddLandscape()
|
|||||||
_vd.foundation[1] = -1;
|
_vd.foundation[1] = -1;
|
||||||
_vd.last_foundation_child[0] = nullptr;
|
_vd.last_foundation_child[0] = nullptr;
|
||||||
_vd.last_foundation_child[1] = nullptr;
|
_vd.last_foundation_child[1] = nullptr;
|
||||||
_vd.cm_highlight = citymania::GetTileHighlight(&tile_info);
|
_vd.cm_highlight = citymania::GetTileHighlight(&tile_info, tile_type);
|
||||||
|
|
||||||
_tile_type_procs[tile_type]->draw_tile_proc(&tile_info);
|
_tile_type_procs[tile_type]->draw_tile_proc(&tile_info);
|
||||||
|
|
||||||
if (tile_info.tile != INVALID_TILE){
|
if (tile_info.tile != INVALID_TILE){
|
||||||
citymania::DrawTileZoning(&tile_info);
|
citymania::DrawTileZoning(&tile_info); // old zoning patch
|
||||||
citymania::DrawTileZoning(&tile_info, _vd.cm_highlight);
|
citymania::DrawTileZoning(&tile_info, _vd.cm_highlight, tile_type);
|
||||||
DrawTileSelection(&tile_info);
|
DrawTileSelection(&tile_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user