summaryrefslogtreecommitdiff
path: root/src/simulation/elements
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-11-16 01:23:38 (GMT)
committer jacob1 <jfu614@gmail.com>2012-11-16 01:23:38 (GMT)
commit1e32c545d9ca7f960cdd6f77714c7b2761880478 (patch)
tree9800e5dbadcc53ed8f2c60762eb8b1abc88cb59f /src/simulation/elements
parentbf3d7e9ad76a9c06c2f7f5771311dc8ea481dd96 (diff)
downloadpowder-1e32c545d9ca7f960cdd6f77714c7b2761880478.zip
powder-1e32c545d9ca7f960cdd6f77714c7b2761880478.tar.gz
fix visual studio std::max problem
Diffstat (limited to 'src/simulation/elements')
-rw-r--r--src/simulation/elements/FIRE.cpp6
-rw-r--r--src/simulation/elements/FWRK.cpp2
-rw-r--r--src/simulation/elements/PLNT.cpp2
-rw-r--r--src/simulation/elements/WOOD.cpp2
4 files changed, 9 insertions, 3 deletions
diff --git a/src/simulation/elements/FIRE.cpp b/src/simulation/elements/FIRE.cpp
index f9313fa..538bd05 100644
--- a/src/simulation/elements/FIRE.cpp
+++ b/src/simulation/elements/FIRE.cpp
@@ -96,6 +96,12 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
(rt!=PT_SPNG || parts[r>>8].life==0) &&
sim->elements[rt].Flammable && (sim->elements[rt].Flammable + (int)(sim->pv[(y+ry)/CELL][(x+rx)/CELL]*10.0f))>(rand()%1000))
{
+ int j = sim->create_part(-1, x-1+rand()%3, y-1+rand()%3, PT_SMKE);
+ if (j != -1)
+ {
+ parts[r>>8].temp = restrict_flt(sim->elements[PT_FIRE].Temperature + (sim->elements[rt].Flammable/2), MIN_TEMP, MAX_TEMP);
+ parts[j].life = rand()%80+480;
+ }
sim->part_change_type(r>>8,x+rx,y+ry,PT_FIRE);
parts[r>>8].temp = restrict_flt(sim->elements[PT_FIRE].Temperature + (sim->elements[rt].Flammable/2), MIN_TEMP, MAX_TEMP);
parts[r>>8].life = rand()%80+180;
diff --git a/src/simulation/elements/FWRK.cpp b/src/simulation/elements/FWRK.cpp
index 6889f91..f05db69 100644
--- a/src/simulation/elements/FWRK.cpp
+++ b/src/simulation/elements/FWRK.cpp
@@ -61,7 +61,7 @@ int Element_FWRK::update(UPDATE_FUNC_ARGS)
gx += sinf(angle)*sim->elements[PT_FWRK].Gravity*0.5f;
gy += cosf(angle)*sim->elements[PT_FWRK].Gravity*0.5f;
}
- gmax = fmaxf(fabsf(gx), fabsf(gy));
+ gmax = std::max(fabsf(gx), fabsf(gy));
if (sim->eval_move(PT_FWRK, (int)(x-(gx/gmax)+0.5f), (int)(y-(gy/gmax)+0.5f), NULL))
{
multiplier = 15.0f/sqrtf(gx*gx+gy*gy);
diff --git a/src/simulation/elements/PLNT.cpp b/src/simulation/elements/PLNT.cpp
index 84a83c2..e7439d1 100644
--- a/src/simulation/elements/PLNT.cpp
+++ b/src/simulation/elements/PLNT.cpp
@@ -107,7 +107,7 @@ int Element_PLNT::update(UPDATE_FUNC_ARGS)
//#TPT-Directive ElementHeader Element_PLNT static int graphics(GRAPHICS_FUNC_ARGS)
int Element_PLNT::graphics(GRAPHICS_FUNC_ARGS)
{
- float maxtemp = fmax(cpart->tmp2, cpart->temp);
+ float maxtemp = std::max((float)cpart->tmp2, cpart->temp);
if (maxtemp > 300)
{
*colr += (int)restrict_flt((maxtemp-300)/5,0,58);
diff --git a/src/simulation/elements/WOOD.cpp b/src/simulation/elements/WOOD.cpp
index cbbab8f..134d827 100644
--- a/src/simulation/elements/WOOD.cpp
+++ b/src/simulation/elements/WOOD.cpp
@@ -49,7 +49,7 @@ Element_WOOD::Element_WOOD()
//#TPT-Directive ElementHeader Element_WOOD static int graphics(GRAPHICS_FUNC_ARGS)
int Element_WOOD::graphics(GRAPHICS_FUNC_ARGS)
{
- float maxtemp = fmax(cpart->tmp, cpart->temp);
+ float maxtemp = std::max((float)cpart->tmp, cpart->temp);
if (maxtemp > 400)
{
*colr -= (int)restrict_flt((maxtemp-400)/3,0,172);