src/autoreplace_cmd.cpp
changeset 10015 2b721243365f
parent 9969 42def43d1267
child 10122 c524226103f1
equal deleted inserted replaced
10014:13c9ede0ae49 10015:2b721243365f
   179 
   179 
   180 		return CT_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
   180 		return CT_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
   181 	} else {
   181 	} else {
   182 		if (!HasBit(available_cargo_types, cargo_type)) return CT_INVALID; // We can't refit the vehicle to carry the cargo we want
   182 		if (!HasBit(available_cargo_types, cargo_type)) return CT_INVALID; // We can't refit the vehicle to carry the cargo we want
   183 
   183 
   184 		if (!VerifyAutoreplaceRefitForOrders(v, engine_type)) return CT_INVALID; // Some refit orders loose their effect
   184 		if (!VerifyAutoreplaceRefitForOrders(v, engine_type)) return CT_INVALID; // Some refit orders lose their effect
   185 
   185 
   186 		/* Do we have to refit the vehicle, or is it already carrying the right cargo? */
   186 		/* Do we have to refit the vehicle, or is it already carrying the right cargo? */
   187 		uint16 *default_capacity = GetCapacityOfArticulatedParts(engine_type, v->type);
   187 		uint16 *default_capacity = GetCapacityOfArticulatedParts(engine_type, v->type);
   188 		for (CargoID cid = 0; cid < NUM_CARGO; cid++) {
   188 		for (CargoID cid = 0; cid < NUM_CARGO; cid++) {
   189 			if (cid != cargo_type && default_capacity[cid] > 0) return cargo_type;
   189 			if (cid != cargo_type && default_capacity[cid] > 0) return cargo_type;