src/autoreplace_cmd.cpp
changeset 6746 ec46969766e3
parent 6735 dd792fed65e2
child 6747 5c696ce73fb3
equal deleted inserted replaced
6745:238ec04a86d4 6746:ec46969766e3
   169 		SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
   169 		SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
   170 		SubtractMoneyFromPlayer(-sell_value); // Take back the money we just gave the player
   170 		SubtractMoneyFromPlayer(-sell_value); // Take back the money we just gave the player
   171 		return cost;
   171 		return cost;
   172 	}
   172 	}
   173 
   173 
   174 	if (replacement_cargo_type != CT_NO_REFIT) cost += GetRefitCost(new_engine_type); // add refit cost
   174 	if (replacement_cargo_type != CT_NO_REFIT) {
       
   175 		/* add refit cost */
       
   176 		int32 refit_cost = GetRefitCost(new_engine_type);
       
   177 		if (old_v->type == VEH_TRAIN && IsMultiheaded(old_v)) refit_cost += refit_cost; // pay for both ends
       
   178 		cost += refit_cost;
       
   179 	}
   175 
   180 
   176 	if (flags & DC_EXEC) {
   181 	if (flags & DC_EXEC) {
   177 		new_v = GetVehicle(_new_vehicle_id);
   182 		new_v = GetVehicle(_new_vehicle_id);
   178 		*w = new_v; //we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is
   183 		*w = new_v; //we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is
   179 
   184