/// <summary>
        /// Check vehicle flags2 contain at least one of the flags in <paramref name="flagMask"/>.
        /// </summary>
        ///
        /// <param name="vehicleId">The id of the vehicle to inspect.</param>
        /// <param name="flagMask">The flags to test.</param>
        /// <param name="expectedResult">If specified, ensure only the expected flags are found.</param>
        ///
        /// <returns>Returns <c>true</c> if the test passes, otherwise <c>false</c>.</returns>
        public bool CheckVehicleFlags2(ushort vehicleId,
                                       Vehicle.Flags2 flagMask,
                                       Vehicle.Flags2?expectedResult = null)
        {
            Vehicle.Flags2 result =
                Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].m_flags2
                & flagMask;

            return(expectedResult == null ? result != 0 : result == expectedResult);
        }
Пример #2
0
        public bool CheckVehicleFlags2(ushort vehicleId, Vehicle.Flags2 flagMask, Vehicle.Flags2?expectedResult = default(Vehicle.Flags2?))
        {
            bool ret = false;

            ProcessVehicle(vehicleId, delegate(ushort vId, ref Vehicle vehicle) {
                ret = LogicUtil.CheckFlags((uint)vehicle.m_flags2, (uint)flagMask, (uint?)expectedResult);
                return(true);
            });
            return(ret);
        }