]> www.fi.muni.cz Git - slotcarman.git/commitdiff
Drop average lap time counting
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 8 May 2011 20:05:52 +0000 (22:05 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 8 May 2011 20:05:52 +0000 (22:05 +0200)
The average lap time is confusing to the driver and is directly proportional
to ten total time, so do not display it. Also, we can save one row per car.

SCX/Car.pm
SCX/GUI.pm
slotcarman.glade

index 878247a902c2af5304987405e5edd0a9e601ae87..1a74c6b3a342b8d9439fa0c3151dbf586dc7d8c9 100644 (file)
@@ -15,7 +15,6 @@ sub new {
                fuel     => 0,
                lap      => 0,
                laptime  => 0,
-               avg_lap  => 0,
                car_img  => $args->{car_img},
                id       => $args->{id},
                track    => $args->{track},
@@ -100,9 +99,7 @@ sub set_lap {
        my ($self, $lap_nr) = @_;
 
        if (!$lap_nr) {
-               $self->{avg_lap} = undef;
                $self->{lap} = $lap_nr;
-               $self->gui->set_avg_lap($self->{order}, undef);
                $self->gui->set_lap($self->{order}, $lap_nr);
                return;
        }
@@ -117,10 +114,6 @@ sub set_lap {
        $self->gui->set_lap($self->{order}, $lap_nr);
        if ($self->track->{race_running} && $self->{lap} > 1) {
                my $now = $self->{last_finish_time};
-               my $avg = ($now - $self->track->{race_running_since})
-                       / ($self->{lap} - 1);
-               $self->{avg_lap} = $avg;
-               $self->gui->set_avg_lap($self->{order}, $self->{avg_lap});
        }
 }
 
@@ -187,7 +180,6 @@ sub set_order {
        $self->gui->set_lap($self->{order}, $self->{lap});
        $self->gui->set_laptime($self->{order}, $self->{laptime});
        $self->gui->set_best_lap($self->{order}, $self->{best_lap});
-       $self->gui->set_avg_lap($self->{order}, $self->{avg_lap});
        $self->gui->set_fuel($self->{order}, $self->{fuel});
        $self->gui->set_car_id($self->{order}, $self->{id} + 1);
        $self->gui->set_distance($self->{order},
index fbdfa703bf37ae309722d1fe214aadbb96a29836..41e911242e6c3619ffc7c1c1dfb8f46795a54aca 100755 (executable)
@@ -292,12 +292,6 @@ sub set_laptime {
        $self->set_label('label_laptime', $row, format_lap_time($text));
 }
 
-sub set_avg_lap {
-       my ($self, $row, $text) = @_;
-
-       $self->set_label('label_avg_lap', $row, format_lap_time($text));
-}
-
 sub set_best_lap {
        my ($self, $row, $text) = @_;
 
index 57674a8a055299adc724b8d6bbbac2965bdee1b5..9dce885f4ecdfb5a204994ecbdf993480293b8f0 100644 (file)
             <child>
               <object class="GtkLabel" id="label3">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">Last/Best/Avg</property>
+                <property name="label" translatable="yes">Last/Best</property>
               </object>
               <packing>
                 <property name="left_attach">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkLabel" id="label_avg_lap1">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">0</property>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="left_attach">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkLabel" id="label_avg_lap2">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">0</property>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="left_attach">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkLabel" id="label_avg_lap3">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">0</property>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="left_attach">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkLabel" id="label_avg_lap4">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">0</property>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="left_attach">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkLabel" id="label_avg_lap5">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">0</property>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="left_attach">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkLabel" id="label_avg_lap6">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">0</property>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="left_attach">5</property>