(svn r8485) -Fix
authortron
Wed, 31 Jan 2007 10:50:12 +0000
changeset 5884 0c9a9c61ca76
parent 5883 6b09a9a559a4
child 5885 28503880e8f3
(svn r8485) -Fix

-Fix (since the dawn of time): Remove phantom oil rigs sometimes present in old savegames
src/industry_cmd.cpp
src/openttd.cpp
src/station.h
--- a/src/industry_cmd.cpp	Wed Jan 31 10:27:45 2007 +0000
+++ b/src/industry_cmd.cpp	Wed Jan 31 10:50:12 2007 +0000
@@ -28,7 +28,6 @@
 
 void ShowIndustryViewWindow(int industry);
 void BuildOilRig(TileIndex tile);
-void DeleteOilRig(TileIndex tile);
 
 static byte _industry_sound_ctr;
 static TileIndex _industry_sound_tile;
--- a/src/openttd.cpp	Wed Jan 31 10:27:45 2007 +0000
+++ b/src/openttd.cpp	Wed Jan 31 10:50:12 2007 +0000
@@ -1302,6 +1302,19 @@
 						}
 						break;
 
+					case STATION_OILRIG: {
+						/* Very old savegames sometimes have phantom oil rigs, i.e.
+						 * an oil rig which got shut down, but not completly removed from
+						 * the map
+						 */
+						TileIndex t1 = TILE_ADDXY(t, 1, 0);
+						if (!IsTileType(t1, MP_INDUSTRY) ||
+								GetIndustryGfx(t1) != GFX_OILRIG_3) {
+							DeleteOilRig(t);
+						}
+						break;
+					}
+
 					default: break;
 				}
 				break;
--- a/src/station.h	Wed Jan 31 10:27:45 2007 +0000
+++ b/src/station.h	Wed Jan 31 10:50:12 2007 +0000
@@ -277,4 +277,6 @@
 	return (st->had_vehicle_of_type & HVOT_BUOY) != 0; /* XXX: We should really ditch this ugly coding and switch to something sane... */
 }
 
+void DeleteOilRig(TileIndex t);
+
 #endif /* STATION_H */