Changeset - r7327:28855024ff6c
[Not reviewed]
master
0 15 0
rubidium - 17 years ago 2007-07-25 19:06:29
rubidium@openttd.org
(svn r10690) -Codechange: use the enum that describes all callback IDs in favor of "just" using an untyped integer.
15 files changed with 29 insertions and 22 deletions:
0 comments (0 inline, 0 general)
src/newgrf_callbacks.h
Show inline comments
 
@@ -15,6 +15,9 @@
 
 * Names are formatted as CBID_<CLASS>_<CALLBACK>
 
 */
 
enum CallbackID {
 
	/** Set when using the callback resolve system, but not to resolve a callback. */
 
	CBID_NO_CALLBACK                     = 0x00,
 

	
 
	/** Set when calling a randomizing trigger (almost undocumented). */
 
	CBID_RANDOM_TRIGGER                  = 0x01,
 

	
src/newgrf_canal.cpp
Show inline comments
 
@@ -73,7 +73,7 @@ static void NewCanalResolver(ResolverObj
 

	
 
	res->u.canal.tile = tile;
 

	
 
	res->callback        = 0;
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
src/newgrf_cargo.cpp
Show inline comments
 
@@ -58,7 +58,7 @@ static void NewCargoResolver(ResolverObj
 

	
 
	res->u.cargo.cs = cs;
 

	
 
	res->callback        = 0;
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
@@ -81,7 +81,7 @@ SpriteID GetCustomCargoSprite(const Carg
 
}
 

	
 

	
 
uint16 GetCargoCallback(uint16 callback, uint32 param1, uint32 param2, const CargoSpec *cs)
 
uint16 GetCargoCallback(CallbackID callback, uint32 param1, uint32 param2, const CargoSpec *cs)
 
{
 
	ResolverObject object;
 
	const SpriteGroup *group;
src/newgrf_cargo.h
Show inline comments
 
@@ -5,6 +5,8 @@
 
#ifndef NEWGRF_CARGO_H
 
#define NEWGRF_CARGO_H
 

	
 
#include "newgrf_callbacks.h"
 

	
 
enum {
 
	CC_NOAVAILABLE  = 0,
 
	CC_PASSENGERS   = 1 << 0,
 
@@ -26,7 +28,7 @@ struct CargoSpec;
 
struct GRFFile;
 

	
 
SpriteID GetCustomCargoSprite(const CargoSpec *cs);
 
uint16 GetCargoCallback(uint16 callback, uint32 param1, uint32 param2, const CargoSpec *cs);
 
uint16 GetCargoCallback(CallbackID callback, uint32 param1, uint32 param2, const CargoSpec *cs);
 
CargoID GetCargoTranslation(uint8 cargo, const GRFFile *grffile);
 
uint8 GetReverseCargoTranslation(CargoID cargo, const GRFFile *grffile);
 

	
src/newgrf_engine.cpp
Show inline comments
 
@@ -838,7 +838,7 @@ static inline void NewVehicleResolver(Re
 

	
 
	res->info_view = false;
 

	
 
	res->callback        = 0;
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
@@ -938,7 +938,7 @@ bool UsesWagonOverride(const Vehicle* v)
 
 * @param v        The vehicle to evaluate the callback for, or NULL if it doesnt exist yet
 
 * @return The value the callback returned, or CALLBACK_FAILED if it failed
 
 */
 
uint16 GetVehicleCallback(uint16 callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v)
 
uint16 GetVehicleCallback(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v)
 
{
 
	const SpriteGroup *group;
 
	ResolverObject object;
 
@@ -965,7 +965,7 @@ uint16 GetVehicleCallback(uint16 callbac
 
 * @param parent   The vehicle to use for parent scope
 
 * @return The value the callback returned, or CALLBACK_FAILED if it failed
 
 */
 
uint16 GetVehicleCallbackParent(uint16 callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v, const Vehicle *parent)
 
uint16 GetVehicleCallbackParent(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v, const Vehicle *parent)
 
{
 
	const SpriteGroup *group;
 
	ResolverObject object;
src/newgrf_engine.h
Show inline comments
 
@@ -30,8 +30,8 @@ void SetEngineGRF(EngineID engine, const
 
const struct GRFFile *GetEngineGRF(EngineID engine);
 
uint32 GetEngineGRFID(EngineID engine);
 

	
 
uint16 GetVehicleCallback(uint16 callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v);
 
uint16 GetVehicleCallbackParent(uint16 callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v, const Vehicle *parent);
 
uint16 GetVehicleCallback(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v);
 
uint16 GetVehicleCallbackParent(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v, const Vehicle *parent);
 
bool UsesWagonOverride(const Vehicle *v);
 
#define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
 
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
src/newgrf_house.cpp
Show inline comments
 
@@ -274,7 +274,7 @@ static void NewHouseResolver(ResolverObj
 
	res->u.house.town     = town;
 
	res->u.house.house_id = house_id;
 

	
 
	res->callback        = 0;
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
@@ -282,7 +282,7 @@ static void NewHouseResolver(ResolverObj
 
	res->reseed          = 0;
 
}
 

	
 
uint16 GetHouseCallback(uint16 callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile)
 
uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile)
 
{
 
	ResolverObject object;
 
	const SpriteGroup *group;
src/newgrf_house.h
Show inline comments
 
@@ -6,6 +6,7 @@
 
#define NEWGRF_HOUSE_H
 

	
 
#include "town.h"
 
#include "newgrf_callbacks.h"
 

	
 
/**
 
 * Makes class IDs unique to each GRF file.
 
@@ -38,7 +39,7 @@ void DrawNewHouseTile(TileInfo *ti, Hous
 
void AnimateNewHouseTile(TileIndex tile);
 
void ChangeHouseAnimationFrame(TileIndex tile, uint16 callback_result);
 

	
 
uint16 GetHouseCallback(uint16 callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile);
 
uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile);
 

	
 
bool CanDeleteHouse(TileIndex tile);
 

	
src/newgrf_industries.cpp
Show inline comments
 
@@ -275,7 +275,7 @@ static void NewIndustryResolver(Resolver
 
	res->u.industry.ind  = indus;
 
	res->u.industry.gfx  = INVALID_INDUSTRYTILE;
 

	
 
	res->callback        = 0;
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
@@ -283,7 +283,7 @@ static void NewIndustryResolver(Resolver
 
	res->reseed          = 0;
 
}
 

	
 
uint16 GetIndustryCallback(uint16 callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile)
 
uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile)
 
{
 
	ResolverObject object;
 
	const SpriteGroup *group;
src/newgrf_industries.h
Show inline comments
 
@@ -10,7 +10,7 @@
 

	
 
/* in newgrf_industry.cpp */
 
uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available);
 
uint16 GetIndustryCallback(uint16 callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile);
 
uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile);
 
uint32 GetIndustryIDAtOffset(TileIndex new_tile, TileIndex old_tile, const Industry *i);
 
void IndustryProductionCallback(Industry *ind, int reason);
 
bool CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint itspec_index);
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -142,7 +142,7 @@ static void NewIndustryTileResolver(Reso
 
	res->u.industry.ind  = indus;
 
	res->u.industry.gfx  = gfx;
 

	
 
	res->callback        = 0;
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
@@ -188,7 +188,7 @@ void IndustryDrawTileLayout(const TileIn
 
	}
 
}
 

	
 
uint16 GetIndustryTileCallback(uint16 callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile)
 
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile)
 
{
 
	ResolverObject object;
 
	const SpriteGroup *group;
src/newgrf_industrytiles.h
Show inline comments
 
@@ -14,7 +14,7 @@ enum IndustryAnimationTrigger {
 
};
 

	
 
bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds);
 
uint16 GetIndustryTileCallback(uint16 callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
 
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
 
bool PerformIndustryTileSlopeCheck(TileIndex tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx);
 

	
 
void AnimateNewIndustryTile(TileIndex tile);
src/newgrf_spritegroup.h
Show inline comments
 
@@ -188,7 +188,7 @@ void InitializeSpriteGroupPool();
 

	
 

	
 
struct ResolverObject {
 
	uint16 callback;
 
	CallbackID callback;
 
	uint32 callback_param1;
 
	uint32 callback_param2;
 

	
src/newgrf_station.cpp
Show inline comments
 
@@ -555,7 +555,7 @@ static void NewStationResolver(ResolverO
 
	res->u.station.statspec = statspec;
 
	res->u.station.tile     = tile;
 

	
 
	res->callback        = 0;
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
@@ -627,7 +627,7 @@ SpriteID GetCustomStationGroundRelocatio
 
}
 

	
 

	
 
uint16 GetStationCallback(uint16 callback, uint32 param1, uint32 param2, const StationSpec *statspec, const Station *st, TileIndex tile)
 
uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, const Station *st, TileIndex tile)
 
{
 
	const SpriteGroup *group;
 
	ResolverObject object;
src/newgrf_station.h
Show inline comments
 
@@ -6,6 +6,7 @@
 
#define NEWGRF_STATION_H
 

	
 
#include "engine.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_cargo.h"
 
#include "helpers.hpp"
 

	
 
@@ -117,7 +118,7 @@ uint32 GetPlatformInfo(Axis axis, byte t
 
 * for variational sprite groups. */
 
SpriteID GetCustomStationRelocation(const StationSpec *statspec, const Station *st, TileIndex tile);
 
SpriteID GetCustomStationGroundRelocation(const StationSpec *statspec, const Station *st, TileIndex tile);
 
uint16 GetStationCallback(uint16 callback, uint32 param1, uint32 param2, const StationSpec *statspec, const Station *st, TileIndex tile);
 
uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, const Station *st, TileIndex tile);
 

	
 
/* Check if a rail station tile is traversable. */
 
bool IsStationTileBlocked(TileIndex tile);
0 comments (0 inline, 0 general)