Fix some undefined behaviour: signed overflow and over shift left.
Caught by UndefinedBehaviourSanitizer.
This commit is contained in:
@@ -8322,7 +8322,7 @@ static void CalculateRefitMasks()
|
||||
}
|
||||
|
||||
/* Clear invalid cargoslots (from default vehicles or pre-NewCargo GRFs) */
|
||||
if (!HasBit(_cargo_mask, ei->cargo_type)) ei->cargo_type = CT_INVALID;
|
||||
if (ei->cargo_type != CT_INVALID && !HasBit(_cargo_mask, ei->cargo_type)) ei->cargo_type = CT_INVALID;
|
||||
|
||||
/* Ensure that the vehicle is either not refittable, or that the default cargo is one of the refittable cargoes.
|
||||
* Note: Vehicles refittable to no cargo are handle differently to vehicle refittable to a single cargo. The latter might have subtypes. */
|
||||
|
Reference in New Issue
Block a user