From f03a13ce6609c4f5dcc6c196ffc3f18ab5f237a6 Mon Sep 17 00:00:00 2001
From: Anton Vakhrushev <a.vakhrushev@elama.ru>
Date: Thu, 10 Oct 2019 16:25:22 +0300
Subject: [PATCH] Add block type hints

---
 src/game/map.cr | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/game/map.cr b/src/game/map.cr
index 5b3bb9a..eea052a 100644
--- a/src/game/map.cr
+++ b/src/game/map.cr
@@ -20,9 +20,7 @@ module Game
 
     property data : DataArray
 
-    def initialize(rows : Int32, cols : Int32)
-      @rows = rows
-      @cols = cols
+    def initialize(@rows : Int32, @cols : Int32)
       @data = DataArray.new @rows
       @rows.times do |row_index|
         tile_row = TileRow.new @cols
@@ -56,7 +54,7 @@ module Game
       @data[point.x][point.y] = tile
     end
 
-    def tiles
+    def tiles(&block : Point, Tile -> _)
       (0...@rows).each do |x|
         (0...@cols).each do |y|
           point = Point.new(x, y)
@@ -66,7 +64,7 @@ module Game
       end
     end
 
-    def nearest_tile(point : Point, &block) : Tile | Nil
+    def nearest_tile(point : Point, &block : Tile -> Bool) : Tile | Nil
       seek_tile = nil
       min_dist = Int32::MAX
       tiles do |tile_point, tile|