From 7856f727a5b7d88904752267d4a1decd66ecbf4e Mon Sep 17 00:00:00 2001 From: jacob1 Date: Mon, 13 May 2013 21:10:45 -0400 Subject: [PATCH] rename TUGN to TUNG (more popular spelling). Broken BRMT smelts back into TUGN --- src/gui/game/GameController.cpp | 2 +- src/simulation/Simulation.cpp | 157 +++++++++++------- src/simulation/elements/BRMT.cpp | 2 +- src/simulation/elements/DMG.cpp | 2 +- src/simulation/elements/SPRK.cpp | 2 +- .../elements/{TUGN.cpp => TUNG.cpp} | 27 +-- 6 files changed, 117 insertions(+), 75 deletions(-) rename src/simulation/elements/{TUGN.cpp => TUNG.cpp} (80%) diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index d7b808b20..fab4a5d4d 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -740,7 +740,7 @@ void GameController::ResetAir() sim->air->Clear(); for (int i = 0; i < NPART; i++) { - if (sim->parts[i].type == PT_QRTZ || sim->parts[i].type == PT_GLAS || sim->parts[i].type == PT_TUGN) + if (sim->parts[i].type == PT_QRTZ || sim->parts[i].type == PT_GLAS || sim->parts[i].type == PT_TUNG) { sim->parts[i].pavg[0] = sim->parts[i].pavg[1] = 0; } diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 50239b197..719bfdd66 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -2917,7 +2917,7 @@ int Simulation::create_part(int p, int x, int y, int tv) parts[i].dcolour = 0; parts[i].flags = 0; - if (t == PT_GLAS || t == PT_QRTZ || t == PT_TUGN) + if (t == PT_GLAS || t == PT_QRTZ || t == PT_TUNG) { parts[i].pavg[1] = pv[y/CELL][x/CELL]; } @@ -3793,7 +3793,7 @@ void Simulation::update_particles_i(int start, int inc) if (elements[t].Diffusion)//the random diffusion that gasses have { #ifdef REALISTIC - //The magic number controlls diffusion speed + //The magic number controls diffusion speed parts[i].vx += 0.05*sqrtf(parts[i].temp)*elements[t].Diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); parts[i].vy += 0.05*sqrtf(parts[i].temp)*elements[t].Diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); #else @@ -3836,13 +3836,11 @@ void Simulation::update_particles_i(int start, int inc) h_count = 0; #ifdef REALISTIC if (t&&(t!=PT_HSWC||parts[i].life==10)&&(elements[t].HeatConduct*gel_scale)) - { - float c_Cm = 0.0f; #else if (t&&(t!=PT_HSWC||parts[i].life==10)&&(elements[t].HeatConduct*gel_scale)>(rand()%250)) +#endif { float c_Cm = 0.0f; -#endif if (aheat_enable && !(elements[t].Properties&PROP_NOAMBHEAT)) { #ifdef REALISTIC @@ -3926,11 +3924,12 @@ void Simulation::update_particles_i(int start, int inc) if ((t==PT_ICEI || t==PT_SNOW) && (parts[i].ctype==0 || parts[i].ctype>=PT_NUM || parts[i].ctype==PT_ICEI || parts[i].ctype==PT_SNOW)) parts[i].ctype = PT_WATR; - if (ctemph>elements[t].HighTemperature&&elements[t].HighTemperatureTransition>-1) { + if (ctemph>elements[t].HighTemperature && elements[t].HighTemperatureTransition>-1) + { // particle type change due to high temperature #ifdef REALISTIC float dbt = ctempl - pt; - if (elements[t].HighTemperatureTransition!=PT_NUM) + if (elements[t].HighTemperatureTransition != PT_NUM) { if (platent[t] <= (c_heat - (elements[t].HighTemperature - dbt)*c_Cm)) { @@ -3943,14 +3942,18 @@ void Simulation::update_particles_i(int start, int inc) s = 0; } } - #else - if (elements[t].HighTemperatureTransition!=PT_NUM) +#else + if (elements[t].HighTemperatureTransition != PT_NUM) t = elements[t].HighTemperatureTransition; #endif - else if (t==PT_ICEI || t==PT_SNOW) { - if (parts[i].ctype-1) { + else if (t == PT_BRMT) + { + if (parts[i].ctype == PT_TUNG && ctemph <= 3695.0) + s = 0; + else + { + t = PT_LAVA; + parts[i].type = PT_TUNG; + } + } + else + s = 0; + } + else if (ctempl -1) + { // particle type change due to low temperature #ifdef REALISTIC float dbt = ctempl - pt; - if (elements[t].LowTemperatureTransition!=PT_NUM) + if (elements[t].LowTemperatureTransition != PT_NUM) { if (platent[elements[t].LowTemperatureTransition] >= (c_heat - (elements[t].LowTemperature - dbt)*c_Cm)) { @@ -4012,44 +4032,62 @@ void Simulation::update_particles_i(int start, int inc) } } #else - if (elements[t].LowTemperatureTransition!=PT_NUM) - t = elements[t].LowTemperatureTransition; + if (elements[t].LowTemperatureTransition != PT_NUM) + t = elements[t].LowTemperatureTransition; #endif - else if (t==PT_WTRV) { - if (pt<273.0f) t = PT_RIME; - else t = PT_DSTW; + else if (t == PT_WTRV) + { + if (pt < 273.0f) + t = PT_RIME; + else + t = PT_DSTW; } - else if (t==PT_LAVA) { - if (parts[i].ctype>0 && parts[i].ctype=elements[PT_BMTL].HighTemperature) s = 0; - else if ((parts[i].ctype==PT_VIBR || parts[i].ctype==PT_BVBR) && pt>=273.15f) s = 0; - else if (parts[i].ctype==PT_TUGN) { - if (pt>3695.0) s = 0; + else if (t == PT_LAVA) + { + if (parts[i].ctype>0 && parts[i].ctype=elements[PT_BMTL].HighTemperature) + s = 0; + else if ((parts[i].ctype==PT_VIBR || parts[i].ctype==PT_BVBR) && pt>=273.15f) + s = 0; + else if (parts[i].ctype==PT_TUNG) + { + if (pt>3695.0) + s = 0; } - else if (elements[parts[i].ctype].HighTemperatureTransition==PT_LAVA) { - if (pt>=elements[parts[i].ctype].HighTemperature) s = 0; + else if (elements[parts[i].ctype].HighTemperatureTransition == PT_LAVA) + { + if (pt >= elements[parts[i].ctype].HighTemperature) + s = 0; } - else if (pt>=973.0f) s = 0; // freezing point for lava with any other (not listed in ptransitions as turning into lava) ctype - if (s) { + else if (pt>=973.0f) + s = 0; // freezing point for lava with any other (not listed in ptransitions as turning into lava) ctype + if (s) + { t = parts[i].ctype; parts[i].ctype = PT_NONE; - if (t==PT_THRM) { + if (t == PT_THRM) + { parts[i].tmp = 0; t = PT_BMTL; } - if (t==PT_PLUT) + if (t == PT_PLUT) { parts[i].tmp = 0; t = PT_LAVA; } } } - else if (pt<973.0f) t = PT_STNE; - else s = 0; + else if (pt<973.0f) + t = PT_STNE; + else + s = 0; } - else s = 0; + else + s = 0; } - else s = 0; + else + s = 0; #ifdef REALISTIC pt = restrict_flt(pt, MIN_TEMP, MAX_TEMP); for (j=0; j<8; j++) @@ -4057,30 +4095,37 @@ void Simulation::update_particles_i(int start, int inc) parts[surround_hconduct[j]].temp = pt; } #endif - if (s) { // particle type change occurred - if (t==PT_ICEI||t==PT_LAVA||t==PT_SNOW) + if (s) // particle type change occurred + { + if (t==PT_ICEI || t==PT_LAVA || t==PT_SNOW) parts[i].ctype = parts[i].type; - if (!(t==PT_ICEI&&parts[i].ctype==PT_FRZW)) parts[i].life = 0; - if (elements[t].State==ST_GAS&&elements[parts[i].type].State!=ST_GAS) + if (!(t==PT_ICEI && parts[i].ctype==PT_FRZW)) + parts[i].life = 0; + if (elements[t].State==ST_GAS && elements[parts[i].type].State!=ST_GAS) pv[y/CELL][x/CELL] += 0.50f; + part_change_type(i,x,y,t); - if (t==PT_FIRE||t==PT_PLSM||t==PT_CFLM) + + if (t==PT_FIRE || t==PT_PLSM || t==PT_CFLM) parts[i].life = rand()%50+120; - if (t==PT_LAVA) { - if (parts[i].ctype==PT_BRMT) parts[i].ctype = PT_BMTL; - else if (parts[i].ctype==PT_SAND) parts[i].ctype = PT_GLAS; - else if (parts[i].ctype==PT_BGLA) parts[i].ctype = PT_GLAS; - else if (parts[i].ctype==PT_PQRT) parts[i].ctype = PT_QRTZ; + if (t == PT_LAVA) + { + if (parts[i].ctype == PT_BRMT) parts[i].ctype = PT_BMTL; + else if (parts[i].ctype == PT_SAND) parts[i].ctype = PT_GLAS; + else if (parts[i].ctype == PT_BGLA) parts[i].ctype = PT_GLAS; + else if (parts[i].ctype == PT_PQRT) parts[i].ctype = PT_QRTZ; parts[i].life = rand()%120+240; } - if (t==PT_NONE) { + if (t == PT_NONE) + { kill_part(i); goto killed; } } pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - if (t==PT_LAVA) { + if (t == PT_LAVA) + { parts[i].life = restrict_flt((parts[i].temp-700)/7, 0.0f, 400.0f); if (parts[i].ctype==PT_THRM&&parts[i].tmp>0) { @@ -4093,11 +4138,7 @@ void Simulation::update_particles_i(int start, int inc) parts[i].temp = MAX_TEMP; } } -#ifdef REALISTIC //needed to fix update_particles_i parsing } -#else - } -#endif else parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); } diff --git a/src/simulation/elements/BRMT.cpp b/src/simulation/elements/BRMT.cpp index cf4f99dfd..c2556ea75 100644 --- a/src/simulation/elements/BRMT.cpp +++ b/src/simulation/elements/BRMT.cpp @@ -40,7 +40,7 @@ Element_BRMT::Element_BRMT() LowTemperature = ITL; LowTemperatureTransition = NT; HighTemperature = 1273.0f; - HighTemperatureTransition = PT_LAVA; + HighTemperatureTransition = ST; Update = &Element_BRMT::update; diff --git a/src/simulation/elements/DMG.cpp b/src/simulation/elements/DMG.cpp index 4f1daafdb..4612d7754 100644 --- a/src/simulation/elements/DMG.cpp +++ b/src/simulation/elements/DMG.cpp @@ -92,7 +92,7 @@ int Element_DMG::update(UPDATE_FUNC_ARGS) sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BCOL); else if(t == PT_QRTZ) sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_PQRT); - else if(t == PT_TUGN) + else if(t == PT_TUNG) sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BRMT); } } diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index 15fd0e4bd..a8b40f7e4 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -158,7 +158,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS) } } break; - case PT_TUGN: + case PT_TUNG: if(parts[i].temp < 3595.0){ parts[i].temp += (rand()%20)-4; } diff --git a/src/simulation/elements/TUGN.cpp b/src/simulation/elements/TUNG.cpp similarity index 80% rename from src/simulation/elements/TUGN.cpp rename to src/simulation/elements/TUNG.cpp index 4fb803291..1666346be 100644 --- a/src/simulation/elements/TUGN.cpp +++ b/src/simulation/elements/TUNG.cpp @@ -1,10 +1,10 @@ #include "simulation/Elements.h" #include "simulation/Air.h" -//#TPT-Directive ElementClass Element_TUGN PT_TUGN 171 -Element_TUGN::Element_TUGN() +//#TPT-Directive ElementClass Element_TUNG PT_TUNG 171 +Element_TUNG::Element_TUNG() { - Identifier = "DEFAULT_PT_TUGN"; - Name = "TUGN"; + Identifier = "DEFAULT_PT_TUNG"; + Name = "TUNG"; Colour = PIXPACK(0x505050); MenuVisible = 1; MenuSection = SC_ELEC; @@ -29,7 +29,7 @@ Element_TUGN::Element_TUGN() Temperature = R_TEMP+0.0f +273.15f; HeatConduct = 251; - Description = "Brittle metal with a very high melting point."; + Description = "Tungsten. Brittle metal with a very high melting point."; State = ST_SOLID; Properties = TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC; @@ -45,15 +45,15 @@ Element_TUGN::Element_TUGN() /*HighTemperature = 3895.0f; HighTemperatureTransition = PT_LAVA;*/ - Update = &Element_TUGN::update; - Graphics = &Element_TUGN::graphics; + Update = &Element_TUNG::update; + Graphics = &Element_TUNG::graphics; } #define MELTING_POINT 3695.0 -//#TPT-Directive ElementHeader Element_TUGN static int update(UPDATE_FUNC_ARGS) -int Element_TUGN::update(UPDATE_FUNC_ARGS) +//#TPT-Directive ElementHeader Element_TUNG static int update(UPDATE_FUNC_ARGS) +int Element_TUNG::update(UPDATE_FUNC_ARGS) { bool splode = false; if(parts[i].temp > 2400.0) @@ -85,7 +85,7 @@ int Element_TUGN::update(UPDATE_FUNC_ARGS) else { sim->part_change_type(i, x, y, PT_LAVA); - parts[i].ctype = PT_TUGN; + parts[i].ctype = PT_TUNG; return 1; } if(splode) @@ -101,13 +101,14 @@ int Element_TUGN::update(UPDATE_FUNC_ARGS) if (parts[i].pavg[1]-parts[i].pavg[0] > 0.50f || parts[i].pavg[1]-parts[i].pavg[0] < -0.50f) { sim->part_change_type(i,x,y,PT_BRMT); + parts[i].ctype = PT_TUNG; } return 0; } -//#TPT-Directive ElementHeader Element_TUGN static int graphics(GRAPHICS_FUNC_ARGS) -int Element_TUGN::graphics(GRAPHICS_FUNC_ARGS) +//#TPT-Directive ElementHeader Element_TUNG static int graphics(GRAPHICS_FUNC_ARGS) +int Element_TUNG::graphics(GRAPHICS_FUNC_ARGS) { double startTemp = (MELTING_POINT - 1500.0); double tempOver = (((cpart->temp - startTemp)/1500.0)*M_PI) - (M_PI/2.0); @@ -129,4 +130,4 @@ int Element_TUGN::graphics(GRAPHICS_FUNC_ARGS) return 0; } -Element_TUGN::~Element_TUGN() {} +Element_TUNG::~Element_TUNG() {}