Check-in [deca17f61a]
Not logged in
Overview
SHA1 Hash:deca17f61a928b584ff32d0e64aec107c1f9ddf7
Date: 2012-07-15 02:38:38
User: kinaba
Comment:trampoline map supported.
Timelines: family | ancestors | descendants | both | trunk
Diffs: redesign
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Modified src/game.d from [a105238bfa87f17a] to [1b2e4ad2dae20251].

98 98 return new Map(raw_data, params, trampo); 99 99 } 100 100 101 101 char[][] data; 102 102 Pos robot; 103 103 Pos lift; 104 104 int waterproof; 105 + // TODO: immutable 105 106 Pos[char] tr_target; 106 107 Pos[][char] tr_source; 107 108 108 109 Map clone() const { return new Map(this); } 109 110 this(in Map m) { 110 111 foreach(s; m.data) 111 112 this.data ~= s.dup; 112 113 this.robot = m.robot.clone(); 113 114 this.lift = m.lift.clone(); 114 115 this.waterproof = m.waterproof; 116 + this.tr_target = cast(Pos[char])m.tr_target; 117 + this.tr_source = cast(Pos[][char])m.tr_source; 115 118 } 116 119 117 120 this(string[] raw_data, string[string] params, char[char] trampo) 118 121 { 119 122 int width = 0; 120 123 foreach(r; raw_data) 121 124 width = max(width, r.length); ................................................................................ 141 144 tr_pos[c] = new Pos(y,x); 142 145 } 143 146 144 147 this.waterproof = params.get("Waterproof", "5").to!int(); 145 148 foreach(fr,to; trampo) { 146 149 tr_target[fr] = tr_pos[to]; 147 150 if(to !in tr_source) tr_source[to] = []; 148 - tr_source[to] ~= tr_pos[to]; 151 + tr_source[to] ~= tr_pos[fr]; 149 152 } 150 153 } 151 154 152 155 const @property { 153 156 int H() { return data.length; } 154 157 int W() { return data[0].length; } 155 158 } ................................................................................ 226 229 this[y+dy,x+dx]='R'; 227 230 robot = new Pos(y+dy,x+dx); 228 231 } else if(dy==0 && '*'==this[y+dy,x+dx] && ' '==this[y+dy*2,x+dx*2]) { 229 232 this[y,x]=' '; 230 233 this[y+dy,x+dx]='R'; 231 234 this[y+dy*2,x+dx*2]='*'; 232 235 robot = new Pos(y+dy,x+dx); 236 + } else if('A'<=this[y+dy,x+dx] && this[y+dy,x+dx]<='I') { 237 + this[y,x]=' '; 238 + Pos tp = tr_target[this[y+dy,x+dx]]; 239 + foreach(p; tr_source[this[tp]]) 240 + this[p] = ' '; 241 + this[tp] = 'R'; 242 + robot = tp; 233 243 } 234 244 if( update() ) 235 245 dead = true; 236 246 return tuple(lambda,dead); 237 247 } 238 248 239 249 bool update()

Modified src/gui.d from [89822443381424ce] to [32e0c6f4fbd77c98].

74 74 this.render['#'] = "■"; 75 75 this.render['*'] = "✹"; 76 76 this.render['.'] = "♒"; 77 77 this.render['\\'] = "λ"; 78 78 this.render['R'] = "☃"; 79 79 this.render['D'] = "☠"; 80 80 this.render['L'] = "☒"; 81 + this.render['O'] = "☐"; 81 82 foreach(c,tp; g.map.tr_target) { 82 83 char d = g.map[tp]; 83 84 this.render[c] = [cast(dchar)('㋀'+d-'1')].to!string(); 84 85 } 85 86 foreach(char c; '1'..':') this.render[c] = [cast(dchar)('㏠'+c-'1')].to!string(); 86 87 this.paint ~= (Control c, PaintEventArgs ev) { 87 88 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientSize.width,this.clientSize.height));