summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-18 14:20:03 +0000
committerrubidium <rubidium@openttd.org>2010-11-18 14:20:03 +0000
commit46186134c892f236ecc610aacd6c18ee95600d5f (patch)
tree8c4fee2d4ad04aa85e1ad0088b3de56ba5885dde /src/newgrf.cpp
parent61ff042460410d5382db56c4af86db6c277f02e1 (diff)
downloadopenttd-46186134c892f236ecc610aacd6c18ee95600d5f.tar.xz
(svn r21239) -Codechange/Fix: [NewGRF] Use 0xFF instead of 0 as default value for visual effect. This makes setting train prop 22 to 0 actually work (Hirundo)
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index d4b74045a..12696b6dc 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -48,6 +48,7 @@
#include "gui.h"
#include "vehicle_func.h"
#include "language.h"
+#include "vehicle_base.h"
#include "table/strings.h"
#include "table/build_industry.h"
@@ -710,8 +711,13 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop
break;
case 0x22: // Visual effect
- /** @see note in engine.h about rvi->visual_effect */
rvi->visual_effect = buf->ReadByte();
+ /* Avoid accidentally setting visual_effect to the default value
+ * Since bit 6 (disable effects) is set anyways, we can safely erase some bits. */
+ if (rvi->visual_effect == VE_DEFAULT) {
+ assert(HasBit(rvi->visual_effect, VE_DISABLE_EFFECT));
+ SB(rvi->visual_effect, VE_TYPE_START, VE_TYPE_COUNT, 0);
+ }
break;
case 0x23: // Powered wagons weight bonus