1
0
Fork 0

(svn r4593) CodeChange : Renamed spec (when using StationSpec) to statspec.

This is following the same scheme as for IndustrySpec
release/0.5
belugas 2006-04-27 18:28:56 +00:00
parent 8d54122649
commit 187013b6a3
7 changed files with 92 additions and 92 deletions

View File

@ -780,7 +780,7 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte *
static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int len) static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int len)
{ {
StationSpec *stat; StationSpec *statspec;
byte *buf = *bufp; byte *buf = *bufp;
int i; int i;
bool ret = false; bool ret = false;
@ -796,7 +796,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
} }
} }
stat = &_cur_grffile->stations[stid]; statspec = &_cur_grffile->stations[stid];
switch (prop) { switch (prop) {
case 0x08: /* Class ID */ case 0x08: /* Class ID */
@ -809,19 +809,19 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
classid |= *(buf++) << 8; classid |= *(buf++) << 8;
classid |= *(buf++); classid |= *(buf++);
stat[i].sclass = AllocateStationClass(classid); statspec[i].sclass = AllocateStationClass(classid);
} }
break; break;
case 0x09: /* Define sprite layout */ case 0x09: /* Define sprite layout */
FOR_EACH_OBJECT { FOR_EACH_OBJECT {
StationSpec *stat = &_cur_grffile->stations[stid + i]; StationSpec *statspec = &_cur_grffile->stations[stid + i];
uint t; uint t;
stat->tiles = grf_load_extended(&buf); statspec->tiles = grf_load_extended(&buf);
stat->renderdata = calloc(stat->tiles, sizeof(*stat->renderdata)); statspec->renderdata = calloc(statspec->tiles, sizeof(*statspec->renderdata));
for (t = 0; t < stat->tiles; t++) { for (t = 0; t < statspec->tiles; t++) {
DrawTileSprites *dts = &stat->renderdata[t]; DrawTileSprites *dts = &statspec->renderdata[t];
uint seq_count = 0; uint seq_count = 0;
PalSpriteID ground_sprite; PalSpriteID ground_sprite;
@ -863,16 +863,16 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
case 0x0A: /* Copy sprite layout */ case 0x0A: /* Copy sprite layout */
FOR_EACH_OBJECT { FOR_EACH_OBJECT {
StationSpec *stat = &_cur_grffile->stations[stid + i]; StationSpec *statspec = &_cur_grffile->stations[stid + i];
byte srcid = grf_load_byte(&buf); byte srcid = grf_load_byte(&buf);
const StationSpec *srcstat = &_cur_grffile->stations[srcid]; const StationSpec *srcstatspec = &_cur_grffile->stations[srcid];
uint t; uint t;
stat->tiles = srcstat->tiles; statspec->tiles = srcstatspec->tiles;
stat->renderdata = calloc(stat->tiles, sizeof(*stat->renderdata)); statspec->renderdata = calloc(statspec->tiles, sizeof(*statspec->renderdata));
for (t = 0; t < stat->tiles; t++) { for (t = 0; t < statspec->tiles; t++) {
DrawTileSprites *dts = &stat->renderdata[t]; DrawTileSprites *dts = &statspec->renderdata[t];
const DrawTileSprites *sdts = &srcstat->renderdata[t]; const DrawTileSprites *sdts = &srcstatspec->renderdata[t];
DrawTileSeqStruct const *sdtss = sdts->seq; DrawTileSeqStruct const *sdtss = sdts->seq;
int seq_count = 0; int seq_count = 0;
@ -899,20 +899,20 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
break; break;
case 0x0B: /* Callback mask */ case 0x0B: /* Callback mask */
FOR_EACH_OBJECT stat[i].callbackmask = grf_load_byte(&buf); FOR_EACH_OBJECT statspec[i].callbackmask = grf_load_byte(&buf);
break; break;
case 0x0C: /* Disallowed number of platforms */ case 0x0C: /* Disallowed number of platforms */
FOR_EACH_OBJECT stat[i].disallowed_platforms = grf_load_byte(&buf); FOR_EACH_OBJECT statspec[i].disallowed_platforms = grf_load_byte(&buf);
break; break;
case 0x0D: /* Disallowed platform lengths */ case 0x0D: /* Disallowed platform lengths */
FOR_EACH_OBJECT stat[i].disallowed_lengths = grf_load_byte(&buf); FOR_EACH_OBJECT statspec[i].disallowed_lengths = grf_load_byte(&buf);
break; break;
case 0x0E: /* Define custom layout */ case 0x0E: /* Define custom layout */
FOR_EACH_OBJECT { FOR_EACH_OBJECT {
StationSpec *stat = &_cur_grffile->stations[stid + i]; StationSpec *statspec = &_cur_grffile->stations[stid + i];
while (buf < *bufp + len) { while (buf < *bufp + len) {
byte length = grf_load_byte(&buf); byte length = grf_load_byte(&buf);
@ -923,27 +923,27 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
if (length == 0 || number == 0) break; if (length == 0 || number == 0) break;
//debug("l %d > %d ?", length, stat->lengths); //debug("l %d > %d ?", length, stat->lengths);
if (length > stat->lengths) { if (length > statspec->lengths) {
stat->platforms = realloc(stat->platforms, length); statspec->platforms = realloc(statspec->platforms, length);
memset(stat->platforms + stat->lengths, 0, length - stat->lengths); memset(statspec->platforms + statspec->lengths, 0, length - statspec->lengths);
stat->layouts = realloc(stat->layouts, length * sizeof(*stat->layouts)); statspec->layouts = realloc(statspec->layouts, length * sizeof(*statspec->layouts));
memset(stat->layouts + stat->lengths, 0, memset(statspec->layouts + statspec->lengths, 0,
(length - stat->lengths) * sizeof(*stat->layouts)); (length - statspec->lengths) * sizeof(*statspec->layouts));
stat->lengths = length; statspec->lengths = length;
} }
l = length - 1; // index is zero-based l = length - 1; // index is zero-based
//debug("p %d > %d ?", number, stat->platforms[l]); //debug("p %d > %d ?", number, stat->platforms[l]);
if (number > stat->platforms[l]) { if (number > statspec->platforms[l]) {
stat->layouts[l] = realloc(stat->layouts[l], statspec->layouts[l] = realloc(statspec->layouts[l],
number * sizeof(**stat->layouts)); number * sizeof(**statspec->layouts));
// We expect NULL being 0 here, but C99 guarantees that. // We expect NULL being 0 here, but C99 guarantees that.
memset(stat->layouts[l] + stat->platforms[l], 0, memset(statspec->layouts[l] + statspec->platforms[l], 0,
(number - stat->platforms[l]) * sizeof(**stat->layouts)); (number - statspec->platforms[l]) * sizeof(**statspec->layouts));
stat->platforms[l] = number; statspec->platforms[l] = number;
} }
p = 0; p = 0;
@ -956,8 +956,8 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
l--; l--;
p--; p--;
free(stat->layouts[l][p]); free(statspec->layouts[l][p]);
stat->layouts[l][p] = layout; statspec->layouts[l][p] = layout;
} }
} }
break; break;
@ -971,27 +971,27 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
break; break;
case 0x10: /* Little/lots cargo threshold */ case 0x10: /* Little/lots cargo threshold */
FOR_EACH_OBJECT stat[i].cargo_threshold = grf_load_word(&buf); FOR_EACH_OBJECT statspec[i].cargo_threshold = grf_load_word(&buf);
break; break;
case 0x11: /* Pylon placement */ case 0x11: /* Pylon placement */
FOR_EACH_OBJECT stat[i].pylons = grf_load_byte(&buf); FOR_EACH_OBJECT statspec[i].pylons = grf_load_byte(&buf);
break; break;
case 0x12: /* Cargo types for random triggers */ case 0x12: /* Cargo types for random triggers */
FOR_EACH_OBJECT stat[i].cargo_triggers = grf_load_dword(&buf); FOR_EACH_OBJECT statspec[i].cargo_triggers = grf_load_dword(&buf);
break; break;
case 0x13: /* General flags */ case 0x13: /* General flags */
FOR_EACH_OBJECT stat[i].flags = grf_load_byte(&buf); FOR_EACH_OBJECT statspec[i].flags = grf_load_byte(&buf);
break; break;
case 0x14: /* Overhead wire placement */ case 0x14: /* Overhead wire placement */
FOR_EACH_OBJECT stat[i].wires = grf_load_byte(&buf); FOR_EACH_OBJECT statspec[i].wires = grf_load_byte(&buf);
break; break;
case 0x15: /* Blocked tiles */ case 0x15: /* Blocked tiles */
FOR_EACH_OBJECT stat[i].blocked = grf_load_byte(&buf); FOR_EACH_OBJECT statspec[i].blocked = grf_load_byte(&buf);
break; break;
default: default:
@ -1612,7 +1612,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
for (i = 0; i < idcount; i++) { for (i = 0; i < idcount; i++) {
uint8 stid = buf[3 + i]; uint8 stid = buf[3 + i];
StationSpec *stat = &_cur_grffile->stations[stid]; StationSpec *statspec = &_cur_grffile->stations[stid];
byte *bp = &buf[4 + idcount]; byte *bp = &buf[4 + idcount];
for (c = 0; c < cidcount; c++) { for (c = 0; c < cidcount; c++) {
@ -1630,7 +1630,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
continue; continue;
} }
stat->spritegroup[1] = _cur_grffile->spritegroups[groupid]; statspec->spritegroup[1] = _cur_grffile->spritegroups[groupid];
} }
} }
@ -1646,12 +1646,12 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
for (i = 0; i < idcount; i++) { for (i = 0; i < idcount; i++) {
uint8 stid = buf[3 + i]; uint8 stid = buf[3 + i];
StationSpec *stat = &_cur_grffile->stations[stid]; StationSpec *statspec = &_cur_grffile->stations[stid];
stat->spritegroup[0] = _cur_grffile->spritegroups[groupid]; statspec->spritegroup[0] = _cur_grffile->spritegroups[groupid];
stat->grfid = _cur_grffile->grfid; statspec->grfid = _cur_grffile->grfid;
stat->localidx = stid; statspec->localidx = stid;
SetCustomStation(stat); SetCustomStationSpec(statspec);
} }
} }
return; return;

View File

@ -127,18 +127,18 @@ uint GetNumCustomStations(StationClassID sclass)
* Tie a station spec to its station class. * Tie a station spec to its station class.
* @param spec The station spec. * @param spec The station spec.
*/ */
void SetCustomStation(StationSpec *spec) void SetCustomStationSpec(StationSpec *statspec)
{ {
StationClass *station_class; StationClass *station_class;
int i; int i;
assert(spec->sclass < STAT_CLASS_MAX); assert(statspec->sclass < STAT_CLASS_MAX);
station_class = &station_classes[spec->sclass]; station_class = &station_classes[statspec->sclass];
i = station_class->stations++; i = station_class->stations++;
station_class->spec = realloc(station_class->spec, station_class->stations * sizeof(*station_class->spec)); station_class->spec = realloc(station_class->spec, station_class->stations * sizeof(*station_class->spec));
station_class->spec[i] = spec; station_class->spec[i] = statspec;
} }
/** /**
@ -147,7 +147,7 @@ void SetCustomStation(StationSpec *spec)
* @param station The station index with the class. * @param station The station index with the class.
* @return The station spec. * @return The station spec.
*/ */
const StationSpec *GetCustomStation(StationClassID sclass, uint station) const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station)
{ {
assert(sclass < STAT_CLASS_MAX); assert(sclass < STAT_CLASS_MAX);
if (station < station_classes[sclass].stations) if (station < station_classes[sclass].stations)
@ -225,16 +225,16 @@ static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg,
} }
} }
uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, byte ctype) uint32 GetCustomStationRelocation(const StationSpec *statspec, const Station *st, byte ctype)
{ {
const RealSpriteGroup *rsg = ResolveStationSpriteGroup(spec->spritegroup[ctype], st); const RealSpriteGroup *rsg = ResolveStationSpriteGroup(statspec->spritegroup[ctype], st);
if (rsg == NULL) return 0; if (rsg == NULL) return 0;
if (rsg->num_loading != 0) return rsg->loading[0]->g.result.sprite; if (rsg->num_loading != 0) return rsg->loading[0]->g.result.sprite;
if (rsg->num_loaded != 0) return rsg->loaded[0]->g.result.sprite; if (rsg->num_loaded != 0) return rsg->loaded[0]->g.result.sprite;
DEBUG(grf, 6)("Custom station 0x%08x::0x%02x has no sprites associated.", DEBUG(grf, 6)("Custom station 0x%08x::0x%02x has no sprites associated.",
spec->grfid, spec->localidx); statspec->grfid, statspec->localidx);
/* This is what gets subscribed of dtss->image in newgrf.c, /* This is what gets subscribed of dtss->image in newgrf.c,
* so it's probably kinda "default offset". Try to use it as * so it's probably kinda "default offset". Try to use it as
* emergency measure. */ * emergency measure. */
@ -249,15 +249,15 @@ uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, by
* @param exec Whether to actually allocate the spec. * @param exec Whether to actually allocate the spec.
* @return Index within the Station's spec list, or -1 if the allocation failed. * @return Index within the Station's spec list, or -1 if the allocation failed.
*/ */
int AllocateSpecToStation(const StationSpec *spec, Station *st, bool exec) int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec)
{ {
uint i; uint i;
if (spec == NULL) return 0; if (statspec == NULL) return 0;
/* Check if this spec has already been allocated */ /* Check if this spec has already been allocated */
for (i = 1; i < st->num_specs && i < 256; i++) { for (i = 1; i < st->num_specs && i < 256; i++) {
if (st->speclist[i].spec == spec) return i; if (st->speclist[i].spec == statspec) return i;
} }
for (i = 1; i < st->num_specs && i < 256; i++) { for (i = 1; i < st->num_specs && i < 256; i++) {
@ -278,9 +278,9 @@ int AllocateSpecToStation(const StationSpec *spec, Station *st, bool exec)
} }
} }
st->speclist[i].spec = spec; st->speclist[i].spec = statspec;
st->speclist[i].grfid = spec->grfid; st->speclist[i].grfid = statspec->grfid;
st->speclist[i].localidx = spec->localidx; st->speclist[i].localidx = statspec->localidx;
} }
return i; return i;
} }

