summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/newgrf_airport.cpp29
-rw-r--r--src/newgrf_airporttiles.cpp15
-rw-r--r--src/newgrf_airporttiles.h14
-rw-r--r--src/newgrf_canal.cpp10
-rw-r--r--src/newgrf_engine.cpp15
-rw-r--r--src/newgrf_engine.h12
-rw-r--r--src/newgrf_generic.cpp29
-rw-r--r--src/newgrf_house.cpp22
-rw-r--r--src/newgrf_house.h16
-rw-r--r--src/newgrf_industries.cpp17
-rw-r--r--src/newgrf_industries.h13
-rw-r--r--src/newgrf_industrytiles.cpp12
-rw-r--r--src/newgrf_industrytiles.h11
-rw-r--r--src/newgrf_object.cpp15
-rw-r--r--src/newgrf_object.h12
-rw-r--r--src/newgrf_railtype.cpp12
-rw-r--r--src/newgrf_railtype.h11
-rw-r--r--src/newgrf_spritegroup.cpp28
-rw-r--r--src/newgrf_spritegroup.h20
-rw-r--r--src/newgrf_station.cpp17
-rw-r--r--src/newgrf_station.h12
-rw-r--r--src/newgrf_town.cpp12
-rw-r--r--src/newgrf_town.h11
23 files changed, 145 insertions, 220 deletions
diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp
index 6db12f737..0863d0986 100644
--- a/src/newgrf_airport.cpp
+++ b/src/newgrf_airport.cpp
@@ -26,7 +26,18 @@ struct AirportScopeResolver : public ScopeResolver {
byte layout; ///< Layout of the airport to build.
TileIndex tile; ///< Tile for the callback, only valid for airporttile callbacks.
- AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout);
+ /**
+ * Constructor of the scope resolver for an airport.
+ * @param ro Surrounding resolver.
+ * @param tile %Tile for the callback, only valid for airporttile callbacks.
+ * @param st %Station of the airport for which the callback is run, or \c NULL for build gui.
+ * @param airport_id Type of airport for which the callback is run.
+ * @param layout Layout of the airport to build.
+ */
+ AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout)
+ : ScopeResolver(ro), st(st), airport_id(airport_id), layout(layout), tile(tile)
+ {
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
@@ -242,22 +253,6 @@ AirportResolverObject::AirportResolverObject(TileIndex tile, Station *st, byte a
this->root_spritegroup = AirportSpec::Get(airport_id)->grf_prop.spritegroup[0];
}
-/**
- * Constructor of the scope resolver for an airport.
- * @param ro Surrounding resolver.
- * @param tile %Tile for the callback, only valid for airporttile callbacks.
- * @param st %Station of the airport for which the callback is run, or \c NULL for build gui.
- * @param airport_id Type of airport for which the callback is run.
- * @param layout Layout of the airport to build.
- */
-AirportScopeResolver::AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout) : ScopeResolver(ro)
-{
- this->st = st;
- this->airport_id = airport_id;
- this->layout = layout;
- this->tile = tile;
-}
-
SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout)
{
AirportResolverObject object(INVALID_TILE, NULL, as->GetIndex(), layout);
diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp
index 5eb24f670..2d3a5129c 100644
--- a/src/newgrf_airporttiles.cpp
+++ b/src/newgrf_airporttiles.cpp
@@ -222,21 +222,6 @@ AirportTileResolverObject::AirportTileResolverObject(const AirportTileSpec *ats,
this->root_spritegroup = ats->grf_prop.spritegroup[0];
}
-/**
- * Constructor of the scope resolver specific for airport tiles.
- * @param ats Specification of the airport tiles.
- * @param tile %Tile for the callback, only valid for airporttile callbacks.
- * @param st Station of the airport for which the callback is run, or \c NULL for build gui.
- */
-AirportTileScopeResolver::AirportTileScopeResolver(ResolverObject &ro, const AirportTileSpec *ats, TileIndex tile, Station *st) : ScopeResolver(ro)
-{
- assert(st != NULL);
-
- this->st = st;
- this->airport_id = st->airport.type;
- this->tile = tile;
-}
-
uint16 GetAirportTileCallback(CallbackID callback, uint32 param1, uint32 param2, const AirportTileSpec *ats, Station *st, TileIndex tile, int extra_data = 0)
{
AirportTileResolverObject object(ats, tile, st, callback, param1, param2);
diff --git a/src/newgrf_airporttiles.h b/src/newgrf_airporttiles.h
index 4d25aa924..dc0464203 100644
--- a/src/newgrf_airporttiles.h
+++ b/src/newgrf_airporttiles.h
@@ -17,6 +17,7 @@
#include "newgrf_animation_type.h"
#include "newgrf_commons.h"
#include "newgrf_spritegroup.h"
+#include "station_base.h"
/** Scope resolver for handling the tiles of an airport. */
struct AirportTileScopeResolver : public ScopeResolver {
@@ -24,7 +25,18 @@ struct AirportTileScopeResolver : public ScopeResolver {
byte airport_id; ///< Type of airport for which the callback is run.
TileIndex tile; ///< Tile for the callback, only valid for airporttile callbacks.
- AirportTileScopeResolver(ResolverObject &ro, const AirportTileSpec *ats, TileIndex tile, Station *st);
+ /**
+ * Constructor of the scope resolver specific for airport tiles.
+ * @param ats Specification of the airport tiles.
+ * @param tile %Tile for the callback, only valid for airporttile callbacks.
+ * @param st Station of the airport for which the callback is run, or \c NULL for build gui.
+ */
+ AirportTileScopeResolver(ResolverObject &ro, const AirportTileSpec *ats, TileIndex tile, Station *st)
+ : ScopeResolver(ro), st(st), tile(tile)
+ {
+ assert(st != NULL);
+ this->airport_id = st->airport.type;
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
diff --git a/src/newgrf_canal.cpp b/src/newgrf_canal.cpp
index cba19cbdb..3438bb985 100644
--- a/src/newgrf_canal.cpp
+++ b/src/newgrf_canal.cpp
@@ -25,7 +25,10 @@ WaterFeature _water_feature[CF_END];
struct CanalScopeResolver : public ScopeResolver {
TileIndex tile; ///< Tile containing the canal.
- CanalScopeResolver(ResolverObject &ro, TileIndex tile);
+ CanalScopeResolver(ResolverObject &ro, TileIndex tile)
+ : ScopeResolver(ro), tile(tile)
+ {
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
@@ -110,11 +113,6 @@ struct CanalResolverObject : public ResolverObject {
return group->loaded[0];
}
-CanalScopeResolver::CanalScopeResolver(ResolverObject &ro, TileIndex tile) : ScopeResolver(ro)
-{
- this->tile = tile;
-}
-
/**
* Canal resolver constructor.
* @param feature Which canal feature we want.
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 94c8df1d1..660b7e476 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -938,21 +938,6 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object,
}
/**
- * Scope resolver of a single vehicle.
- * @param ro Surrounding resolver.
- * @param engine_type Engine type
- * @param v %Vehicle being resolved.
- * @param info_view Indicates if the item is being drawn in an info window.
- */
-VehicleScopeResolver::VehicleScopeResolver(ResolverObject &ro, EngineID engine_type, const Vehicle *v, bool info_view)
- : ScopeResolver(ro)
-{
- this->v = v;
- this->self_type = engine_type;
- this->info_view = info_view;
-}
-
-/**
* Get the grf file associated with an engine type.
* @param engine_type Engine to query.
* @return grf file associated with the engine.
diff --git a/src/newgrf_engine.h b/src/newgrf_engine.h
index 6406b0f4e..51adb0b7f 100644
--- a/src/newgrf_engine.h
+++ b/src/newgrf_engine.h
@@ -26,7 +26,17 @@ struct VehicleScopeResolver : public ScopeResolver {
EngineID self_type; ///< Type of the vehicle.
bool info_view; ///< Indicates if the item is being drawn in an info window.
- VehicleScopeResolver(ResolverObject &ro, EngineID engine_type, const Vehicle *v, bool info_view);
+ /**
+ * Scope resolver of a single vehicle.
+ * @param ro Surrounding resolver.
+ * @param engine_type Engine type
+ * @param v %Vehicle being resolved.
+ * @param info_view Indicates if the item is being drawn in an info window.
+ */
+ VehicleScopeResolver(ResolverObject &ro, EngineID engine_type, const Vehicle *v, bool info_view)
+ : ScopeResolver(ro), v(v), self_type(engine_type), info_view(info_view)
+ {
+ }
void SetVehicle(const Vehicle *v) { this->v = v; }
diff --git a/src/newgrf_generic.cpp b/src/newgrf_generic.cpp
index 9bd77239a..660642215 100644
--- a/src/newgrf_generic.cpp
+++ b/src/newgrf_generic.cpp
@@ -31,7 +31,16 @@ struct GenericScopeResolver : public ScopeResolver {
uint8 count;
uint8 station_size;
- GenericScopeResolver(ResolverObject &ro, bool ai_callback);
+ /**
+ * Generic scope resolver.
+ * @param ro Surrounding resolver.
+ * @param ai_callback Callback comes from the AI.
+ */
+ GenericScopeResolver(ResolverObject &ro, bool ai_callback)
+ : ScopeResolver(ro), cargo_type(0), default_selection(0), src_industry(0), dst_industry(0), distance(0),
+ event(), count(0), station_size(0), ai_callback(ai_callback)
+ {
+ }
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
@@ -145,24 +154,6 @@ GenericResolverObject::GenericResolverObject(bool ai_callback, CallbackID callba
{
}
-/**
- * Generic scope resolver.
- * @param ro Surrounding resolver.
- * @param ai_callback Callback comes from the AI.
- */
-GenericScopeResolver::GenericScopeResolver(ResolverObject &ro, bool ai_callback) : ScopeResolver(ro)
-{
- this->cargo_type = 0;
- this->default_selection = 0;
- this->src_industry = 0;
- this->dst_industry = 0;
- this->distance = 0;
- this->event = (AIConstructionEvent)0;
- this->count = 0;
- this->station_size = 0;
- this->ai_callback = ai_callback;
-}
-
/**
* Follow a generic feature callback list and return the first successful
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index bcd83f2f1..ebdd858a4 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -32,28 +32,6 @@ static HouseClassMapping _class_mapping[HOUSE_CLASS_MAX];
HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, NUM_HOUSES, INVALID_HOUSE_ID);
/**
- * Constructor of a house scope resolver.
- * @param ro Surrounding resolver.
- * @param house_id House type being queried.
- * @param tile %Tile containing the house.
- * @param town %Town containing the house.
- * @param not_yet_constructed House is still under construction.
- * @param initial_random_bits Random bits during construction checks.
- * @param watched_cargo_triggers Cargo types that triggered the watched cargo callback.
- */
-HouseScopeResolver::HouseScopeResolver(ResolverObject &ro, HouseID house_id, TileIndex tile, Town *town,
- bool not_yet_constructed, uint8 initial_random_bits, uint32 watched_cargo_triggers)
- : ScopeResolver(ro)
-{
- this->house_id = house_id;
- this->tile = tile;
- this->town = town;
- this->not_yet_constructed = not_yet_constructed;
- this->initial_random_bits = initial_random_bits;
- this->watched_cargo_triggers = watched_cargo_triggers;
-}
-
-/**
* Retrieve the grf file associated with a house.
* @param house_id House to query.
* @return The associated GRF file (may be \c NULL).
diff --git a/src/newgrf_house.h b/src/newgrf_house.h
index efc0c6cbb..0ac868d1e 100644
--- a/src/newgrf_house.h
+++ b/src/newgrf_house.h
@@ -27,8 +27,22 @@ struct HouseScopeResolver : public ScopeResolver {
uint16 initial_random_bits; ///< Random bits during construction checks.
uint32 watched_cargo_triggers; ///< Cargo types that triggered the watched cargo callback.
+ /**
+ * Constructor of a house scope resolver.
+ * @param ro Surrounding resolver.
+ * @param house_id House type being queried.
+ * @param tile %Tile containing the house.
+ * @param town %Town containing the house.
+ * @param not_yet_constructed House is still under construction.
+ * @param initial_random_bits Random bits during construction checks.
+ * @param watched_cargo_triggers Cargo types that triggered the watched cargo callback.
+ */
HouseScopeResolver(ResolverObject &ro, HouseID house_id, TileIndex tile, Town *town,
- bool not_yet_constructed, uint8 initial_random_bits, uint32 watched_cargo_triggers);
+ bool not_yet_constructed, uint8 initial_random_bits, uint32 watched_cargo_triggers)
+ : ScopeResolver(ro), house_id(house_id), tile(tile), town(town), not_yet_constructed(not_yet_constructed),
+ initial_random_bits(initial_random_bits), watched_cargo_triggers(watched_cargo_triggers)
+ {
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 9f227a9f5..7815ba36a 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -458,23 +458,6 @@ TownScopeResolver *IndustriesResolverObject::GetTown()
}
/**
- * Scope resolver for industries.
- * @param ro Surrounding resolver.
- * @param tile %Tile owned by the industry.
- * @param industry %Industry being resolved.
- * @param type Type of the industry.
- * @param random_bits Random bits of the new industry.
- */
-IndustriesScopeResolver::IndustriesScopeResolver(ResolverObject &ro, TileIndex tile, Industry *industry, IndustryType type, uint32 random_bits)
- : ScopeResolver(ro)
-{
- this->tile = tile;
- this->industry = industry;
- this->type = type;
- this->random_bits = random_bits;
-}
-
-/**
* Perform an industry callback.
* @param callback The callback to perform.
* @param param1 The first parameter.
diff --git a/src/newgrf_industries.h b/src/newgrf_industries.h
index 45b0333a6..fa809fcd7 100644
--- a/src/newgrf_industries.h
+++ b/src/newgrf_industries.h
@@ -21,7 +21,18 @@ struct IndustriesScopeResolver : public ScopeResolver {
IndustryType type; ///< Type of the industry.
uint32 random_bits; ///< Random bits of the new industry.
- IndustriesScopeResolver(ResolverObject &ro, TileIndex tile, Industry *industry, IndustryType type, uint32 random_bits = 0);
+ /**
+ * Scope resolver for industries.
+ * @param ro Surrounding resolver.
+ * @param tile %Tile owned by the industry.
+ * @param industry %Industry being resolved.
+ * @param type Type of the industry.
+ * @param random_bits Random bits of the new industry.
+ */
+ IndustriesScopeResolver(ResolverObject &ro, TileIndex tile, Industry *industry, IndustryType type, uint32 random_bits = 0)
+ : ScopeResolver(ro), tile(tile), industry(industry), type(type), random_bits(random_bits)
+ {
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index b4b8f77c4..69c4b1d07 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -146,18 +146,6 @@ IndustryTileResolverObject::IndustryTileResolverObject(IndustryGfx gfx, TileInde
this->root_spritegroup = GetIndustryTileSpec(gfx)->grf_prop.spritegroup[0];
}
-/**
- * Constructor of the scope resolver for the industry tile.
- * @param ro Surrounding resolver.
- * @param industry %Industry owning the tile.
- * @param tile %Tile of the industry.
- */
-IndustryTileScopeResolver::IndustryTileScopeResolver(ResolverObject &ro, Industry *industry, TileIndex tile) : ScopeResolver(ro)
-{
- this->industry = industry;
- this->tile = tile;
-}
-
static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage, IndustryGfx gfx)
{
const DrawTileSprites *dts = group->ProcessRegisters(&stage);
diff --git a/src/newgrf_industrytiles.h b/src/newgrf_industrytiles.h
index 2af064054..6051c1062 100644
--- a/src/newgrf_industrytiles.h
+++ b/src/newgrf_industrytiles.h
@@ -21,7 +21,16 @@ struct IndustryTileScopeResolver : public ScopeResolver {
Industry *industry; ///< Industry owning the tiles.
TileIndex tile; ///< %Tile being resolved.
- IndustryTileScopeResolver(ResolverObject &ro, Industry *industry, TileIndex tile);
+ /**
+ * Constructor of the scope resolver for the industry tile.
+ * @param ro Surrounding resolver.
+ * @param industry %Industry owning the tile.
+ * @param tile %Tile of the industry.
+ */
+ IndustryTileScopeResolver(ResolverObject &ro, Industry *industry, TileIndex tile)
+ : ScopeResolver(ro), industry(industry), tile(tile)
+ {
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index 058d5e0c0..78bbc5244 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -128,21 +128,6 @@ bool NewGRFClass<Tspec, Tid, Tmax>::IsUIAvailable(uint index) const
INSTANTIATE_NEWGRF_CLASS_METHODS(ObjectClass, ObjectSpec, ObjectClassID, OBJECT_CLASS_MAX)
-/**
- * Constructor of an object scope resolver.
- * @param ro Surrounding resolver.
- * @param obj Object being resolved.
- * @param tile %Tile of the object.
- * @param view View of the object.
- */
-ObjectScopeResolver::ObjectScopeResolver(ResolverObject &ro, Object *obj, TileIndex tile, uint8 view)
- : ScopeResolver(ro)
-{
- this->obj = obj;
- this->tile = tile;
- this->view = view;
-}
-
/* virtual */ uint32 ObjectScopeResolver::GetRandomBits() const
{
return IsValidTile(this->tile) && IsTileType(this->tile, MP_OBJECT) ? GetObjectRandomBits(this->tile) : 0;
diff --git a/src/newgrf_object.h b/src/newgrf_object.h
index cbd06b6f6..69e1a3299 100644
--- a/src/newgrf_object.h
+++ b/src/newgrf_object.h
@@ -104,7 +104,17 @@ struct ObjectScopeResolver : public ScopeResolver {
TileIndex tile; ///< The tile related to the object.
uint8 view; ///< The view of the object.
- ObjectScopeResolver(ResolverObject &ro, Object *obj, TileIndex tile, uint8 view = 0);
+ /**
+ * Constructor of an object scope resolver.
+ * @param ro Surrounding resolver.
+ * @param obj Object being resolved.
+ * @param tile %Tile of the object.
+ * @param view View of the object.
+ */
+ ObjectScopeResolver(ResolverObject &ro, Object *obj, TileIndex tile, uint8 view = 0)
+ : ScopeResolver(ro), obj(obj), tile(tile), view(view)
+ {
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp
index 8a074db97..624b0eca8 100644
--- a/src/newgrf_railtype.cpp
+++ b/src/newgrf_railtype.cpp
@@ -68,18 +68,6 @@
}
/**
- * Constructor of the railtype scope resolvers.
- * @param ro Surrounding resolver.
- * @param tile %Tile containing the track. For track on a bridge this is the southern bridgehead.
- * @param context Are we resolving sprites for the upper halftile, or on a bridge?
- */
-RailTypeScopeResolver::RailTypeScopeResolver(ResolverObject &ro, TileIndex tile, TileContext context) : ScopeResolver(ro)
-{
- this->tile = tile;
- this->context = context;
-}
-
-/**
* Resolver object for rail types.
* @param rti Railtype. NULL in NewGRF Inspect window.
* @param tile %Tile containing the track. For track on a bridge this is the southern bridgehead.
diff --git a/src/newgrf_railtype.h b/src/newgrf_railtype.h
index 4c68e7d1d..5fadcd2ab 100644
--- a/src/newgrf_railtype.h
+++ b/src/newgrf_railtype.h
@@ -21,7 +21,16 @@ struct RailTypeScopeResolver : public ScopeResolver {
TileIndex tile; ///< Tracktile. For track on a bridge this is the southern bridgehead.
TileContext context; ///< Are we resolving sprites for the upper halftile, or on a bridge?
- RailTypeScopeResolver(ResolverObject &ro, TileIndex tile, TileContext context);
+ /**
+ * Constructor of the railtype scope resolvers.
+ * @param ro Surrounding resolver.
+ * @param tile %Tile containing the track. For track on a bridge this is the southern bridgehead.
+ * @param context Are we resolving sprites for the upper halftile, or on a bridge?
+ */
+ RailTypeScopeResolver(ResolverObject &ro, TileIndex tile, TileContext context)
+ : ScopeResolver(ro), tile(tile), context(context)
+ {
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp
index 5a53e3b6a..cb70a88bf 100644
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -83,13 +83,6 @@ static inline uint32 GetVariable(const ResolverObject &object, ScopeResolver *sc
}
}
-ScopeResolver::ScopeResolver(ResolverObject &ro)
- : ro(ro)
-{
-}
-
-ScopeResolver::~ScopeResolver() {}
-
/**
* Get a few random bits. Default implementation has no random bits.
* @return Random bits.
@@ -130,27 +123,6 @@ ScopeResolver::~ScopeResolver() {}
/* virtual */ void ScopeResolver::StorePSA(uint reg, int32 value) {}
/**
- * Resolver constructor.
- * @param grffile NewGRF file associated with the object (or \c NULL if none).
- * @param callback Callback code being resolved (default value is #CBID_NO_CALLBACK).
- * @param callback_param1 First parameter (var 10) of the callback (only used when \a callback is also set).
- * @param callback_param2 Second parameter (var 18) of the callback (only used when \a callback is also set).
- */
-ResolverObject::ResolverObject(const GRFFile *grffile, CallbackID callback, uint32 callback_param1, uint32 callback_param2)
- : default_scope(*this)
-{
- this->callback = callback;
- this->callback_param1 = callback_param1;
- this->callback_param2 = callback_param2;
- this->ResetState();
-
- this->grffile = grffile;
- this->root_spritegroup = NULL;
-}
-
-ResolverObject::~ResolverObject() {}
-
-/**
* Get the real sprites of the grf.
* @param group Group to get.
* @return The available sprite group.
diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h
index a0ae6ce51..4d290b137 100644
--- a/src/newgrf_spritegroup.h
+++ b/src/newgrf_spritegroup.h
@@ -288,8 +288,8 @@ struct IndustryProductionSpriteGroup : SpriteGroup {
struct ScopeResolver {
ResolverObject &ro; ///< Surrounding resolver object.
- ScopeResolver(ResolverObject &ro);
- virtual ~ScopeResolver();
+ ScopeResolver(ResolverObject &ro) : ro(ro) {}
+ virtual ~ScopeResolver() {}
virtual uint32 GetRandomBits() const;
virtual uint32 GetTriggers() const;
@@ -305,8 +305,20 @@ struct ScopeResolver {
* to get the results of callbacks, rerandomisations or normal sprite lookups.
*/
struct ResolverObject {
- ResolverObject(const GRFFile *grffile, CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
- virtual ~ResolverObject();
+ /**
+ * Resolver constructor.
+ * @param grffile NewGRF file associated with the object (or \c NULL if none).
+ * @param callback Callback code being resolved (default value is #CBID_NO_CALLBACK).
+ * @param callback_param1 First parameter (var 10) of the callback (only used when \a callback is also set).
+ * @param callback_param2 Second parameter (var 18) of the callback (only used when \a callback is also set).
+ */
+ ResolverObject(const GRFFile *grffile, CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0)
+ : default_scope(*this), callback(callback), callback_param1(callback_param1), callback_param2(callback_param2), grffile(grffile), root_spritegroup(NULL)
+ {
+ this->ResetState();
+ }
+
+ virtual ~ResolverObject() {}
ScopeResolver default_scope; ///< Default implementation of the grf scope.
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 091182185..41ef7af75 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -579,23 +579,6 @@ StationResolverObject::~StationResolverObject()
}
/**
- * Constructor for station scopes.
- * @param ro Surrounding resolver.
- * @param statspec Station (type) specification.
- * @param st Instance of the station.
- * @param tile %Tile of the station.
- */
-StationScopeResolver::StationScopeResolver(ResolverObject &ro, const StationSpec *statspec, BaseStation *st, TileIndex tile)
- : ScopeResolver(ro)
-{
- this->tile = tile;
- this->st = st;
- this->statspec = statspec;
- this->cargo_type = CT_INVALID;
- this->axis = INVALID_AXIS;
-}
-
-/**
* Resolve sprites for drawing a station tile.
* @param statspec Station spec
* @param st Station (NULL in GUI)
diff --git a/src/newgrf_station.h b/src/newgrf_station.h
index f6a39efb1..5413a4c08 100644
--- a/src/newgrf_station.h
+++ b/src/newgrf_station.h
@@ -30,7 +30,17 @@ struct StationScopeResolver : public ScopeResolver {
CargoID cargo_type; ///< Type of cargo of the station.
Axis axis; ///< Station axis, used only for the slope check callback.
- StationScopeResolver(ResolverObject &ro, const StationSpec *statspec, BaseStation *st, TileIndex tile);
+ /**
+ * Constructor for station scopes.
+ * @param ro Surrounding resolver.
+ * @param statspec Station (type) specification.
+ * @param st Instance of the station.
+ * @param tile %Tile of the station.
+ */
+ StationScopeResolver(ResolverObject &ro, const StationSpec *statspec, BaseStation *st, TileIndex tile)
+ : ScopeResolver(ro), tile(tile), st(st), statspec(statspec), cargo_type(CT_INVALID), axis(INVALID_AXIS)
+ {
+ }
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetTriggers() const;
diff --git a/src/newgrf_town.cpp b/src/newgrf_town.cpp
index 2f48eb757..820e2be68 100644
--- a/src/newgrf_town.cpp
+++ b/src/newgrf_town.cpp
@@ -16,18 +16,6 @@
#include "safeguards.h"
-/**
- * Resolver of a town scope.
- * @param ro Surrounding resolver.
- * @param t %Town of the scope.
- * @param readonly Scope may change persistent storage of the town.
- */
-TownScopeResolver::TownScopeResolver(ResolverObject &ro, Town *t, bool readonly) : ScopeResolver(ro)
-{
- this->t = t;
- this->readonly = readonly;
-}
-
/* virtual */ uint32 TownScopeResolver::GetVariable(byte variable, uint32 parameter, bool *available) const
{
switch (variable) {
diff --git a/src/newgrf_town.h b/src/newgrf_town.h
index 145571e8a..7c4fb5395 100644
--- a/src/newgrf_town.h
+++ b/src/newgrf_town.h
@@ -25,7 +25,16 @@ struct TownScopeResolver : public ScopeResolver {
Town *t; ///< %Town of the scope.
bool readonly; ///< When set, persistent storage of the town is read-only,
- TownScopeResolver(ResolverObject &ro, Town *t, bool readonly);
+ /**
+ * Resolver of a town scope.
+ * @param ro Surrounding resolver.
+ * @param t %Town of the scope.
+ * @param readonly Scope may change persistent storage of the town.
+ */
+ TownScopeResolver(ResolverObject &ro, Town *t, bool readonly)
+ : ScopeResolver(ro), t(t), readonly(readonly)
+ {
+ }
virtual uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
virtual void StorePSA(uint reg, int32 value);