diff options
-rw-r--r-- | src/industrytype.h | 4 | ||||
-rw-r--r-- | src/newgrf_airport.h | 2 | ||||
-rw-r--r-- | src/newgrf_commons.h | 19 | ||||
-rw-r--r-- | src/table/airport_defaults.h | 2 | ||||
-rw-r--r-- | src/table/airporttiles.h | 4 | ||||
-rw-r--r-- | src/table/build_industry.h | 4 |
6 files changed, 24 insertions, 11 deletions
diff --git a/src/industrytype.h b/src/industrytype.h index e1d8b3596..c67c7d1f3 100644 --- a/src/industrytype.h +++ b/src/industrytype.h @@ -131,7 +131,7 @@ struct IndustrySpec { uint16 callback_mask; ///< Bitmask of industry callbacks that have to be called uint8 cleanup_flag; ///< flags indicating which data should be freed upon cleaning up bool enabled; ///< entity still avaible (by default true).newgrf can disable it, though - struct GRFFileProps grf_prop; ///< properties related the the grf file + GRFFileProps grf_prop; ///< properties related the the grf file /** * Is an industry with the spec a raw industry? @@ -172,7 +172,7 @@ struct IndustryTileSpec { uint8 animation_triggers; ///< When to start the animation IndustryTileSpecialFlags special_flags; ///< Bitmask of extra flags used by the tile bool enabled; ///< entity still avaible (by default true).newgrf can disable it, though - struct GRFFileProps grf_prop; + GRFFileProps grf_prop; ///< properties related the the grf file }; /* industry_cmd.cpp*/ diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h index a20be0f54..def946907 100644 --- a/src/newgrf_airport.h +++ b/src/newgrf_airport.h @@ -76,7 +76,7 @@ struct AirportSpec { SpriteID preview_sprite; ///< preview sprite for this airport /* Newgrf data */ bool enabled; ///< entity still avaible (by default true).newgrf can disable it, though - GRFFileProps grf_prop; ///< properties related the the grf file + struct GRFFileProps grf_prop; ///< properties related the the grf file static const AirportSpec *Get(byte type); static AirportSpec *GetWithoutOverride(byte type); diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h index 7b5c6c297..0b7ee3d85 100644 --- a/src/newgrf_commons.h +++ b/src/newgrf_commons.h @@ -129,11 +129,24 @@ TileIndex GetNearbyTile(byte parameter, TileIndex tile); uint32 GetNearbyTileInformation(TileIndex tile); /** Data related to the handling of grf files. */ -struct GRFFileProps { - uint16 subst_id; +struct GRFFilePropsBase { + /** Set all data constructor for the props. */ + GRFFilePropsBase(uint local_id, const struct GRFFile *grffile) : local_id(local_id), grffile(grffile) {} + /** Simple constructor for the props. */ + GRFFilePropsBase() {} uint16 local_id; ///< id defined by the grf file for this entity - struct SpriteGroup *spritegroup; ///< pointer to the different sprites of the entity const struct GRFFile *grffile; ///< grf file that introduced this entity +}; + +/** Data related to the handling of grf files. */ +struct GRFFileProps : GRFFilePropsBase { + /** Set all default data constructor for the props. */ + GRFFileProps(uint16 subst_id) : + GRFFilePropsBase(0, NULL), subst_id(subst_id), spritegroup(NULL), override(subst_id) {} + /** Simple constructor for the props. */ + GRFFileProps() : GRFFilePropsBase() {} + uint16 subst_id; + struct SpriteGroup *spritegroup; ///< pointer to the different sprites of the entity uint16 override; ///< id of the entity been replaced by }; diff --git a/src/table/airport_defaults.h b/src/table/airport_defaults.h index 13e888dd0..960009499 100644 --- a/src/table/airport_defaults.h +++ b/src/table/airport_defaults.h @@ -382,7 +382,7 @@ static Direction _default_airports_rotation[] = { /** General AirportSpec definition. */ #define AS_GENERIC(fsm, att, rot, att_len, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name, preview, enabled) \ - {fsm, att, rot, att_len, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, name, ttdpatch_type, class_id, preview, enabled, {AT_INVALID, 0, NULL, NULL, AT_INVALID}} + {fsm, att, rot, att_len, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, name, ttdpatch_type, class_id, preview, enabled, GRFFileProps(AT_INVALID)} /** AirportSpec definition for airports without any depot. */ #define AS_ND(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id, name, preview) \ diff --git a/src/table/airporttiles.h b/src/table/airporttiles.h index 513dff46b..37e7d512f 100644 --- a/src/table/airporttiles.h +++ b/src/table/airporttiles.h @@ -13,9 +13,9 @@ #define AIRPORTTILES_H /** Writes all airport tile properties in the AirportTile struct */ -#define AT(num_frames, anim_speed) {(1 << 8) | num_frames, anim_speed, STR_NULL, 0, 0, 0, true, {INVALID_AIRPORTTILE, 0, NULL, NULL, INVALID_AIRPORTTILE}} +#define AT(num_frames, anim_speed) {(1 << 8) | num_frames, anim_speed, STR_NULL, 0, 0, 0, true, GRFFileProps(INVALID_AIRPORTTILE)} /** Writes an airport tile without animation in the AirportTile struct */ -#define AT_NOANIM {0xFFFF, 2, STR_NULL, 0, 0, 0, true, {INVALID_AIRPORTTILE, 0, NULL, NULL, INVALID_AIRPORTTILE}} +#define AT_NOANIM {0xFFFF, 2, STR_NULL, 0, 0, 0, true, GRFFileProps(INVALID_AIRPORTTILE)} /** * All default airport tiles. diff --git a/src/table/build_industry.h b/src/table/build_industry.h index b5aa117fe..cb2c7d92e 100644 --- a/src/table/build_industry.h +++ b/src/table/build_industry.h @@ -1184,7 +1184,7 @@ enum IndustryTypes { c1, c2, c3, proc, p1, r1, p2, r2, m, a1, im1, a2, im2, a3, im3, pr, clim, bev, in, intx, s1, s2, s3) \ {tbl, lengthof(tbl), d, 0, pc, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \ {a1, a2, a3}, {{im1, 0}, {im2, 0}, {im3, 0}}, pr, clim, bev, col, in, intx, s1, s2, s3, STR_UNDEFINED, {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, \ - sndc, snd, 0, 0, true, {INVALID_INDUSTRYTYPE, 0, NULL, NULL, INVALID_INDUSTRYTYPE}} + sndc, snd, 0, 0, true, GRFFileProps(INVALID_INDUSTRYTYPE)} /* Format: tile table count and sounds table cost multiplier appear chances(4ingame, 4random) map colour @@ -1581,7 +1581,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = { * @param a2 next frame of animation * @param a3 chooses between animation or construction state */ -#define MT(ca1, c1, ca2, c2, ca3, c3, sl, a1, a2, a3) {{c1, c2, c3}, {ca1, ca2, ca3}, sl, a1, a2, a3, 0, 0xFFFF, 2, 0, INDTILE_SPECIAL_NONE, true, {INVALID_INDUSTRYTILE, 0, NULL, NULL, INVALID_INDUSTRYTILE}} +#define MT(ca1, c1, ca2, c2, ca3, c3, sl, a1, a2, a3) {{c1, c2, c3}, {ca1, ca2, ca3}, sl, a1, a2, a3, 0, 0xFFFF, 2, 0, INDTILE_SPECIAL_NONE, true, GRFFileProps(INVALID_INDUSTRYTILE)} static const IndustryTileSpec _origin_industry_tile_specs[NEW_INDUSTRYTILEOFFSET] = { /* Coal Mine */ MT(0, CT_INVALID, 0, CT_INVALID, 0, CT_INVALID, SLOPE_STEEP, INDUSTRYTILE_NOANIM, INDUSTRYTILE_NOANIM, false), |