Changeset - r14474:aa12474cff10
[Not reviewed]
master
0 4 0
frosch - 15 years ago 2010-02-07 12:04:44
frosch@openttd.org
(svn r19053) -Codechange: Add an enum for the special flags of industry tiles. (based on andythenorth' work)
4 files changed with 13 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/industrytype.h
Show inline comments
 
@@ -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;
 
};
src/newgrf.cpp
Show inline comments
 
@@ -2160,7 +2160,7 @@ static ChangeInfoResult IndustrytilesCha
 
				break;
 

	
 
			case 0x12: // Special flags
 
				tsp->animation_special_flags = buf->ReadByte();
 
				tsp->special_flags = (IndustryTileSpecialFlags)buf->ReadByte();
 
				break;
 

	
 
			default:
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -291,7 +291,8 @@ void AnimateNewIndustryTile(TileIndex ti
 
	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;
src/table/build_industry.h
Show inline comments
 
@@ -1580,7 +1580,7 @@ static const IndustrySpec _origin_indust
 
 * @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),
0 comments (0 inline, 0 general)