Differences From Artifact [17dbdc662950a670]:
- File
src/game.d
- 2012-07-14 13:45:03 - part of checkin [62a5c6c47f] on branch trunk - Correctly implemented below-rock avoider. (user: kinaba) [annotate]
To Artifact [3baab0ddf11cca7d]:
- File
src/game.d
- 2012-07-14 14:22:32 - part of checkin [a0c3529225] on branch trunk - code cleanup (user: kinaba) [annotate]
- 2012-07-14 16:58:31 - part of checkin [b1ce0206cd] on branch trunk - Revert. (user: kinaba) [annotate]
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;