summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aircraft_cmd.c2
-rw-r--r--roadveh_cmd.c2
-rw-r--r--ship_cmd.c2
-rw-r--r--table/engines.h4
-rw-r--r--train_cmd.c7
5 files changed, 11 insertions, 6 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 913fda5bd..3136865e5 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -594,7 +594,7 @@ int32 CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
cost = 0;
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
- cost = _price.aircraft_base >> 7;
+ cost = (EngInfo(v->engine_type)->refit_cost * _price.aircraft_base) >> 10;
}
if (flags & DC_EXEC) {
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index f701937c4..875ef6241 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -1798,7 +1798,7 @@ int32 CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
cost = 0;
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
- cost = _price.roadveh_base >> 7;
+ cost = (EngInfo(v->engine_type)->refit_cost * _price.roadveh_base) >> 10;
}
if (flags & DC_EXEC) {
diff --git a/ship_cmd.c b/ship_cmd.c
index 009d243fa..a47882f11 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -1081,7 +1081,7 @@ int32 CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
cost = 0;
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
- cost = _price.ship_base >> 7;
+ cost = (EngInfo(v->engine_type)->refit_cost * _price.ship_base) >> 10;
}
if (flags & DC_EXEC) {
diff --git a/table/engines.h b/table/engines.h
index c59ce94cf..9365c7f8c 100644
--- a/table/engines.h
+++ b/table/engines.h
@@ -15,7 +15,7 @@
* @param e Rail Type of the vehicle
* @param f Bitmask of the climates
*/
-#define MK(a, b, c, d, e, f) { a, b, c, d, e, f, 0, 0, 0, 0 }
+#define MK(a, b, c, d, e, f) { a, b, c, d, e, f, 0, 8, 0, 0 }
/** Writes the properties of a train carriage into the EngineInfo struct.
* @see EngineInfo
* @param a Introduction date
@@ -23,7 +23,7 @@
* @param f Bitmask of the climates
* @note the 0x80 in parameter b sets the "is carriage bit"
*/
-#define MW(a, b, c, d, e, f) { a, b | 0x80, c, d, e, f, 0, 0, 0, 0 }
+#define MW(a, b, c, d, e, f) { a, b | 0x80, c, d, e, f, 0, 8, 0, 0 }
// Rail types
// R = Conventional railway
diff --git a/train_cmd.c b/train_cmd.c
index 9fd87146c..1bcc1bffa 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1794,7 +1794,12 @@ int32 CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
};
if (amount != 0) {
- if (new_cid != v->cargo_type) cost += _price.build_railvehicle >> 8;
+ if (new_cid != v->cargo_type) {
+ int32 base_cost = (rvi->flags & RVI_WAGON) ?
+ _price.build_railwagon : _price.build_railvehicle;
+ cost += (EngInfo(v->engine_type)->refit_cost * base_cost) >> 9;
+ }
+
num += amount;
if (flags & DC_EXEC) {
v->cargo_count = (v->cargo_type == new_cid) ? min(amount, v->cargo_count) : 0;