|
@@ -47,7 +47,7 @@ bool CheckAutoreplaceValidity(EngineID f
|
|
|
/* we can't replace an engine into itself (that would be autorenew) */
|
|
|
if (from == to) return false;
|
|
|
|
|
|
VehicleType type = GetEngine(from)->type;
|
|
|
VehicleType type = Engine::Get(from)->type;
|
|
|
|
|
|
/* check that the new vehicle type is available to the company and its type is the same as the original one */
|
|
|
if (!IsEngineBuildable(to, type, company)) return false;
|
|
@@ -247,7 +247,7 @@ static CommandCost BuildReplacementVehic
|
|
|
*new_vehicle = NULL;
|
|
|
|
|
|
/* Shall the vehicle be replaced? */
|
|
|
const Company *c = GetCompany(_current_company);
|
|
|
const Company *c = Company::Get(_current_company);
|
|
|
EngineID e = GetNewEngineType(old_veh, c);
|
|
|
if (e == INVALID_ENGINE) return CommandCost(); // neither autoreplace is set, nor autorenew is triggered
|
|
|
|
|
@@ -259,7 +259,7 @@ static CommandCost BuildReplacementVehic
|
|
|
CommandCost cost = DoCommand(old_veh->tile, e, 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh));
|
|
|
if (cost.Failed()) return cost;
|
|
|
|
|
|
Vehicle *new_veh = GetVehicle(_new_vehicle_id);
|
|
|
Vehicle *new_veh = Vehicle::Get(_new_vehicle_id);
|
|
|
*new_vehicle = new_veh;
|
|
|
|
|
|
/* Refit the vehicle if needed */
|
|
@@ -609,7 +609,7 @@ CommandCost CmdAutoreplaceVehicle(TileIn
|
|
|
bool nothing_to_do = true;
|
|
|
|
|
|
if (!IsValidVehicleID(p1)) return CMD_ERROR;
|
|
|
Vehicle *v = GetVehicle(p1);
|
|
|
Vehicle *v = Vehicle::Get(p1);
|
|
|
if (!CheckOwnership(v->owner)) return CMD_ERROR;
|
|
|
if (!v->IsInDepot()) return CMD_ERROR;
|
|
|
if (HASBITS(v->vehstatus, VS_CRASHED)) return CMD_ERROR;
|
|
@@ -623,7 +623,7 @@ CommandCost CmdAutoreplaceVehicle(TileIn
|
|
|
if (!v->IsPrimaryVehicle()) return CMD_ERROR;
|
|
|
}
|
|
|
|
|
|
const Company *c = GetCompany(_current_company);
|
|
|
const Company *c = Company::Get(_current_company);
|
|
|
bool wagon_removal = c->settings.renew_keep_length;
|
|
|
|
|
|
/* Test whether any replacement is set, before issuing a whole lot of commands that would end in nothing changed */
|