]> www.fi.muni.cz Git - slotcarman.git/blobdiff - SCX/Track.pm
Track: drop the ->reset method
[slotcarman.git] / SCX / Track.pm
index c88e6f8540ff024ce9d67c9636b60310084d4096..6ed3d822581242fb96e88dc86d7c9f3b626196e3 100644 (file)
@@ -20,6 +20,7 @@ sub new {
                round => 0,
                now => 0,
                qualification_setup => -100,
+               no_semaphore => $args->{no_semaphore},
        };
 
        bless $self, $class;
@@ -49,6 +50,11 @@ sub race_start {
 
        if ($time - $self->{qualification_setup} < 1) {
                $self->{qualification_running} = 1;
+       } elsif ($self->{no_semaphore}) {
+               $self->{round} = 0;
+               $self->{race_running} = 1;
+               $self->{race_running_since} = $self->{now};
+               $self->{start_in_progress} = undef;
        } else {
                $self->{round} = 0;
                $self->{race_running} = 0;
@@ -109,27 +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);
-}
-
-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;