]> www.fi.muni.cz Git - slotcarman.git/commitdiff
Make cars aware of their IDs.
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Tue, 7 Dec 2010 16:34:27 +0000 (17:34 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Tue, 7 Dec 2010 16:34:27 +0000 (17:34 +0100)
SCX/Car.pm
SCX/Track.pm

index 165d09ecb66d97f934a0ae9d90302d5e097ca977..7dffb7a5361df8d184e1a303884e07f8aa5575c8 100644 (file)
@@ -3,16 +3,17 @@
 package SCX::Car;
 
 use strict;
+use Time::HiRes qw(gettimeofday);
 
 sub new {
        my ($class, $args) = @_;
 
        my $self = {
-               gui => $args->{gui},
+               gui      => $args->{gui},
                throttle => -1,
-               fuel => -1,
-               order => $args->{order},
-               track => $args->{track},
+               fuel     => -1,
+               id       => $args->{id},
+               track    => $args->{track},
        };
 
        bless $self, $class;
index bd6ceea620e9d3626cba484c34f5f9f8c094944d..4e0e722ce9dde34f93f750df2734aab0c4fbe23d 100644 (file)
@@ -25,9 +25,10 @@ sub new {
        for my $i (0..5) {
                $self->{cars}->[$i] = SCX::Car->new({
                        gui => $self->{gui},
-                       order => $i,
+                       id => $i,
                        track => $self,
                });
+               $self->car($i)->set_order($i);
        }
 
        return $self;