summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-06-09 07:45:26 +0000
committerpeter1138 <peter1138@openttd.org>2006-06-09 07:45:26 +0000
commite679cfe80282428d61edeaf450aca0ac4cb10d7a (patch)
treeeeeb3c2fefa332d53e3104f89a73d34092b83e62 /vehicle.c
parent19d14b474e13add081087f3f67c7caae73fb9645 (diff)
downloadopenttd-e679cfe80282428d61edeaf450aca0ac4cb10d7a.tar.xz
(svn r5191) - NewGRF: add cargo refit support for road vehicles
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/vehicle.c b/vehicle.c
index b7b521248..3b9a559de 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -59,7 +59,7 @@ static const uint32 _veh_sell_proc_table[] = {
static const uint32 _veh_refit_proc_table[] = {
CMD_REFIT_RAIL_VEHICLE,
- 0, // road vehicles can't be refitted
+ CMD_REFIT_ROAD_VEH,
CMD_REFIT_SHIP,
CMD_REFIT_AIRCRAFT,
};
@@ -1658,14 +1658,12 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags)
*w = new_v; //we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is
/* refit if needed */
- if (new_v->type != VEH_Road) { // road vehicles can't be refitted
- if (old_v->cargo_type != new_v->cargo_type && old_v->cargo_cap != 0 && new_v->cargo_cap != 0) {// some train engines do not have cargo capacity
- // we add the refit cost to cost, so it's added to the cost animation
- // it's not in the calculation of having enough money to actually do the replace since it's rather hard to do by design, but since
- // we pay for it, it's nice to make the cost animation include it
- int32 temp_cost = DoCommand(0, new_v->index, old_v->cargo_type, DC_EXEC, CMD_REFIT_VEH(new_v->type));
- if (!CmdFailed(temp_cost)) cost += temp_cost;
- }
+ if (old_v->cargo_type != new_v->cargo_type && old_v->cargo_cap != 0 && new_v->cargo_cap != 0) {// some train engines do not have cargo capacity
+ // we add the refit cost to cost, so it's added to the cost animation
+ // it's not in the calculation of having enough money to actually do the replace since it's rather hard to do by design, but since
+ // we pay for it, it's nice to make the cost animation include it
+ int32 temp_cost = DoCommand(0, new_v->index, old_v->cargo_type, DC_EXEC, CMD_REFIT_VEH(new_v->type));
+ if (!CmdFailed(temp_cost)) cost += temp_cost;
}
if (new_v->type == VEH_Train && HASBIT(old_v->u.rail.flags, VRF_REVERSE_DIRECTION) && !IsMultiheaded(new_v) && !(new_v->next != NULL && IsArticulatedPart(new_v->next))) {
// we are autorenewing to a single engine, so we will turn it as the old one was turned as well