summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/industrytype.h10
-rw-r--r--src/newgrf.cpp2
-rw-r--r--src/newgrf_industrytiles.cpp3
-rw-r--r--src/table/build_industry.h2
4 files changed, 13 insertions, 4 deletions
diff --git a/src/industrytype.h b/src/industrytype.h
index f4834a6cf..ff85e45d9 100644
--- a/src/industrytype.h
+++ b/src/industrytype.h
@@ -55,6 +55,7 @@ enum IndustryConstructionType {
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 @@ enum IndustryBehaviour {
};
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 @@ struct IndustryTileSpec {
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;
};
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 786c5f373..f8d988489 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2160,7 +2160,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr
break;
case 0x12: // Special flags
- tsp->animation_special_flags = buf->ReadByte();
+ tsp->special_flags = (IndustryTileSpecialFlags)buf->ReadByte();
break;
default:
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 86ac36f24..70eebe0a8 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -291,7 +291,8 @@ void AnimateNewIndustryTile(TileIndex tile)
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;
diff --git a/src/table/build_industry.h b/src/table/build_industry.h
index ac3c648fd..c7e7870da 100644
--- a/src/table/build_industry.h
+++ b/src/table/build_industry.h
@@ -1580,7 +1580,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, 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),