1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-20 04:59:11 +00:00

Codechange: do not hide variables with other variables

This commit is contained in:
rubidium42
2023-01-28 20:06:51 +01:00
committed by rubidium42
parent 1951af07c0
commit 6ba55e663e
30 changed files with 137 additions and 146 deletions

View File

@@ -754,7 +754,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
if (st == nullptr) return CMD_ERROR;
if (st->owner != OWNER_NONE) {
CommandCost ret = CheckOwnership(st->owner);
ret = CheckOwnership(st->owner);
if (ret.Failed()) return ret;
}
@@ -800,7 +800,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
if (st == nullptr) return CMD_ERROR;
CommandCost ret = CheckOwnership(st->owner);
ret = CheckOwnership(st->owner);
if (ret.Failed()) return ret;
if (!CanVehicleUseStation(v, st) || !st->airport.HasHangar()) {
@@ -811,7 +811,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
if (dp == nullptr) return CMD_ERROR;
CommandCost ret = CheckOwnership(GetTileOwner(dp->xy));
ret = CheckOwnership(GetTileOwner(dp->xy));
if (ret.Failed()) return ret;
switch (v->type) {
@@ -849,7 +849,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
case VEH_TRAIN: {
if (!(wp->facilities & FACIL_TRAIN)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
CommandCost ret = CheckOwnership(wp->owner);
ret = CheckOwnership(wp->owner);
if (ret.Failed()) return ret;
break;
}
@@ -857,7 +857,7 @@ CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
case VEH_SHIP:
if (!(wp->facilities & FACIL_DOCK)) return_cmd_error(STR_ERROR_CAN_T_ADD_ORDER);
if (wp->owner != OWNER_NONE) {
CommandCost ret = CheckOwnership(wp->owner);
ret = CheckOwnership(wp->owner);
if (ret.Failed()) return ret;
}
break;
@@ -1514,7 +1514,7 @@ CommandCost CmdCloneOrder(DoCommandFlag flags, CloneOptions action, VehicleID ve
/* Sanity checks */
if (src == nullptr || !src->IsPrimaryVehicle() || dst->type != src->type || dst == src) return CMD_ERROR;
CommandCost ret = CheckOwnership(src->owner);
ret = CheckOwnership(src->owner);
if (ret.Failed()) return ret;
/* Trucks can't share orders with busses (and visa versa) */
@@ -1571,7 +1571,7 @@ CommandCost CmdCloneOrder(DoCommandFlag flags, CloneOptions action, VehicleID ve
/* Sanity checks */
if (src == nullptr || !src->IsPrimaryVehicle() || dst->type != src->type || dst == src) return CMD_ERROR;
CommandCost ret = CheckOwnership(src->owner);
ret = CheckOwnership(src->owner);
if (ret.Failed()) return ret;
/* Trucks can't copy all the orders from busses (and visa versa),
@@ -1771,12 +1771,9 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination, bool
/* Go through all vehicles */
for (Vehicle *v : Vehicle::Iterate()) {
Order *order;
order = &v->current_order;
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) && !hangar ? OT_GOTO_STATION : order->GetType()) == type &&
if ((v->type == VEH_AIRCRAFT && v->current_order.IsType(OT_GOTO_DEPOT) && !hangar ? OT_GOTO_STATION : v->current_order.GetType()) == type &&
(!hangar || v->type == VEH_AIRCRAFT) && v->current_order.GetDestination() == destination) {
order->MakeDummy();
v->current_order.MakeDummy();
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
}