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
- branch=trunk inherited from [16f0b5784f]
- sym-trunk inherited from [16f0b5784f]
Changes
Modified src/game.d from [a105238bfa87f17a] to [1b2e4ad2dae20251].
98 return new Map(raw_data, params, trampo); 98 return new Map(raw_data, params, trampo); 99 } 99 } 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 // TODO: immutable 105 Pos[char] tr_target; 106 Pos[char] tr_target; 106 Pos[][char] tr_source; 107 Pos[][char] tr_source; 107 108 108 Map clone() const { return new Map(this); } 109 Map clone() const { return new Map(this); } 109 this(in Map m) { 110 this(in Map m) { 110 foreach(s; m.data) 111 foreach(s; m.data) 111 this.data ~= s.dup; 112 this.data ~= s.dup; 112 this.robot = m.robot.clone(); 113 this.robot = m.robot.clone(); 113 this.lift = m.lift.clone(); 114 this.lift = m.lift.clone(); 114 this.waterproof = m.waterproof; 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 this(string[] raw_data, string[string] params, char[char] trampo) 120 this(string[] raw_data, string[string] params, char[char] trampo) 118 { 121 { 119 int width = 0; 122 int width = 0; 120 foreach(r; raw_data) 123 foreach(r; raw_data) 121 width = max(width, r.length); 124 width = max(width, r.length); ................................................................................................................................................................................ 141 tr_pos[c] = new Pos(y,x); 144 tr_pos[c] = new Pos(y,x); 142 } 145 } 143 146 144 this.waterproof = params.get("Waterproof", "5").to!int(); 147 this.waterproof = params.get("Waterproof", "5").to!int(); 145 foreach(fr,to; trampo) { 148 foreach(fr,to; trampo) { 146 tr_target[fr] = tr_pos[to]; 149 tr_target[fr] = tr_pos[to]; 147 if(to !in tr_source) tr_source[to] = []; 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 const @property { 155 const @property { 153 int H() { return data.length; } 156 int H() { return data.length; } 154 int W() { return data[0].length; } 157 int W() { return data[0].length; } 155 } 158 } ................................................................................................................................................................................ 226 this[y+dy,x+dx]='R'; 229 this[y+dy,x+dx]='R'; 227 robot = new Pos(y+dy,x+dx); 230 robot = new Pos(y+dy,x+dx); 228 } else if(dy==0 && '*'==this[y+dy,x+dx] && ' '==this[y+dy*2,x+dx 231 } else if(dy==0 && '*'==this[y+dy,x+dx] && ' '==this[y+dy*2,x+dx 229 this[y,x]=' '; 232 this[y,x]=' '; 230 this[y+dy,x+dx]='R'; 233 this[y+dy,x+dx]='R'; 231 this[y+dy*2,x+dx*2]='*'; 234 this[y+dy*2,x+dx*2]='*'; 232 robot = new Pos(y+dy,x+dx); 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 if( update() ) 244 if( update() ) 235 dead = true; 245 dead = true; 236 return tuple(lambda,dead); 246 return tuple(lambda,dead); 237 } 247 } 238 248 239 bool update() 249 bool update()
Modified src/gui.d from [89822443381424ce] to [32e0c6f4fbd77c98].
74 this.render['#'] = "■"; 74 this.render['#'] = "■"; 75 this.render['*'] = "✹"; 75 this.render['*'] = "✹"; 76 this.render['.'] = "♒"; 76 this.render['.'] = "♒"; 77 this.render['\\'] = "λ"; 77 this.render['\\'] = "λ"; 78 this.render['R'] = "☃"; 78 this.render['R'] = "☃"; 79 this.render['D'] = "☠"; 79 this.render['D'] = "☠"; 80 this.render['L'] = "☒"; 80 this.render['L'] = "☒"; > 81 this.render['O'] = "☐"; 81 foreach(c,tp; g.map.tr_target) { 82 foreach(c,tp; g.map.tr_target) { 82 char d = g.map[tp]; 83 char d = g.map[tp]; 83 this.render[c] = [cast(dchar)('㋀'+d-'1')].to!string(); 84 this.render[c] = [cast(dchar)('㋀'+d-'1')].to!string(); 84 } 85 } 85 foreach(char c; '1'..':') this.render[c] = [cast(dchar)('㏠'+c-'1 86 foreach(char c; '1'..':') this.render[c] = [cast(dchar)('㏠'+c-'1 86 this.paint ~= (Control c, PaintEventArgs ev) { 87 this.paint ~= (Control c, PaintEventArgs ev) { 87 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientS 88 graphicContext.copyTo(ev.graphics, Rect(0,0,this.clientS