summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-10 14:01:17 +0000
committerrubidium <rubidium@openttd.org>2009-01-10 14:01:17 +0000
commit1b546505d29c69f1d25bfb3fe45fa2f617554b69 (patch)
tree239d6250b13ddb67b4c149c08a7c7351427fa9b7
parent7878405a12bae0a3d4c6f5b2adfdaff9eecac679 (diff)
downloadopenttd-1b546505d29c69f1d25bfb3fe45fa2f617554b69.tar.xz
(svn r14955) -Fix: newgrf station specs didn't get deallocated when building a new station part over them.
-rw-r--r--src/station_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 12eca14d2..cfa23287d 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1099,7 +1099,11 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
}
}
+ byte old_specindex = IsTileType(tile, MP_STATION) ? GetCustomStationSpecIndex(tile) : 0;
MakeRailStation(tile, st->owner, st->index, axis, layout & ~1, (RailType)GB(p1, 0, 4));
+ /* Free the spec if we overbuild something */
+ DeallocateSpecFromStation(st, old_specindex);
+
SetCustomStationSpecIndex(tile, specindex);
SetStationTileRandomBits(tile, GB(Random(), 0, 4));
SetStationAnimationFrame(tile, 0);