mirror of https://github.com/OpenTTD/OpenTTD
(svn r23518) -Fix (r23124): [NewGRF] The refit cost callback wasn't called if only the subtype differed.
parent
66d1848f5e
commit
caebb5ac63
|
@ -228,7 +228,7 @@ static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID ne
|
||||||
}
|
}
|
||||||
|
|
||||||
*auto_refit_allowed = e->info.refit_cost == 0;
|
*auto_refit_allowed = e->info.refit_cost == 0;
|
||||||
return e->info.refit_cost;
|
return (v->cargo_type != new_cid) ? e->info.refit_cost : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -335,7 +335,6 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
|
||||||
v->cargo_type = temp_cid;
|
v->cargo_type = temp_cid;
|
||||||
v->cargo_subtype = temp_subtype;
|
v->cargo_subtype = temp_subtype;
|
||||||
|
|
||||||
if (new_cid != v->cargo_type) {
|
|
||||||
bool auto_refit_allowed;
|
bool auto_refit_allowed;
|
||||||
CommandCost refit_cost = GetRefitCost(v, v->engine_type, new_cid, new_subtype, &auto_refit_allowed);
|
CommandCost refit_cost = GetRefitCost(v, v->engine_type, new_cid, new_subtype, &auto_refit_allowed);
|
||||||
if (auto_refit && !auto_refit_allowed) {
|
if (auto_refit && !auto_refit_allowed) {
|
||||||
|
@ -345,7 +344,6 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cost.AddCost(refit_cost);
|
cost.AddCost(refit_cost);
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
v->cargo.Truncate((v->cargo_type == new_cid) ? amount : 0);
|
v->cargo.Truncate((v->cargo_type == new_cid) ? amount : 0);
|
||||||
|
|
Loading…
Reference in New Issue