Move part of game code to Game namespace

This commit is contained in:
Anton Vakhrushev
2019-10-04 16:40:42 +03:00
parent d4b37377b9
commit ce9d9afd31
6 changed files with 138 additions and 137 deletions

View File

@ -4,7 +4,7 @@ require "./../src/game/command"
macro define_dummy_classes(count)
{% for i in (1...count) %}
class Test::DummyCommand{{ i }} < Command
class Test::DummyCommand{{ i }} < Game::Command
def start(world) : Int32
end

View File

@ -3,18 +3,18 @@ require "../src/game/world"
describe "World" do
it "should build crystal harvester" do
world = World.new
world = Game::World.new
point = Point.new(2, 3)
cmd = BuildCrystalHarvesterCommand.new(point)
cmd = Game::BuildCrystalHarvesterCommand.new(point)
world.push(cmd)
world.run(100)
world.map.get(point).has_role(TileRole::CrystalHarvester)
end
it "should fail when not enought resources" do
world = World.new
world = Game::World.new
point = Point.new(2, 3)
cmd = BuildCrystalRestorerCommand.new(point)
cmd = Game::BuildCrystalRestorerCommand.new(point)
expect_raises(NotEnoughtResources) do
world.push(cmd)
end