diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -754,7 +754,7 @@ CommandCost CmdInsertOrder(DoCommandFlag 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 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 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 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 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 /* 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 /* 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(OrderTyp /* 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); }