From 5b1210714d3909139886cc7f8a72291580fc0eeb Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 2 Feb 2011 17:37:59 +0000 Subject: More fixes Fix PHOT and FWRK. Fix QRTZ conductivity (broken by removing PROP_CONDUCTS) Add some things lost during rewrite: NTCT/PTCT not heated if INSL in the way; boiling point varies with pressure. diff --git a/src/elements/fwrk.c b/src/elements/fwrk.c index def28e4..06390c5 100644 --- a/src/elements/fwrk.c +++ b/src/elements/fwrk.c @@ -7,9 +7,9 @@ int update_FWRK(UPDATE_FUNC_ARGS) { np = create_part(-1, x , y-1 , PT_FWRK); if (np!=-1) { - parts[r>>8].vy = rand()%8-22; - parts[r>>8].vx = rand()%20-rand()%20; - parts[r>>8].life=rand()%15+25; + parts[np].vy = rand()%8-22; + parts[np].vx = rand()%20-rand()%20; + parts[np].life=rand()%15+25; kill_part(i); return 1; } @@ -33,13 +33,13 @@ int update_FWRK(UPDATE_FUNC_ARGS) { pv[y/CELL][x/CELL] += 2.00f*CFDS; if (np!=-1) { - parts[r>>8].vy = -(rand()%10-1); - parts[r>>8].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ; - parts[r>>8].life= rand()%37+18; - parts[r>>8].tmp=q; - parts[r>>8].flags=w; - parts[r>>8].ctype=e; - parts[r>>8].temp= rand()%20+6000; + parts[np].vy = -(rand()%10-1); + parts[np].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ; + parts[np].life= rand()%37+18; + parts[np].tmp=q; + parts[np].flags=w; + parts[np].ctype=e; + parts[np].temp= rand()%20+6000; } } } diff --git a/src/elements/phot.c b/src/elements/phot.c index 11585f9..59e9cd8 100644 --- a/src/elements/phot.c +++ b/src/elements/phot.c @@ -7,6 +7,7 @@ int update_PHOT(UPDATE_FUNC_ARGS) { for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>0 && x+rx>8)>=NPART || !r) continue; if ((r&0xFF)==PT_ISOZ && 5>(rand()%2000)) diff --git a/src/elements/sprk.c b/src/elements/sprk.c index ddac968..39f7497 100644 --- a/src/elements/sprk.c +++ b/src/elements/sprk.c @@ -97,12 +97,12 @@ int update_SPRK(UPDATE_FUNC_ARGS) { // ct = spark from material, rt = spark to material. Make conduct_sprk = 0 if conduction not allowed if (pavg == PT_INSL) conduct_sprk = 0; - if (!(ptypes[rt].properties&PROP_CONDUCTS||rt==PT_INST)) conduct_sprk = 0; + if (!(ptypes[rt].properties&PROP_CONDUCTS||rt==PT_INST||rt==PT_QRTZ)) conduct_sprk = 0; if (abs(rx)+abs(ry)>=4 &&ct!=PT_SWCH&&rt!=PT_SWCH) conduct_sprk = 0; - if (ct==PT_METL && (rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR||(rt==PT_SPRK&&(parts[r>>8].ctype==PT_NTCT||parts[r>>8].ctype==PT_PTCT)))) + if (ct==PT_METL && (rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR||(rt==PT_SPRK&&(parts[r>>8].ctype==PT_NTCT||parts[r>>8].ctype==PT_PTCT))) && pavg!=PT_INSL) { parts[r>>8].temp = 473.0f; if (rt==PT_NTCT||rt==PT_PTCT) diff --git a/src/powder.c b/src/powder.c index f8a5d3d..b9495a7 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1127,7 +1127,7 @@ int nearest_part(int ci, int t) void update_particles_i(pixel *vid, int start, int inc) { int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors; - float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp; + float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp, ctemph, ctempl; int fin_x, fin_y, clear_x, clear_y; float fin_xf, fin_yf, clear_xf, clear_yf; float nn, ct1, ct2, swappage; @@ -1522,8 +1522,16 @@ void update_particles_i(pixel *vid, int start, int inc) parts[surround_hconduct[j]].temp = pt; } + ctemph = ctempl = pt; + // change boiling point with pressure + if ((ptypes[t].state==ST_LIQUID && ptransitions[t].tht>-1 && ptransitions[t].tht-1 && ptransitions[t].tltptransitions[t].thv&&ptransitions[t].tht>-1) { + if (ctemph>ptransitions[t].thv&&ptransitions[t].tht>-1) { // particle type change due to high temperature if (ptransitions[t].tht!=PT_NUM) t = ptransitions[t].tht; @@ -1544,7 +1552,7 @@ void update_particles_i(pixel *vid, int start, int inc) else t = PT_WTRV; } else s = 0; - } else if (pt-1) { + } else if (ctempl-1) { // particle type change due to low temperature if (ptransitions[t].tlt!=PT_NUM) t = ptransitions[t].tlt; -- cgit v0.9.2-21-gd62e