diff options
author | tron <tron@openttd.org> | 2007-01-31 10:50:12 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2007-01-31 10:50:12 +0000 |
commit | c846b28d40810547e18a2720554e0b9117de4798 (patch) | |
tree | 9126411c97777bed62166bd5c07af56b5db913a0 | |
parent | 4a5c2bb70cb7578c6f0751822130881cbb500c91 (diff) | |
download | openttd-c846b28d40810547e18a2720554e0b9117de4798.tar.xz |
(svn r8485) -Fix
-Fix (since the dawn of time): Remove phantom oil rigs sometimes present in old savegames
-rw-r--r-- | src/industry_cmd.cpp | 1 | ||||
-rw-r--r-- | src/openttd.cpp | 13 | ||||
-rw-r--r-- | src/station.h | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 49ceab815..a7748bf92 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -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; diff --git a/src/openttd.cpp b/src/openttd.cpp index a8fea2804..625a1b8f8 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1302,6 +1302,19 @@ bool AfterLoadGame(void) } 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; diff --git a/src/station.h b/src/station.h index 226eddc0c..8000bee91 100644 --- a/src/station.h +++ b/src/station.h @@ -277,4 +277,6 @@ static inline bool IsBuoy(const Station* st) 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 */ |