(svn r9601) -Codechange: Store grf file reference in station spec, not just GRF ID
--- a/src/newgrf.cpp Wed Apr 11 20:42:13 2007 +0000
+++ b/src/newgrf.cpp Wed Apr 11 21:04:03 2007 +0000
@@ -2539,7 +2539,7 @@
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);
}
--- a/src/newgrf_station.cpp Wed Apr 11 20:42:13 2007 +0000
+++ b/src/newgrf_station.cpp Wed Apr 11 21:04:03 2007 +0000
@@ -184,7 +184,7 @@
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 @@
}
st->speclist[i].spec = statspec;
- st->speclist[i].grfid = statspec->grfid;
+ st->speclist[i].grfid = statspec->grffile->grfid;
st->speclist[i].localidx = statspec->localidx;
}
--- a/src/newgrf_station.h Wed Apr 11 20:42:13 2007 +0000
+++ b/src/newgrf_station.h Wed Apr 11 21:04:03 2007 +0000
@@ -28,7 +28,7 @@
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
--- a/src/openttd.cpp Wed Apr 11 20:42:13 2007 +0000
+++ b/src/openttd.cpp Wed Apr 11 21:04:03 2007 +0000
@@ -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 @@
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. */
--- a/src/waypoint.cpp Wed Apr 11 20:42:13 2007 +0000
+++ b/src/waypoint.cpp Wed Apr 11 21:04:03 2007 +0000
@@ -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 @@
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 @@
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. */