From 1ad7239247e1bc3c7f018c98830ee59cdb9acaaa Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 8 Nov 2011 17:23:30 +0000 Subject: (svn r23138) -Feature: [NewGRF] Allow passing 32bit parameters to 60+x variables (using var 7B). Currently most useful for vehicle var 60. --- src/newgrf_airport.cpp | 2 +- src/newgrf_airporttiles.cpp | 2 +- src/newgrf_canal.cpp | 2 +- src/newgrf_cargo.cpp | 2 +- src/newgrf_debug_gui.cpp | 6 +++--- src/newgrf_engine.cpp | 4 ++-- src/newgrf_generic.cpp | 4 ++-- src/newgrf_house.cpp | 2 +- src/newgrf_industries.cpp | 4 ++-- src/newgrf_industries.h | 2 +- src/newgrf_industrytiles.cpp | 2 +- src/newgrf_object.cpp | 2 +- src/newgrf_railtype.cpp | 2 +- src/newgrf_spritegroup.cpp | 2 +- src/newgrf_spritegroup.h | 2 +- src/newgrf_station.cpp | 2 +- src/newgrf_town.cpp | 2 +- src/newgrf_town.h | 2 +- 18 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index 504c0e26f..05e54ab23 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -127,7 +127,7 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as) } } -uint32 AirportGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +uint32 AirportGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { const Station *st = object->u.airport.st; byte layout = object->u.airport.layout; diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index 090ccf676..abb468bc1 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -166,7 +166,7 @@ static uint32 GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint32 return 0xFF << 8 | ats->grf_prop.subst_id; // so just give him the substitute } -static uint32 AirportTileGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 AirportTileGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { const Station *st = object->u.airport.st; TileIndex tile = object->u.airport.tile; diff --git a/src/newgrf_canal.cpp b/src/newgrf_canal.cpp index 418b51755..cea1cdbce 100644 --- a/src/newgrf_canal.cpp +++ b/src/newgrf_canal.cpp @@ -41,7 +41,7 @@ static void CanalSetTriggers(const ResolverObject *object, int triggers) } -static uint32 CanalGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 CanalGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { TileIndex tile = object->u.canal.tile; diff --git a/src/newgrf_cargo.cpp b/src/newgrf_cargo.cpp index 7eb397016..8629f263d 100644 --- a/src/newgrf_cargo.cpp +++ b/src/newgrf_cargo.cpp @@ -33,7 +33,7 @@ static void CargoSetTriggers(const ResolverObject *object, int triggers) } -static uint32 CargoGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 CargoGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { DEBUG(grf, 1, "Unhandled cargo variable 0x%X", variable); diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 4bd32f337..f1d628712 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -291,7 +291,7 @@ struct NewGRFInspectWindow : Window { static const int BOTTOM_OFFSET = 5; ///< Position of bottom edge /** The value for the variable 60 parameters. */ - static byte var60params[GSF_FAKE_END][0x20]; + static uint32 var60params[GSF_FAKE_END][0x20]; /** GRFID of the caller of this window, 0 if it has no caller. */ uint32 caller_grfid; @@ -497,7 +497,7 @@ struct NewGRFInspectWindow : Window { if (!HasVariableParameter(niv->var)) break; this->current_edit_param = niv->var; - ShowQueryString(STR_EMPTY, STR_NEWGRF_INSPECT_QUERY_CAPTION, 3, this, CS_HEXADECIMAL, QSF_NONE); + ShowQueryString(STR_EMPTY, STR_NEWGRF_INSPECT_QUERY_CAPTION, 9, this, CS_HEXADECIMAL, QSF_NONE); } } } @@ -517,7 +517,7 @@ struct NewGRFInspectWindow : Window { } }; -/* static */ byte NewGRFInspectWindow::var60params[GSF_FAKE_END][0x20] = { {0} }; // Use spec to have 0s in whole array +/* static */ uint32 NewGRFInspectWindow::var60params[GSF_FAKE_END][0x20] = { {0} }; // Use spec to have 0s in whole array static const NWidgetPart _nested_newgrf_inspect_widgets[] = { NWidget(NWID_HORIZONTAL), diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 991fe2aea..48830240f 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -460,7 +460,7 @@ static uint32 PositionHelper(const Vehicle *v, bool consecutive) return chain_before | chain_after << 8 | (chain_before + chain_after + consecutive) << 16; } -static uint32 VehicleGetVariable(Vehicle *v, const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 VehicleGetVariable(Vehicle *v, const ResolverObject *object, byte variable, uint32 parameter, bool *available) { /* Calculated vehicle parameters */ switch (variable) { @@ -837,7 +837,7 @@ static uint32 VehicleGetVariable(Vehicle *v, const ResolverObject *object, byte return UINT_MAX; } -static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { Vehicle *v = const_cast(GRV(object)); diff --git a/src/newgrf_generic.cpp b/src/newgrf_generic.cpp index 0c57a0ef4..86db53e1d 100644 --- a/src/newgrf_generic.cpp +++ b/src/newgrf_generic.cpp @@ -85,7 +85,7 @@ static void GenericCallbackSetTriggers(const ResolverObject *object, int trigger } -static uint32 GenericCallbackGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 GenericCallbackGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { DEBUG(grf, 1, "Unhandled generic feature variable 0x%02X", variable); @@ -93,7 +93,7 @@ static uint32 GenericCallbackGetVariable(const ResolverObject *object, byte vari return UINT_MAX; } -static uint32 GenericAiCallbackGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 GenericAiCallbackGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { switch (variable) { case 0x40: return object->grffile->cargo_map[object->u.generic.cargo_type]; diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index 50d58b0bd..6b44277c0 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -254,7 +254,7 @@ static uint32 GetDistanceFromNearbyHouse(uint8 parameter, TileIndex tile, HouseI * * Used by the resolver to get values for feature 07 deterministic spritegroups. */ -static uint32 HouseGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 HouseGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { Town *town = object->u.house.town; TileIndex tile = object->u.house.tile; diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 4bc188bb1..389bcebfb 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -170,7 +170,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout * @param available will return false if ever the variable asked for does not exist * @return the value stored in the corresponding variable */ -uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +uint32 IndustryGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { const Industry *industry = object->u.industry.ind; TileIndex tile = object->u.industry.tile; @@ -456,7 +456,7 @@ uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, In return group->GetCallbackResult(); } -uint32 IndustryLocationGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +uint32 IndustryLocationGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { const Industry *industry = object->u.industry.ind; TileIndex tile = object->u.industry.tile; diff --git a/src/newgrf_industries.h b/src/newgrf_industries.h index af12a390e..91a0fe963 100644 --- a/src/newgrf_industries.h +++ b/src/newgrf_industries.h @@ -35,7 +35,7 @@ enum IndustryAvailabilityCallType { }; /* in newgrf_industry.cpp */ -uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available); +uint32 IndustryGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available); uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile); uint32 GetIndustryIDAtOffset(TileIndex new_tile, const Industry *i, uint32 cur_grfid); void IndustryProductionCallback(Industry *ind, int reason); diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index 7ee7f9f89..187a63ddc 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -61,7 +61,7 @@ uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile) return ((y & 0xF) << 20) | ((x & 0xF) << 16) | (y << 8) | x; } -static uint32 IndustryTileGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 IndustryTileGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { const Industry *inds = object->u.industry.ind; TileIndex tile = object->u.industry.tile; diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index 436df1d85..285570c1b 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -222,7 +222,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid, } /** Used by the resolver to get values for feature 0F deterministic spritegroups. */ -static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { const Object *o = object->u.object.o; TileIndex tile = object->u.object.tile; diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp index 9650d0366..6d7a0c8aa 100644 --- a/src/newgrf_railtype.cpp +++ b/src/newgrf_railtype.cpp @@ -32,7 +32,7 @@ static void RailTypeSetTriggers(const ResolverObject *object, int triggers) { } -static uint32 RailTypeGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 RailTypeGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { TileIndex tile = object->u.routes.tile; diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index bfca86718..2c89aa000 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -38,7 +38,7 @@ RandomizedSpriteGroup::~RandomizedSpriteGroup() TemporaryStorageArray _temp_store; -static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static inline uint32 GetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { /* First handle variables common with Action7/9/D */ uint32 value; diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index 4395a3923..637e76eef 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -383,7 +383,7 @@ struct ResolverObject { uint32 (*GetRandomBits)(const struct ResolverObject*); uint32 (*GetTriggers)(const struct ResolverObject*); void (*SetTriggers)(const struct ResolverObject*, int); - uint32 (*GetVariable)(const struct ResolverObject*, byte, byte, bool*); + uint32 (*GetVariable)(const struct ResolverObject *object, byte variable, uint32 parameter, bool *available); const SpriteGroup *(*ResolveReal)(const struct ResolverObject*, const RealSpriteGroup*); void (*StorePSA)(struct ResolverObject*, uint, int32); diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index ed1a7b267..e86d40214 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -257,7 +257,7 @@ static struct { uint8 valid; ///< Bits indicating what variable is valid (for each bit, \c 0 is invalid, \c 1 is valid). } _svc; -static uint32 StationGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) +static uint32 StationGetVariable(const ResolverObject *object, byte variable, uint32 parameter, bool *available) { const BaseStation *st = object->u.station.st; TileIndex tile = object->u.station.tile; diff --git a/src/newgrf_town.cpp b/src/newgrf_town.cpp index 5fa180444..3ef42e492 100644 --- a/src/newgrf_town.cpp +++ b/src/newgrf_town.cpp @@ -24,7 +24,7 @@ * @param caller_grffile #GRFFile of the entity asking for a town variable. * @return the value stored in the corresponding variable */ -uint32 TownGetVariable(byte variable, byte parameter, bool *available, Town *t, const GRFFile *caller_grffile) +uint32 TownGetVariable(byte variable, uint32 parameter, bool *available, Town *t, const GRFFile *caller_grffile) { switch (variable) { /* Larger towns */ diff --git a/src/newgrf_town.h b/src/newgrf_town.h index 1489d1b1d..55fefdef7 100644 --- a/src/newgrf_town.h +++ b/src/newgrf_town.h @@ -17,7 +17,7 @@ /* Currently there is no direct town resolver; we only need to get town * variable results from inside stations, house tiles and industries, * and to check the town's persistent storage. */ -uint32 TownGetVariable(byte variable, byte parameter, bool *available, Town *t, const GRFFile *caller_grffile); +uint32 TownGetVariable(byte variable, uint32 parameter, bool *available, Town *t, const GRFFile *caller_grffile); void TownStorePSA(Town *t, const GRFFile *caller_grffile, uint pos, int32 value); #endif /* NEWGRF_TOWN_H */ -- cgit v1.2.3-54-g00ecf