Changeset - r6354:42c2e80c9e8d
[Not reviewed]
master
0 1 0
peter1138 - 17 years ago 2007-03-21 20:58:01
peter1138@openttd.org
(svn r9393) -Codechange: Use newgrf town resolver as station parent scope handler
1 file changed with 18 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf_station.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "date.h"
 
#include "helpers.hpp"
 
#include "cargotype.h"
 
#include "town_map.h"
 
#include "newgrf_town.h"
 

	
 
static StationClass station_classes[STAT_CLASS_MAX];
 

	
 
@@ -348,6 +350,22 @@ static uint32 StationGetVariable(const R
 
	const Station *st = object->u.station.st;
 
	TileIndex tile = object->u.station.tile;
 

	
 
	if (object->scope == VSG_SCOPE_PARENT) {
 
		/* Pass the request on to the town of the station */
 
		Town *t;
 

	
 
		if (st != NULL) {
 
			t = st->town;
 
		} else if (tile != INVALID_TILE) {
 
			t = GetTownByTile(tile);
 
		} else {
 
			*available = false;
 
			return UINT_MAX;
 
		}
 

	
 
		return TownGetVariable(variable, parameter, available, t);
 
	}
 

	
 
	if (st == NULL) {
 
		/* Station does not exist, so we're in a purchase list */
 
		switch (variable) {
0 comments (0 inline, 0 general)