mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-07-05 03:49:37 +01:00
(svn r23127) -Fix [FS#4819] (r23086): Don't crash when refitting default vehicles.
This commit is contained in:
parent
09c10af480
commit
a58b975fd0
@ -212,6 +212,9 @@ static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID ne
|
|||||||
{
|
{
|
||||||
/* Prepare callback param with info about the new cargo type. */
|
/* Prepare callback param with info about the new cargo type. */
|
||||||
const Engine *e = Engine::Get(engine_type);
|
const Engine *e = Engine::Get(engine_type);
|
||||||
|
|
||||||
|
/* Is this vehicle a NewGRF vehicle? */
|
||||||
|
if (e->GetGRF() != NULL) {
|
||||||
const CargoSpec *cs = CargoSpec::Get(new_cid);
|
const CargoSpec *cs = CargoSpec::Get(new_cid);
|
||||||
uint32 param1 = (cs->classes << 16) | (new_subtype << 8) | e->GetGRF()->cargo_map[new_cid];
|
uint32 param1 = (cs->classes << 16) | (new_subtype << 8) | e->GetGRF()->cargo_map[new_cid];
|
||||||
|
|
||||||
@ -222,6 +225,7 @@ static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID ne
|
|||||||
if (factor >= 0x2000) factor -= 0x4000; // Treat as signed integer.
|
if (factor >= 0x2000) factor -= 0x4000; // Treat as signed integer.
|
||||||
return factor;
|
return factor;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*auto_refit_allowed = e->info.refit_cost == 0;
|
*auto_refit_allowed = e->info.refit_cost == 0;
|
||||||
return e->info.refit_cost;
|
return e->info.refit_cost;
|
||||||
|
Loading…
Reference in New Issue
Block a user