From fc4836e69b14b413315deb67c349b7e2badb9c2b Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Wed, 12 Oct 2011 23:58:56 +0800 Subject: [PATCH] Don't heat elements which don't conduct heat --- src/elements/dest.c | 2 +- src/elements/emp.c | 2 +- src/elements/ligh.c | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/elements/dest.c b/src/elements/dest.c index a50dfaa6f..17ea2fead 100644 --- a/src/elements/dest.c +++ b/src/elements/dest.c @@ -43,7 +43,7 @@ int update_DEST(UPDATE_FUNC_ARGS) { } else { - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+10000.0f, MIN_TEMP, MAX_TEMP); + if (ptypes[r&0xFF].hconduct) parts[r>>8].temp = restrict_flt(parts[r>>8].temp+10000.0f, MIN_TEMP, MAX_TEMP); } int topv=pv[y/CELL][x/CELL]/9+parts[r>>8].temp/900; if (topv>40.0f) diff --git a/src/elements/emp.c b/src/elements/emp.c index 96d1a6d0a..b90fa86b4 100644 --- a/src/elements/emp.c +++ b/src/elements/emp.c @@ -35,7 +35,7 @@ int update_EMP(UPDATE_FUNC_ARGS) { parts[r].ctype==PT_NTCT || parts[r].ctype==PT_INST || parts[r].ctype==PT_SWCH) || t==PT_WIRE || t==PT_SWCH) { is_elec=1; - if (rand()%100==0) + if (ptypes[parts[r].type].hconduct && rand()%100==0) parts[r].temp = restrict_flt(parts[r].temp+3000.0f, MIN_TEMP, MAX_TEMP); if (rand()%80==0) part_change_type(r, rx, ry, PT_BREC); diff --git a/src/elements/ligh.c b/src/elements/ligh.c index f3eb31663..1d38a6d40 100644 --- a/src/elements/ligh.c +++ b/src/elements/ligh.c @@ -114,12 +114,12 @@ int update_LIGH(UPDATE_FUNC_ARGS) parts[r>>8].life = 4; pv[y/CELL][x/CELL] += powderful/1200; - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/20, MIN_TEMP, MAX_TEMP); + if (ptypes[r&0xFF].hconduct) parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/20, MIN_TEMP, MAX_TEMP); } else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT) { pv[y/CELL][x/CELL] += powderful/110; - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/1.5, MIN_TEMP, MAX_TEMP); + if (ptypes[r&0xFF].hconduct) parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/1.5, MIN_TEMP, MAX_TEMP); } if ((r&0xFF)==PT_DEUT || (r&0xFF)==PT_PLUT) { @@ -134,10 +134,13 @@ int update_LIGH(UPDATE_FUNC_ARGS) } } } - if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT) - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/16, MIN_TEMP, MAX_TEMP); - else - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/70, MIN_TEMP, MAX_TEMP); + if (ptypes[r&0xFF].hconduct) + { + if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT) + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/16, MIN_TEMP, MAX_TEMP); + else + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/70, MIN_TEMP, MAX_TEMP); + } } } if (parts[i].tmp2==3)