changeset 18302:4925b06e241f draft

(svn r23138) -Feature: [NewGRF] Allow passing 32bit parameters to 60+x variables (using var 7B). Currently most useful for vehicle var 60.
author frosch <frosch@openttd.org>
date Tue, 08 Nov 2011 17:23:30 +0000
parents 51ada4c1086e
children d4e516050f24
files src/newgrf_airport.cpp src/newgrf_airporttiles.cpp src/newgrf_canal.cpp src/newgrf_cargo.cpp src/newgrf_debug_gui.cpp src/newgrf_engine.cpp src/newgrf_generic.cpp src/newgrf_house.cpp src/newgrf_industries.cpp src/newgrf_industries.h src/newgrf_industrytiles.cpp src/newgrf_object.cpp src/newgrf_railtype.cpp src/newgrf_spritegroup.cpp src/newgrf_spritegroup.h src/newgrf_station.cpp src/newgrf_town.cpp src/newgrf_town.h
diffstat 18 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_airport.cpp
+++ b/src/newgrf_airport.cpp
@@ -127,7 +127,7 @@
 	}
 }
 
-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;
--- a/src/newgrf_airporttiles.cpp
+++ b/src/newgrf_airporttiles.cpp
@@ -166,7 +166,7 @@
 	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;
--- a/src/newgrf_canal.cpp
+++ b/src/newgrf_canal.cpp
@@ -41,7 +41,7 @@
 }
 
 
-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;
 
--- a/src/newgrf_cargo.cpp
+++ b/src/newgrf_cargo.cpp
@@ -33,7 +33,7 @@
 }
 
 
-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);
 
--- a/src/newgrf_debug_gui.cpp
+++ b/src/newgrf_debug_gui.cpp
@@ -291,7 +291,7 @@
 	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 @@
 					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 @@
 	}
 };
 
-/* 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),
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -460,7 +460,7 @@
 	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 @@
 	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<Vehicle*>(GRV(object));
 
--- a/src/newgrf_generic.cpp
+++ b/src/newgrf_generic.cpp
@@ -85,7 +85,7 @@
 }
 
 
-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 @@
 	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];
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -254,7 +254,7 @@
  *
  * 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;
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -170,7 +170,7 @@
  * @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 @@
 	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;
--- a/src/newgrf_industries.h
+++ b/src/newgrf_industries.h
@@ -35,7 +35,7 @@
 };
 
 /* 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);
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -61,7 +61,7 @@
 	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;
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -222,7 +222,7 @@
 }
 
 /** 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;
--- a/src/newgrf_railtype.cpp
+++ b/src/newgrf_railtype.cpp
@@ -32,7 +32,7 @@
 {
 }
 
-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;
 
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -38,7 +38,7 @@
 TemporaryStorageArray<int32, 0x110> _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;
--- a/src/newgrf_spritegroup.h
+++ b/src/newgrf_spritegroup.h
@@ -383,7 +383,7 @@
 	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);
 
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -257,7 +257,7 @@
 	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;
--- 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 */
--- 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 */