fix visual studio std::max problem

This commit is contained in:
jacob1 2012-11-15 20:23:38 -05:00
parent bf3d7e9ad7
commit 1e32c545d9
5 changed files with 9 additions and 6 deletions

View File

@ -8,9 +8,6 @@
#include "Gravity.h"
#include "Misc.h"
#include "ElementGraphics.h"
#ifdef _MSC_VER
#include <Windows.h>
#endif
#define IPL -257.0f
#define IPH 257.0f

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);