mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
This commit is contained in:
parent
76dbdca2f8
commit
fb9b833dc4
|
@ -55,6 +55,7 @@ enum IndustryConstructionType {
|
||||||
ICT_SCENARIO_EDITOR ///< while scenarion edition
|
ICT_SCENARIO_EDITOR ///< while scenarion edition
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Various industry behaviours mostly to represent original TTD specialities */
|
||||||
enum IndustryBehaviour {
|
enum IndustryBehaviour {
|
||||||
INDUSTRYBEH_NONE = 0,
|
INDUSTRYBEH_NONE = 0,
|
||||||
INDUSTRYBEH_PLANT_FIELDS = 1 << 0, ///< periodically plants fileds around itself (temp and artic farms)
|
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);
|
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 {
|
struct IndustryTileTable {
|
||||||
TileIndexDiffC ti;
|
TileIndexDiffC ti;
|
||||||
IndustryGfx gfx;
|
IndustryGfx gfx;
|
||||||
|
@ -167,7 +175,7 @@ struct IndustryTileSpec {
|
||||||
uint16 animation_info; ///< Information about the animation (is it looping, how many loops etc)
|
uint16 animation_info; ///< Information about the animation (is it looping, how many loops etc)
|
||||||
uint8 animation_speed; ///< The speed of the animation
|
uint8 animation_speed; ///< The speed of the animation
|
||||||
uint8 animation_triggers; ///< When to start 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
|
bool enabled; ///< entity still avaible (by default true).newgrf can disable it, though
|
||||||
struct GRFFileProps grf_prop;
|
struct GRFFileProps grf_prop;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2160,7 +2160,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x12: // Special flags
|
case 0x12: // Special flags
|
||||||
tsp->animation_special_flags = buf->ReadByte();
|
tsp->special_flags = (IndustryTileSpecialFlags)buf->ReadByte();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -291,7 +291,8 @@ void AnimateNewIndustryTile(TileIndex tile)
|
||||||
uint16 num_frames = GB(itspec->animation_info, 0, 8);
|
uint16 num_frames = GB(itspec->animation_info, 0, 8);
|
||||||
|
|
||||||
if (HasBit(itspec->callback_mask, CBM_INDT_ANIM_NEXT_FRAME)) {
|
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) {
|
if (callback_res != CALLBACK_FAILED) {
|
||||||
frame_set_by_callback = true;
|
frame_set_by_callback = true;
|
||||||
|
|
|
@ -1580,7 +1580,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = {
|
||||||
* @param a2 next frame of animation
|
* @param a2 next frame of animation
|
||||||
* @param a3 chooses between animation or construction state
|
* @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] = {
|
static const IndustryTileSpec _origin_industry_tile_specs[NEW_INDUSTRYTILEOFFSET] = {
|
||||||
/* Coal Mine */
|
/* Coal Mine */
|
||||||
MT(0, CT_INVALID, 0, CT_INVALID, 0, CT_INVALID, SLOPE_STEEP, INDUSTRYTILE_NOANIM, INDUSTRYTILE_NOANIM, false),
|
MT(0, CT_INVALID, 0, CT_INVALID, 0, CT_INVALID, SLOPE_STEEP, INDUSTRYTILE_NOANIM, INDUSTRYTILE_NOANIM, false),
|
||||||
|
|
Loading…
Reference in New Issue