Changeset - r19097:ec2b0cea1565
[Not reviewed]
master
0 3 0
frosch - 13 years ago 2012-02-19 18:34:24
frosch@openttd.org
(svn r23965) -Fix [FS#5070]: Refittability should never depend on the current capacity of a vehicle.
3 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/articulated_vehicles.cpp
Show inline comments
 
@@ -109,13 +109,13 @@ static inline uint16 GetVehicleDefaultCa
 
 */
 
static inline uint32 GetAvailableVehicleCargoTypes(EngineID engine, bool include_initial_cargo_type)
 
{
 
	uint32 cargoes = 0;
 
	CargoID initial_cargo_type;
 
	const Engine *e = Engine::Get(engine);
 
	if (!e->CanCarryCargo()) return 0;
 

	
 
	if (GetVehicleDefaultCapacity(engine, &initial_cargo_type) > 0) {
 
		const EngineInfo *ei = EngInfo(engine);
 
		cargoes = ei->refit_mask;
 
		if (include_initial_cargo_type && initial_cargo_type < NUM_CARGO) SetBit(cargoes, initial_cargo_type);
 
	uint32 cargoes = e->info.refit_mask;
 

	
 
	if (include_initial_cargo_type) {
 
		SetBit(cargoes, e->GetDefaultCargoType());
 
	}
 

	
 
	return cargoes;
 
@@ -240,7 +240,7 @@ bool IsArticulatedVehicleCarryingDiffere
 
	CargoID first_cargo = CT_INVALID;
 

	
 
	do {
 
		if (v->cargo_cap > 0 && v->cargo_type != CT_INVALID) {
 
		if (v->cargo_type != CT_INVALID && v->GetEngine()->CanCarryCargo()) {
 
			if (first_cargo == CT_INVALID) first_cargo = v->cargo_type;
 
			if (first_cargo != v->cargo_type) {
 
				if (cargo_type != NULL) *cargo_type = CT_INVALID;
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -206,7 +206,7 @@ static CargoID GetNewCargoTypeForReplace
 
		 * now we will figure out what cargo the train is carrying and refit to fit this */
 

	
 
		for (v = v->First(); v != NULL; v = v->Next()) {
 
			if (v->cargo_cap == 0) continue;
 
			if (!v->GetEngine()->CanCarryCargo()) continue;
 
			/* Now we found a cargo type being carried on the train and we will see if it is possible to carry to this one */
 
			if (HasBit(available_cargo_types, v->cargo_type)) return v->cargo_type;
 
		}
src/newgrf_engine.cpp
Show inline comments
 
@@ -498,7 +498,7 @@ static uint32 VehicleGetVariable(Vehicle
 
					if (v->type == VEH_TRAIN) user_def_data |= Train::From(u)->tcache.user_def_data;
 

	
 
					/* Skip empty engines */
 
					if (u->cargo_cap == 0) continue;
 
					if (!u->GetEngine()->CanCarryCargo()) continue;
 

	
 
					cargo_classes |= CargoSpec::Get(u->cargo_type)->classes;
 
					common_cargoes[u->cargo_type]++;
 
@@ -516,7 +516,7 @@ static uint32 VehicleGetVariable(Vehicle
 
				/* Count subcargo types of common_cargo_type */
 
				for (u = v; u != NULL; u = u->Next()) {
 
					/* Skip empty engines and engines not carrying common_cargo_type */
 
					if (u->cargo_cap == 0 || u->cargo_type != common_cargo_type) continue;
 
					if (u->cargo_type != common_cargo_type || !u->GetEngine()->CanCarryCargo()) continue;
 

	
 
					common_subtypes[u->cargo_subtype]++;
 
				}
0 comments (0 inline, 0 general)