mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-31 16:14:29 +01:00
Codechange: Add HasFlag() to test if a value is present in a bitset enum type. (#12959)
This simplifies tests for `(x & y) != y` with enum classes by reducing repetition, similar to HasBit(), and also makes the intent of the expression clearer.
This commit is contained in:
@@ -1046,10 +1046,10 @@ static CommandCost SendAllVehiclesToDepot(DoCommandFlag flags, bool service, con
|
||||
*/
|
||||
CommandCost CmdSendVehicleToDepot(DoCommandFlag flags, VehicleID veh_id, DepotCommand depot_cmd, const VehicleListIdentifier &vli)
|
||||
{
|
||||
if ((depot_cmd & DepotCommand::MassSend) != DepotCommand::None) {
|
||||
if (HasFlag(depot_cmd, DepotCommand::MassSend)) {
|
||||
/* Mass goto depot requested */
|
||||
if (!vli.Valid()) return CMD_ERROR;
|
||||
return SendAllVehiclesToDepot(flags, (depot_cmd & DepotCommand::Service) != DepotCommand::None, vli);
|
||||
return SendAllVehiclesToDepot(flags, HasFlag(depot_cmd, DepotCommand::Service), vli);
|
||||
}
|
||||
|
||||
Vehicle *v = Vehicle::GetIfValid(veh_id);
|
||||
|
||||
Reference in New Issue
Block a user