From e7dd766c1e226b40e154f8e3ef15f09bf2e2dd74 Mon Sep 17 00:00:00 2001 From: tron Date: Fri, 26 Jan 2007 20:39:36 +0000 Subject: (svn r8423) -Fix Do not explicitly pass the station specification and the station to ResolveStation(). They are already contained in the ResolverObject --- src/newgrf_station.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index b70146fa9..f84b34ec0 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -502,12 +502,12 @@ static void NewStationResolver(ResolverObject *res, const StationSpec *statspec, res->reseed = 0; } -static const SpriteGroup *ResolveStation(const StationSpec *statspec, const Station *st, ResolverObject *object) +static const SpriteGroup *ResolveStation(ResolverObject *object) { const SpriteGroup *group; CargoID ctype = GC_DEFAULT_NA; - if (st == NULL) { + if (object->u.station.st == NULL) { /* No station, so we are in a purchase list */ ctype = GC_PURCHASE; } else { @@ -516,17 +516,19 @@ static const SpriteGroup *ResolveStation(const StationSpec *statspec, const Stat /* Pick the first cargo that we have waiting */ for (cargo = 0; cargo < NUM_GLOBAL_CID; cargo++) { CargoID lcid = _local_cargo_id_ctype[cargo]; - if (lcid != CT_INVALID && statspec->spritegroup[cargo] != NULL && GB(st->goods[lcid].waiting_acceptance, 0, 12) != 0) { + if (lcid != CT_INVALID && + object->u.station.statspec->spritegroup[cargo] != NULL && + GB(object->u.station.st->goods[lcid].waiting_acceptance, 0, 12) != 0) { ctype = cargo; break; } } } - group = statspec->spritegroup[ctype]; + group = object->u.station.statspec->spritegroup[ctype]; if (group == NULL) { ctype = GC_DEFAULT; - group = statspec->spritegroup[ctype]; + group = object->u.station.statspec->spritegroup[ctype]; } if (group == NULL) return NULL; @@ -544,7 +546,7 @@ SpriteID GetCustomStationRelocation(const StationSpec *statspec, const Station * NewStationResolver(&object, statspec, st, tile); - group = ResolveStation(statspec, st, &object); + group = ResolveStation(&object); if (group == NULL || group->type != SGT_RESULT) return 0; return group->g.result.sprite - 0x42D; } @@ -558,7 +560,7 @@ SpriteID GetCustomStationGroundRelocation(const StationSpec *statspec, const Sta NewStationResolver(&object, statspec, st, tile); object.callback_param1 = 1; /* Indicate we are resolving the ground sprite */ - group = ResolveStation(statspec, st, &object); + group = ResolveStation(&object); if (group == NULL || group->type != SGT_RESULT) return 0; return group->g.result.sprite - 0x42D; } @@ -575,7 +577,7 @@ uint16 GetStationCallback(uint16 callback, uint32 param1, uint32 param2, const S object.callback_param1 = param1; object.callback_param2 = param2; - group = ResolveStation(statspec, st, &object); + group = ResolveStation(&object); if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED; return group->g.callback.result; } -- cgit v1.2.3-70-g09d2