From a86f9dba0f619cb6cad99e4e9825567f882b348a Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:47:22 +0000 Subject: [PATCH] Codefix: Correct handling of GetDepotOrderType() comparison (#13023) In the function where we check the depot order type, using `!=` with GetDepotOrderType() is not ideal because the function can return flag bits. --- src/vehicle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index eb3bc71251..7ef6633e3f 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -273,7 +273,7 @@ bool Vehicle::NeedsAutomaticServicing() const { if (this->HasDepotOrder()) return false; if (this->current_order.IsType(OT_LOADING)) return false; - if (this->current_order.IsType(OT_GOTO_DEPOT) && this->current_order.GetDepotOrderType() != ODTFB_SERVICE) return false; + if (this->current_order.IsType(OT_GOTO_DEPOT) && (this->current_order.GetDepotOrderType() & ODTFB_SERVICE) == 0) return false; return NeedsServicing(); }