summaryrefslogtreecommitdiff
path: root/newgrf_station.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-07 12:58:45 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-07 12:58:45 +0000
commit5c3887cdb4bf14a1033f843da06b3ddd5579569d (patch)
tree659e25219492c9309c4a58908a4d9e953314ee67 /newgrf_station.c
parent8bd664f81f3664ee4ce13cfa547f113a34eccbcc (diff)
downloadopenttd-5c3887cdb4bf14a1033f843da06b3ddd5579569d.tar.xz
(svn r4772) - Newstations: when allocating a custom station (via action 0x03) check if the station has already been allocated. (Fixes duplicate waypoints in newstatsw in non-temperate climate)
Diffstat (limited to 'newgrf_station.c')
-rw-r--r--newgrf_station.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/newgrf_station.c b/newgrf_station.c
index cb02b9b2f..2b699e217 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -137,6 +137,9 @@ void SetCustomStationSpec(StationSpec *statspec)
StationClass *station_class;
int i;
+ /* If the station has already been allocated, don't reallocate it. */
+ if (statspec->allocated) return;
+
assert(statspec->sclass < STAT_CLASS_MAX);
station_class = &station_classes[statspec->sclass];
@@ -144,6 +147,7 @@ void SetCustomStationSpec(StationSpec *statspec)
station_class->spec = realloc(station_class->spec, station_class->stations * sizeof(*station_class->spec));
station_class->spec[i] = statspec;
+ statspec->allocated = true;
}
/**