diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/build_vehicle_gui.cpp | 8 | ||||
-rw-r--r-- | src/newgrf.cpp | 32 | ||||
-rw-r--r-- | src/table/engines.h | 16 | ||||
-rw-r--r-- | src/train_cmd.cpp | 6 |
4 files changed, 25 insertions, 37 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index df75315a4..1908039a3 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -154,8 +154,8 @@ static int CDECL TrainEnginePowerSorter(const void *a, const void *b) const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a); const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b); - int va = rvi_a->power << (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 1 : 0); - int vb = rvi_b->power << (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 1 : 0); + int va = rvi_a->power; + int vb = rvi_b->power; int r = va - vb; return _internal_sort_order ? -r : r; @@ -538,7 +538,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons /* Max speed - Engine power */ SetDParam(0, GetEngineProperty(engine_number, 0x09, rvi->max_speed) * 10 / 16); - SetDParam(1, GetEngineProperty(engine_number, 0x0B, rvi->power) << multihead); + SetDParam(1, GetEngineProperty(engine_number, 0x0B, rvi->power)); DrawString(x, y, STR_PURCHASE_INFO_SPEED_POWER, TC_FROMSTRING); y += 10; @@ -551,7 +551,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons /* Running cost */ if (rvi->running_cost_class != 0xFF) { - SetDParam(0, (GetEngineProperty(engine_number, 0x0D, rvi->running_cost) * GetPriceByIndex(rvi->running_cost_class) >> 8) << multihead); + SetDParam(0, GetEngineProperty(engine_number, 0x0D, rvi->running_cost) * GetPriceByIndex(rvi->running_cost_class) >> 8); DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, TC_FROMSTRING); y += 10; } 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; } diff --git a/src/table/engines.h b/src/table/engines.h index caaaae008..3ca03afba 100644 --- a/src/table/engines.h +++ b/src/table/engines.h @@ -387,8 +387,8 @@ static const RailVehicleInfo _orig_rail_vehicle_info[] = { RVI( 0, G, 13, 112, 1000, 131, 120, RC_S, 0, 0 , 20, R, S), // 8 RVI( 1, G, 19, 128, 1200, 162, 140, RC_S, 0, 0 , 21, R, S), // 9 RVI( 0, G, 22, 144, 1600, 170, 130, RC_S, 0, 0 , 22, R, S), // 10 - RVI( 8, M, 11, 112, 600/2, 32, 85/2, RC_D, 38, CT_PASSENGERS , 10, R, D), // 11 - RVI(10, M, 14, 120, 700/2, 38, 70/2, RC_D, 40, CT_PASSENGERS , 11, R, D), // 12 + RVI( 8, M, 11, 112, 600, 32, 85, RC_D, 38, CT_PASSENGERS , 10, R, D), // 11 + RVI(10, M, 14, 120, 700, 38, 70, RC_D, 40, CT_PASSENGERS , 11, R, D), // 12 RVI( 4, G, 15, 128, 1250, 72, 95, RC_D, 0, 0 , 30, R, D), // 13 RVI( 5, G, 17, 144, 1750, 101, 120, RC_D, 0, 0 , 31, R, D), // 14 RVI( 4, G, 18, 160, 2580, 112, 140, RC_D, 0, 0 , 32, R, D), // 15 @@ -396,13 +396,13 @@ static const RailVehicleInfo _orig_rail_vehicle_info[] = { RVI(12, G, 16, 112, 2400, 120, 105, RC_D, 0, 0 , 34, R, D), // 17 RVI(13, G, 30, 112, 6600, 207, 155, RC_D, 0, 0 , 35, R, D), // 18 RVI(15, G, 18, 104, 1500, 110, 105, RC_D, 0, 0 , 29, R, D), // 19 - RVI(16, M, 35, 160, 3500/2, 95, 205/2, RC_D, 0, 0 , 45, R, D), // 20 + RVI(16, M, 35, 160, 3500, 95, 205, RC_D, 0, 0 , 45, R, D), // 20 RVI(18, G, 21, 104, 2200, 120, 145, RC_D, 0, 0 , 32, R, D), // 21 - RVI( 6, M, 20, 200, 4500/2, 70, 190/2, RC_D, 4, CT_MAIL , 50, R, D), // 22 + RVI( 6, M, 20, 200, 4500, 70, 190, RC_D, 4, CT_MAIL , 50, R, D), // 22 RVI(20, G, 26, 160, 3600, 84, 180, RC_E, 0, 0 , 40, C, E), // 23 RVI(20, G, 30, 176, 5000, 82, 205, RC_E, 0, 0 , 41, C, E), // 24 - RVI(21, M, 40, 240, 7000/2, 90, 240/2, RC_E, 0, 0 , 51, C, E), // 25 - RVI(23, M, 43, 264, 8000/2, 95, 250/2, RC_E, 0, 0 , 52, C, E), // 26 + RVI(21, M, 40, 240, 7000, 90, 240, RC_E, 0, 0 , 51, C, E), // 25 + RVI(23, M, 43, 264, 8000, 95, 250, RC_E, 0, 0 , 52, C, E), // 26 RVI(33, W, 247, 0, 0, 25, 0, RC_W, 40, CT_PASSENGERS , 0, R, A), // 27 RVI(35, W, 228, 0, 0, 21, 0, RC_W, 30, CT_MAIL , 0, R, A), // 28 RVI(34, W, 176, 0, 0, 18, 0, RC_W, 30, CT_COAL , 0, R, A), // 29 @@ -431,7 +431,7 @@ static const RailVehicleInfo _orig_rail_vehicle_info[] = { RVI(58, W, 193, 0, 0, 18, 0, RC_W, 25, CT_FIZZY_DRINKS, 0, R, A), // 52 RVI(59, W, 191, 0, 0, 18, 0, RC_W, 30, CT_PLASTIC , 0, R, A), // 53 RVI(25, G, 52, 304, 9000, 95, 230, RC_E, 0, 0 , 60, O, N), // 54 - RVI(26, M, 60, 336, 10000/2, 85, 240/2, RC_E, 25, CT_PASSENGERS , 62, O, N), // 55 + RVI(26, M, 60, 336, 10000, 85, 240, RC_E, 25, CT_PASSENGERS , 62, O, N), // 55 RVI(26, G, 53, 320, 5000, 95, 230, RC_E, 0, 0 , 63, O, N), // 56 RVI(60, W, 247, 0, 0, 25, 0, RC_W, 45, CT_PASSENGERS , 0, O, A), // 57 RVI(62, W, 228, 0, 0, 21, 0, RC_W, 35, CT_MAIL , 0, O, A), // 58 @@ -463,7 +463,7 @@ static const RailVehicleInfo _orig_rail_vehicle_info[] = { RVI(28, G, 70, 400, 10000, 105, 250, RC_E, 0, 0 , 70, L, V), // 84 RVI(29, G, 74, 448, 12000, 120, 253, RC_E, 0, 0 , 71, L, V), // 85 RVI(30, G, 82, 480, 15000, 130, 254, RC_E, 0, 0 , 72, L, V), // 86 - RVI(31, M, 95, 640, 20000/2, 150, 255/2, RC_E, 0, 0 , 73, L, V), // 87 + RVI(31, M, 95, 640, 20000, 150, 255, RC_E, 0, 0 , 73, L, V), // 87 RVI(28, G, 70, 480, 10000, 120, 250, RC_E, 0, 0 , 74, L, V), // 88 RVI(60, W, 247, 0, 0, 25, 0, RC_W, 47, CT_PASSENGERS , 0, L, A), // 89 RVI(62, W, 228, 0, 0, 21, 0, RC_W, 37, CT_MAIL , 0, L, A), // 90 diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 0ac6f657c..4f7fef012 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -118,6 +118,9 @@ void TrainPowerChanged(Vehicle *v) if (engine_has_power) { uint16 power = GetVehicleProperty(u, 0x0B, rvi_u->power); if (power != 0) { + /* Halve power for multiheaded parts */ + if (IsMultiheaded(u)) power /= 2; + total_power += power; /* Tractive effort in (tonnes * 1000 * 10 =) N */ max_te += (u->u.rail.cached_veh_weight * 10000 * GetVehicleProperty(u, 0x1F, rvi_u->tractive_effort)) / 256; @@ -3499,6 +3502,9 @@ Money Train::GetRunningCost() const byte cost_factor = GetVehicleProperty(v, 0x0D, rvi->running_cost); if (cost_factor == 0) continue; + /* Halve running cost for multiheaded parts */ + if (IsMultiheaded(v)) cost_factor /= 2; + cost += cost_factor * GetPriceByIndex(rvi->running_cost_class); } while ((v = GetNextVehicle(v)) != NULL); |