Permalink
Browse files

now BoardRenderer catches illegal move exceptions and doesnt make the…

… move
  • Loading branch information...
1 parent 4b7174c commit d86a0b5b6d5507cbf8c99f87617e6f2f7ca7298a @scrooloose committed Mar 5, 2008
Showing with 4 additions and 3 deletions.
  1. +4 −3 views/board_renderer.rb
@@ -100,9 +100,10 @@ def square_selected
if @selected_square.nil?
@selected_square = @current_square
else
- p = @board.piece_for(@selected_square)
- m = Move.new(p, @current_square)
- m.execute
+ begin
+ @board.piece_for(@selected_square).move_to(@current_square)
+ rescue Piece::IllegalMoveError
+ end
@selected_square = nil
end
end

0 comments on commit d86a0b5

Please sign in to comment.