mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-11 18:10:14 +00:00
(svn r23138) -Feature: [NewGRF] Allow passing 32bit parameters to 60+x variables (using var 7B). Currently most useful for vehicle var 60.
This commit is contained in:
parent
f97fa89f1a
commit
1ad7239247
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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<Vehicle*>(GRV(object));
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -38,7 +38,7 @@ RandomizedSpriteGroup::~RandomizedSpriteGroup()
|
||||
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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user