View File

@ -91,16 +91,16 @@ StringID *BuildStationClassDropdown(void);
uint GetNumStationClasses(void); uint GetNumStationClasses(void);
uint GetNumCustomStations(StationClassID sclass); uint GetNumCustomStations(StationClassID sclass);
void SetCustomStation(StationSpec *spec); void SetCustomStationSpec(StationSpec *statspec);
const StationSpec *GetCustomStation(StationClassID sclass, uint station); const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station);
/* Get sprite offset for a given custom station and station structure (may be /* Get sprite offset for a given custom station and station structure (may be
* NULL if ctype is set - that means we are in a build dialog). The station * NULL if ctype is set - that means we are in a build dialog). The station
* structure is used for variational sprite groups. */ * structure is used for variational sprite groups. */
uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, byte ctype); uint32 GetCustomStationRelocation(const StationSpec *statspec, const Station *st, byte ctype);
/* Allocate a StationSpec to a Station. This is called once per build operation. */ /* Allocate a StationSpec to a Station. This is called once per build operation. */
int AllocateSpecToStation(const StationSpec *spec, Station *st, bool exec); int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec);
/* Deallocate a StationSpec from a Station. Called when removing a single station tile. */ /* Deallocate a StationSpec from a Station. Called when removing a single station tile. */
bool DeallocateSpecFromStation(Station *st, byte specindex); bool DeallocateSpecFromStation(Station *st, byte specindex);

