changeset 19781:cbd1ab2a068f draft

(svn r24714) -Fix [FS#5337]: [NewGRF] Draw default foundations if resolving of custom station foundation sprites fails.
author frosch <frosch@openttd.org>
date Mon, 12 Nov 2012 20:13:17 +0000
parents 3e5e1e2af3ac
children 1397f9590e4f
files src/newgrf_station.cpp src/station_cmd.cpp
diffstat 2 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -630,7 +630,7 @@
  * @param tile Station tile being drawn
  * @param layout Spritelayout as returned by previous callback
  * @param edge_info Information about northern tile edges; whether they need foundations or merge into adjacent tile's foundations.
- * @return First sprite of a set of foundation sprites for various slopes.
+ * @return First sprite of a set of foundation sprites for various slopes, or 0 if default foundations shall be drawn.
  */
 SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint layout, uint edge_info)
 {
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2652,6 +2652,7 @@
 			if (!HasFoundationNW(ti->tile, slope, z)) SetBit(edge_info, 0);
 			if (!HasFoundationNE(ti->tile, slope, z)) SetBit(edge_info, 1);
 			SpriteID image = GetCustomStationFoundationRelocation(statspec, st, ti->tile, tile_layout, edge_info);
+			if (image == 0) goto draw_default_foundation;
 
 			if (HasBit(statspec->flags, SSF_EXTENDED_FOUNDATIONS)) {
 				/* Station provides extended foundations. */