8 my ($class, $args) = @_;
14 order => $args->{order},
19 $self->set_throttle(undef);
20 $self->set_fuel(undef);
25 sub gui { return shift->{gui}; }
28 my ($self, $val) = @_;
30 return if (!defined $self->{throttle} && !defined $val)
31 || (defined $self->{throttle} && defined $val
32 && $self->{throttle} == $val);
34 if ($self->{in_pit_lane} && defined $val && $val > 3) {
35 delete $self->{in_pit_lane};
36 $self->gui->leave_pit_lane;
39 $self->{throttle} = $val;
40 $self->gui->set_throttle($self->{order}, $val);
45 my ($self, $val) = @_;
47 return if (!defined $self->{fuel} && !defined $val)
48 || (defined $self->{fuel} && defined $val
49 && $self->{fuel} == $val);
52 $self->gui->set_fuel($self->{order}, $val);
64 my ($self, $name) = @_;
66 return if (!defined $self->{car_icon} && !defined $name)
67 || (defined $self->{car_icon} && defined $name
68 && $self->{car_icon} eq $name);
70 $self->{car_icon} = $name;
71 $self->gui->set_car_icon($self->{order}, $name);
75 my ($self, $lap_nr) = @_;
77 return if (!defined $self->{lap} && !defined $lap_nr)
78 || (defined $self->{lap} && defined $lap_nr
79 && $self->{lap} == $lap_nr);
81 $self->{lap} = $lap_nr;
82 $self->gui->set_lap($self->{order}, defined $lap_nr ? $lap_nr : '--');
86 my ($self, $lap_time) = @_;
88 if (defined $lap_time) {
89 $lap_time = sprintf("%.2f", $lap_time);
90 if ($lap_time > 1.0 && (
91 !$self->{in_pit_lane} && !defined $self->{best_lap}
92 || $self->{best_lap} > $lap_time
95 $self->gui->set_best_lap($self->{order}, $lap_time);
96 $self->{best_lap} = $lap_time;
100 $self->gui->set_best_lap($self->{order}, '--');
101 $self->{best_lap} = undef;
104 return if (!defined $self->{laptime} && !defined $lap_time)
105 || (defined $self->{laptime} && defined $lap_time
106 && $self->{laptime} == $lap_time);
108 $self->{laptime} = $lap_time;
110 $self->gui->set_laptime($self->{order}, defined $lap_time
115 my ($self, $driver_name) = @_;
117 return if (!defined $self->{driver} && !defined $driver_name)
118 || (defined $self->{driver} && defined $driver_name
119 && $self->{driver} == $driver_name);
121 $self->{driver} = $driver_name;
122 $self->gui->set_driver($self->{order}, $driver_name || '--');
128 $self->{in_pit_lane} = 1;
129 $self->gui->enter_pit_lane;
133 my ($self, $pos) = @_;
135 $self->{order} = $pos;
137 $self->gui->set_driver($self->{order}, $self->{driver}
139 $self->gui->set_car_icon($self->{order}, $self->{car_icon});
140 $self->gui->set_throttle($self->{order}, $self->{throttle});
141 $self->gui->set_lap($self->{order}, defined $self->{lap}
142 ? $self->{lap} : '--');
143 $self->gui->set_laptime($self->{order}, defined $self->{laptime}
144 ? $self->{laptime} : '--');
145 $self->gui->set_best_lap($self->{order}, defined $self->{best_lap}
146 ? $self->{best_lap} : '--');
147 $self->gui->set_fuel($self->{order}, $self->{fuel});