src/autoreplace_cmd.cpp
branchgamebalance
changeset 9913 e79cd19772dd
parent 9912 1ac8aac92385
--- a/src/autoreplace_cmd.cpp	Wed Jun 13 12:05:56 2007 +0000
+++ b/src/autoreplace_cmd.cpp	Tue Jun 19 07:21:01 2007 +0000
@@ -124,10 +124,10 @@
  * @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 int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
+static CommandCost ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
 {
-	int32 cost;
-	int32 sell_value;
+	CommandCost cost;
+	CommandCost sell_value;
 	Vehicle *old_v = *w;
 	const Player *p = GetPlayer(old_v->owner);
 	EngineID new_engine_type;
@@ -173,7 +173,7 @@
 
 	if (replacement_cargo_type != CT_NO_REFIT) {
 		/* add refit cost */
-		int32 refit_cost = GetRefitCost(new_engine_type);
+		CommandCost refit_cost = GetRefitCost(new_engine_type);
 		if (old_v->type == VEH_TRAIN && IsMultiheaded(old_v)) refit_cost += refit_cost; // pay for both ends
 		cost += refit_cost;
 	}
@@ -246,7 +246,7 @@
 			GetName(vehicle_name, old_v->string_id & 0x7FF, lastof(vehicle_name));
 		}
 	} else { // flags & DC_EXEC not set
-		int32 tmp_move = 0;
+		CommandCost tmp_move = 0;
 		if (old_v->type == VEH_TRAIN && IsFrontEngine(old_v) && old_v->next != 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. */
@@ -295,12 +295,12 @@
  * @param display_costs If set, a cost animation is shown (only if check is false)
  * @return CMD_ERROR if something went wrong. Otherwise the price of the replace
  */
-int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
+CommandCost MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
 {
 	Vehicle *w;
 	const Player *p = GetPlayer(v->owner);
 	byte flags = 0;
-	int32 cost, temp_cost = 0;
+	CommandCost cost, temp_cost = 0;
 	bool stopped;
 
 	/* Remember the length in case we need to trim train later on