Check-in [a0c3529225]
Not logged in
Overview
SHA1 Hash:a0c352922523d4813fbe6cb5c6880b0d3689da23
Date: 2012-07-14 23:22:32
User: kinaba
Comment:code cleanup
Timelines: family | ancestors | descendants | both | trunk
Diffs: redesign
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Modified src/cui_auto_main.d from [a0394f9b9692c1eb] to [d3f73764386d7688].

2 2 import game; 3 3 import output; 4 4 import driver; 5 5 import solver; 6 6 7 7 class CUI(Solver) : GameObserver 8 8 { 9 - this(const(Game) g) { 10 - solver = new Solver(g); 11 - } 9 + this(in Game g) { solver = new Solver(g); } 12 10 Solver solver; 13 11 bool fin; 14 12 override void on_game_changed(char c, const(Game) g, bool finished) 15 13 { 16 14 fin = finished; 17 15 } 18 16 }

Modified src/game.d from [17dbdc662950a670] to [3baab0ddf11cca7d].

4 4 5 5 class Pos 6 6 { 7 7 public immutable int y, x; 8 8 mixin DeriveCreate; 9 9 mixin DeriveCompare; 10 10 mixin DeriveShow; 11 - Pos clone() const { return new Pos(y, x); } 11 + Pos clone() const { return cast(Pos) this; } 12 12 13 13 @property: 14 14 Pos wait() { return this.clone(); } 15 15 Pos up() { return new Pos(y+1, x); } 16 16 Pos down() { return new Pos(y-1, x); } 17 17 Pos left() { return new Pos(y, x-1); } 18 18 Pos right() { return new Pos(y, x+1); } ................................................................................ 41 41 42 42 class Water 43 43 { 44 44 public immutable int base, pace; 45 45 mixin DeriveCreate; 46 46 mixin DeriveCompare; 47 47 mixin DeriveShow; 48 - Water clone() const { return new Water(base, pace); } 48 + Water clone() const { return cast(Water)this; } 49 49 50 50 static load(string[string] params) 51 51 { 52 52 return new Water( 53 53 params.get("Water", "0").to!int(), 54 54 params.get("Flooding", "0").to!int() 55 55 ); ................................................................................ 100 100 101 101 char[][] data; 102 102 Pos robot; 103 103 Pos lift; 104 104 int waterproof; 105 105 106 106 Map clone() const { return new Map(this); } 107 - this(const(Map) m) { 107 + this(in Map m) { 108 108 foreach(s; m.data) 109 109 this.data ~= s.dup; 110 110 this.robot = m.robot.clone(); 111 111 this.lift = m.lift.clone(); 112 112 this.waterproof = m.waterproof; 113 113 } 114 114 ................................................................................ 302 302 this(string[] raw_data, string[string] params) 303 303 { 304 304 this.map = Map.load(raw_data, params); 305 305 this.water = Water.load(params); 306 306 } 307 307 308 308 Game clone() const { return new Game(this); } 309 - this(const(Game) g) { 309 + this(in Game g) { 310 310 map = g.map.clone(); 311 311 water = g.water.clone(); 312 312 turn = g.turn; 313 313 dead = g.dead; 314 314 lambda = g.lambda; 315 315 exit_bonus = g.exit_bonus; 316 316 under_water = g.under_water;

Modified src/gui.d from [e56b333ba2eacac4] to [f5e549c65e603be1].

1 1 import dfl.all; 2 2 import util; 3 3 import game; 4 4 import driver; 5 5 6 6 class GUI(Solver) : Form, GameObserver 7 7 { 8 - this(const(Game) g) 8 + this(in Game g) 9 9 { 10 10 this.solver = new Solver(g); 11 11 setup_size(g.map.W, g.map.H); 12 12 setup_resources(); 13 13 setup_keyhandling(); 14 14 draw(g); 15 15 }

Modified src/output.d from [7fa423ba9f8ebe92] to [3f9e2911ee63dc4e].

1 1 import util; 2 2 import game; 3 3 import driver; 4 4 import core.stdc.signal; 5 5 6 6 class NilOutput : GameObserver 7 7 { 8 - this(const(Game) g) {} 9 - override void on_game_changed(char c, const(Game) g, bool finished) {} 8 + this(in Game g) {} 9 + override void on_game_changed(char c, in Game g, bool finished) {} 10 10 } 11 11 12 12 class StdOutput : GameObserver 13 13 { 14 - this(const(Game) g) {} 15 - override void on_game_changed(char c, const(Game) g, bool finished) 14 + this(in Game g) {} 15 + override void on_game_changed(char c, in Game g, bool finished) 16 16 { 17 17 stdout.write(c); 18 18 stdout.flush(); 19 19 } 20 20 } 21 21 22 22 class GuardedOutput : GameObserver 23 23 { 24 - this(const(Game) g) 24 + this(in Game g) 25 25 { 26 26 setup_sigint_handling(); 27 27 ideal_log ~= g.score_if_abort_now; 28 28 } 29 29 30 - override void on_game_changed(char c, const(Game) g, bool finished) 30 + override void on_game_changed(char c, in Game g, bool finished) 31 31 { 32 32 log ~= c; 33 33 score_log ~= g.score; 34 34 ideal_log ~= g.score_if_abort_now; 35 35 if(finished) 36 36 flush(); 37 37 }