Changeset - r6451:e63c0821b250
[Not reviewed]
master
0 5 0
peter1138 - 17 years ago 2007-04-11 21:04:03
peter1138@openttd.org
(svn r9601) -Codechange: Store grf file reference in station spec, not just GRF ID
5 files changed with 9 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -2539,7 +2539,7 @@ static void StationMapSpriteGroup(byte *
 
			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);
 
		}
src/newgrf_station.cpp
Show inline comments
 
@@ -184,7 +184,7 @@ const StationSpec *GetCustomStationSpecB
 
		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 StationS
 
		}
 

	
 
		st->speclist[i].spec     = statspec;
 
		st->speclist[i].grfid    = statspec->grfid;
 
		st->speclist[i].grfid    = statspec->grffile->grfid;
 
		st->speclist[i].localidx = statspec->localidx;
 
	}
 

	
src/newgrf_station.h
Show inline comments
 
@@ -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
src/openttd.cpp
Show inline comments
 
@@ -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. */
src/waypoint.cpp
Show inline comments
 
@@ -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 ti
 

	
 
		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. */
0 comments (0 inline, 0 general)