changeset 7826:4ea8c684b2d1 draft

(svn r11376) -Fix: fill the town a oil rig is associated with before creating the name, otherwise every oil rig will become "<TOWN> Oilrig" which effectively means that there can be several oil rigs with exactly the same name.
author rubidium <rubidium@openttd.org>
date Sun, 04 Nov 2007 11:46:01 +0000
parents 8791573e7431
children ce139ad89369
files src/station_cmd.cpp
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2759,14 +2759,16 @@
 		DEBUG(misc, 0, "Can't allocate station for oilrig at 0x%X, reverting to oilrig only", tile);
 		return;
 	}
-	if (!GenerateStationName(st, tile, STATIONNAMING_OILRIG)) {
-		DEBUG(misc, 0, "Can't allocate station-name for oilrig at 0x%X, reverting to oilrig only", tile);
-		return;
-	}
 
 	st->town = ClosestTownFromTile(tile, (uint)-1);
 	st->sign.width_1 = 0;
 
+	if (!GenerateStationName(st, tile, STATIONNAMING_OILRIG)) {
+		DEBUG(misc, 0, "Can't allocate station-name for oilrig at 0x%X, reverting to oilrig only", tile);
+		delete st;
+		return;
+	}
+
 	MakeOilrig(tile, st->index);
 
 	st->owner = OWNER_NONE;