fixed compiling using visual studio 2013 by renaming the round function

This commit is contained in:
SushiTee 2013-12-09 14:00:24 +01:00
parent 22fe75245c
commit 13a128ef8c
6 changed files with 14 additions and 14 deletions

View file

@ -20,7 +20,7 @@ inline float sign(float f)
return f<0.0f?-1.0f:1.0f; return f<0.0f?-1.0f:1.0f;
} }
inline int round(float f) inline int round_to_int(float f)
{ {
if(f > 0) if(f > 0)
return (int)(f+0.5f); return (int)(f+0.5f);

View file

@ -88,7 +88,7 @@ void CHud::RenderPauseTimer()
if(Seconds < 5) if(Seconds < 5)
str_format(aBuf, sizeof(aBuf), "%.1f", Seconds); str_format(aBuf, sizeof(aBuf), "%.1f", Seconds);
else else
str_format(aBuf, sizeof(aBuf), "%d", round(Seconds)); str_format(aBuf, sizeof(aBuf), "%d", round_to_int(Seconds));
} }
w = TextRender()->TextWidth(0, FontSize, aBuf, -1); w = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, aBuf, -1); TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, aBuf, -1);
@ -338,7 +338,7 @@ void CHud::RenderWarmupTimer()
if(Seconds < 5) if(Seconds < 5)
str_format(aBuf, sizeof(aBuf), "%.1f", Seconds); str_format(aBuf, sizeof(aBuf), "%.1f", Seconds);
else else
str_format(aBuf, sizeof(aBuf), "%d", round(Seconds)); str_format(aBuf, sizeof(aBuf), "%d", round_to_int(Seconds));
} }
w = TextRender()->TextWidth(0, FontSize, aBuf, -1); w = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, aBuf, -1); TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, aBuf, -1);

View file

@ -25,9 +25,9 @@ public:
CCollision(); CCollision();
void Init(class CLayers *pLayers); void Init(class CLayers *pLayers);
bool CheckPoint(float x, float y) { return IsTileSolid(round(x), round(y)); } bool CheckPoint(float x, float y) { return IsTileSolid(round_to_int(x), round_to_int(y)); }
bool CheckPoint(vec2 Pos) { return CheckPoint(Pos.x, Pos.y); } bool CheckPoint(vec2 Pos) { return CheckPoint(Pos.x, Pos.y); }
int GetCollisionAt(float x, float y) { return GetTile(round(x), round(y)); } int GetCollisionAt(float x, float y) { return GetTile(round_to_int(x), round_to_int(y)); }
int GetWidth() { return m_Width; }; int GetWidth() { return m_Width; };
int GetHeight() { return m_Height; }; int GetHeight() { return m_Height; };
int IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision); int IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision);

View file

@ -250,7 +250,7 @@ void CLayerTiles::BrushFlipY()
void CLayerTiles::BrushRotate(float Amount) void CLayerTiles::BrushRotate(float Amount)
{ {
int Rotation = (round(360.0f*Amount/(pi*2))/90)%4; // 0=0°, 1=90°, 2=180°, 3=270° int Rotation = (round_to_int(360.0f*Amount/(pi*2))/90)%4; // 0=0°, 1=90°, 2=180°, 3=270°
if(Rotation < 0) if(Rotation < 0)
Rotation +=4; Rotation +=4;

View file

@ -403,15 +403,15 @@ void CCharacterCore::Move()
void CCharacterCore::Write(CNetObj_CharacterCore *pObjCore) void CCharacterCore::Write(CNetObj_CharacterCore *pObjCore)
{ {
pObjCore->m_X = round(m_Pos.x); pObjCore->m_X = round_to_int(m_Pos.x);
pObjCore->m_Y = round(m_Pos.y); pObjCore->m_Y = round_to_int(m_Pos.y);
pObjCore->m_VelX = round(m_Vel.x*256.0f); pObjCore->m_VelX = round_to_int(m_Vel.x*256.0f);
pObjCore->m_VelY = round(m_Vel.y*256.0f); pObjCore->m_VelY = round_to_int(m_Vel.y*256.0f);
pObjCore->m_HookState = m_HookState; pObjCore->m_HookState = m_HookState;
pObjCore->m_HookTick = m_HookTick; pObjCore->m_HookTick = m_HookTick;
pObjCore->m_HookX = round(m_HookPos.x); pObjCore->m_HookX = round_to_int(m_HookPos.x);
pObjCore->m_HookY = round(m_HookPos.y); pObjCore->m_HookY = round_to_int(m_HookPos.y);
pObjCore->m_HookedPlayer = m_HookedPlayer; pObjCore->m_HookedPlayer = m_HookedPlayer;
pObjCore->m_Jumped = m_Jumped; pObjCore->m_Jumped = m_Jumped;
pObjCore->m_Direction = m_Direction; pObjCore->m_Direction = m_Direction;

View file

@ -52,6 +52,6 @@ int CEntity::NetworkClipped(int SnappingClient, vec2 CheckPos)
bool CEntity::GameLayerClipped(vec2 CheckPos) bool CEntity::GameLayerClipped(vec2 CheckPos)
{ {
return round(CheckPos.x)/32 < -200 || round(CheckPos.x)/32 > GameServer()->Collision()->GetWidth()+200 || return round_to_int(CheckPos.x)/32 < -200 || round_to_int(CheckPos.x)/32 > GameServer()->Collision()->GetWidth()+200 ||
round(CheckPos.y)/32 < -200 || round(CheckPos.y)/32 > GameServer()->Collision()->GetHeight()+200 ? true : false; round_to_int(CheckPos.y)/32 < -200 || round_to_int(CheckPos.y)/32 > GameServer()->Collision()->GetHeight()+200 ? true : false;
} }