[gnome-chess] Code Cleanup



commit fe69cc5a0274e2a9f7866955eae39a9c6429858f
Author: Sahil Sareen <sahil sareen hotmail com>
Date:   Thu Feb 19 20:49:36 2015 +0530

    Code Cleanup

 lib/chess-clock.vala |    4 ++--
 lib/chess-game.vala  |    4 ++--
 lib/chess-pgn.vala   |   14 ++++++--------
 lib/chess-state.vala |    2 +-
 4 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/lib/chess-clock.vala b/lib/chess-clock.vala
index 7e790b3..0bb3854 100644
--- a/lib/chess-clock.vala
+++ b/lib/chess-clock.vala
@@ -96,9 +96,9 @@ public class ChessClock : Object
             white_move_used = white_seconds_used - white_prev_move_seconds;
             black_move_used = black_seconds_used - black_prev_move_seconds;
             if (active_color != Color.WHITE)
-                white_extra_seconds += int.min(extra_seconds, white_move_used);
+                white_extra_seconds += int.min (extra_seconds, white_move_used);
             else
-                black_extra_seconds += int.min(extra_seconds, black_move_used);
+                black_extra_seconds += int.min (extra_seconds, black_move_used);
             break;
         }
     }
diff --git a/lib/chess-game.vala b/lib/chess-game.vala
index e579e17..b72cfff 100644
--- a/lib/chess-game.vala
+++ b/lib/chess-game.vala
@@ -297,7 +297,7 @@ public class ChessGame : Object
 
     public uint n_moves
     {
-        get { return move_stack.length() - 1; }
+        get { return move_stack.length () - 1; }
     }
 
     public void pause (bool show_overlay = true)
@@ -330,7 +330,7 @@ public class ChessGame : Object
         this.rule = rule;
         is_started = false;
         if (_clock != null)
-            _clock.stop();
+            _clock.stop ();
         ended ();
     }
 }
diff --git a/lib/chess-pgn.vala b/lib/chess-pgn.vala
index 39733a6..51e364f 100644
--- a/lib/chess-pgn.vala
+++ b/lib/chess-pgn.vala
@@ -336,7 +336,7 @@ public class PGN : Object
             case State.TAG_START:
                 if (c.isspace ())
                     continue;
-                else if (c.isalnum())
+                else if (c.isalnum ())
                 {
                     token_start = offset;
                     state = State.TAG_NAME;
@@ -348,10 +348,10 @@ public class PGN : Object
             case State.TAG_NAME:
                 if (c.isspace ())
                 {
-                    tag_name = data[(long)token_start:(long)offset];
+                    tag_name = data[(long) token_start:(long) offset];
                     state = State.PRE_TAG_VALUE;
                 }
-                else if (c.isalnum() || c == '_' || c == '+' || c == '#' || c == '=' || c == ':' || c == '-')
+                else if (c.isalnum () || c == '_' || c == '+' || c == '#' || c == '=' || c == ':' || c == 
'-')
                     continue;
                 else
                     state = State.ERROR;
@@ -402,7 +402,7 @@ public class PGN : Object
                     continue;
                 else
                 {
-                    string symbol = data[(long)token_start:(long)offset];
+                    string symbol = data[(long) token_start:(long) offset];
 
                     bool is_number = true;
                     for (int i = 0; i < symbol.length; i++)
@@ -441,8 +441,6 @@ public class PGN : Object
                     continue;
                 else
                 {
-                    //string nag = data[(long)token_start:(long)offset];
-                    //stdout.printf ("nag = '%s'\n", nag);
                     state = State.MOVE_TEXT;
                     offset--;
                 }
@@ -451,7 +449,7 @@ public class PGN : Object
             case State.ERROR:
                 size_t char_offset = offset - line_offset - 1;
                 stderr.printf ("%d.%d: error: Unexpected character\n", line, (int) (char_offset + 1));
-                stderr.printf ("%s\n", data[(long)line_offset:(long)offset]);
+                stderr.printf ("%s\n", data[(long) line_offset:(long) offset]);
                 for (int i = 0; i < char_offset; i++)
                     stderr.printf (" ");
                 stderr.printf ("^\n");
@@ -464,7 +462,7 @@ public class PGN : Object
 
         /* Must have at least one game */
         if (games == null)
-            throw new PGNError.LOAD_ERROR("No games in PGN file");
+            throw new PGNError.LOAD_ERROR ("No games in PGN file");
     }
 
     public PGN.from_file (File file) throws Error
diff --git a/lib/chess-state.vala b/lib/chess-state.vala
index 52b3b42..325f56e 100644
--- a/lib/chess-state.vala
+++ b/lib/chess-state.vala
@@ -144,7 +144,7 @@ public class ChessState : Object
         state.en_passant_index = en_passant_index;
         state.check_state = check_state;
         if (last_move != null)
-            state.last_move = last_move.copy();
+            state.last_move = last_move.copy ();
         for (int i = 0; i < 64; i++)
             state.board[i] = board[i];
         state.piece_masks[Color.WHITE] = piece_masks[Color.WHITE];


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