[gnome-chess] Improve time control handling



commit 83a1d1bc0c00976e500b9aff9b4d453be5804fbe
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Jul 6 14:42:15 2014 -0500

    Improve time control handling
    
    Set the game's time limit, not a duration, so that selecting one hour
    gives each player a time limit of one hour (rather than 30 minutes).
    
    This also fixes our interpretation of the TimeControl field.

 data/preferences.ui  |   10 +++++-----
 src/gnome-chess.vala |   12 +++++-------
 2 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index 32234d0..1a66ee5 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -10,10 +10,6 @@
     </columns>
     <data>
       <row>
-        <col id="0">seconds</col>
-        <col id="1">1</col>
-      </row>
-      <row>
         <col id="0">minutes</col>
         <col id="1">60</col>
       </row>
@@ -65,6 +61,10 @@
         <col id="1">0</col>
       </row>
       <row>
+        <col id="0" translatable="yes" comments="Preferences Dialog: Combo box entry for game timer of five 
minutes">Five minutes</col>
+        <col id="1">300</col>
+      </row>
+      <row>
         <col id="0" translatable="yes" comments="Preferences Dialog: Combo box entry for game timer of ten 
minutes">Ten minutes</col>
         <col id="1">600</col>
       </row>
@@ -367,7 +367,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="halign">start</property>
-                    <property name="label" translatable="yes" comments="Preferences Dialog: Label before 
game timer settings">_Game duration:</property>
+                    <property name="label" translatable="yes" comments="Preferences Dialog: Label before 
game timer settings">_Time limit:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">duration_combo</property>
                   </object>
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index be08214..38cb84c 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -1885,10 +1885,6 @@ public class ChessApplication : Gtk.Application
                 model.get (iter, 1, out multiplier, -1);
                 switch (multiplier)
                 {
-                case 1:
-                    model.set (iter, 0, ngettext (/* Preferences Dialog: Combo box entry for a custom game 
timer set in seconds */
-                                                  "second", "seconds", (ulong) adjustment.value), -1);
-                    break;
                 case 60:
                     model.set (iter, 0, ngettext (/* Preferences Dialog: Combo box entry for a custom game 
timer set in minutes */
                                                   "minute", "minutes", (ulong) adjustment.value), -1);
@@ -1897,6 +1893,8 @@ public class ChessApplication : Gtk.Application
                     model.set (iter, 0, ngettext (/* Preferences Dialog: Combo box entry for a custom game 
timer set in hours */
                                                   "hour", "hours", (ulong) adjustment.value), -1);
                     break;
+                default:
+                    assert_not_reached ();
                 }
             } while (model.iter_next (ref iter));
         }
@@ -2226,9 +2224,9 @@ public class ChessApplication : Gtk.Application
         var duration = settings.get_int ("duration");
         if (duration > 0)
         {
-            pgn_game.time_control = (duration / 2).to_string ();
-            pgn_game.white_time_left = (duration / 2).to_string ();
-            pgn_game.black_time_left = (duration / 2).to_string ();
+            pgn_game.time_control = duration.to_string ();
+            pgn_game.white_time_left = duration.to_string ();
+            pgn_game.black_time_left = duration.to_string ();
         }
         var engine_name = settings.get_string ("opponent");
         if (engine_name == "")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]