summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-07 20:52:45 +0000
committerrubidium <rubidium@openttd.org>2010-08-07 20:52:45 +0000
commitb6a0806948583a9551df6ae3601a7310e648207d (patch)
treee40ab7b652a3de753034576c0269c914a74bf85f /src
parent178f74c31cd79ac248308a6fa389e5aa223b0895 (diff)
downloadopenttd-b6a0806948583a9551df6ae3601a7310e648207d.tar.xz
(svn r20400) -Codechange: let StationSpec use GRFFilePropsBase
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp4
-rw-r--r--src/newgrf_station.cpp18
-rw-r--r--src/newgrf_station.h4
-rw-r--r--src/saveload/waypoint_sl.cpp2
-rw-r--r--src/station_cmd.cpp4
5 files changed, 16 insertions, 16 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index ebb5ece3a..9ea6382d4 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -3886,8 +3886,8 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount)
}
statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
- statspec->grffile = _cur_grffile;
- statspec->localidx = stations[i];
+ statspec->grf_prop.grffile = _cur_grffile;
+ statspec->grf_prop.local_id = stations[i];
SetCustomStationSpec(statspec);
}
}
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 209acaa1b..90d76c1bf 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -217,7 +217,7 @@ const StationSpec *GetCustomStationSpecByGrf(uint32 grfid, byte localidx, int *i
for (j = 0; j < _station_classes[i].stations; j++) {
const StationSpec *statspec = _station_classes[i].spec[j];
if (statspec == NULL) continue;
- if (statspec->grffile->grfid == grfid && statspec->localidx == localidx) {
+ if (statspec->grf_prop.grffile->grfid == grfid && statspec->grf_prop.local_id == localidx) {
if (index != NULL) *index = j;
return statspec;
}
@@ -439,7 +439,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
if (!HasBit(_svc.valid, 1)) { _svc.v41 = GetPlatformInfoHelper(tile, true, false, false); SetBit(_svc.valid, 1); }
return _svc.v41;
- case 0x42: return GetTerrainType(tile) | (GetReverseRailTypeTranslation(GetRailType(tile), object->u.station.statspec->grffile) << 8);
+ case 0x42: return GetTerrainType(tile) | (GetReverseRailTypeTranslation(GetRailType(tile), object->u.station.statspec->grf_prop.grffile) << 8);
case 0x43: return st->owner; // Station owner
case 0x44: return HasStationReservation(tile) ? 7 : 4; // PBS status
case 0x45:
@@ -529,7 +529,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject *object, byte variable, b
/* Handle cargo variables with parameter, 0x60 to 0x65 */
if (variable >= 0x60 && variable <= 0x65) {
- CargoID c = GetCargoTranslation(parameter, object->u.station.statspec->grffile);
+ CargoID c = GetCargoTranslation(parameter, object->u.station.statspec->grf_prop.grffile);
if (c == CT_INVALID) return 0;
const GoodsEntry *ge = &this->goods[c];
@@ -668,7 +668,7 @@ static void NewStationResolver(ResolverObject *res, const StationSpec *statspec,
res->trigger = 0;
res->reseed = 0;
res->count = 0;
- res->grffile = (statspec != NULL ? statspec->grffile : NULL);
+ res->grffile = (statspec != NULL ? statspec->grf_prop.grffile : NULL);
}
static const SpriteGroup *ResolveStation(ResolverObject *object)
@@ -813,8 +813,8 @@ int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exe
}
st->speclist[i].spec = statspec;
- st->speclist[i].grfid = statspec->grffile->grfid;
- st->speclist[i].localidx = statspec->localidx;
+ st->speclist[i].grfid = statspec->grf_prop.grffile->grfid;
+ st->speclist[i].localidx = statspec->grf_prop.local_id;
}
return i;
@@ -989,7 +989,7 @@ void AnimateStationTile(TileIndex tile)
/* If the lower 7 bits of the upper byte of the callback
* result are not empty, it is a sound effect. */
- if (GB(callback, 8, 7) != 0) PlayTileSound(ss->grffile, GB(callback, 8, 7), tile);
+ if (GB(callback, 8, 7) != 0) PlayTileSound(ss->grf_prop.grffile, GB(callback, 8, 7), tile);
}
}
@@ -1027,7 +1027,7 @@ static void ChangeStationAnimationFrame(const StationSpec *ss, const BaseStation
/* If the lower 7 bits of the upper byte of the callback
* result are not empty, it is a sound effect. */
- if (GB(callback, 8, 7) != 0) PlayTileSound(ss->grffile, GB(callback, 8, 7), tile);
+ if (GB(callback, 8, 7) != 0) PlayTileSound(ss->grf_prop.grffile, GB(callback, 8, 7), tile);
}
void StationAnimationTrigger(const BaseStation *st, TileIndex tile, StatAnimTrigger trigger, CargoID cargo_type)
@@ -1056,7 +1056,7 @@ void StationAnimationTrigger(const BaseStation *st, TileIndex tile, StatAnimTrig
if (cargo_type == CT_INVALID) {
cargo = CT_INVALID;
} else {
- cargo = GetReverseCargoTranslation(cargo_type, ss->grffile);
+ cargo = GetReverseCargoTranslation(cargo_type, ss->grf_prop.grffile);
}
ChangeStationAnimationFrame(ss, st, tile, random_bits, trigger, cargo);
}
diff --git a/src/newgrf_station.h b/src/newgrf_station.h
index d42db176f..99e3c55ae 100644
--- a/src/newgrf_station.h
+++ b/src/newgrf_station.h
@@ -13,6 +13,7 @@
#define NEWGRF_STATION_H
#include "newgrf_callbacks.h"
+#include "newgrf_commons.h"
#include "sprite.h"
#include "direction_type.h"
#include "cargo_type.h"
@@ -46,8 +47,7 @@ typedef byte *StationLayout;
/** Station specification. */
struct StationSpec {
- const struct GRFFile *grffile; ///< ID of GRF file station belongs to.
- int localidx; ///< Index within GRF file of station.
+ GRFFilePropsBase grf_prop; ///< Properties related the the grf file
bool allocated; ///< Flag whether this station has been added to a station class list
diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp
index 8cc66d0a4..3cdafd990 100644
--- a/src/saveload/waypoint_sl.cpp
+++ b/src/saveload/waypoint_sl.cpp
@@ -85,7 +85,7 @@ void MoveWaypointsToBaseStations()
for (OldWaypoint *wp = _old_waypoints.Begin(); wp != _old_waypoints.End(); wp++) {
for (uint i = 0; i < GetNumCustomStations(STAT_CLASS_WAYP); i++) {
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, i);
- if (statspec != NULL && statspec->grffile->grfid == wp->grfid && statspec->localidx == wp->localidx) {
+ if (statspec != NULL && statspec->grf_prop.grffile->grfid == wp->grfid && statspec->grf_prop.local_id == wp->localidx) {
wp->spec = statspec;
break;
}
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 8e7136543..28fe6ce74 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2804,8 +2804,8 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td)
td->station_class = GetStationClassName(spec->sclass);
td->station_name = spec->name;
- if (spec->grffile != NULL) {
- const GRFConfig *gc = GetGRFConfig(spec->grffile->grfid);
+ if (spec->grf_prop.grffile != NULL) {
+ const GRFConfig *gc = GetGRFConfig(spec->grf_prop.grffile->grfid);
td->grf = gc->GetName();
}
}