@@ -7,9 +7,9 @@ public immutable int y, x; mixin DeriveCreate; mixin DeriveCompare; mixin DeriveShow; - Pos clone() const { return new Pos(y, x); } + Pos clone() const { return cast(Pos) this; } @property: Pos wait() { return this.clone(); } Pos up() { return new Pos(y+1, x); } @@ -44,9 +44,9 @@ public immutable int base, pace; mixin DeriveCreate; mixin DeriveCompare; mixin DeriveShow; - Water clone() const { return new Water(base, pace); } + Water clone() const { return cast(Water)this; } static load(string[string] params) { return new Water( @@ -103,9 +103,9 @@ Pos lift; int waterproof; Map clone() const { return new Map(this); } - this(const(Map) m) { + this(in Map m) { foreach(s; m.data) this.data ~= s.dup; this.robot = m.robot.clone(); this.lift = m.lift.clone(); @@ -305,9 +305,9 @@ this.water = Water.load(params); } Game clone() const { return new Game(this); } - this(const(Game) g) { + this(in Game g) { map = g.map.clone(); water = g.water.clone(); turn = g.turn; dead = g.dead;