From a93b93cfb5ca4865ca052d551ced6d1ddf3cf244 Mon Sep 17 00:00:00 2001 From: maciejpedzich Date: Fri, 28 Feb 2025 23:08:20 +0100 Subject: [PATCH] fix: remove player_car_index assert due to the possibility of player being a spectator --- src/lib.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index bbe212e..d5e0d4d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -186,7 +186,7 @@ pub mod constants; /// and submodules for packet-specific structs. pub mod packets; -use crate::constants::{PacketId, MAX_NUM_CARS}; +use crate::constants::PacketId; use crate::packets::{ u8_to_usize, F1PacketCarDamage, F1PacketCarSetups, F1PacketCarStatus, F1PacketCarTelemetry, F1PacketEvent, F1PacketFinalClassification, F1PacketLaps, @@ -361,15 +361,8 @@ pub struct F1PacketHeader { /// Available from the 2023 format onwards. #[br(if(packet_format >= 2023))] pub overall_frame_identifier: u32, - /// Index of player 1's car. - #[br( - map(u8_to_usize), - assert( - player_car_index < MAX_NUM_CARS, - "Header has an invalid player 1 car index: {}", - player_car_index - ) - )] + /// Index of player 1's car (255 if in spectator mode). + #[br(map(u8_to_usize))] pub player_car_index: usize, /// Index of player 2's car in splitscreen mode. /// Set to 255 if not in splitscreen mode.