Fix MSVC not compiling

master
BlockMen 2017-04-14 03:41:30 +02:00 committed by darkrose
parent b924a6a5c3
commit 634e299e81
2 changed files with 11 additions and 2 deletions

View File

@ -35,6 +35,15 @@
#include "sound.h"
#ifndef SERVER
// For all MSVC versions before Visual Studio 2013
#if defined(_MSC_VER) && _MSC_VER < 1800
float roundf(float x)
{
return float((x < 0) ? (ceil((x) - 0.5)) : (floor((x) + 0.5)));
}
#endif
static const v3s16 corners[8] = {
v3s16(-1, 1, 1),
v3s16( 1, 1, 1),

View File

@ -312,7 +312,7 @@ bool UDPSocket::WaitData(int timeout_ms)
// Initialize time out struct
struct timeval tv;
tv.tv_sec = floor(timeout_ms / 1000) ;
tv.tv_sec = floor((float)timeout_ms / 1000) ;
tv.tv_usec = 1000 * (timeout_ms % 1000);
// select()
result = select(m_handle+1, &readset, NULL, NULL, &tv);
@ -574,7 +574,7 @@ bool TCPSocket::WaitData(int timeout_ms)
// Initialize time out struct
struct timeval tv;
tv.tv_sec = floor(timeout_ms / 1000);
tv.tv_sec = floor((float)timeout_ms / 1000);
tv.tv_usec = 1000 * (timeout_ms % 1000);
if (m_bstart != m_bend)