diff options
author | peter1138 <peter1138@openttd.org> | 2007-04-11 21:04:03 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-04-11 21:04:03 +0000 |
commit | 3148fdca59bb620685663c7cb26571f6a0a24113 (patch) | |
tree | bb3bdbca60f3320458aaf7a9f6d6d1da9cc03590 | |
parent | f7a92a2f16ec59a3cfbe19144c7217e88f1a3e6f (diff) | |
download | openttd-3148fdca59bb620685663c7cb26571f6a0a24113.tar.xz |
(svn r9601) -Codechange: Store grf file reference in station spec, not just GRF ID
-rw-r--r-- | src/newgrf.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_station.cpp | 4 | ||||
-rw-r--r-- | src/newgrf_station.h | 2 | ||||
-rw-r--r-- | src/openttd.cpp | 3 | ||||
-rw-r--r-- | src/waypoint.cpp | 5 |
5 files changed, 9 insertions, 7 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index a2dd255cb..fcfa39a41 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -2539,7 +2539,7 @@ static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount) StationSpec *statspec = _cur_grffile->stations[stid]; statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid]; - statspec->grfid = _cur_grffile->grfid; + statspec->grffile = _cur_grffile; statspec->localidx = stid; SetCustomStationSpec(statspec); } diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 18b597cfa..a799e3c57 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -184,7 +184,7 @@ const StationSpec *GetCustomStationSpecByGrf(uint32 grfid, byte localidx) for (j = 0; j < station_classes[i].stations; j++) { const StationSpec *statspec = station_classes[i].spec[j]; if (statspec == NULL) continue; - if (statspec->grfid == grfid && statspec->localidx == localidx) return statspec; + if (statspec->grffile->grfid == grfid && statspec->localidx == localidx) return statspec; } } @@ -638,7 +638,7 @@ int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec) } st->speclist[i].spec = statspec; - st->speclist[i].grfid = statspec->grfid; + st->speclist[i].grfid = statspec->grffile->grfid; st->speclist[i].localidx = statspec->localidx; } diff --git a/src/newgrf_station.h b/src/newgrf_station.h index 640620fe7..d3dd0ac99 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -28,7 +28,7 @@ DECLARE_POSTFIX_INCREMENT(StationClassID); typedef byte *StationLayout; struct StationSpec { - uint32 grfid; ///< ID of GRF file station belongs to. + const struct GRFFile *grffile; ///< 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 diff --git a/src/openttd.cpp b/src/openttd.cpp index 7cc37f2f2..263751c62 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -57,6 +57,7 @@ #include "date.h" #include "clear_map.h" #include "fontcache.h" +#include "newgrf.h" #include "newgrf_config.h" #include "newgrf_house.h" #include "player_face.h" @@ -1586,7 +1587,7 @@ bool AfterLoadGame() if (statspec != NULL) { wp->stat_id = _m[wp->xy].m4 + 1; - wp->grfid = statspec->grfid; + wp->grfid = statspec->grffile->grfid; wp->localidx = statspec->localidx; } else { /* No custom graphics set, so set to default. */ diff --git a/src/waypoint.cpp b/src/waypoint.cpp index a7e02d6f1..b981694b7 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -22,6 +22,7 @@ #include "vehicle.h" #include "yapf/yapf.h" #include "date.h" +#include "newgrf.h" enum { MAX_WAYPOINTS_PER_TOWN = 64, @@ -181,7 +182,7 @@ void AfterLoadWaypoints() for (i = 0; i < GetNumCustomStations(STAT_CLASS_WAYP); i++) { const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, i); - if (statspec != NULL && statspec->grfid == wp->grfid && statspec->localidx == wp->localidx) { + if (statspec != NULL && statspec->grffile->grfid == wp->grfid && statspec->localidx == wp->localidx) { wp->stat_id = i; break; } @@ -250,7 +251,7 @@ int32 CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (statspec != NULL) { wp->stat_id = p1; - wp->grfid = statspec->grfid; + wp->grfid = statspec->grffile->grfid; wp->localidx = statspec->localidx; } else { /* Specified custom graphics do not exist, so use default. */ |