summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2011-09-11 09:31:57 +0000
committerplanetmaker <planetmaker@openttd.org>2011-09-11 09:31:57 +0000
commit3b70f697e1c08cda55a4729636120170b9c79bcc (patch)
treed753003f3f95c82abcf77849211d360f86573ffc /src/newgrf.cpp
parentbc52aa11a6d273f603e8aa195221904757192a14 (diff)
downloadopenttd-3b70f697e1c08cda55a4729636120170b9c79bcc.tar.xz
(svn r22918) -Fix: [NewGRF] Properties for feature 0x05 were not zeroed for each NewGRF, thus waterfeatures could glitch when the properties were set by a previous NewGRF and the NewGRF assumed the properties to be unmodified
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index b19030033..056e1f7b6 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -1650,15 +1650,15 @@ static ChangeInfoResult CanalChangeInfo(uint id, int numinfo, int prop, ByteRead
}
for (int i = 0; i < numinfo; i++) {
- WaterFeature *wf = &_water_feature[id + i];
+ CanalProperties *cp = &_cur.grffile->canal_local_properties[id + i];
switch (prop) {
case 0x08:
- wf->callback_mask = buf->ReadByte();
+ cp->callback_mask = buf->ReadByte();
break;
case 0x09:
- wf->flags = buf->ReadByte();
+ cp->flags = buf->ReadByte();
break;
default:
@@ -7656,6 +7656,17 @@ static void CalculateRefitMasks()
}
}
+/** Set to use the correct action0 properties for each canal feature */
+static void FinaliseCanals()
+{
+ for (uint i = 0; i < CF_END; i++) {
+ if (_water_feature[i].grffile != NULL) {
+ _water_feature[i].callback_mask = _water_feature[i].grffile->canal_local_properties[i].callback_mask;
+ _water_feature[i].flags = _water_feature[i].grffile->canal_local_properties[i].flags;
+ }
+ }
+}
+
/** Check for invalid engines */
static void FinaliseEngineArray()
{
@@ -8348,6 +8359,9 @@ static void AfterLoadGRFs()
/* Polish engines */
FinaliseEngineArray();
+ /* Set the actually used Canal properties */
+ FinaliseCanals();
+
/* Set the block size in the depot windows based on vehicle sprite sizes */
InitDepotWindowBlockSizes();