]> www.fi.muni.cz Git - slotcarman.git/blobdiff - SCX/Reader.pm
Best lap handling.
[slotcarman.git] / SCX / Reader.pm
index 8d9f42dcad72e6382d2f2e9e6880cc6605df809b..db88e3416519f969287032196f8f3b0e2a616b28 100644 (file)
@@ -264,10 +264,11 @@ sub race_setup_packet {
                || $bytes[4] != 0xFF
                || $bytes[5] != 0xFF;
 
-       for my $car (0..5) {
-               $self->track->car($car)->set_lap(undef);
-               $self->track->car($car)->set_laptime(undef);
-       }
+       $self->track->race_setup($bytes[0] == 0x00
+               ? 0
+               : $bytes[1] & 0x0F * 256
+                       + $bytes[2] & 0x0F * 16
+                       + $bytes[3] & 0x0F);
 
        return $msg; # FIXME - to be implemented
 }
@@ -408,7 +409,6 @@ sub finish_line_packet {
        return $msg; # FIXME - to be implemented
 }
 
-
 sub controller_status_packet {
        my ($self, @bytes) = @_;