Merge branch 'template_train_replacement' into jgrpp
This commit is contained in:
@@ -1175,6 +1175,16 @@ void CallVehicleTicks()
|
||||
it->first->vehstatus |= VS_STOPPED;
|
||||
CommandCost res = DoCommand(t->tile, t->index, stayInDepot ? 1 : 0, DC_EXEC, CMD_TEMPLATE_REPLACE_VEHICLE);
|
||||
|
||||
if (res.Succeeded()) {
|
||||
VehicleID t_new = _new_vehicle_id;
|
||||
t = Train::From(Vehicle::Get(t_new));
|
||||
const Company *c = Company::Get(_current_company);
|
||||
SubtractMoneyFromCompany(CommandCost(EXPENSES_NEW_VEHICLES, (Money)c->settings.engine_renew_money));
|
||||
CommandCost res2 = DoCommand(0, t_new, 1, DC_EXEC, CMD_AUTOREPLACE_VEHICLE);
|
||||
SubtractMoneyFromCompany(CommandCost(EXPENSES_NEW_VEHICLES, -(Money)c->settings.engine_renew_money));
|
||||
if (res2.Succeeded() || res.GetCost() == 0) res.AddCost(res2);
|
||||
}
|
||||
|
||||
if (!IsLocalCompany()) continue;
|
||||
|
||||
if (res.Succeeded()) {
|
||||
|
Reference in New Issue
Block a user