summaryrefslogtreecommitdiff
path: root/roadveh_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'roadveh_cmd.c')
-rw-r--r--roadveh_cmd.c45
1 files changed, 5 insertions, 40 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 17d93ea85..2450387ca 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -320,11 +320,6 @@ static Depot *FindClosestRoadDepot(Vehicle *v)
}
}
-/* Send a road vehicle to the nearest depot
- p1 = index of the road vehicle
- p2 = bit 0 = do not stop in depot
- bit 1 = set v->set_for_replacement
- bit 2 = clear v->set_for_replacement */
int32 CmdSendRoadVehToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
@@ -337,11 +332,6 @@ int32 CmdSendRoadVehToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (v->type != VEH_Road || !CheckOwnership(v->owner))
return CMD_ERROR;
- if (HASBIT(p2, 0)) v->set_for_replacement = true;
- if (HASBIT(p2, 2)) v->set_for_replacement = false;
-
- if (HASBIT(p2, 1) || HASBIT(p2, 2)) return CMD_ERROR; // vehicle has a depot in schedule. It just needed to alter set_for_replacement
-
if (v->current_order.type == OT_GOTO_DEPOT) {
if (flags & DC_EXEC) {
if (v->current_order.flags & OF_UNLOAD)
@@ -359,7 +349,7 @@ int32 CmdSendRoadVehToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = p2 == 0 ? OF_NON_STOP | OF_FULL_LOAD : 0;
+ v->current_order.flags = OF_NON_STOP | OF_FULL_LOAD;
v->current_order.station = depot->index;
v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@@ -615,7 +605,7 @@ static void ProcessRoadVehOrder(Vehicle *v)
if (v->current_order.type == OT_GOTO_DEPOT &&
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
- !VehicleNeedsService(v) && !v->set_for_replacement) {
+ !VehicleNeedsService(v)) {
v->cur_order_index++;
}
@@ -716,28 +706,6 @@ static void HandleRoadVehLoading(Vehicle *v)
v->cur_order_index++;
InvalidateVehicleOrder(v);
-
- if (v->current_order.type != OT_GOTO_DEPOT && v->owner == _local_player) {
- // only the vehicle owner needs to calculate the rest (locally)
- if ((_autoreplace_array[v->engine_type] != v->engine_type) ||
- (_patches.autorenew && v->age - v->max_age > (_patches.autorenew_months * 30))) {
- byte flags = 1;
- // the flags means, bit 0 = needs to go to depot, bit 1 = have depot in orders
- if (VehicleHasDepotOrders(v)) SETBIT(flags, 1);
- if (!(HASBIT(flags, 1) && v->set_for_replacement)) {
- _current_player = _local_player;
- DoCommandP(v->tile, v->index, flags, NULL, CMD_SEND_ROADVEH_TO_DEPOT | CMD_SHOW_NO_ERROR);
- _current_player = OWNER_NONE;
- }
- } else { // no need to go to a depot
- if (v->set_for_replacement) {
- // it seems that the user clicked "Stop replacing"
- _current_player = _local_player;
- DoCommandP(v->tile, v->index, 1 | (1 << 2), NULL, CMD_SEND_ROADVEH_TO_DEPOT | CMD_SHOW_NO_ERROR);
- _current_player = OWNER_NONE;
- }
- }
- }
}
static void StartRoadVehSound(Vehicle *v)
@@ -1600,10 +1568,10 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
{
Depot *depot;
- if (_patches.servint_roadveh == 0 && !v->set_for_replacement)
+ if (_patches.servint_roadveh == 0)
return;
- if (!VehicleNeedsService(v) && !v->set_for_replacement)
+ if (!VehicleNeedsService(v))
return;
if (v->vehstatus & VS_STOPPED)
@@ -1625,10 +1593,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
depot = FindClosestRoadDepot(v);
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
- if (v->current_order.type == OT_GOTO_DEPOT && !(
- DistanceManhattan(v->tile, v->dest_tile) > 25 && v->set_for_replacement)) {
- /* a vehicle needs a greater distance to a depot to loose it than to find it since
- they can circle forever othervise if they are in a loop with an unlucky distance */
+ if (v->current_order.type == OT_GOTO_DEPOT) {
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);