summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-01-07 13:20:02 +0000
committerpeter1138 <peter1138@openttd.org>2006-01-07 13:20:02 +0000
commit473b3072ea97b78f5863d27dcca48efb152dcb04 (patch)
tree4a1cd1baec250e2e813d411302f8cd4f2a6174ab /newgrf.c
parent1cfabfbb09ebf105c8f6f37fe09badfb1f8b915d (diff)
downloadopenttd-473b3072ea97b78f5863d27dcca48efb152dcb04.tar.xz
(svn r3384) - NewGRF fix: running cost should be halved for dual head vehicles.
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/newgrf.c b/newgrf.c
index 189557157..90a777a9e 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -250,6 +250,9 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint8 runcostfact = grf_load_byte(&buf);
+ if (rvi[i].flags & RVI_MULTIHEAD)
+ runcostfact /= 2;
+
rvi[i].running_cost_base = runcostfact;
dewagonize(runcostfact, engine + i);
}
@@ -278,12 +281,18 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
uint8 dual = grf_load_byte(&buf);
if (dual != 0) {
- if (!(rvi[i].flags & RVI_MULTIHEAD)) // adjust power if needed
+ if (!(rvi[i].flags & RVI_MULTIHEAD)) {
+ // adjust power and running cost if needed
rvi[i].power /= 2;
+ rvi[i].running_cost_base /= 2;
+ }
rvi[i].flags |= RVI_MULTIHEAD;
} else {
- if (rvi[i].flags & RVI_MULTIHEAD) // adjust power if needed
+ if (rvi[i].flags & RVI_MULTIHEAD) {
+ // adjust power and running cost if needed
rvi[i].power *= 2;
+ rvi[i].running_cost_base /= 2;
+ }
rvi[i].flags &= ~RVI_MULTIHEAD;
}
}