1
0
Fork 0

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.
pull/13037/head
SamuXarick 2024-10-27 17:47:22 +00:00 committed by GitHub
parent 9cf47e69d6
commit a86f9dba0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

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