|
@@ -447,13 +447,14 @@ static uint GetOrderDistance(const Order
|
|
|
TileIndex prev_tile = prev->GetLocation(v);
|
|
|
TileIndex cur_tile = cur->GetLocation(v);
|
|
|
if (prev_tile == INVALID_TILE || cur_tile == INVALID_TILE) return 0;
|
|
|
return DistanceManhattan(prev_tile, cur_tile);
|
|
|
}
|
|
|
|
|
|
/** Add an order to the orderlist of a vehicle.
|
|
|
/**
|
|
|
* Add an order to the orderlist of a vehicle.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 various bitstuffed elements
|
|
|
* - p1 = (bit 0 - 15) - ID of the vehicle
|
|
|
* - p1 = (bit 16 - 31) - the selected order (if any). If the last order is given,
|
|
|
* the order will be inserted before that one
|
|
@@ -715,13 +716,14 @@ CommandCost CmdInsertOrder(TileIndex til
|
|
|
InvalidateWindowClassesData(GetWindowClassForVehicleType(v->type), 0);
|
|
|
}
|
|
|
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** Declone an order-list
|
|
|
/**
|
|
|
* Declone an order-list
|
|
|
* @param *dst delete the orders of this vehicle
|
|
|
* @param flags execution flags
|
|
|
*/
|
|
|
static CommandCost DecloneOrder(Vehicle *dst, DoCommandFlag flags)
|
|
|
{
|
|
|
if (flags & DC_EXEC) {
|
|
@@ -729,13 +731,14 @@ static CommandCost DecloneOrder(Vehicle
|
|
|
InvalidateVehicleOrder(dst, -1);
|
|
|
InvalidateWindowClassesData(GetWindowClassForVehicleType(dst->type), 0);
|
|
|
}
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** Delete an order from the orderlist of a vehicle.
|
|
|
/**
|
|
|
* Delete an order from the orderlist of a vehicle.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 the ID of the vehicle
|
|
|
* @param p2 the order to delete (max 255)
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
@@ -797,13 +800,14 @@ CommandCost CmdDeleteOrder(TileIndex til
|
|
|
InvalidateWindowClassesData(GetWindowClassForVehicleType(v->type), 0);
|
|
|
}
|
|
|
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** Goto order of order-list.
|
|
|
/**
|
|
|
* Goto order of order-list.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 The ID of the vehicle which order is skipped
|
|
|
* @param p2 the selected order to which we want to skip
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
@@ -911,13 +915,14 @@ CommandCost CmdMoveOrder(TileIndex tile,
|
|
|
InvalidateWindowClassesData(GetWindowClassForVehicleType(v->type), 0);
|
|
|
}
|
|
|
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** Modify an order in the orderlist of a vehicle.
|
|
|
/**
|
|
|
* Modify an order in the orderlist of a vehicle.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 various bitstuffed elements
|
|
|
* - p1 = (bit 0 - 15) - ID of the vehicle
|
|
|
* - p1 = (bit 16 - 31) - the selected order (if any). If the last order is given,
|
|
|
* the order will be inserted before that one
|
|
@@ -1147,13 +1152,14 @@ CommandCost CmdModifyOrder(TileIndex til
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** Clone/share/copy an order-list of another vehicle.
|
|
|
/**
|
|
|
* Clone/share/copy an order-list of another vehicle.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 various bitstuffed elements
|
|
|
* - p1 = (bit 0-15) - destination vehicle to clone orders to (p1 & 0xFFFF)
|
|
|
* - p1 = (bit 16-31) - source vehicle to clone orders from, if any (none for CO_UNSHARE)
|
|
|
* @param p2 mode of cloning: CO_SHARE, CO_COPY, or CO_UNSHARE
|
|
@@ -1275,13 +1281,14 @@ CommandCost CmdCloneOrder(TileIndex tile
|
|
|
default: return CMD_ERROR;
|
|
|
}
|
|
|
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** Add/remove refit orders from an order
|
|
|
/**
|
|
|
* Add/remove refit orders from an order
|
|
|
* @param tile Not used
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 VehicleIndex of the vehicle having the order
|
|
|
* @param p2 bitmask
|
|
|
* - bit 0-7 CargoID
|
|
|
* - bit 8-15 Cargo subtype
|
|
@@ -1428,13 +1435,14 @@ void RestoreVehicleOrders(const Vehicle
|
|
|
DoCommandP(0, v->index, bak->orderindex | (bak->service_interval << 16), CMD_RESTORE_ORDER_INDEX);
|
|
|
|
|
|
/* Restore vehicle group */
|
|
|
DoCommandP(0, bak->group, v->index, CMD_ADD_VEHICLE_GROUP);
|
|
|
}
|
|
|
|
|
|
/** Restore the current order-index of a vehicle and sets service-interval.
|
|
|
/**
|
|
|
* Restore the current order-index of a vehicle and sets service-interval.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 the ID of the vehicle
|
|
|
* @param p2 various bistuffed elements
|
|
|
* - p2 = (bit 0-15) - current order-index (p2 & 0xFFFF)
|
|
|
* - p2 = (bit 16-31) - service interval (p2 >> 16)
|