Fix ameba inspections
This commit is contained in:
parent
b63c00cea4
commit
ea5e7950de
@ -13,7 +13,6 @@ class App
|
||||
@router = CLI::CommandRouter.new
|
||||
|
||||
@buildings.items.each do |i|
|
||||
t = i[:t]
|
||||
b = i[:b]
|
||||
route = sprintf "%s {x} {y}", b.name.downcase
|
||||
desc = sprintf "Build %s at x,y", b.name
|
||||
@ -26,7 +25,7 @@ class App
|
||||
end
|
||||
end
|
||||
|
||||
@router.add "help", "Show all commands" do |p|
|
||||
@router.add "help", "Show all commands" do
|
||||
printf "Commands:\n"
|
||||
@router.routes.each do |r|
|
||||
printf " %s - %s\n", r.route, r.desc
|
||||
@ -47,7 +46,7 @@ class App
|
||||
(0...rows).each do |x|
|
||||
if x == 0
|
||||
printf "+"
|
||||
(0...cols).each do |y|
|
||||
(0...cols).each do
|
||||
printf "------+"
|
||||
end
|
||||
print "\n"
|
||||
@ -59,7 +58,7 @@ class App
|
||||
end
|
||||
print "\n"
|
||||
printf "|"
|
||||
(0...cols).each do |y|
|
||||
(0...cols).each do
|
||||
printf " |"
|
||||
end
|
||||
print "\n"
|
||||
@ -74,7 +73,7 @@ class App
|
||||
end
|
||||
print "\n"
|
||||
printf "+"
|
||||
(0...cols).each do |y|
|
||||
(0...cols).each do
|
||||
printf "------+"
|
||||
end
|
||||
print "\n"
|
||||
|
@ -39,7 +39,7 @@ class CLI::CommandRouter
|
||||
m = command.match(pattern)
|
||||
return false if m.nil?
|
||||
groups = m.named_captures
|
||||
nil_groups = groups.select { |k, v| v.nil? }
|
||||
nil_groups = groups.select { |_, v| v.nil? }
|
||||
return false if nil_groups.size != 0
|
||||
params = groups.transform_values { |v| v.to_s }
|
||||
cb.call params
|
||||
|
@ -80,15 +80,15 @@ module Game
|
||||
end
|
||||
|
||||
private def nearest_deposit(world : World, res_type : Resource::Type) : DepositTile?
|
||||
tile = world.map.nearest_tile @point do |tile|
|
||||
tile.is_a?(DepositTile) && tile.dep.type == res_type && tile.dep.cur > 0
|
||||
tile = world.map.nearest_tile @point do |t|
|
||||
t.is_a?(DepositTile) && t.dep.type == res_type && t.dep.cur > 0
|
||||
end
|
||||
tile.as?(DepositTile)
|
||||
end
|
||||
|
||||
private def nearest_stock(world : World) : BuildingTile?
|
||||
tile = world.map.nearest_tile @point do |tile|
|
||||
tile.is_a?(BuildingTile) && tile.building.has_role Building::Role::Storehouse
|
||||
tile = world.map.nearest_tile @point do |t|
|
||||
t.is_a?(BuildingTile) && t.building.has_role Building::Role::Storehouse
|
||||
end
|
||||
tile.as?(BuildingTile)
|
||||
end
|
||||
@ -135,8 +135,8 @@ module Game
|
||||
end
|
||||
|
||||
private def nearest_deposit(world : World, res_type : Resource::Type) : DepositTile?
|
||||
tile = world.map.nearest_tile @point do |tile|
|
||||
tile.is_a?(DepositTile) && tile.dep.type == res_type && tile.dep.cur == 0
|
||||
tile = world.map.nearest_tile @point do |t|
|
||||
t.is_a?(DepositTile) && t.dep.type == res_type && t.dep.cur == 0
|
||||
end
|
||||
tile.as?(DepositTile)
|
||||
end
|
||||
|
@ -9,6 +9,6 @@ struct Game::Point
|
||||
getter y
|
||||
|
||||
def distance(other) : Int32
|
||||
return (other.x - @x).abs + (other.y - @y).abs
|
||||
(other.x - @x).abs + (other.y - @y).abs
|
||||
end
|
||||
end
|
||||
|
@ -28,7 +28,7 @@ class Game::ResourceBag
|
||||
|
||||
def initialize(vals : ResourceHash | Nil = nil)
|
||||
@values = ResourceHash.new
|
||||
Resource::Type.each { |t, v| @values[t] = 0 }
|
||||
Resource::Type.each { |t, _| @values[t] = 0 }
|
||||
if vals.is_a?(ResourceHash)
|
||||
add_amounts vals
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user