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