summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-10 21:30:26 +0000
committerrubidium <rubidium@openttd.org>2010-12-10 21:30:26 +0000
commitfdeab92dc7d5391bd9be48cd29beafbced278cb1 (patch)
tree8505e085b059c1b9c33112baeb11ff118cac7b11 /src/newgrf.cpp
parentc1efcb76cace2ef00d14f78613e991ea4009fa0d (diff)
downloadopenttd-fdeab92dc7d5391bd9be48cd29beafbced278cb1.tar.xz
(svn r21452) -Codechange: read object property 17 (number of views)
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index bde9037e6..580ad49e2 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -3012,6 +3012,7 @@ static ChangeInfoResult IgnoreObjectProperty(uint prop, ByteReader *buf)
case 0x12:
case 0x14:
case 0x16:
+ case 0x17:
buf->ReadByte();
case 0x09:
@@ -3066,7 +3067,10 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, ByteRea
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(uint id, int numinfo, int prop, ByteRea
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;