summaryrefslogtreecommitdiff
path: root/src/powder.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-08-22 00:02:27 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-08-22 00:02:27 (GMT)
commitac6feec87451b9a28e3e1546c1d7421dc550c272 (patch)
tree29cd07936a6f2ebd3db1ec9cecfc3e82bfddad1d /src/powder.c
parent75cb924bd9d0525646bbdabf8959b58e149b7442 (diff)
parent54ee10936de1251d1a6be3c2f4024af1e8f4ac02 (diff)
downloadpowder-ac6feec87451b9a28e3e1546c1d7421dc550c272.zip
powder-ac6feec87451b9a28e3e1546c1d7421dc550c272.tar.gz
Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
Diffstat (limited to 'src/powder.c')
-rw-r--r--src/powder.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/powder.c b/src/powder.c
index bdbc1b7..e9b3e62 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -213,7 +213,7 @@ int try_move(int i, int x, int y, int nx, int ny)
if ((r & 0xFF) == PT_COAL || (r & 0xFF) == PT_BCOL)
parts[r>>8].temp = parts[i].temp;
- if ((r & 0xFF) < PT_NUM && ptypes[r&0xFF].hconduct)
+ if ((r & 0xFF) < PT_NUM && ptypes[r&0xFF].hconduct && ((r&0xFF)!=PT_HSWC||parts[r>>8].life==10) && (r&0xFF)!=PT_FILT)
parts[i].temp = parts[r>>8].temp = restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP);
}
if (parts[i].type==PT_NEUT && ((r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || (r&0xFF)==PT_BCLN || (r&0xFF)==PT_PBCN)) {
@@ -223,30 +223,19 @@ int try_move(int i, int x, int y, int nx, int ny)
if ((r&0xFF)==PT_PRTI && (parts[i].type==PT_PHOT || parts[i].type==PT_NEUT))
{
int nnx, count;
- if (nx-x<0)
+ for (count=0; count<8; count++)
{
- if (ny-y<0) count = 1;
- else if (ny-y==0) count = 2;
- else count = 3;
- }
- else if (nx-x==0)
- {
- if (ny-y<0) count = 4;
- else count = 5;
- }
- else
- {
- if (ny-y<0) count = 6;
- else if (ny-y==0) count = 7;
- else count = 8;
+ if (isign(x-nx)==isign(portal_rx[count]) && isign(y-ny)==isign(portal_ry[count]))
+ break;
}
+ count = count%8;
parts[r>>8].tmp = (int)((parts[r>>8].temp-73.15f)/100+1);
if (parts[r>>8].tmp>=CHANNELS) parts[r>>8].tmp = CHANNELS-1;
else if (parts[r>>8].tmp<0) parts[r>>8].tmp = 0;
for ( nnx=0; nnx<80; nnx++)
- if (!portalp[parts[r>>8].tmp][count-1][nnx].type)
+ if (!portalp[parts[r>>8].tmp][count][nnx].type)
{
- portalp[parts[r>>8].tmp][count-1][nnx] = parts[i];
+ portalp[parts[r>>8].tmp][count][nnx] = parts[i];
parts[i].type=PT_NONE;
break;
}