summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-12-09 17:14:03 +0000
committeryexo <yexo@openttd.org>2011-12-09 17:14:03 +0000
commitb8ee5c018d3487d2a905290652c8381f30478d5a (patch)
tree93935a90ba6ae1e1eb0b6c54034a71de8e1a3d8e
parent2b1a3809024d5ad6cd947c268f644e45e57b09ce (diff)
downloadopenttd-b8ee5c018d3487d2a905290652c8381f30478d5a.tar.xz
(svn r23459) -Fix: don't crash trying to draw airport tiles when the airport grf is missing
-rw-r--r--src/station_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 652a623f8..49711f2e6 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2613,8 +2613,9 @@ static void DrawTile_Station(TileInfo *ti)
total_offset = 0;
}
+ StationGfx gfx = GetStationGfx(ti->tile);
if (IsAirport(ti->tile)) {
- StationGfx gfx = GetAirportGfx(ti->tile);
+ gfx = GetAirportGfx(ti->tile);
if (gfx >= NEW_AIRPORTTILE_OFFSET) {
const AirportTileSpec *ats = AirportTileSpec::Get(gfx);
if (ats->grf_prop.spritegroup[0] != NULL && DrawNewAirportTile(ti, Station::GetByTile(ti->tile), gfx, ats)) {
@@ -2654,7 +2655,7 @@ static void DrawTile_Station(TileInfo *ti)
palette = PALETTE_TO_GREY;
}
- if (layout == NULL && (t == NULL || t->seq == NULL)) t = GetStationTileLayout(GetStationType(ti->tile), GetStationGfx(ti->tile));
+ if (layout == NULL && (t == NULL || t->seq == NULL)) t = GetStationTileLayout(GetStationType(ti->tile), gfx);
/* don't show foundation for docks */
if (ti->tileh != SLOPE_FLAT && !IsDock(ti->tile)) {