equal
deleted
inserted
replaced
19 #include "command_func.h" |
19 #include "command_func.h" |
20 #include "vehicle_func.h" |
20 #include "vehicle_func.h" |
21 #include "functions.h" |
21 #include "functions.h" |
22 #include "variables.h" |
22 #include "variables.h" |
23 #include "autoreplace_func.h" |
23 #include "autoreplace_func.h" |
|
24 #include "articulated_vehicles.h" |
24 |
25 |
25 #include "table/strings.h" |
26 #include "table/strings.h" |
26 |
27 |
27 /* |
28 /* |
28 * move the cargo from one engine to another if possible |
29 * move the cargo from one engine to another if possible |
173 } |
174 } |
174 |
175 |
175 if (replacement_cargo_type != CT_NO_REFIT) { |
176 if (replacement_cargo_type != CT_NO_REFIT) { |
176 /* add refit cost */ |
177 /* add refit cost */ |
177 CommandCost refit_cost = GetRefitCost(new_engine_type); |
178 CommandCost refit_cost = GetRefitCost(new_engine_type); |
178 if (old_v->type == VEH_TRAIN && IsMultiheaded(old_v)) refit_cost.AddCost(refit_cost); // pay for both ends |
179 if (old_v->type == VEH_TRAIN && RailVehInfo(new_engine_type)->railveh_type == RAILVEH_MULTIHEAD) { |
|
180 /* Since it's a dualheaded engine we have to pay once more because the rear end is being refitted too. */ |
|
181 refit_cost.AddCost(refit_cost); |
|
182 } |
179 cost.AddCost(refit_cost); |
183 cost.AddCost(refit_cost); |
180 } |
184 } |
181 |
185 |
182 if (flags & DC_EXEC) { |
186 if (flags & DC_EXEC) { |
183 new_v = GetVehicle(_new_vehicle_id); |
187 new_v = GetVehicle(_new_vehicle_id); |