]> www.fi.muni.cz Git - slotcarman.git/commitdiff
Track: drop the ->reset method
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sat, 7 May 2011 21:52:37 +0000 (23:52 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sat, 7 May 2011 21:52:37 +0000 (23:52 +0200)
RaceParser does not implement its own ->reset, so the Track does
not need it either. It is sent before the qual start, so it can
only confuse things.

Instead, reset the cars in the race_setup method.

SCX/Car.pm
SCX/Track.pm

index 86f78651cf9d328d1cf012818a15789a2f59a6ec..e5e229a255903d6bc8786617fb28eef5ec45c0c3 100644 (file)
@@ -216,6 +216,7 @@ sub reset {
        $self->{lap_diff} = undef;
        $self->{total_time} = undef;
        $self->{grey_diff} = undef;
+       $self->print_state;
 }
 
 sub finish_line {
index f561f2a955b7a72afca109294c3f4f3be44ac3f4..6ed3d822581242fb96e88dc86d7c9f3b626196e3 100644 (file)
@@ -115,31 +115,13 @@ sub race_setup {
        $self->{best_lap} = undef;
 
        $self->{gui}->show_semaphore(undef);
-       $self->{race_running} = 0;
-       $self->{qualification_running} = 0;
-       $self->{start_in_progress} = 0;
-
-       $self->{gui}->time(undef);
-       $self->{gui}->best_lap(undef);
-
-       for my $car (0..5) {
-               $self->car($car)->reset;
-       }
-}
-
-sub reset {
-       my ($self) = @_;
-
        $self->{race_running} = 0;
        $self->{qualification_running} = 0;
        $self->{start_in_progress} = 0;
        $self->{race_finishing} = 0;
-       $self->{best_lap} = undef;
-       $self->{round} = 0;
 
-       $self->print_rounds;
-       $self->{gui}->best_lap(undef);
        $self->{gui}->time(undef);
+       $self->{gui}->best_lap(undef);
 
        for my $car (0..5) {
                $self->car($car)->reset;