summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-06-02 21:38:50 +0000
committerhackykid <hackykid@openttd.org>2005-06-02 21:38:50 +0000
commit3f3cbea5c49ccf0293d22066ed810b6daf8b9a54 (patch)
tree58e4bf7630579c8a06dd513ca53cf664ee4874bc /newgrf.c
parente8c6b8feca60797c88467f2b77da26fcf7679a60 (diff)
downloadopenttd-3f3cbea5c49ccf0293d22066ed810b6daf8b9a54.tar.xz
(svn r2400) - Fix: [newgrf] Load power for dual-headed engines correctly
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/newgrf.c b/newgrf.c
index df9fbed7c..729594d36 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -225,6 +225,9 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint16 power = grf_load_word(&buf);
+ if (rvi[i].flags & RVI_MULTIHEAD)
+ power /= 2;
+
rvi[i].power = power;
dewagonize(power, engine + i);
}
@@ -269,9 +272,13 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
uint8 dual = grf_load_byte(&buf);
if (dual != 0) {
- rvi[i].flags |= 1;
+ if (!(rvi[i].flags & RVI_MULTIHEAD)) // adjust power if needed
+ rvi[i].power /= 2;
+ rvi[i].flags |= RVI_MULTIHEAD;
} else {
- rvi[i].flags &= ~1;
+ if (rvi[i].flags & RVI_MULTIHEAD) // adjust power if needed
+ rvi[i].power *= 2;
+ rvi[i].flags &= ~RVI_MULTIHEAD;
}
}
} break;