1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-26 07:59:09 +00:00

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.
This commit is contained in:
SamuXarick
2024-10-27 17:47:22 +00:00
committed by GitHub
parent 9cf47e69d6
commit a86f9dba0f

View File

@@ -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();
}