From b5de23433d6da22552a7927b5f70d2555af3ad38 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Mon, 17 Dec 2012 21:11:33 -0500 Subject: [PATCH] fix '=' resetting air heat, fix uninitialized ambient heat setting, a few LOLZ / LOVE changes --- src/simulation/Air.cpp | 6 +++++- src/simulation/Air.h | 1 + src/simulation/Simulation.cpp | 20 +++++++++++--------- src/simulation/Simulation.h | 4 ---- src/simulation/elements/LOLZ.cpp | 11 ++--------- src/simulation/elements/LOVE.cpp | 11 ++--------- 6 files changed, 21 insertions(+), 32 deletions(-) diff --git a/src/simulation/Air.cpp b/src/simulation/Air.cpp index 10c45690d..a6bd16c63 100644 --- a/src/simulation/Air.cpp +++ b/src/simulation/Air.cpp @@ -41,12 +41,16 @@ void Air::make_kernel(void) //used for velocity void Air::Clear() { - std::fill(&hv[0][0], &hv[0][0]+((XRES/CELL)*(YRES/CELL)), 273.15f + 22.0f); std::fill(&pv[0][0], &pv[0][0]+((XRES/CELL)*(YRES/CELL)), 0.0f); std::fill(&vy[0][0], &vy[0][0]+((XRES/CELL)*(YRES/CELL)), 0.0f); std::fill(&vx[0][0], &vx[0][0]+((XRES/CELL)*(YRES/CELL)), 0.0f); } +void Air::ClearAirH() +{ + std::fill(&hv[0][0], &hv[0][0]+((XRES/CELL)*(YRES/CELL)), 273.15f + 22.0f); +} + void Air::update_airh(void) { int x, y, i, j; diff --git a/src/simulation/Air.h b/src/simulation/Air.h index 936f54b92..cad560659 100644 --- a/src/simulation/Air.h +++ b/src/simulation/Air.h @@ -30,6 +30,7 @@ public: void update_airh(void); void update_air(void); void Clear(); + void ClearAirH(); void Invert(); Air(Simulation & sim); }; diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index afb50c57f..bbd2324a9 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -1976,7 +1976,10 @@ void Simulation::clear_sim(void) if(grav) grav->Clear(); if(air) + { air->Clear(); + air->ClearAirH(); + } SetEdgeMode(edgeMode); } void Simulation::init_can_move() @@ -3372,11 +3375,9 @@ void Simulation::update_particles_i(int start, int inc) } } - if (ISLOVE || ISLOLZ) //LOVE and LOLZ element handling + if (elementCount[PT_LOVE] > 0 || elementCount[PT_LOLZ] > 0) //LOVE and LOLZ element handling { int nx, nnx, ny, nny, r, rt; - ISLOVE = 0; - ISLOLZ = 0; for (ny=0; ny>8); else if (parts[r>>8].type==PT_LOVE) { - love[nx/9][ny/9] = 1; + Element_LOVE::love[nx/9][ny/9] = 1; } else if (parts[r>>8].type==PT_LOLZ) { - lolz[nx/9][ny/9] = 1; + Element_LOLZ::lolz[nx/9][ny/9] = 1; } } } @@ -3402,7 +3403,7 @@ void Simulation::update_particles_i(int start, int inc) { for (ny=9; ny<=YRES-7; ny++) { - if (love[nx/9][ny/9]==1) + if (Element_LOVE::love[nx/9][ny/9]==1) { for ( nnx=0; nnx<9; nnx++) for ( nny=0; nny<9; nny++) @@ -3419,8 +3420,8 @@ void Simulation::update_particles_i(int start, int inc) } } } - love[nx/9][ny/9]=0; - if (lolz[nx/9][ny/9]==1) + Element_LOVE::love[nx/9][ny/9]=0; + if (Element_LOLZ::lolz[nx/9][ny/9]==1) { for ( nnx=0; nnx<9; nnx++) for ( nny=0; nny<9; nny++) @@ -3438,7 +3439,7 @@ void Simulation::update_particles_i(int start, int inc) } } } - lolz[nx/9][ny/9]=0; + Element_LOLZ::lolz[nx/9][ny/9]=0; } } } @@ -4805,6 +4806,7 @@ Simulation::Simulation(): vy = air->vy; pv = air->pv; hv = air->hv; + aheat_enable = false; int menuCount; menu_section * msectionsT = LoadMenus(menuCount); diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h index d0accad67..e9a1504e5 100644 --- a/src/simulation/Simulation.h +++ b/src/simulation/Simulation.h @@ -118,10 +118,6 @@ public: int pretty_powder; int sandcolour; int sandcolour_frame; - bool ISLOVE; - int love[XRES/9][YRES/9]; - bool ISLOLZ; - int lolz[XRES/9][YRES/9]; int Load(GameSave * save); int Load(int x, int y, GameSave * save); diff --git a/src/simulation/elements/LOLZ.cpp b/src/simulation/elements/LOLZ.cpp index a5e837183..f1d4167ca 100644 --- a/src/simulation/elements/LOLZ.cpp +++ b/src/simulation/elements/LOLZ.cpp @@ -42,8 +42,6 @@ Element_LOLZ::Element_LOLZ() HighTemperature = ITH; HighTemperatureTransition = NT; - Update = &Element_LOLZ::update; - } //#TPT-Directive ElementHeader Element_LOLZ static int RuleTable[9][9] @@ -60,12 +58,7 @@ int Element_LOLZ::RuleTable[9][9] = {0,1,0,0,0,0,0,1,0}, }; -//#TPT-Directive ElementHeader Element_LOLZ static int update(UPDATE_FUNC_ARGS) -int Element_LOLZ::update(UPDATE_FUNC_ARGS) - { - sim->ISLOLZ = true; - return 0; -} - +//#TPT-Directive ElementHeader Element_LOLZ static int lolz[XRES/9][YRES/9]; +int Element_LOLZ::lolz[XRES/9][YRES/9]; Element_LOLZ::~Element_LOLZ() {} \ No newline at end of file diff --git a/src/simulation/elements/LOVE.cpp b/src/simulation/elements/LOVE.cpp index 3e7b3d400..c5ce789a1 100644 --- a/src/simulation/elements/LOVE.cpp +++ b/src/simulation/elements/LOVE.cpp @@ -42,8 +42,6 @@ Element_LOVE::Element_LOVE() HighTemperature = ITH; HighTemperatureTransition = NT; - Update = &Element_LOVE::update; - } //#TPT-Directive ElementHeader Element_LOVE static int RuleTable[9][9] @@ -60,12 +58,7 @@ int Element_LOVE::RuleTable[9][9] = {0,0,1,1,0,0,0,0,0}, }; -//#TPT-Directive ElementHeader Element_LOVE static int update(UPDATE_FUNC_ARGS) -int Element_LOVE::update(UPDATE_FUNC_ARGS) - { - sim->ISLOVE = true; - return 0; -} - +//#TPT-Directive ElementHeader Element_LOVE static int love[XRES/9][YRES/9]; +int Element_LOVE::love[XRES/9][YRES/9]; Element_LOVE::~Element_LOVE() {} \ No newline at end of file