summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newgrf.c94
-rw-r--r--newgrf_station.c28
-rw-r--r--newgrf_station.h8
-rw-r--r--openttd.c10
-rw-r--r--rail_cmd.c8
-rw-r--r--station_cmd.c12
-rw-r--r--waypoint.c24
7 files changed, 92 insertions, 92 deletions
diff --git a/newgrf.c b/newgrf.c
index 4c02ceb65..75092bcf2 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -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)
{
- StationSpec *stat;
+ StationSpec *statspec;
byte *buf = *bufp;
int i;
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) {
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++);
- stat[i].sclass = AllocateStationClass(classid);
+ statspec[i].sclass = AllocateStationClass(classid);
}
break;
case 0x09: /* Define sprite layout */
FOR_EACH_OBJECT {
- StationSpec *stat = &_cur_grffile->stations[stid + i];
+ StationSpec *statspec = &_cur_grffile->stations[stid + i];
uint t;
- stat->tiles = grf_load_extended(&buf);
- stat->renderdata = calloc(stat->tiles, sizeof(*stat->renderdata));
- for (t = 0; t < stat->tiles; t++) {
- DrawTileSprites *dts = &stat->renderdata[t];
+ statspec->tiles = grf_load_extended(&buf);
+ statspec->renderdata = calloc(statspec->tiles, sizeof(*statspec->renderdata));
+ for (t = 0; t < statspec->tiles; t++) {
+ DrawTileSprites *dts = &statspec->renderdata[t];
uint seq_count = 0;
PalSpriteID ground_sprite;
@@ -863,16 +863,16 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
case 0x0A: /* Copy sprite layout */
FOR_EACH_OBJECT {
- StationSpec *stat = &_cur_grffile->stations[stid + i];
+ StationSpec *statspec = &_cur_grffile->stations[stid + i];
byte srcid = grf_load_byte(&buf);
- const StationSpec *srcstat = &_cur_grffile->stations[srcid];
+ const StationSpec *srcstatspec = &_cur_grffile->stations[srcid];
uint t;
- stat->tiles = srcstat->tiles;
- stat->renderdata = calloc(stat->tiles, sizeof(*stat->renderdata));
- for (t = 0; t < stat->tiles; t++) {
- DrawTileSprites *dts = &stat->renderdata[t];
- const DrawTileSprites *sdts = &srcstat->renderdata[t];
+ statspec->tiles = srcstatspec->tiles;
+ statspec->renderdata = calloc(statspec->tiles, sizeof(*statspec->renderdata));
+ for (t = 0; t < statspec->tiles; t++) {
+ DrawTileSprites *dts = &statspec->renderdata[t];
+ const DrawTileSprites *sdts = &srcstatspec->renderdata[t];
DrawTileSeqStruct const *sdtss = sdts->seq;
int seq_count = 0;
@@ -899,20 +899,20 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
break;
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;
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;
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;
case 0x0E: /* Define custom layout */
FOR_EACH_OBJECT {
- StationSpec *stat = &_cur_grffile->stations[stid + i];
+ StationSpec *statspec = &_cur_grffile->stations[stid + i];
while (buf < *bufp + len) {
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;
//debug("l %d > %d ?", length, stat->lengths);
- if (length > stat->lengths) {
- stat->platforms = realloc(stat->platforms, length);
- memset(stat->platforms + stat->lengths, 0, length - stat->lengths);
+ if (length > statspec->lengths) {
+ statspec->platforms = realloc(statspec->platforms, length);
+ memset(statspec->platforms + statspec->lengths, 0, length - statspec->lengths);
- stat->layouts = realloc(stat->layouts, length * sizeof(*stat->layouts));
- memset(stat->layouts + stat->lengths, 0,
- (length - stat->lengths) * sizeof(*stat->layouts));
+ statspec->layouts = realloc(statspec->layouts, length * sizeof(*statspec->layouts));
+ memset(statspec->layouts + statspec->lengths, 0,
+ (length - statspec->lengths) * sizeof(*statspec->layouts));
- stat->lengths = length;
+ statspec->lengths = length;
}
l = length - 1; // index is zero-based
//debug("p %d > %d ?", number, stat->platforms[l]);
- if (number > stat->platforms[l]) {
- stat->layouts[l] = realloc(stat->layouts[l],
- number * sizeof(**stat->layouts));
+ if (number > statspec->platforms[l]) {
+ statspec->layouts[l] = realloc(statspec->layouts[l],
+ number * sizeof(**statspec->layouts));
// We expect NULL being 0 here, but C99 guarantees that.
- memset(stat->layouts[l] + stat->platforms[l], 0,
- (number - stat->platforms[l]) * sizeof(**stat->layouts));
+ memset(statspec->layouts[l] + statspec->platforms[l], 0,
+ (number - statspec->platforms[l]) * sizeof(**statspec->layouts));
- stat->platforms[l] = number;
+ statspec->platforms[l] = number;
}
p = 0;
@@ -956,8 +956,8 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
l--;
p--;
- free(stat->layouts[l][p]);
- stat->layouts[l][p] = layout;
+ free(statspec->layouts[l][p]);
+ statspec->layouts[l][p] = layout;
}
}
break;
@@ -971,27 +971,27 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
break;
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;
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;
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;
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;
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;
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;
default:
@@ -1612,7 +1612,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
for (i = 0; i < idcount; i++) {
uint8 stid = buf[3 + i];
- StationSpec *stat = &_cur_grffile->stations[stid];
+ StationSpec *statspec = &_cur_grffile->stations[stid];
byte *bp = &buf[4 + idcount];
for (c = 0; c < cidcount; c++) {
@@ -1630,7 +1630,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len)
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++) {
uint8 stid = buf[3 + i];
- StationSpec *stat = &_cur_grffile->stations[stid];
+ StationSpec *statspec = &_cur_grffile->stations[stid];
- stat->spritegroup[0] = _cur_grffile->spritegroups[groupid];
- stat->grfid = _cur_grffile->grfid;
- stat->localidx = stid;
- SetCustomStation(stat);
+ statspec->spritegroup[0] = _cur_grffile->spritegroups[groupid];
+ statspec->grfid = _cur_grffile->grfid;
+ statspec->localidx = stid;
+ SetCustomStationSpec(statspec);
}
}
return;
diff --git a/newgrf_station.c b/newgrf_station.c
index c59aaf167..657b310e1 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -127,18 +127,18 @@ uint GetNumCustomStations(StationClassID sclass)
* Tie a station spec to its station class.
* @param spec The station spec.
*/
-void SetCustomStation(StationSpec *spec)
+void SetCustomStationSpec(StationSpec *statspec)
{
StationClass *station_class;
int i;
- assert(spec->sclass < STAT_CLASS_MAX);
- station_class = &station_classes[spec->sclass];
+ assert(statspec->sclass < STAT_CLASS_MAX);
+ station_class = &station_classes[statspec->sclass];
i = station_class->stations++;
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.
* @return The station spec.
*/
-const StationSpec *GetCustomStation(StationClassID sclass, uint station)
+const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station)
{
assert(sclass < STAT_CLASS_MAX);
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->num_loading != 0) return rsg->loading[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.",
- spec->grfid, spec->localidx);
+ statspec->grfid, statspec->localidx);
/* This is what gets subscribed of dtss->image in newgrf.c,
* so it's probably kinda "default offset". Try to use it as
* emergency measure. */
@@ -249,15 +249,15 @@ uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, by
* @param exec Whether to actually allocate the spec.
* @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;
- if (spec == NULL) return 0;
+ if (statspec == NULL) return 0;
/* Check if this spec has already been allocated */
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++) {
@@ -278,9 +278,9 @@ int AllocateSpecToStation(const StationSpec *spec, Station *st, bool exec)
}
}
- st->speclist[i].spec = spec;
- st->speclist[i].grfid = spec->grfid;
- st->speclist[i].localidx = spec->localidx;
+ st->speclist[i].spec = statspec;
+ st->speclist[i].grfid = statspec->grfid;
+ st->speclist[i].localidx = statspec->localidx;
}
return i;
}
diff --git a/newgrf_station.h b/newgrf_station.h
index 64eaeec41..00776dab5 100644
--- a/newgrf_station.h
+++ b/newgrf_station.h
@@ -91,16 +91,16 @@ StringID *BuildStationClassDropdown(void);
uint GetNumStationClasses(void);
uint GetNumCustomStations(StationClassID sclass);
-void SetCustomStation(StationSpec *spec);
-const StationSpec *GetCustomStation(StationClassID sclass, uint station);
+void SetCustomStationSpec(StationSpec *statspec);
+const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station);
/* 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
* 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. */
-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. */
bool DeallocateSpecFromStation(Station *st, byte specindex);
diff --git a/openttd.c b/openttd.c
index a3c30476d..b7ef3a635 100644
--- a/openttd.c
+++ b/openttd.c
@@ -1342,15 +1342,15 @@ bool AfterLoadGame(void)
FOR_ALL_WAYPOINTS(wp) {
if (wp->xy != 0 && wp->deleted == 0) {
- const StationSpec *spec = NULL;
+ const StationSpec *statspec = NULL;
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->grfid = spec->grfid;
- wp->localidx = spec->localidx;
+ wp->grfid = statspec->grfid;
+ wp->localidx = statspec->localidx;
} else {
// No custom graphics set, so set to default.
wp->stat_id = 0;
diff --git a/rail_cmd.c b/rail_cmd.c
index 20d14445f..3435b4a49 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1318,13 +1318,13 @@ static void DrawTile_Track(TileInfo *ti)
if (IsRailWaypoint(ti->tile) && IsCustomWaypoint(ti->tile)) {
// look for customization
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;
// emulate station tile - open with building
- const DrawTileSprites *cust = &stat->renderdata[2 + GetWaypointAxis(ti->tile)];
- uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0);
+ const DrawTileSprites *cust = &statspec->renderdata[2 + GetWaypointAxis(ti->tile)];
+ uint32 relocation = GetCustomStationRelocation(statspec, ComposeWaypointStation(ti->tile), 0);
/* We don't touch the 0x8000 bit. In all this
* waypoint code, it is used to indicate that
diff --git a/station_cmd.c b/station_cmd.c
index 9cd8505b7..b88c9f0e1 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -918,13 +918,13 @@ static inline byte *CreateMulti(byte *layout, int n, byte b)
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 &&
- spec->platforms[plat_len - 1] >= numtracks &&
- spec->layouts[plat_len - 1][numtracks - 1]) {
+ if (statspec != NULL && statspec->lengths >= plat_len &&
+ statspec->platforms[plat_len - 1] >= numtracks &&
+ statspec->layouts[plat_len - 1][numtracks - 1]) {
/* 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);
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;
/* 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);
if (specindex == -1) return CMD_ERROR;
diff --git a/waypoint.c b/waypoint.c
index 2de0bf0d5..a3dbbb443 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -153,8 +153,8 @@ void UpdateAllWaypointCustomGraphics(void)
if (wp->grfid == 0) continue;
for (i = 0; i < GetNumCustomStations(STAT_CLASS_WAYP); i++) {
- const StationSpec *spec = GetCustomStation(STAT_CLASS_WAYP, i);
- if (spec != NULL && spec->grfid == wp->grfid && spec->localidx == wp->localidx) {
+ const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, i);
+ if (statspec != NULL && statspec->grfid == wp->grfid && statspec->localidx == wp->localidx) {
wp->stat_id = i;
break;
}
@@ -213,18 +213,18 @@ int32 CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
if (flags & DC_EXEC) {
- const StationSpec *spec = NULL;
+ const StationSpec *statspec = NULL;
MakeRailWaypoint(tile, GetTileOwner(tile), axis, GetRailType(tile), wp->index);
MarkTileDirtyByTile(tile);
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);
wp->stat_id = GB(p1, 0, 8);
- wp->grfid = spec->grfid;
- wp->localidx = spec->localidx;
+ wp->grfid = statspec->grfid;
+ wp->localidx = statspec->localidx;
} else {
// Specified custom graphics do not exist, so use default.
ClearCustomWaypointSprite(tile);
@@ -385,7 +385,7 @@ extern uint16 _custom_sprites_base;
/* Draw a waypoint */
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
{
- const StationSpec *stat;
+ const StationSpec *statspec;
uint32 relocation;
const DrawTileSprites *cust;
DrawTileSeqStruct const *seq;
@@ -397,18 +397,18 @@ void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
x += 33;
y += 17;
- stat = GetCustomStation(STAT_CLASS_WAYP, stat_id);
- if (stat == NULL) {
+ statspec = GetCustomStationSpec(STAT_CLASS_WAYP, stat_id);
+ if (statspec == NULL) {
// stat is NULL for default waypoints and when waypoint graphics are
// not loaded.
DrawDefaultWaypointSprite(x, y, railtype);
return;
}
- relocation = GetCustomStationRelocation(stat, NULL, 1);
+ relocation = GetCustomStationRelocation(statspec, NULL, 1);
// emulate station tile - open with building
// add 1 to get the other direction
- cust = &stat->renderdata[2];
+ cust = &statspec->renderdata[2];
img = cust->ground_sprite;
img += (img < _custom_sprites_base) ? rti->total_offset : rti->custom_ground_offset;