View File

@ -1342,15 +1342,15 @@ bool AfterLoadGame(void)
FOR_ALL_WAYPOINTS(wp) { FOR_ALL_WAYPOINTS(wp) {
if (wp->xy != 0 && wp->deleted == 0) { if (wp->xy != 0 && wp->deleted == 0) {
const StationSpec *spec = NULL; const StationSpec *statspec = NULL;
if (HASBIT(_m[wp->xy].m3, 4)) if (HASBIT(_m[wp->xy].m3, 4))
spec = GetCustomStation(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1); statspec = GetCustomStationSpec(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1);
if (spec != NULL) { if (statspec != NULL) {
wp->stat_id = _m[wp->xy].m4 + 1; wp->stat_id = _m[wp->xy].m4 + 1;
wp->grfid = spec->grfid; wp->grfid = statspec->grfid;
wp->localidx = spec->localidx; wp->localidx = statspec->localidx;
} else { } else {
// No custom graphics set, so set to default. // No custom graphics set, so set to default.
wp->stat_id = 0; wp->stat_id = 0;

View File

@ -1318,13 +1318,13 @@ static void DrawTile_Track(TileInfo *ti)
if (IsRailWaypoint(ti->tile) && IsCustomWaypoint(ti->tile)) { if (IsRailWaypoint(ti->tile) && IsCustomWaypoint(ti->tile)) {
// look for customization // look for customization
byte stat_id = GetWaypointByTile(ti->tile)->stat_id; byte stat_id = GetWaypointByTile(ti->tile)->stat_id;
const StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, stat_id); const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, stat_id);
if (stat != NULL) { if (statspec != NULL) {
DrawTileSeqStruct const *seq; DrawTileSeqStruct const *seq;
// emulate station tile - open with building // emulate station tile - open with building
const DrawTileSprites *cust = &stat->renderdata[2 + GetWaypointAxis(ti->tile)]; const DrawTileSprites *cust = &statspec->renderdata[2 + GetWaypointAxis(ti->tile)];
uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0); uint32 relocation = GetCustomStationRelocation(statspec, ComposeWaypointStation(ti->tile), 0);
/* We don't touch the 0x8000 bit. In all this /* We don't touch the 0x8000 bit. In all this
* waypoint code, it is used to indicate that * waypoint code, it is used to indicate that

View File

@ -918,13 +918,13 @@ static inline byte *CreateMulti(byte *layout, int n, byte b)
return layout; return layout;
} }
static void GetStationLayout(byte *layout, int numtracks, int plat_len, const StationSpec *spec) static void GetStationLayout(byte *layout, int numtracks, int plat_len, const StationSpec *statspec)
{ {
if (spec != NULL && spec->lengths >= plat_len && if (statspec != NULL && statspec->lengths >= plat_len &&
spec->platforms[plat_len - 1] >= numtracks && statspec->platforms[plat_len - 1] >= numtracks &&
spec->layouts[plat_len - 1][numtracks - 1]) { statspec->layouts[plat_len - 1][numtracks - 1]) {
/* Custom layout defined, follow it. */ /* Custom layout defined, follow it. */
memcpy(layout, spec->layouts[plat_len - 1][numtracks - 1], memcpy(layout, statspec->layouts[plat_len - 1][numtracks - 1],
plat_len * numtracks); plat_len * numtracks);
return; return;
} }
@ -1042,7 +1042,7 @@ int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint3
if (GB(p2, 8, 8) >= STAT_CLASS_MAX) return CMD_ERROR; if (GB(p2, 8, 8) >= STAT_CLASS_MAX) return CMD_ERROR;
/* Check if we can allocate a custom stationspec to this station */ /* Check if we can allocate a custom stationspec to this station */
statspec = GetCustomStation(GB(p2, 8, 8), GB(p2, 16, 8)); statspec = GetCustomStationSpec(GB(p2, 8, 8), GB(p2, 16, 8));
specindex = AllocateSpecToStation(statspec, st, flags & DC_EXEC); specindex = AllocateSpecToStation(statspec, st, flags & DC_EXEC);
if (specindex == -1) return CMD_ERROR; if (specindex == -1) return CMD_ERROR;

View File

@ -153,8 +153,8 @@ void UpdateAllWaypointCustomGraphics(void)
if (wp->grfid == 0) continue; if (wp->grfid == 0) continue;
for (i = 0; i < GetNumCustomStations(STAT_CLASS_WAYP); i++) { for (i = 0; i < GetNumCustomStations(STAT_CLASS_WAYP); i++) {
const StationSpec *spec = GetCustomStation(STAT_CLASS_WAYP, i); const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, i);
if (spec != NULL && spec->grfid == wp->grfid && spec->localidx == wp->localidx) { if (statspec != NULL && statspec->grfid == wp->grfid && statspec->localidx == wp->localidx) {
wp->stat_id = i; wp->stat_id = i;
break; break;
} }
@ -213,18 +213,18 @@ int32 CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
} }
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
const StationSpec *spec = NULL; const StationSpec *statspec = NULL;
MakeRailWaypoint(tile, GetTileOwner(tile), axis, GetRailType(tile), wp->index); MakeRailWaypoint(tile, GetTileOwner(tile), axis, GetRailType(tile), wp->index);
MarkTileDirtyByTile(tile); MarkTileDirtyByTile(tile);
if (GB(p1, 0, 8) < GetNumCustomStations(STAT_CLASS_WAYP)) if (GB(p1, 0, 8) < GetNumCustomStations(STAT_CLASS_WAYP))
spec = GetCustomStation(STAT_CLASS_WAYP, GB(p1, 0, 8)); statspec = GetCustomStationSpec(STAT_CLASS_WAYP, GB(p1, 0, 8));
if (spec != NULL) { if (statspec != NULL) {
SetCustomWaypointSprite(tile); SetCustomWaypointSprite(tile);
wp->stat_id = GB(p1, 0, 8); wp->stat_id = GB(p1, 0, 8);
wp->grfid = spec->grfid; wp->grfid = statspec->grfid;
wp->localidx = spec->localidx; wp->localidx = statspec->localidx;
} else { } else {
// Specified custom graphics do not exist, so use default. // Specified custom graphics do not exist, so use default.
ClearCustomWaypointSprite(tile); ClearCustomWaypointSprite(tile);
@ -385,7 +385,7 @@ extern uint16 _custom_sprites_base;
/* Draw a waypoint */ /* Draw a waypoint */
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype) void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
{ {
const StationSpec *stat; const StationSpec *statspec;
uint32 relocation; uint32 relocation;
const DrawTileSprites *cust; const DrawTileSprites *cust;
DrawTileSeqStruct const *seq; DrawTileSeqStruct const *seq;
@ -397,18 +397,18 @@ void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
x += 33; x += 33;
y += 17; y += 17;
stat = GetCustomStation(STAT_CLASS_WAYP, stat_id); statspec = GetCustomStationSpec(STAT_CLASS_WAYP, stat_id);
if (stat == NULL) { if (statspec == NULL) {
// stat is NULL for default waypoints and when waypoint graphics are // stat is NULL for default waypoints and when waypoint graphics are
// not loaded. // not loaded.
DrawDefaultWaypointSprite(x, y, railtype); DrawDefaultWaypointSprite(x, y, railtype);
return; return;
} }
relocation = GetCustomStationRelocation(stat, NULL, 1); relocation = GetCustomStationRelocation(statspec, NULL, 1);
// emulate station tile - open with building // emulate station tile - open with building
// add 1 to get the other direction // add 1 to get the other direction
cust = &stat->renderdata[2]; cust = &statspec->renderdata[2];
img = cust->ground_sprite; img = cust->ground_sprite;
img += (img < _custom_sprites_base) ? rti->total_offset : rti->custom_ground_offset; img += (img < _custom_sprites_base) ? rti->total_offset : rti->custom_ground_offset;