Changeset - r16709:76a89a42f916
[Not reviewed]
master
0 3 0
rubidium - 13 years ago 2010-12-10 21:30:26
rubidium@openttd.org
(svn r21452) -Codechange: read object property 17 (number of views)
3 files changed with 15 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -3012,6 +3012,7 @@ static ChangeInfoResult IgnoreObjectProp
 
		case 0x12:
 
		case 0x14:
 
		case 0x16:
 
		case 0x17:
 
			buf->ReadByte();
 

	
 
		case 0x09:
 
@@ -3066,7 +3067,10 @@ static ChangeInfoResult ObjectChangeInfo
 
				ObjectSpec **ospec = &_cur_grffile->objectspec[id + i];
 

	
 
				/* Allocate space for this object. */
 
				if (*ospec == NULL) *ospec = CallocT<ObjectSpec>(1);
 
				if (*ospec == NULL) {
 
					*ospec = CallocT<ObjectSpec>(1);
 
					(*ospec)->views = 1; // Default for NewGRFs that don't set it.
 
				}
 

	
 
				/* Swap classid because we read it in BE. */
 
				uint32 classid = buf->ReadDWord();
 
@@ -3138,6 +3142,14 @@ static ChangeInfoResult ObjectChangeInfo
 
				spec->height = buf->ReadByte();
 
				break;
 

	
 
			case 0x17: // Views
 
				spec->views = buf->ReadByte();
 
				if (spec->views != 1 && spec->views != 2 && spec->views != 4) {
 
					grfmsg(2, "ObjectChangeInfo: Invalid number of views (%u) for object id %u. Ignoring.", spec->views, id + i);
 
					spec->views = 1;
 
				}
 
				break;
 

	
 
			default:
 
				ret = CIR_UNKNOWN;
 
				break;
src/newgrf_object.h
Show inline comments
 
@@ -69,6 +69,7 @@ struct ObjectSpec {
 
	AnimationInfo animation;      ///< Information about the animation.
 
	uint16 callback_mask;         ///< Bitmask of requested/allowed callbacks.
 
	uint8 height;                 ///< The height of this structure, in heightlevels; max MAX_TILE_HEIGHT.
 
	uint8 views;                  ///< The number of views.
 
	bool enabled;                 ///< Is this spec enabled?
 

	
 
	/**
src/table/object_land.h
Show inline comments
 
@@ -123,7 +123,7 @@ static const DrawTileSprites _object_hq[
 

	
 
#undef TILE_SPRITE_LINE
 

	
 
#define M(name, size, build_cost_multiplier, clear_cost_multiplier, height, flags) { GRFFilePropsBase<2>(), INVALID_OBJECT_CLASS, name, 0xF, size, 0, 0, build_cost_multiplier, clear_cost_multiplier, flags, {0, 0, 0, 0}, 0, height, true }
 
#define M(name, size, build_cost_multiplier, clear_cost_multiplier, height, flags) { GRFFilePropsBase<2>(), INVALID_OBJECT_CLASS, name, 0xF, size, 0, 0, build_cost_multiplier, clear_cost_multiplier, flags, {0, 0, 0, 0}, 0, height, 1, true }
 

	
 
/** Specification of the original object structures. */
 
extern const ObjectSpec _original_objects[] = {
0 comments (0 inline, 0 general)