mirror of https://github.com/OpenTTD/OpenTTD
(svn r22557) -Codechange: Remove constness from AnimationBase callbacks.
parent
d7ec492887
commit
e127fca384
|
@ -246,7 +246,7 @@ static void AirportTileResolver(ResolverObject *res, const AirportTileSpec *ats,
|
||||||
res->grffile = ats->grf_prop.grffile;
|
res->grffile = ats->grf_prop.grffile;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 GetAirportTileCallback(CallbackID callback, uint32 param1, uint32 param2, const AirportTileSpec *ats, const Station *st, TileIndex tile)
|
uint16 GetAirportTileCallback(CallbackID callback, uint32 param1, uint32 param2, const AirportTileSpec *ats, Station *st, TileIndex tile)
|
||||||
{
|
{
|
||||||
ResolverObject object;
|
ResolverObject object;
|
||||||
const SpriteGroup *group;
|
const SpriteGroup *group;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @tparam Tobj Object related to the animated tile.
|
* @tparam Tobj Object related to the animated tile.
|
||||||
* @tparam GetCallback The callback function pointer.
|
* @tparam GetCallback The callback function pointer.
|
||||||
*/
|
*/
|
||||||
template <typename Tbase, typename Tspec, typename Tobj, uint16 (*GetCallback)(CallbackID callback, uint32 param1, uint32 param2, const Tspec *statspec, const Tobj *st, TileIndex tile)>
|
template <typename Tbase, typename Tspec, typename Tobj, uint16 (*GetCallback)(CallbackID callback, uint32 param1, uint32 param2, const Tspec *statspec, Tobj *st, TileIndex tile)>
|
||||||
struct AnimationBase {
|
struct AnimationBase {
|
||||||
/**
|
/**
|
||||||
* Animate a single tile.
|
* Animate a single tile.
|
||||||
|
@ -35,7 +35,7 @@ struct AnimationBase {
|
||||||
* @param tile Tile to animate changes for.
|
* @param tile Tile to animate changes for.
|
||||||
* @param random_animation Whether to pass random bits to the "next frame" callback.
|
* @param random_animation Whether to pass random bits to the "next frame" callback.
|
||||||
*/
|
*/
|
||||||
static void AnimateTile(const Tspec *spec, const Tobj *obj, TileIndex tile, bool random_animation)
|
static void AnimateTile(const Tspec *spec, Tobj *obj, TileIndex tile, bool random_animation)
|
||||||
{
|
{
|
||||||
assert(spec != NULL);
|
assert(spec != NULL);
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ struct AnimationBase {
|
||||||
* @param random_bits Random bits for this update. To be passed as parameter to the NewGRF.
|
* @param random_bits Random bits for this update. To be passed as parameter to the NewGRF.
|
||||||
* @param trigger What triggered this update? To be passed as parameter to the NewGRF.
|
* @param trigger What triggered this update? To be passed as parameter to the NewGRF.
|
||||||
*/
|
*/
|
||||||
static void ChangeAnimationFrame(CallbackID cb, const Tspec *spec, const Tobj *obj, TileIndex tile, uint32 random_bits, uint32 trigger)
|
static void ChangeAnimationFrame(CallbackID cb, const Tspec *spec, Tobj *obj, TileIndex tile, uint32 random_bits, uint32 trigger)
|
||||||
{
|
{
|
||||||
uint16 callback = GetCallback(cb, random_bits, trigger, spec, obj, tile);
|
uint16 callback = GetCallback(cb, random_bits, trigger, spec, obj, tile);
|
||||||
if (callback == CALLBACK_FAILED) return;
|
if (callback == CALLBACK_FAILED) return;
|
||||||
|
|
|
@ -469,7 +469,7 @@ void DrawNewHouseTile(TileInfo *ti, HouseID house_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simple wrapper for GetHouseCallback to keep the animation unified. */
|
/* Simple wrapper for GetHouseCallback to keep the animation unified. */
|
||||||
uint16 GetSimpleHouseCallback(CallbackID callback, uint32 param1, uint32 param2, const HouseSpec *spec, const Town *town, TileIndex tile)
|
uint16 GetSimpleHouseCallback(CallbackID callback, uint32 param1, uint32 param2, const HouseSpec *spec, Town *town, TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetHouseCallback(callback, param1, param2, spec - HouseSpec::Get(0), town, tile);
|
return GetHouseCallback(callback, param1, param2, spec - HouseSpec::Get(0), town, tile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,9 +297,9 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simple wrapper for GetHouseCallback to keep the animation unified. */
|
/* Simple wrapper for GetHouseCallback to keep the animation unified. */
|
||||||
uint16 GetSimpleIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, const IndustryTileSpec *spec, const Industry *ind, TileIndex tile)
|
uint16 GetSimpleIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, const IndustryTileSpec *spec, Industry *ind, TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetIndustryTileCallback(callback, param1, param2, spec - GetIndustryTileSpec(0), const_cast<Industry *>(ind), tile);
|
return GetIndustryTileCallback(callback, param1, param2, spec - GetIndustryTileSpec(0), ind, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Helper class for animation control. */
|
/** Helper class for animation control. */
|
||||||
|
|
|
@ -504,7 +504,7 @@ void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8 view)
|
||||||
* @param tile The tile the callback is called for.
|
* @param tile The tile the callback is called for.
|
||||||
* @return The result of the callback.
|
* @return The result of the callback.
|
||||||
*/
|
*/
|
||||||
uint16 StubGetObjectCallback(CallbackID callback, uint32 param1, uint32 param2, const ObjectSpec *spec, const Object *o, TileIndex tile)
|
uint16 StubGetObjectCallback(CallbackID callback, uint32 param1, uint32 param2, const ObjectSpec *spec, Object *o, TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetObjectCallback(callback, param1, param2, spec, o, tile);
|
return GetObjectCallback(callback, param1, param2, spec, o, tile);
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ void AnimateNewObjectTile(TileIndex tile)
|
||||||
* @param trigger The trigger that is triggered.
|
* @param trigger The trigger that is triggered.
|
||||||
* @param spec The spec associated with the object.
|
* @param spec The spec associated with the object.
|
||||||
*/
|
*/
|
||||||
void TriggerObjectTileAnimation(const Object *o, TileIndex tile, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
|
void TriggerObjectTileAnimation(Object *o, TileIndex tile, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
|
||||||
{
|
{
|
||||||
if (!HasBit(spec->animation.triggers, trigger)) return;
|
if (!HasBit(spec->animation.triggers, trigger)) return;
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ void TriggerObjectTileAnimation(const Object *o, TileIndex tile, ObjectAnimation
|
||||||
* @param trigger The trigger that is triggered.
|
* @param trigger The trigger that is triggered.
|
||||||
* @param spec The spec associated with the object.
|
* @param spec The spec associated with the object.
|
||||||
*/
|
*/
|
||||||
void TriggerObjectAnimation(const Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
|
void TriggerObjectAnimation(Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
|
||||||
{
|
{
|
||||||
if (!HasBit(spec->animation.triggers, trigger)) return;
|
if (!HasBit(spec->animation.triggers, trigger)) return;
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ uint16 GetObjectCallback(CallbackID callback, uint32 param1, uint32 param2, cons
|
||||||
void DrawNewObjectTile(TileInfo *ti, const ObjectSpec *spec);
|
void DrawNewObjectTile(TileInfo *ti, const ObjectSpec *spec);
|
||||||
void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8 view);
|
void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8 view);
|
||||||
void AnimateNewObjectTile(TileIndex tile);
|
void AnimateNewObjectTile(TileIndex tile);
|
||||||
void TriggerObjectTileAnimation(const Object *o, TileIndex tile, ObjectAnimationTrigger trigger, const ObjectSpec *spec);
|
void TriggerObjectTileAnimation(Object *o, TileIndex tile, ObjectAnimationTrigger trigger, const ObjectSpec *spec);
|
||||||
void TriggerObjectAnimation(const Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec);
|
void TriggerObjectAnimation(Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec);
|
||||||
|
|
||||||
#endif /* NEWGRF_OBJECT_H */
|
#endif /* NEWGRF_OBJECT_H */
|
||||||
|
|
|
@ -623,7 +623,7 @@ SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, const BaseStation *st, TileIndex tile)
|
uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, BaseStation *st, TileIndex tile)
|
||||||
{
|
{
|
||||||
const SpriteGroup *group;
|
const SpriteGroup *group;
|
||||||
ResolverObject object;
|
ResolverObject object;
|
||||||
|
@ -866,7 +866,7 @@ void AnimateStationTile(TileIndex tile)
|
||||||
StationAnimationBase::AnimateTile(ss, BaseStation::GetByTile(tile), tile, HasBit(ss->flags, SSF_CB141_RANDOM_BITS));
|
StationAnimationBase::AnimateTile(ss, BaseStation::GetByTile(tile), tile, HasBit(ss->flags, SSF_CB141_RANDOM_BITS));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerStationAnimation(const BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type)
|
void TriggerStationAnimation(BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type)
|
||||||
{
|
{
|
||||||
/* List of coverage areas for each animation trigger */
|
/* List of coverage areas for each animation trigger */
|
||||||
static const TriggerArea tas[] = {
|
static const TriggerArea tas[] = {
|
||||||
|
|
|
@ -113,7 +113,7 @@ uint32 GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, i
|
||||||
|
|
||||||
SpriteID GetCustomStationRelocation(const StationSpec *statspec, const BaseStation *st, TileIndex tile, uint32 var10 = 0);
|
SpriteID GetCustomStationRelocation(const StationSpec *statspec, const BaseStation *st, TileIndex tile, uint32 var10 = 0);
|
||||||
SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, const BaseStation *st, TileIndex tile, uint layout, uint edge_info);
|
SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, const BaseStation *st, TileIndex tile, uint layout, uint edge_info);
|
||||||
uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, const BaseStation *st, TileIndex tile);
|
uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, BaseStation *st, TileIndex tile);
|
||||||
|
|
||||||
/* Allocate a StationSpec to a Station. This is called once per build operation. */
|
/* Allocate a StationSpec to a Station. This is called once per build operation. */
|
||||||
int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exec);
|
int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exec);
|
||||||
|
@ -125,7 +125,7 @@ void DeallocateSpecFromStation(BaseStation *st, byte specindex);
|
||||||
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station);
|
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station);
|
||||||
|
|
||||||
void AnimateStationTile(TileIndex tile);
|
void AnimateStationTile(TileIndex tile);
|
||||||
void TriggerStationAnimation(const BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
|
void TriggerStationAnimation(BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
|
||||||
void StationUpdateAnimTriggers(BaseStation *st);
|
void StationUpdateAnimTriggers(BaseStation *st);
|
||||||
|
|
||||||
#endif /* NEWGRF_STATION_H */
|
#endif /* NEWGRF_STATION_H */
|
||||||
|
|
|
@ -526,7 +526,7 @@ static void TileLoop_Object(TileIndex tile)
|
||||||
{
|
{
|
||||||
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
|
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
|
||||||
if (spec->flags & OBJECT_FLAG_ANIMATION) {
|
if (spec->flags & OBJECT_FLAG_ANIMATION) {
|
||||||
const Object *o = Object::GetByTile(tile);
|
Object *o = Object::GetByTile(tile);
|
||||||
TriggerObjectTileAnimation(o, tile, OAT_TILELOOP, spec);
|
TriggerObjectTileAnimation(o, tile, OAT_TILELOOP, spec);
|
||||||
if (o->location.tile == tile) TriggerObjectAnimation(o, OAT_256_TICKS, spec);
|
if (o->location.tile == tile) TriggerObjectAnimation(o, OAT_256_TICKS, spec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2505,7 +2505,7 @@ static void DrawTile_Station(TileInfo *ti)
|
||||||
const RailtypeInfo *rti = NULL;
|
const RailtypeInfo *rti = NULL;
|
||||||
uint32 relocation = 0;
|
uint32 relocation = 0;
|
||||||
uint32 ground_relocation = 0;
|
uint32 ground_relocation = 0;
|
||||||
const BaseStation *st = NULL;
|
BaseStation *st = NULL;
|
||||||
const StationSpec *statspec = NULL;
|
const StationSpec *statspec = NULL;
|
||||||
uint tile_layout = 0;
|
uint tile_layout = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue