Mercurial > hg > openttd
changeset 15733:fc40021c45d3 draft
(svn r20400) -Codechange: let StationSpec use GRFFilePropsBase
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 07 Aug 2010 20:52:45 +0000 |
parents | 574ae0427343 |
children | ecf03c7c6d3b |
files | src/newgrf.cpp src/newgrf_station.cpp src/newgrf_station.h src/saveload/waypoint_sl.cpp src/station_cmd.cpp |
diffstat | 5 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -3886,8 +3886,8 @@ } 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); } }
--- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -217,7 +217,7 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ } 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 @@ /* 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 @@ /* 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 @@ 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); }
--- 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 @@ /** 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
--- a/src/saveload/waypoint_sl.cpp +++ b/src/saveload/waypoint_sl.cpp @@ -85,7 +85,7 @@ 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; }
--- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2804,8 +2804,8 @@ 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(); } }