diff options
| author | lieuwe <lieuwe@mint> | 2011-07-29 13:54:35 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-08-08 12:32:53 (GMT) |
| commit | 8f92829aab9e3c38f65e4f0f8d83a1293e237e54 (patch) | |
| tree | 37977e0490171f3580fa599d85deeb0c339295e6 /src/elements | |
| parent | 50c4bfd86d66c805097f4a12fb12ee8094cc2c5f (diff) | |
| download | powder-8f92829aab9e3c38f65e4f0f8d83a1293e237e54.zip powder-8f92829aab9e3c38f65e4f0f8d83a1293e237e54.tar.gz | |
IT WOOOOOORKS :D (fixed WIRE logic.)
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/wire.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/elements/wire.c b/src/elements/wire.c index da41bd1..abdb982 100644 --- a/src/elements/wire.c +++ b/src/elements/wire.c @@ -1,8 +1,7 @@ #include <element.h> int update_WIRE(UPDATE_FUNC_ARGS) { - int s,r,rx,ry,count; - printf("FUCK"); + int s,r,rx,ry,count; s=pmap[y][x]; /* 0: wire @@ -11,22 +10,23 @@ int update_WIRE(UPDATE_FUNC_ARGS) { tmp is previous state, ctype is current state */ - parts[s>>8].tmp=parts[s>>8].ctype; - if(parts[s>>8].tmp==1){parts[s>>8].ctype=2;} - if(parts[s>>8].tmp==2){parts[s>>8].ctype=0;} + //parts[s>>8].tmp=parts[s>>8].ctype; + parts[s>>8].ctype=0; + if(parts[s>>8].tmp==1){parts[s>>8].ctype=2; return 0;} + if(parts[s>>8].tmp==2){parts[s>>8].ctype=0; return 0;} + count=0; for(rx=-1; rx<2; rx++) for(ry=-1; ry<2; ry++) { - count=0; - if(x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && pmap[y+ry][x+rx] && rx==0 && ry==0 && (pmap[y+ry][x+rx]&0xFF)!=0xFF) + if(x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && pmap[y+ry][x+rx] && (rx!=0 || ry!=0) && (pmap[y+ry][x+rx]&0xFF)!=0xFF) { r = pmap[y+ry][x+rx]; - if((r&0xFF)==PT_SPRK){parts[s>>8].ctype=1;} + if((r&0xFF)==PT_SPRK){parts[s>>8].ctype=1; return 0;} if((r&0xFF)==PT_WIRE && parts[r>>8].tmp==1){count++;} } - if(count==1 || count==2) - parts[s>>8].ctype=1; } + if(count==1 || count==2) + parts[s>>8].ctype=1; return 0; } |
