Coding guideline fixes

Cleanup of chess code

https://bugzilla.gnome.org/show_bug.cgi?id=738918
This commit is contained in:
Sahil Sareen 2014-10-21 16:13:02 +05:30 committed by Michael Catanzaro
parent 64697591a8
commit c13ae48cf1
5 changed files with 8 additions and 8 deletions

View file

@ -62,13 +62,13 @@ public class ChessEngineCECP : ChessEngine
string move = line[prefix.length:line.length];
debug ("Engine moves %s", move);
moving = true;
moved (move.strip());
moved (move.strip ());
}
}
if (line == "resign" || line == "tellics resign" ||
(line.has_prefix ("1-0 {") && line.contains("resign")) ||
(line.has_prefix ("0-1 {") && line.contains("resign")))
(line.has_prefix ("1-0 {") && line.contains ("resign")) ||
(line.has_prefix ("0-1 {") && line.contains ("resign")))
{
resigned ();
}

View file

@ -208,7 +208,7 @@ public abstract class ChessEngine : Object
do
{
n_written = Posix.write(stdin_fd, &data[offset], data.length - offset);
n_written = Posix.write (stdin_fd, &data[offset], data.length - offset);
offset += n_written;
} while (n_written > 0 && offset < data.length);
}

View file

@ -234,7 +234,7 @@ public class ChessScene : Object
selected_file, rank, file, true, promotion_selection);
selected_rank = selected_file = -1;
}
if (game.current_player.move_with_coords(selected_rank, selected_file, rank, file))
if (game.current_player.move_with_coords (selected_rank, selected_file, rank, file))
selected_rank = selected_file = -1;
}

View file

@ -276,8 +276,8 @@ public class ChessView : Gtk.DrawingArea
if (scene.game == null || event.button != 1 || scene.game.should_show_paused_overlay)
return false;
int file = (int) Math.floor((event.x - 0.5 * get_allocated_width () + square_size * 4) / square_size);
int rank = 7 - (int) Math.floor((event.y - 0.5 * get_allocated_height () + square_size * 4) / square_size);
int file = (int) Math.floor ((event.x - 0.5 * get_allocated_width () + square_size * 4) / square_size);
int rank = 7 - (int) Math.floor ((event.y - 0.5 * get_allocated_height () + square_size * 4) / square_size);
// FIXME: Use proper Cairo rotation matrix
if (scene.board_angle == 180.0)

View file

@ -196,7 +196,7 @@ public class ChessApplication : Gtk.Application
add_window (window);
scene = new ChessScene ();
scene.is_human.connect ((p) => { return p == human_player; } );
scene.is_human.connect ((p) => { return p == human_player; });
scene.changed.connect (scene_changed_cb);
scene.choose_promotion_type.connect (show_promotion_type_selector);