ship_cmd.c
changeset 1520 c85dc79795e0
parent 1443 d9c101f7634b
child 1530 caa16c506a22
--- a/ship_cmd.c	Sat Mar 19 12:24:51 2005 +0000
+++ b/ship_cmd.c	Sat Mar 19 21:16:22 2005 +0000
@@ -98,10 +98,10 @@
 {
 	Depot *depot;
 
-	if (_patches.servint_ships == 0 && !v->set_for_replacement)
+	if (_patches.servint_ships == 0)
 		return;
 
-	if (!VehicleNeedsService(v) && !v->set_for_replacement)
+	if (!VehicleNeedsService(v))
 		return;
 
 	if (v->vehstatus & VS_STOPPED)
@@ -226,7 +226,7 @@
 
 	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++;
 	}
 
@@ -297,28 +297,6 @@
 			Order b = v->current_order;
 			v->current_order.type = OT_LEAVESTATION;
 			v->current_order.flags = 0;
-
-			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_SHIP_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_SHIP_TO_DEPOT | CMD_SHOW_NO_ERROR);
-						_current_player = OWNER_NONE;
-					}
-				}
-			}
 			if (!(b.flags & OF_NON_STOP))
 				return;
 		}
@@ -1001,11 +979,6 @@
 	return 0;
 }
 
-/*  Send a ship to the nearest depot
-	p1 = index of the ship
-	p2 = bit 0 = do not stop in depot
-		 bit 1 = set v->set_for_replacement
-		 bit 2 = clear v->set_for_replacement */
 int32 CmdSendShipToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 {
 	Vehicle *v;
@@ -1018,11 +991,6 @@
 	if (v->type != VEH_Ship || !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) v->cur_order_index++;
@@ -1038,7 +1006,7 @@
 		if (flags & DC_EXEC) {
 			v->dest_tile = depot->xy;
 			v->current_order.type = OT_GOTO_DEPOT;
-			v->current_order.flags = HASBIT(p2, 0) ? 0 : OF_NON_STOP | OF_FULL_LOAD;
+			v->current_order.flags = OF_NON_STOP | OF_FULL_LOAD;
 			v->current_order.station = depot->index;
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 		}