Index: src/cui_auto_main.d ================================================================== --- src/cui_auto_main.d +++ src/cui_auto_main.d @@ -4,13 +4,11 @@ import driver; import solver; class CUI(Solver) : GameObserver { - this(const(Game) g) { - solver = new Solver(g); - } + this(in Game g) { solver = new Solver(g); } Solver solver; bool fin; override void on_game_changed(char c, const(Game) g, bool finished) { fin = finished; Index: src/game.d ================================================================== --- src/game.d +++ src/game.d @@ -6,11 +6,11 @@ { 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); } Pos down() { return new Pos(y-1, x); } @@ -43,11 +43,11 @@ { 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( params.get("Water", "0").to!int(), @@ -102,11 +102,11 @@ Pos robot; 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(); this.waterproof = m.waterproof; @@ -304,11 +304,11 @@ this.map = Map.load(raw_data, params); 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; lambda = g.lambda; Index: src/gui.d ================================================================== --- src/gui.d +++ src/gui.d @@ -3,11 +3,11 @@ import game; import driver; class GUI(Solver) : Form, GameObserver { - this(const(Game) g) + this(in Game g) { this.solver = new Solver(g); setup_size(g.map.W, g.map.H); setup_resources(); setup_keyhandling(); Index: src/output.d ================================================================== --- src/output.d +++ src/output.d @@ -3,33 +3,33 @@ import driver; import core.stdc.signal; class NilOutput : GameObserver { - this(const(Game) g) {} - override void on_game_changed(char c, const(Game) g, bool finished) {} + this(in Game g) {} + override void on_game_changed(char c, in Game g, bool finished) {} } class StdOutput : GameObserver { - this(const(Game) g) {} - override void on_game_changed(char c, const(Game) g, bool finished) + this(in Game g) {} + override void on_game_changed(char c, in Game g, bool finished) { stdout.write(c); stdout.flush(); } } class GuardedOutput : GameObserver { - this(const(Game) g) + this(in Game g) { setup_sigint_handling(); ideal_log ~= g.score_if_abort_now; } - override void on_game_changed(char c, const(Game) g, bool finished) + override void on_game_changed(char c, in Game g, bool finished) { log ~= c; score_log ~= g.score; ideal_log ~= g.score_if_abort_now; if(finished)