mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-07 06:46:43 +00:00
(svn r9393) -Codechange: Use newgrf town resolver as station parent scope handler
This commit is contained in:
parent
c29aa2ec44
commit
e2801aa320
@ -20,6 +20,8 @@
|
|||||||
#include "date.h"
|
#include "date.h"
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
#include "cargotype.h"
|
#include "cargotype.h"
|
||||||
|
#include "town_map.h"
|
||||||
|
#include "newgrf_town.h"
|
||||||
|
|
||||||
static StationClass station_classes[STAT_CLASS_MAX];
|
static StationClass station_classes[STAT_CLASS_MAX];
|
||||||
|
|
||||||
@ -348,6 +350,22 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
|
|||||||
const Station *st = object->u.station.st;
|
const Station *st = object->u.station.st;
|
||||||
TileIndex tile = object->u.station.tile;
|
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) {
|
if (st == NULL) {
|
||||||
/* Station does not exist, so we're in a purchase list */
|
/* Station does not exist, so we're in a purchase list */
|
||||||
switch (variable) {
|
switch (variable) {
|
||||||
|
Loading…
Reference in New Issue
Block a user