summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-12-18 02:11:33 (GMT)
committer jacob1 <jfu614@gmail.com>2012-12-18 02:11:33 (GMT)
commitb5de23433d6da22552a7927b5f70d2555af3ad38 (patch)
tree3d38f437df87678bdcc61625828390c6b6472497
parentf68cded2d2bd35989c5d81e710293ca2c96be36e (diff)
downloadpowder-b5de23433d6da22552a7927b5f70d2555af3ad38.zip
powder-b5de23433d6da22552a7927b5f70d2555af3ad38.tar.gz
fix '=' resetting air heat, fix uninitialized ambient heat setting, a few LOLZ / LOVE changes
-rw-r--r--src/simulation/Air.cpp6
-rw-r--r--src/simulation/Air.h1
-rw-r--r--src/simulation/Simulation.cpp20
-rw-r--r--src/simulation/Simulation.h4
-rw-r--r--src/simulation/elements/LOLZ.cpp11
-rw-r--r--src/simulation/elements/LOVE.cpp11
6 files changed, 21 insertions, 32 deletions
diff --git a/src/simulation/Air.cpp b/src/simulation/Air.cpp
index 10c4569..a6bd16c 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 936f54b..cad5606 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 afb50c5..bbd2324 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<YRES-4; ny++)
{
for (nx=0; nx<XRES-4; nx++)
@@ -3390,11 +3391,11 @@ void Simulation::update_particles_i(int start, int inc)
kill_part(r>>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 d0accad..e9a1504 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 a5e8371..f1d4167 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 3e7b3d4..c5ce789 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