summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-05-13 20:39:57 +0000
committerpeter1138 <peter1138@openttd.org>2008-05-13 20:39:57 +0000
commiteb112946a707a0457cecd4cc0b5e2a8c8c5cc33e (patch)
treeeeff2b9982348b174c4e5e2216cb0de7bb5d2b42 /src/newgrf.cpp
parent153acec334a3ad4eacc76699f16c30feb7558132 (diff)
downloadopenttd-eb112946a707a0457cecd4cc0b5e2a8c8c5cc33e.tar.xz
(svn r13074) -Fix: For multiheaded engines, halve power and running cost when used instead of when loading, to allow callback values to work properly.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp32
1 files changed, 7 insertions, 25 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 4567e7ae3..903c33078 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -466,22 +466,14 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
rvi->max_speed = speed;
} break;
- case 0x0B: { // Power
- uint16 power = grf_load_word(&buf);
-
- if (rvi->railveh_type == RAILVEH_MULTIHEAD) power /= 2;
-
- rvi->power = power;
- dewagonize(power, e);
- } break;
-
- case 0x0D: { // Running cost factor
- uint8 runcostfact = grf_load_byte(&buf);
-
- if (rvi->railveh_type == RAILVEH_MULTIHEAD) runcostfact /= 2;
+ case 0x0B: // Power
+ rvi->power = grf_load_word(&buf);
+ dewagonize(rvi->power, e);
+ break;
- rvi->running_cost = runcostfact;
- } break;
+ case 0x0D: // Running cost factor
+ rvi->running_cost = grf_load_byte(&buf);
+ break;
case 0x0E: { // Running cost base
uint32 base = grf_load_dword(&buf);
@@ -513,18 +505,8 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
uint8 dual = grf_load_byte(&buf);
if (dual != 0) {
- if (rvi->railveh_type != RAILVEH_MULTIHEAD) {
- // adjust power and running cost if needed
- rvi->power /= 2;
- rvi->running_cost /= 2;
- }
rvi->railveh_type = RAILVEH_MULTIHEAD;
} else {
- if (rvi->railveh_type == RAILVEH_MULTIHEAD) {
- // adjust power and running cost if needed
- rvi->power *= 2;
- rvi->running_cost *= 2;
- }
rvi->railveh_type = rvi->power == 0 ?
RAILVEH_WAGON : RAILVEH_SINGLEHEAD;
}