From d4665392633f460827331f17ec3f71abd77e63e3 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:58:46 +0100 Subject: [PATCH] Codefix: Correct handling of GetDepotOrderType() comparison 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(); }