Mercurial > hg > openttd
changeset 14484:24501a41ea9a draft
(svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
author | frosch <frosch@openttd.org> |
---|---|
date | Sun, 07 Feb 2010 12:04:44 +0000 |
parents | 20fa7b6c0bf0 |
children | 360154cdeb26 |
files | src/industrytype.h src/newgrf.cpp src/newgrf_industrytiles.cpp src/table/build_industry.h |
diffstat | 4 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/industrytype.h +++ b/src/industrytype.h @@ -55,6 +55,7 @@ ICT_SCENARIO_EDITOR ///< while scenarion edition }; +/** Various industry behaviours mostly to represent original TTD specialities */ enum IndustryBehaviour { INDUSTRYBEH_NONE = 0, INDUSTRYBEH_PLANT_FIELDS = 1 << 0, ///< periodically plants fileds around itself (temp and artic farms) @@ -79,6 +80,13 @@ }; DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour); +/** Flags for miscellaneous industry tile specialities */ +enum IndustryTileSpecialFlags { + INDTILE_SPECIAL_NONE = 0, + INDTILE_SPECIAL_NEXTFRAME_RANDOMBITS = 1 << 0, ///< Callback 0x26 needs random bits +}; +DECLARE_ENUM_AS_BIT_SET(IndustryTileSpecialFlags); + struct IndustryTileTable { TileIndexDiffC ti; IndustryGfx gfx; @@ -167,7 +175,7 @@ uint16 animation_info; ///< Information about the animation (is it looping, how many loops etc) uint8 animation_speed; ///< The speed of the animation uint8 animation_triggers; ///< When to start the animation - uint8 animation_special_flags; ///< Extra flags to influence 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; };
--- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -2160,7 +2160,7 @@ break; case 0x12: // Special flags - tsp->animation_special_flags = buf->ReadByte(); + tsp->special_flags = (IndustryTileSpecialFlags)buf->ReadByte(); break; default:
--- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -291,7 +291,8 @@ uint16 num_frames = GB(itspec->animation_info, 0, 8); if (HasBit(itspec->callback_mask, CBM_INDT_ANIM_NEXT_FRAME)) { - uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_ANIM_NEXT_FRAME, HasBit(itspec->animation_special_flags, 0) ? Random() : 0, 0, gfx, ind, tile); + uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_ANIM_NEXT_FRAME, + (itspec->special_flags & INDTILE_SPECIAL_NEXTFRAME_RANDOMBITS) ? Random() : 0, 0, gfx, ind, tile); if (callback_res != CALLBACK_FAILED) { frame_set_by_callback = true;
--- a/src/table/build_industry.h +++ b/src/table/build_industry.h @@ -1580,7 +1580,7 @@ * @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, 0, 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, {INVALID_INDUSTRYTILE, 0, NULL, NULL, 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),