Changeset - r3780:8c041ef429a9
[Not reviewed]
master
0 2 0
peter1138 - 18 years ago 2006-05-07 12:58:45
peter1138@openttd.org
(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)
2 files changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
newgrf_station.c
Show inline comments
 
@@ -137,6 +137,9 @@ void SetCustomStationSpec(StationSpec *s
 
	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 *s
 
	station_class->spec = realloc(station_class->spec, station_class->stations * sizeof(*station_class->spec));
 

	
 
	station_class->spec[i] = statspec;
 
	statspec->allocated = true;
 
}
 

	
 
/**
newgrf_station.h
Show inline comments
 
@@ -21,6 +21,8 @@ typedef struct StationSpec {
 
	uint32 grfid; ///< ID of GRF file station belongs to.
 
	int localidx; ///< Index within GRF file of station.
 

	
 
	bool allocated; ///< Flag whether this station has been added to a station class list
 

	
 
	StationClassID sclass; ///< The class to which this spec belongs.
 
	StringID name; ///< Name of this station.
 

	
0 comments (0 inline, 0 general)