src/autoreplace_cmd.cpp
branch0.6
changeset 11150 4e3726a46a72
parent 9176 676d04b1e38a
--- a/src/autoreplace_cmd.cpp	Wed Jul 09 19:39:57 2008 +0000
+++ b/src/autoreplace_cmd.cpp	Wed Jul 16 10:07:38 2008 +0000
@@ -127,7 +127,7 @@
  * @param flags is the flags to use when calling DoCommand(). Mainly DC_EXEC counts
  * @return value is cost of the replacement or CMD_ERROR
  */
-static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost)
+static CommandCost ReplaceVehicle(Vehicle **w, uint32 flags, Money total_cost)
 {
 	CommandCost cost;
 	CommandCost sell_value;
@@ -157,7 +157,7 @@
 	 * We take it back if building fails or when we really sell the old engine */
 	SubtractMoneyFromPlayer(sell_value);
 
-	cost = DoCommand(old_v->tile, new_engine_type, 3, flags, GetCmdBuildVeh(old_v));
+	cost = DoCommand(old_v->tile, new_engine_type, 0, flags | DC_AUTOREPLACE, GetCmdBuildVeh(old_v));
 	if (CmdFailed(cost)) {
 		/* Take back the money we just gave the player */
 		sell_value.MultiplyCost(-1);
@@ -246,7 +246,7 @@
 			if (next_veh != NULL) {
 				/* Verify that the wagons can be placed on the engine in question.
 				 * This is done by building an engine, test if the wagons can be added and then sell the test engine. */
-				DoCommand(old_v->tile, new_engine_type, 3, DC_EXEC, GetCmdBuildVeh(old_v));
+				DoCommand(old_v->tile, new_engine_type, 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_v));
 				Vehicle *temp = GetVehicle(_new_vehicle_id);
 				tmp_move = DoCommand(0, (temp->index << 16) | next_veh->index, 1, 0, CMD_MOVE_RAIL_VEHICLE);
 				DoCommand(0, temp->index, 0, DC_EXEC, GetCmdSellVeh(old_v));