- updated for better handling of streflop on different platforms

- attempt for bugfix on windows when socket send buffer is continuously full
This commit is contained in:
Mark Vejvoda 2012-02-10 06:21:06 +00:00
parent b6473b69ab
commit 4ad42518c0
23 changed files with 181 additions and 124 deletions

View File

@ -83,24 +83,34 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
ENDIF() ENDIF()
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
IF(NOT MAX_SSE_LEVEL_DESIRED) #MESSAGE(STATUS "*TEST: Checking for max SSE LEVEL [${MAX_SSE_LEVEL_DESIRED}]")
SET(MAX_SSE_LEVEL_DESIRED "1" CACHE STRING "Set the max SSE level to use if supported (0-3)" FORCE)
IF(NOT STREFLOP_SOFTWRAPPER_FORCE)
SET(STREFLOP_SOFTWRAPPER_FORCE "0" CACHE STRING "Set the streflop library to be forced to use the software emulator")
ENDIF()
IF(NOT MAX_SSE_LEVEL_DESIRED AND NOT STREFLOP_SOFTWRAPPER_FORCE)
SET(MAX_SSE_LEVEL_DESIRED "1" CACHE STRING "Set the max SSE level to use if supported (0-3)")
ENDIF() ENDIF()
MESSAGE(STATUS "*NOTE: Checking for max SSE LEVEL [${MAX_SSE_LEVEL_DESIRED}]") IF(NOT STREFLOP_SOFTWRAPPER_FORCE)
special_check_for_sse( ${MAX_SSE_LEVEL_DESIRED} ) MESSAGE(STATUS "*NOTE: Checking for max SSE LEVEL [${MAX_SSE_LEVEL_DESIRED}]")
special_check_for_sse( ${MAX_SSE_LEVEL_DESIRED} )
ENDIF()
OPTION(WANT_STREFLOP "use the library streflop" ON) OPTION(WANT_STREFLOP "use the library streflop" ON)
IF(WANT_STREFLOP) IF(WANT_STREFLOP)
ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32") ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32 -DN_SPECIALIZED=32")
IF(HAS_SSE_EXTENSIONS) IF(HAS_SSE_EXTENSIONS AND NOT ${MAX_SSE_LEVEL_DESIRED} MATCHES "0" AND NOT STREFLOP_SOFTWRAPPER_FORCE)
ADD_DEFINITIONS("-DSTREFLOP_SSE") ADD_DEFINITIONS("-DSTREFLOP_SSE")
MESSAGE(STATUS "*NOTE: using SSE for STREFLOP.") MESSAGE(STATUS "*NOTE: using SSE for STREFLOP.")
ELSE() ELSE()
special_check_for_x87() IF(NOT STREFLOP_SOFTWRAPPER_FORCE)
special_check_for_x87()
ENDIF()
IF(HAS_X87_SUPPORT) IF(HAS_X87_SUPPORT AND NOT STREFLOP_SOFTWRAPPER_FORCE)
ADD_DEFINITIONS("-DSTREFLOP_X87") ADD_DEFINITIONS("-DSTREFLOP_X87")
MESSAGE(STATUS "*NOTE: using X87 for STREFLOP.") MESSAGE(STATUS "*NOTE: using X87 for STREFLOP.")
ELSE() ELSE()

View File

@ -70,13 +70,13 @@ macro(special_check_for_sse _max_sse_level_desired)
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
if(HAS_SSE3_EXTENSIONS AND (NOT ${_max_sse_level_desired} OR ${_max_sse_level_desired} MATCHES "3")) if(HAS_SSE3_EXTENSIONS AND (${_max_sse_level_desired} MATCHES "3"))
set(SSE_FLAGS "-msse3 -mfpmath=sse") set(SSE_FLAGS "-msse3 -mfpmath=sse")
message(STATUS "Found SSE3 extensions, using flags: ${SSE_FLAGS}") message(STATUS "Found SSE3 extensions, using flags: ${SSE_FLAGS}")
elseif(HAS_SSE2_EXTENSIONS AND (NOT ${_max_sse_level_desired} OR ${_max_sse_level_desired} MATCHES "2" OR ${_max_sse_level_desired} MATCHES "3")) elseif(HAS_SSE2_EXTENSIONS AND (${_max_sse_level_desired} MATCHES "2" OR ${_max_sse_level_desired} MATCHES "3"))
set(SSE_FLAGS "-msse2 -mfpmath=sse") set(SSE_FLAGS "-msse2 -mfpmath=sse")
message(STATUS "Found SSE2 extensions, using flags: ${SSE_FLAGS}") message(STATUS "Found SSE2 extensions, using flags: ${SSE_FLAGS}")
elseif(HAS_SSE_EXTENSIONS AND (NOT ${_max_sse_level_desired} OR ${_max_sse_level_desired} MATCHES "1" OR ${_max_sse_level_desired} MATCHES "2" OR ${_max_sse_level_desired} MATCHES "3")) elseif(HAS_SSE_EXTENSIONS AND (${_max_sse_level_desired} MATCHES "1" OR ${_max_sse_level_desired} MATCHES "2" OR ${_max_sse_level_desired} MATCHES "3"))
set(SSE_FLAGS "-msse -mfpmath=sse") set(SSE_FLAGS "-msse -mfpmath=sse")
message(STATUS "Found SSE extensions, using flags: ${SSE_FLAGS}") message(STATUS "Found SSE extensions, using flags: ${SSE_FLAGS}")
endif() endif()

View File

@ -135,7 +135,7 @@ void GameCamera::update(){
//free state //free state
if(state==sFree){ if(state==sFree){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if(streflop::fabs(rotate) == 1){ if(streflop::fabs(static_cast<streflop::Simple>(rotate)) == 1){
#else #else
if(fabs(rotate) == 1){ if(fabs(rotate) == 1){
#endif #endif
@ -216,9 +216,9 @@ Quad2i GameCamera::computeVisibleQuad() {
const float viewDegree = 180.f; const float viewDegree = 180.f;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
Vec2f v(streflop::sinf(degToRad(viewDegree - hAng)), streflop::cosf(degToRad(viewDegree - hAng))); Vec2f v(streflop::sinf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng))), streflop::cosf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng))));
Vec2f v1(streflop::sinf(degToRad(viewDegree - hAng - fov)), streflop::cosf(degToRad(viewDegree - hAng - fov))); Vec2f v1(streflop::sinf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng - fov))), streflop::cosf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng - fov))));
Vec2f v2(streflop::sinf(degToRad(viewDegree - hAng + fov)), streflop::cosf(degToRad(viewDegree - hAng + fov))); Vec2f v2(streflop::sinf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng + fov))), streflop::cosf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng + fov))));
#else #else
Vec2f v(sinf(degToRad(viewDegree - hAng)), cosf(degToRad(viewDegree - hAng))); Vec2f v(sinf(degToRad(viewDegree - hAng)), cosf(degToRad(viewDegree - hAng)));
Vec2f v1(sinf(degToRad(viewDegree - hAng - fov)), cosf(degToRad(viewDegree - hAng - fov))); Vec2f v1(sinf(degToRad(viewDegree - hAng - fov)), cosf(degToRad(viewDegree - hAng - fov)));
@ -318,8 +318,8 @@ void GameCamera::transitionVH(float v, float h) {
void GameCamera::zoom(float dist) { void GameCamera::zoom(float dist) {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float flatDist = dist * streflop::cosf(degToRad(vAng)); float flatDist = dist * streflop::cosf(static_cast<streflop::Simple>(degToRad(vAng)));
Vec3f offset(flatDist * streflop::sinf(degToRad(hAng)), dist * streflop::sinf(degToRad(vAng)), flatDist * -streflop::cosf(degToRad(hAng))); Vec3f offset(flatDist * streflop::sinf(static_cast<streflop::Simple>(degToRad(hAng))), dist * streflop::sinf(static_cast<streflop::Simple>(degToRad(vAng))), flatDist * -streflop::cosf(static_cast<streflop::Simple>(degToRad(hAng))));
#else #else
float flatDist = dist * cosf(degToRad(vAng)); float flatDist = dist * cosf(degToRad(vAng));
Vec3f offset(flatDist * sinf(degToRad(hAng)), dist * sinf(degToRad(vAng)), flatDist * -cosf(degToRad(hAng))); Vec3f offset(flatDist * sinf(degToRad(hAng)), dist * sinf(degToRad(vAng)), flatDist * -cosf(degToRad(hAng)));
@ -386,7 +386,7 @@ void GameCamera::clampAng() {
//move camera forwad but never change heightFactor //move camera forwad but never change heightFactor
void GameCamera::moveForwardH(float d, float response) { void GameCamera::moveForwardH(float d, float response) {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
Vec3f offset(streflop::sinf(degToRad(hAng)) * d, 0.f, -streflop::cosf(degToRad(hAng)) * d); Vec3f offset(streflop::sinf(static_cast<streflop::Simple>(degToRad(hAng))) * d, 0.f, -streflop::cosf(static_cast<streflop::Simple>(degToRad(hAng))) * d);
#else #else
Vec3f offset(sinf(degToRad(hAng)) * d, 0.f, -cosf(degToRad(hAng)) * d); Vec3f offset(sinf(degToRad(hAng)) * d, 0.f, -cosf(degToRad(hAng)) * d);
#endif #endif
@ -398,7 +398,7 @@ void GameCamera::moveForwardH(float d, float response) {
//move camera to a side but never change heightFactor //move camera to a side but never change heightFactor
void GameCamera::moveSideH(float d, float response){ void GameCamera::moveSideH(float d, float response){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
Vec3f offset(streflop::sinf(degToRad(hAng+90)) * d, 0.f, -streflop::cosf(degToRad(hAng+90)) * d); Vec3f offset(streflop::sinf(static_cast<streflop::Simple>(degToRad(hAng+90))) * d, 0.f, -streflop::cosf(static_cast<streflop::Simple>(degToRad(hAng+90))) * d);
#else #else
Vec3f offset(sinf(degToRad(hAng+90)) * d, 0.f, -cosf(degToRad(hAng+90)) * d); Vec3f offset(sinf(degToRad(hAng+90)) * d, 0.f, -cosf(degToRad(hAng+90)) * d);
#endif #endif

View File

@ -980,7 +980,7 @@ static Vec2i _unprojectMap(const Vec2i& pt,const GLdouble* model,const GLdouble*
w = start-plane; w = start-plane;
const float d = norm.x*u.x + norm.y*u.y + norm.z*u.z; const float d = norm.x*u.x + norm.y*u.y + norm.z*u.z;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if(streflop::fabs(d) < 0.00001) if(streflop::fabs(static_cast<streflop::Simple>(d)) < 0.00001)
#else #else
if(fabs(d) < 0.00001) if(fabs(d) < 0.00001)
#endif #endif
@ -996,28 +996,28 @@ static Vec2i _unprojectMap(const Vec2i& pt,const GLdouble* model,const GLdouble*
Vec2i pos; Vec2i pos;
if(strcmp(label,"tl") == 0) { if(strcmp(label,"tl") == 0) {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
pos = Vec2i(streflop::floor(i.x),streflop::floor(i.z)); pos = Vec2i(streflop::floor(static_cast<streflop::Simple>(i.x)),streflop::floor(static_cast<streflop::Simple>(i.z)));
#else #else
pos = Vec2i(floor(i.x),floor(i.z)); pos = Vec2i(floor(i.x),floor(i.z));
#endif #endif
} }
else if(strcmp(label,"tr") == 0) { else if(strcmp(label,"tr") == 0) {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
pos = Vec2i(streflop::ceil(i.x),streflop::floor(i.z)); pos = Vec2i(streflop::ceil(static_cast<streflop::Simple>(i.x)),streflop::floor(static_cast<streflop::Simple>(i.z)));
#else #else
pos = Vec2i(ceil(i.x),floor(i.z)); pos = Vec2i(ceil(i.x),floor(i.z));
#endif #endif
} }
else if(strcmp(label,"bl") == 0) { else if(strcmp(label,"bl") == 0) {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
pos = Vec2i(streflop::floor(i.x),streflop::ceil(i.z)); pos = Vec2i(streflop::floor(static_cast<streflop::Simple>(i.x)),streflop::ceil(static_cast<streflop::Simple>(i.z)));
#else #else
pos = Vec2i(floor(i.x),ceil(i.z)); pos = Vec2i(floor(i.x),ceil(i.z));
#endif #endif
} }
else if(strcmp(label,"br") == 0) { else if(strcmp(label,"br") == 0) {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
pos = Vec2i(streflop::ceil(i.x),streflop::ceil(i.z)); pos = Vec2i(streflop::ceil(static_cast<streflop::Simple>(i.x)),streflop::ceil(static_cast<streflop::Simple>(i.z)));
#else #else
pos = Vec2i(ceil(i.x),ceil(i.z)); pos = Vec2i(ceil(i.x),ceil(i.z));
#endif #endif
@ -1149,7 +1149,7 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
/* Normalize the result */ /* Normalize the result */
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
t = streflop::sqrt( frustum[0][0] * frustum[0][0] + frustum[0][1] * frustum[0][1] + frustum[0][2] * frustum[0][2] ); t = streflop::sqrt( static_cast<streflop::Simple>(frustum[0][0] * frustum[0][0] + frustum[0][1] * frustum[0][1] + frustum[0][2] * frustum[0][2]) );
#else #else
t = sqrt( frustum[0][0] * frustum[0][0] + frustum[0][1] * frustum[0][1] + frustum[0][2] * frustum[0][2] ); t = sqrt( frustum[0][0] * frustum[0][0] + frustum[0][1] * frustum[0][1] + frustum[0][2] * frustum[0][2] );
#endif #endif
@ -1172,7 +1172,7 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
/* Normalize the result */ /* Normalize the result */
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
t = streflop::sqrt( frustum[1][0] * frustum[1][0] + frustum[1][1] * frustum[1][1] + frustum[1][2] * frustum[1][2] ); t = streflop::sqrt( static_cast<streflop::Simple>(frustum[1][0] * frustum[1][0] + frustum[1][1] * frustum[1][1] + frustum[1][2] * frustum[1][2]) );
#else #else
t = sqrt( frustum[1][0] * frustum[1][0] + frustum[1][1] * frustum[1][1] + frustum[1][2] * frustum[1][2] ); t = sqrt( frustum[1][0] * frustum[1][0] + frustum[1][1] * frustum[1][1] + frustum[1][2] * frustum[1][2] );
#endif #endif
@ -1195,7 +1195,7 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
/* Normalize the result */ /* Normalize the result */
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
t = streflop::sqrt( frustum[2][0] * frustum[2][0] + frustum[2][1] * frustum[2][1] + frustum[2][2] * frustum[2][2] ); t = streflop::sqrt( static_cast<streflop::Simple>(frustum[2][0] * frustum[2][0] + frustum[2][1] * frustum[2][1] + frustum[2][2] * frustum[2][2]) );
#else #else
t = sqrt( frustum[2][0] * frustum[2][0] + frustum[2][1] * frustum[2][1] + frustum[2][2] * frustum[2][2] ); t = sqrt( frustum[2][0] * frustum[2][0] + frustum[2][1] * frustum[2][1] + frustum[2][2] * frustum[2][2] );
#endif #endif
@ -1218,7 +1218,7 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
/* Normalize the result */ /* Normalize the result */
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
t = streflop::sqrt( frustum[3][0] * frustum[3][0] + frustum[3][1] * frustum[3][1] + frustum[3][2] * frustum[3][2] ); t = streflop::sqrt( static_cast<streflop::Simple>(frustum[3][0] * frustum[3][0] + frustum[3][1] * frustum[3][1] + frustum[3][2] * frustum[3][2]) );
#else #else
t = sqrt( frustum[3][0] * frustum[3][0] + frustum[3][1] * frustum[3][1] + frustum[3][2] * frustum[3][2] ); t = sqrt( frustum[3][0] * frustum[3][0] + frustum[3][1] * frustum[3][1] + frustum[3][2] * frustum[3][2] );
#endif #endif
@ -1242,7 +1242,7 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
/* Normalize the result */ /* Normalize the result */
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
t = streflop::sqrt( frustum[4][0] * frustum[4][0] + frustum[4][1] * frustum[4][1] + frustum[4][2] * frustum[4][2] ); t = streflop::sqrt( static_cast<streflop::Simple>(frustum[4][0] * frustum[4][0] + frustum[4][1] * frustum[4][1] + frustum[4][2] * frustum[4][2]) );
#else #else
t = sqrt( frustum[4][0] * frustum[4][0] + frustum[4][1] * frustum[4][1] + frustum[4][2] * frustum[4][2] ); t = sqrt( frustum[4][0] * frustum[4][0] + frustum[4][1] * frustum[4][1] + frustum[4][2] * frustum[4][2] );
#endif #endif
@ -1266,7 +1266,7 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
/* Normalize the result */ /* Normalize the result */
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
t = streflop::sqrt( frustum[5][0] * frustum[5][0] + frustum[5][1] * frustum[5][1] + frustum[5][2] * frustum[5][2] ); t = streflop::sqrt( static_cast<streflop::Simple>(frustum[5][0] * frustum[5][0] + frustum[5][1] * frustum[5][1] + frustum[5][2] * frustum[5][2]) );
#else #else
t = sqrt( frustum[5][0] * frustum[5][0] + frustum[5][1] * frustum[5][1] + frustum[5][2] * frustum[5][2] ); t = sqrt( frustum[5][0] * frustum[5][0] + frustum[5][1] * frustum[5][1] + frustum[5][2] * frustum[5][2] );
#endif #endif
@ -2379,7 +2379,7 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
//printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str()); //printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str());
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
pos.y += (streflop::ceil((float)lineHeight - (float)h)); pos.y += (float)(streflop::ceil( static_cast<streflop::Simple>( ((float)lineHeight - (float)h)) ));
#else #else
pos.y += (ceil(lineHeight - h)); pos.y += (ceil(lineHeight - h));
#endif #endif
@ -5285,8 +5285,8 @@ void Renderer::renderMinimap(){
int x1 = 0; int x1 = 0;
int y1 = 0; int y1 = 0;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
x1 = mx + x + static_cast<int>(20*streflop::sin(ang-pi/5)); x1 = mx + x + static_cast<int>(20*streflop::sin(static_cast<streflop::Simple>(ang-pi/5)));
y1 = my + mh - (y-static_cast<int>(20*streflop::cos(ang-pi/5))); y1 = my + mh - (y-static_cast<int>(20*streflop::cos(static_cast<streflop::Simple>(ang-pi/5))));
#else #else
x1 = mx + x + static_cast<int>(20*sin(ang-pi/5)); x1 = mx + x + static_cast<int>(20*sin(ang-pi/5));
y1 = my + mh - (y-static_cast<int>(20*cos(ang-pi/5))); y1 = my + mh - (y-static_cast<int>(20*cos(ang-pi/5)));
@ -5295,8 +5295,8 @@ void Renderer::renderMinimap(){
int x2 = 0; int x2 = 0;
int y2 = 0; int y2 = 0;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
x2 = mx + x + static_cast<int>(20*streflop::sin(ang+pi/5)); x2 = mx + x + static_cast<int>(20*streflop::sin(static_cast<streflop::Simple>(ang+pi/5)));
y2 = my + mh - (y-static_cast<int>(20*streflop::cos(ang+pi/5))); y2 = my + mh - (y-static_cast<int>(20*streflop::cos(static_cast<streflop::Simple>(ang+pi/5))));
#else #else
x2 = mx + x + static_cast<int>(20*sin(ang+pi/5)); x2 = mx + x + static_cast<int>(20*sin(ang+pi/5));
y2 = my + mh - (y-static_cast<int>(20*cos(ang+pi/5))); y2 = my + mh - (y-static_cast<int>(20*cos(ang+pi/5)));
@ -6461,7 +6461,7 @@ float Renderer::computeMoonAngle(float time) {
Vec4f Renderer::computeSunPos(float time) { Vec4f Renderer::computeSunPos(float time) {
float ang= computeSunAngle(time); float ang= computeSunAngle(time);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
return Vec4f(-streflop::cos(ang)*sunDist, streflop::sin(ang)*sunDist, 0.f, 0.f); return Vec4f(-streflop::cos(static_cast<streflop::Simple>(ang))*sunDist, streflop::sin(static_cast<streflop::Simple>(ang))*sunDist, 0.f, 0.f);
#else #else
return Vec4f(-cos(ang)*sunDist, sin(ang)*sunDist, 0.f, 0.f); return Vec4f(-cos(ang)*sunDist, sin(ang)*sunDist, 0.f, 0.f);
#endif #endif
@ -6470,7 +6470,7 @@ Vec4f Renderer::computeSunPos(float time) {
Vec4f Renderer::computeMoonPos(float time) { Vec4f Renderer::computeMoonPos(float time) {
float ang= computeMoonAngle(time); float ang= computeMoonAngle(time);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
return Vec4f(-streflop::cos(ang)*moonDist, streflop::sin(ang)*moonDist, 0.f, 0.f); return Vec4f(-streflop::cos(static_cast<streflop::Simple>(ang))*moonDist, streflop::sin(static_cast<streflop::Simple>(ang))*moonDist, 0.f, 0.f);
#else #else
return Vec4f(-cos(ang)*moonDist, sin(ang)*moonDist, 0.f, 0.f); return Vec4f(-cos(ang)*moonDist, sin(ang)*moonDist, 0.f, 0.f);
#endif #endif
@ -7446,7 +7446,7 @@ void Renderer::renderUnitTitles3D(Font3D *font, Vec3f color) {
//get the screen coordinates //get the screen coordinates
Vec3f screenPos = unit->getScreenPos(); Vec3f screenPos = unit->getScreenPos();
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
renderText3D(unit->getCurrentUnitTitle(), font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false); renderText3D(unit->getCurrentUnitTitle(), font, color, streflop::fabs(static_cast<streflop::Simple>(screenPos.x)) + 5, streflop::fabs(static_cast<streflop::Simple>(screenPos.y)) + 5, false);
#else #else
renderText3D(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false); renderText3D(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
#endif #endif
@ -7457,7 +7457,7 @@ void Renderer::renderUnitTitles3D(Font3D *font, Vec3f color) {
string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]"; string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]";
Vec3f screenPos = unit->getScreenPos(); Vec3f screenPos = unit->getScreenPos();
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
renderText3D(str, font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false); renderText3D(str, font, color, streflop::fabs(static_cast<streflop::Simple>(screenPos.x)) + 5, streflop::fabs(static_cast<streflop::Simple>(screenPos.y)) + 5, false);
#else #else
renderText3D(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false); renderText3D(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
#endif #endif
@ -7508,7 +7508,7 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
//get the screen coordinates //get the screen coordinates
Vec3f screenPos = unit->getScreenPos(); Vec3f screenPos = unit->getScreenPos();
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
renderText(unit->getCurrentUnitTitle(), font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false); renderText(unit->getCurrentUnitTitle(), font, color, streflop::fabs(static_cast<streflop::Simple>(screenPos.x)) + 5, streflop::fabs(static_cast<streflop::Simple>(screenPos.y)) + 5, false);
#else #else
renderText(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false); renderText(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
#endif #endif
@ -7519,7 +7519,7 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]"; string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]";
Vec3f screenPos = unit->getScreenPos(); Vec3f screenPos = unit->getScreenPos();
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
renderText(str, font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false); renderText(str, font, color, streflop::fabs(static_cast<streflop::Simple>(screenPos.x)) + 5, streflop::fabs(static_cast<streflop::Simple>(screenPos.y)) + 5, false);
#else #else
renderText(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false); renderText(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
#endif #endif

View File

@ -625,7 +625,7 @@ void MenuStateJoinGame::connectToServer() {
for(time_t elapsedWait = time(NULL); for(time_t elapsedWait = time(NULL);
clientInterface->getIntroDone() == false && clientInterface->getIntroDone() == false &&
clientInterface->isConnected() && clientInterface->isConnected() &&
difftime(time(NULL),elapsedWait) <= 5;) { difftime(time(NULL),elapsedWait) <= 8;) {
if(clientInterface->isConnected()) { if(clientInterface->isConnected()) {
//update lobby //update lobby
clientInterface->updateLobby(); clientInterface->updateLobby();

View File

@ -1060,10 +1060,11 @@ bool MenuStateMasterserver::connectToServer(string ipString, int port) {
for(time_t elapsedWait = time(NULL); for(time_t elapsedWait = time(NULL);
clientInterface->getIntroDone() == false && clientInterface->getIntroDone() == false &&
clientInterface->isConnected() && clientInterface->isConnected() &&
difftime(time(NULL),elapsedWait) <= 3;) { difftime(time(NULL),elapsedWait) <= 8;) {
if(clientInterface->isConnected()) { if(clientInterface->isConnected()) {
//update lobby //update lobby
clientInterface->updateLobby(); clientInterface->updateLobby();
sleep(0);
} }
} }
if( clientInterface->isConnected() == true && if( clientInterface->isConnected() == true &&

View File

@ -184,7 +184,7 @@ void SoundRenderer::playFx(StaticSound *staticSound, Vec3f soundPos, Vec3f camPo
if(d < audibleDist){ if(d < audibleDist){
float vol= (1.f-d/audibleDist)*fxVolume; float vol= (1.f-d/audibleDist)*fxVolume;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float correctedVol= streflop::log10(streflop::log10(vol*9+1)*9+1); float correctedVol= streflop::log10(streflop::log10(static_cast<streflop::Simple>(vol*9+1))*9+1);
#else #else
float correctedVol= log10(log10(vol*9+1)*9+1); float correctedVol= log10(log10(vol*9+1)*9+1);
#endif #endif

View File

@ -574,7 +574,7 @@ void Unit::calculateXZRotation(){
const Vec3f normal= sc->getNormal(); const Vec3f normal= sc->getNormal();
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
targetRotationZ= radToDeg(streflop::atan2(abs(normal.x), abs(normal.y))); targetRotationZ= radToDeg(streflop::atan2(static_cast<streflop::Simple>(abs(normal.x)), static_cast<streflop::Simple>(abs(normal.y))));
#else #else
targetRotationZ= radToDeg(atan2(abs(normal.x), abs(normal.y))); targetRotationZ= radToDeg(atan2(abs(normal.x), abs(normal.y)));
#endif #endif
@ -585,7 +585,7 @@ void Unit::calculateXZRotation(){
targetRotationZ= targetRotationZ * -1; targetRotationZ= targetRotationZ * -1;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
targetRotationX= radToDeg(streflop::atan2(abs(normal.z), abs(normal.y))); targetRotationX= radToDeg(streflop::atan2(static_cast<streflop::Simple>(abs(normal.z)), static_cast<streflop::Simple>(abs(normal.y))));
#else #else
targetRotationX= radToDeg(atan2(abs(normal.z), abs(normal.y))); targetRotationX= radToDeg(atan2(abs(normal.z), abs(normal.y)));
#endif #endif
@ -946,7 +946,7 @@ void Unit::setTargetPos(const Vec2i &targetPos) {
Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y); Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
targetRotation= radToDeg(streflop::atan2(relPosf.x, relPosf.y)); targetRotation= radToDeg(streflop::atan2(static_cast<streflop::Simple>(relPosf.x), static_cast<streflop::Simple>(relPosf.y)));
#else #else
targetRotation= radToDeg(atan2(relPosf.x, relPosf.y)); targetRotation= radToDeg(atan2(relPosf.x, relPosf.y));
#endif #endif
@ -2581,7 +2581,7 @@ void Unit::updateTarget(){
Vec2i relPos= targetPos - pos; Vec2i relPos= targetPos - pos;
Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y); Vec2f relPosf= Vec2f((float)relPos.x, (float)relPos.y);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
targetRotation= radToDeg(streflop::atan2(relPosf.x, relPosf.y)); targetRotation= radToDeg(streflop::atan2(static_cast<streflop::Simple>(relPosf.x), static_cast<streflop::Simple>(relPosf.y)));
#else #else
targetRotation= radToDeg(atan2(relPosf.x, relPosf.y)); targetRotation= radToDeg(atan2(relPosf.x, relPosf.y));
#endif #endif

View File

@ -1537,8 +1537,8 @@ void Map::smoothSurface(Tileset *tileset) {
for (int k = -1; k <= 1; ++k) { for (int k = -1; k <= 1; ++k) {
for (int l = -1; l <= 1; ++l) { for (int l = -1; l <= 1; ++l) {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if (cliffLevel<=0.1f || cliffLevel > streflop::fabs(oldHeights[(j) * surfaceW + (i)] if (cliffLevel<=0.1f || cliffLevel > streflop::fabs(static_cast<streflop::Simple>(oldHeights[(j) * surfaceW + (i)]
- oldHeights[(j + k) * surfaceW + (i + l)])) { - oldHeights[(j + k) * surfaceW + (i + l)]))) {
#else #else
if (cliffLevel<=0.1f || cliffLevel > fabs(oldHeights[(j) * surfaceW + (i)] if (cliffLevel<=0.1f || cliffLevel > fabs(oldHeights[(j) * surfaceW + (i)]
- oldHeights[(j + k) * surfaceW + (i + l)])) { - oldHeights[(j + k) * surfaceW + (i + l)])) {
@ -1673,7 +1673,7 @@ bool PosCircularIterator::next(){
return false; return false;
} }
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
while(streflop::floor(pos.dist(center)) >= (radius+1) || !map->isInside(pos) || !map->isInsideSurface(map->toSurfCoords(pos)) ); while(streflop::floor(static_cast<streflop::Simple>(pos.dist(center))) >= (radius+1) || !map->isInside(pos) || !map->isInsideSurface(map->toSurfCoords(pos)) );
#else #else
while(floor(pos.dist(center)) >= (radius+1) || !map->isInside(pos) || !map->isInsideSurface(map->toSurfCoords(pos)) ); while(floor(pos.dist(center)) >= (radius+1) || !map->isInside(pos) || !map->isInsideSurface(map->toSurfCoords(pos)) );
#endif #endif

View File

@ -330,7 +330,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float rnd= streflop::fabs(random.randRange(-1.f, 1.f)); float rnd= streflop::fabs(static_cast<streflop::Simple>(random.randRange(-1.f, 1.f)));
#else #else
float rnd= fabs(random.randRange(-1.f, 1.f)); float rnd= fabs(random.randRange(-1.f, 1.f));
#endif #endif

View File

@ -2289,7 +2289,7 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
for(int j = center.y - range; j < center.y + range + size; ++j) { for(int j = center.y - range; j < center.y + range + size; ++j) {
//cells inside map and in range //cells inside map and in range
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if(map->isInside(i, j) && streflop::floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){ if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2f((float)i, (float)j)))) <= (range+1)){
#else #else
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){ if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){
#endif #endif
@ -2394,7 +2394,7 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
} }
else { else {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
currentDistance = streflop::floor(enemyFloatCenter.dist(attackWarnings[i]->attackPosition)); // no need for streflops here! currentDistance = streflop::floor(static_cast<streflop::Simple>(enemyFloatCenter.dist(attackWarnings[i]->attackPosition))); // no need for streflops here!
#else #else
currentDistance = floor(enemyFloatCenter.dist(attackWarnings[i]->attackPosition)); // no need for streflops here! currentDistance = floor(enemyFloatCenter.dist(attackWarnings[i]->attackPosition)); // no need for streflops here!
#endif #endif
@ -2473,7 +2473,7 @@ vector<Unit*> UnitUpdater::enemyUnitsOnRange(const Unit *unit,const AttackSkillT
for(int j = center.y - range; j < center.y + range + size; ++j) { for(int j = center.y - range; j < center.y + range + size; ++j) {
//cells inside map and in range //cells inside map and in range
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if(map->isInside(i, j) && streflop::floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){ if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2f((float)i, (float)j)))) <= (range+1)){
#else #else
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){ if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){
#endif #endif
@ -2527,7 +2527,7 @@ vector<Unit*> UnitUpdater::findUnitsInRange(const Unit *unit, int radius) {
for(int j = center.y - range; j < center.y + range + size; ++j) { for(int j = center.y - range; j < center.y + range + size; ++j) {
//cells inside map and in range //cells inside map and in range
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if(map->isInside(i, j) && streflop::floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){ if(map->isInside(i, j) && streflop::floor(static_cast<streflop::Simple>(floatCenter.dist(Vec2f((float)i, (float)j)))) <= (range+1)){
#else #else
if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){ if(map->isInside(i, j) && floor(floatCenter.dist(Vec2f((float)i, (float)j))) <= (range+1)){
#endif #endif

View File

@ -295,6 +295,8 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
set(CMAKE_REQUIRED_INCLUDES "${IRCCLIENT_INCLUDE_DIR}") set(CMAKE_REQUIRED_INCLUDES "${IRCCLIENT_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${IRCCLIENT_LIBRARY}") set(CMAKE_REQUIRED_LIBRARIES "${IRCCLIENT_LIBRARY}")
include(CheckCXXSourceRuns)
check_cxx_source_runs(" check_cxx_source_runs("
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -145,7 +145,7 @@ public:
float length() const{ float length() const{
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
return static_cast<float>(streflop::sqrt(static_cast<float>(x*x + y*y))); return static_cast<float>(streflop::sqrt(static_cast<streflop::Simple>(x*x + y*y)));
#else #else
return static_cast<float>(sqrt(static_cast<float>(x*x + y*y))); return static_cast<float>(sqrt(static_cast<float>(x*x + y*y)));
#endif #endif
@ -331,7 +331,7 @@ public:
float length() const{ float length() const{
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
return static_cast<float>(streflop::sqrt(x*x + y*y + z*z)); return static_cast<float>(streflop::sqrt(static_cast<streflop::Simple>(x*x + y*y + z*z)));
#else #else
return static_cast<float>(sqrt(x*x + y*y + z*z)); return static_cast<float>(sqrt(x*x + y*y + z*z));
#endif #endif

View File

@ -162,7 +162,7 @@ public:
static void setBlock(bool block, PLATFORM_SOCKET socket); static void setBlock(bool block, PLATFORM_SOCKET socket);
bool isReadable(); bool isReadable();
bool isWritable(); bool isWritable(struct timeval *timeVal=NULL);
bool isConnected(); bool isConnected();
static string getHostName(); static string getHostName();

View File

@ -245,7 +245,7 @@ void ParticleRendererGl::renderModel(GameParticleSystem *ps, ModelRenderer *mr){
Vec3f rotVector= Vec3f(0.f, 1.f, 0.f).cross(flatDirection); Vec3f rotVector= Vec3f(0.f, 1.f, 0.f).cross(flatDirection);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float angleV= radToDeg(streflop::atan2(flatDirection.length(), direction.y)) - 90.f; float angleV= radToDeg(streflop::atan2(static_cast<streflop::Simple>(flatDirection.length()), static_cast<streflop::Simple>(direction.y))) - 90.f;
#else #else
float angleV= radToDeg(atan2(flatDirection.length(), direction.y)) - 90.f; float angleV= radToDeg(atan2(flatDirection.length(), direction.y)) - 90.f;
#endif #endif
@ -253,7 +253,7 @@ void ParticleRendererGl::renderModel(GameParticleSystem *ps, ModelRenderer *mr){
glRotatef(angleV, rotVector.x, rotVector.y, rotVector.z); glRotatef(angleV, rotVector.x, rotVector.y, rotVector.z);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float angleH= radToDeg(streflop::atan2(direction.x, direction.z)); float angleH= radToDeg(streflop::atan2(static_cast<streflop::Simple>(direction.x), static_cast<streflop::Simple>(direction.z)));
#else #else
float angleH= radToDeg(atan2(direction.x, direction.z)); float angleH= radToDeg(atan2(direction.x, direction.z));
#endif #endif

View File

@ -344,19 +344,19 @@ void FireParticleSystem::initParticle(Particle *p, int particleIndex){
float ang= random.randRange(-2.0f * pi, 2.0f * pi); float ang= random.randRange(-2.0f * pi, 2.0f * pi);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float mod= streflop::fabsf(random.randRange(-radius, radius)); float mod= streflop::fabsf(static_cast<streflop::Simple>(random.randRange(-radius, radius)));
float x= streflop::sinf(ang)*mod; float x= streflop::sinf(static_cast<streflop::Simple>(ang))*mod;
float y= streflop::cosf(ang)*mod; float y= streflop::cosf(static_cast<streflop::Simple>(ang))*mod;
float radRatio= streflop::sqrtf(streflop::sqrtf(mod/radius)); float radRatio= streflop::sqrtf(static_cast<streflop::Simple>(mod/radius));
#else #else
float mod= fabsf(random.randRange(-radius, radius)); float mod= fabsf(random.randRange(-radius, radius));
float x= sinf(ang) * mod; float x= sinf(ang) * mod;
float y= cosf(ang) * mod; float y= cosf(ang) * mod;
float radRatio= sqrtf(sqrtf(mod / radius)); float radRatio= sqrtf((mod / radius));
#endif #endif
p->color= colorNoEnergy * 0.5f + colorNoEnergy * 0.5f * radRatio; p->color= colorNoEnergy * 0.5f + colorNoEnergy * 0.5f * radRatio;
@ -392,9 +392,9 @@ void FireParticleSystem::setRadius(float radius){
void FireParticleSystem::setWind(float windAngle, float windSpeed){ void FireParticleSystem::setWind(float windAngle, float windSpeed){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
this->windSpeed.x= streflop::sinf(degToRad(windAngle))*windSpeed; this->windSpeed.x= streflop::sinf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
this->windSpeed.y= 0.0f; this->windSpeed.y= 0.0f;
this->windSpeed.z= streflop::cosf(degToRad(windAngle))*windSpeed; this->windSpeed.z= streflop::cosf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
#else #else
this->windSpeed.x= sinf(degToRad(windAngle)) * windSpeed; this->windSpeed.x= sinf(degToRad(windAngle)) * windSpeed;
this->windSpeed.y= 0.0f; this->windSpeed.y= 0.0f;
@ -498,7 +498,7 @@ void GameParticleSystem::setTween(float relative,float absolute) {
} }
else { else {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if(streflop::fabs(absolute) <= 0.00001f){ if(streflop::fabs(static_cast<streflop::Simple>(absolute)) <= 0.00001f){
#else #else
if(fabs(absolute) <= 0.00001f){ if(fabs(absolute) <= 0.00001f){
#endif #endif
@ -506,7 +506,7 @@ void GameParticleSystem::setTween(float relative,float absolute) {
} }
else { else {
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
tween= streflop::fmod(absolute, modelCycle); tween= streflop::fmod(static_cast<streflop::Simple>(absolute), static_cast<streflop::Simple>(modelCycle));
#else #else
tween= fmod(absolute, modelCycle); tween= fmod(absolute, modelCycle);
#endif #endif
@ -628,11 +628,11 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
const float ang= random.randRange(-2.0f * pi, 2.0f * pi); const float ang= random.randRange(-2.0f * pi, 2.0f * pi);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
const float mod= streflop::fabsf(random.randRange(-radius, radius)); const float mod= streflop::fabsf(static_cast<streflop::Simple>(random.randRange(-radius, radius)));
const float radRatio= streflop::sqrtf(streflop::sqrtf(mod/radius)); const float radRatio= streflop::sqrtf(static_cast<streflop::Simple>(mod/radius));
#else #else
const float mod= fabsf(random.randRange(-radius, radius)); const float mod= fabsf(random.randRange(-radius, radius));
const float radRatio= sqrtf(sqrtf(mod / radius)); const float radRatio= sqrtf(mod / radius);
#endif #endif
p->color= color; p->color= color;
if(radiusBasedStartenergy == true){ if(radiusBasedStartenergy == true){
@ -663,8 +663,8 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
} break; } break;
case sLinear:{ case sLinear:{
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float x= streflop::sinf(ang)*mod; float x= streflop::sinf(static_cast<streflop::Simple>(ang))*mod;
float y= streflop::cosf(ang)*mod; float y= streflop::cosf(static_cast<streflop::Simple>(ang))*mod;
#else #else
float x= sinf(ang) * mod; float x= sinf(ang) * mod;
float y= cosf(ang) * mod; float y= cosf(ang) * mod;
@ -676,7 +676,7 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
} }
else{// rotate it according to rotation else{// rotate it according to rotation
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
p->pos= Vec3f(pos.x+x+offset.z*streflop::sinf(rad)+offset.x*streflop::cosf(rad), pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*streflop::cosf(rad)-offset.x*streflop::sinf(rad))); p->pos= Vec3f(pos.x+x+offset.z*streflop::sinf(static_cast<streflop::Simple>(rad))+offset.x*streflop::cosf(static_cast<streflop::Simple>(rad)), pos.y+random.randRange(-radius/2, radius/2)+offset.y, pos.z+y+(offset.z*streflop::cosf(static_cast<streflop::Simple>(rad))-offset.x*streflop::sinf(static_cast<streflop::Simple>(rad))));
#else #else
p->pos= Vec3f(pos.x + x + offset.z * sinf(rad) + offset.x * cosf(rad), pos.y + random.randRange(-radius / 2, p->pos= Vec3f(pos.x + x + offset.z * sinf(rad) + offset.x * cosf(rad), pos.y + random.randRange(-radius / 2,
radius / 2) + offset.y, pos.z + y + (offset.z * cosf(rad) - offset.x * sinf(rad))); radius / 2) + offset.y, pos.z + y + (offset.z * cosf(rad) - offset.x * sinf(rad)));
@ -687,7 +687,7 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
p->speed= p->speed * speed; p->speed= p->speed * speed;
if(relative && relativeDirection){ if(relative && relativeDirection){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
p->speed=Vec3f(p->speed.z*streflop::sinf(rad)+p->speed.x*streflop::cosf(rad),p->speed.y,(p->speed.z*streflop::cosf(rad)-p->speed.x*streflop::sinf(rad))); p->speed=Vec3f(p->speed.z*streflop::sinf(static_cast<streflop::Simple>(rad))+p->speed.x*streflop::cosf(static_cast<streflop::Simple>(rad)),p->speed.y,(p->speed.z*streflop::cosf(static_cast<streflop::Simple>(rad))-p->speed.x*streflop::sinf(static_cast<streflop::Simple>(rad))));
#else #else
p->speed= Vec3f(p->speed.z * sinf(rad) + p->speed.x * cosf(rad), p->speed.y, (p->speed.z * cosf(rad) p->speed= Vec3f(p->speed.z * sinf(rad) + p->speed.x * cosf(rad), p->speed.y, (p->speed.z * cosf(rad)
- p->speed.x * sinf(rad))); - p->speed.x * sinf(rad)));
@ -778,9 +778,9 @@ void UnitParticleSystem::updateParticle(Particle *p){
void UnitParticleSystem::setWind(float windAngle, float windSpeed){ void UnitParticleSystem::setWind(float windAngle, float windSpeed){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
this->windSpeed.x= streflop::sinf(degToRad(windAngle))*windSpeed; this->windSpeed.x= streflop::sinf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
this->windSpeed.y= 0.0f; this->windSpeed.y= 0.0f;
this->windSpeed.z= streflop::cosf(degToRad(windAngle))*windSpeed; this->windSpeed.z= streflop::cosf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
#else #else
this->windSpeed.x= sinf(degToRad(windAngle)) * windSpeed; this->windSpeed.x= sinf(degToRad(windAngle)) * windSpeed;
this->windSpeed.y= 0.0f; this->windSpeed.y= 0.0f;
@ -833,9 +833,9 @@ void RainParticleSystem::setRadius(float radius){
void RainParticleSystem::setWind(float windAngle, float windSpeed){ void RainParticleSystem::setWind(float windAngle, float windSpeed){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
this->windSpeed.x= streflop::sinf(degToRad(windAngle))*windSpeed; this->windSpeed.x= streflop::sinf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
this->windSpeed.y= 0.0f; this->windSpeed.y= 0.0f;
this->windSpeed.z= streflop::cosf(degToRad(windAngle))*windSpeed; this->windSpeed.z= streflop::cosf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
#else #else
this->windSpeed.x= sinf(degToRad(windAngle)) * windSpeed; this->windSpeed.x= sinf(degToRad(windAngle)) * windSpeed;
this->windSpeed.y= 0.0f; this->windSpeed.y= 0.0f;
@ -884,9 +884,9 @@ void SnowParticleSystem::setRadius(float radius){
void SnowParticleSystem::setWind(float windAngle, float windSpeed){ void SnowParticleSystem::setWind(float windAngle, float windSpeed){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
this->windSpeed.x= streflop::sinf(degToRad(windAngle))*windSpeed; this->windSpeed.x= streflop::sinf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
this->windSpeed.y= 0.0f; this->windSpeed.y= 0.0f;
this->windSpeed.z= streflop::cosf(degToRad(windAngle))*windSpeed; this->windSpeed.z= streflop::cosf(static_cast<streflop::Simple>(degToRad(windAngle)))*windSpeed;
#else #else
this->windSpeed.x= sinf(degToRad(windAngle)) * windSpeed; this->windSpeed.x= sinf(degToRad(windAngle)) * windSpeed;
this->windSpeed.y= 0.0f; this->windSpeed.y= 0.0f;
@ -950,7 +950,7 @@ void ProjectileParticleSystem::update(){
// ratio // ratio
float relative= clamp(currentVector.length() / targetVector.length(), 0.0f, 1.0f); float relative= clamp(currentVector.length() / targetVector.length(), 0.0f, 1.0f);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float absolute= clamp(streflop::fabs(currentVector.length()), 0.0f, 1.0f); float absolute= clamp(streflop::fabs(static_cast<streflop::Simple>(currentVector.length())), 0.0f, 1.0f);
#else #else
float absolute= clamp(fabs(currentVector.length()), 0.0f, 1.0f); float absolute= clamp(fabs(currentVector.length()), 0.0f, 1.0f);
#endif #endif
@ -975,8 +975,8 @@ void ProjectileParticleSystem::update(){
case tSpiral: { case tSpiral: {
pos= flatPos; pos= flatPos;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
pos+= xVector * streflop::cos(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale; pos+= xVector * streflop::cos(static_cast<streflop::Simple>(relative * trajectoryFrequency * targetVector.length())) * trajectoryScale;
pos+= yVector * streflop::sin(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale; pos+= yVector * streflop::sin(static_cast<streflop::Simple>(relative * trajectoryFrequency * targetVector.length())) * trajectoryScale;
#else #else
pos+= xVector * cos(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale; pos+= xVector * cos(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale;
pos+= yVector * sin(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale; pos+= yVector * sin(relative * trajectoryFrequency * targetVector.length()) * trajectoryScale;
@ -1017,7 +1017,7 @@ void ProjectileParticleSystem::update(){
void ProjectileParticleSystem::rotateChildren() { void ProjectileParticleSystem::rotateChildren() {
//### only on horizontal plane :( //### only on horizontal plane :(
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float rotation = streflop::atan2(direction.x, direction.z); float rotation = streflop::atan2(static_cast<streflop::Simple>(direction.x), static_cast<streflop::Simple>(direction.z));
#else #else
float rotation = atan2(direction.x, direction.z); float rotation = atan2(direction.x, direction.z);
#endif #endif

View File

@ -1173,11 +1173,11 @@ void Pixmap2D::splat(const Pixmap2D *leftUp, const Pixmap2D *rightUp, const Pixm
const float powFactor= 2.0f; const float powFactor= 2.0f;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
distLu= streflop::pow(distLu, powFactor); distLu= streflop::pow(static_cast<streflop::Simple>(distLu), static_cast<streflop::Simple>(powFactor));
distRu= streflop::pow(distRu, powFactor); distRu= streflop::pow(static_cast<streflop::Simple>(distRu), static_cast<streflop::Simple>(powFactor));
distLd= streflop::pow(distLd, powFactor); distLd= streflop::pow(static_cast<streflop::Simple>(distLd), static_cast<streflop::Simple>(powFactor));
distRd= streflop::pow(distRd, powFactor); distRd= streflop::pow(static_cast<streflop::Simple>(distRd), static_cast<streflop::Simple>(powFactor));
avg= streflop::pow(avg, powFactor); avg= streflop::pow(static_cast<streflop::Simple>(avg), static_cast<streflop::Simple>(powFactor));
#else #else
distLu= pow(distLu, powFactor); distLu= pow(distLu, powFactor);
distRu= pow(distRu, powFactor); distRu= pow(distRu, powFactor);

View File

@ -68,10 +68,10 @@ void Quaternion::setAddIdentity(){
void Quaternion::setAxisAngle(const AxisAngle &axisAngle){ void Quaternion::setAxisAngle(const AxisAngle &axisAngle){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
w= streflop::cosf(axisAngle.angle/2.0f); w= streflop::cosf(static_cast<streflop::Simple>(axisAngle.angle/2.0f));
v.x= axisAngle.axis.x * streflop::sinf(axisAngle.angle/2.0f); v.x= axisAngle.axis.x * streflop::sinf(static_cast<streflop::Simple>(axisAngle.angle/2.0f));
v.y= axisAngle.axis.y * streflop::sinf(axisAngle.angle/2.0f); v.y= axisAngle.axis.y * streflop::sinf(static_cast<streflop::Simple>(axisAngle.angle/2.0f));
v.z= axisAngle.axis.z * streflop::sinf(axisAngle.angle/2.0f); v.z= axisAngle.axis.z * streflop::sinf(static_cast<streflop::Simple>(axisAngle.angle/2.0f));
#else #else
w= cosf(axisAngle.angle/2.0f); w= cosf(axisAngle.angle/2.0f);
v.x= axisAngle.axis.x * sinf(axisAngle.angle/2.0f); v.x= axisAngle.axis.x * sinf(axisAngle.angle/2.0f);
@ -84,14 +84,14 @@ void Quaternion::setEuler(const EulerAngles &eulerAngles){
Quaternion qx, qy, qz, qr; Quaternion qx, qy, qz, qr;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
qx.w= streflop::cosf(eulerAngles.x/2.0f); qx.w= streflop::cosf(static_cast<streflop::Simple>(eulerAngles.x/2.0f));
qx.v= Vec3f(streflop::sinf(eulerAngles.x/2.0f), 0.0f, 0.0f); qx.v= Vec3f(streflop::sinf(static_cast<streflop::Simple>(eulerAngles.x/2.0f)), 0.0f, 0.0f);
qy.w= streflop::cosf(eulerAngles.y/2.0f); qy.w= streflop::cosf(static_cast<streflop::Simple>(eulerAngles.y/2.0f));
qy.v= Vec3f(0.0f, streflop::sinf(eulerAngles.y/2.0f), 0.0f); qy.v= Vec3f(0.0f, streflop::sinf(static_cast<streflop::Simple>(eulerAngles.y/2.0f)), 0.0f);
qz.w= streflop::cosf(eulerAngles.z/2.0f); qz.w= streflop::cosf(static_cast<streflop::Simple>(eulerAngles.z/2.0f));
qz.v= Vec3f(0.0f, 0.0f, streflop::sinf(eulerAngles.z/2.0f)); qz.v= Vec3f(0.0f, 0.0f, streflop::sinf(static_cast<streflop::Simple>(eulerAngles.z/2.0f)));
#else #else
qx.w= cosf(eulerAngles.x/2.0f); qx.w= cosf(eulerAngles.x/2.0f);
qx.v= Vec3f(sinf(eulerAngles.x/2.0f), 0.0f, 0.0f); qx.v= Vec3f(sinf(eulerAngles.x/2.0f), 0.0f, 0.0f);
@ -111,7 +111,7 @@ void Quaternion::setEuler(const EulerAngles &eulerAngles){
float Quaternion::length(){ float Quaternion::length(){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
return streflop::sqrt(w*w+v.x*v.x+v.y*v.y+v.z*v.z); return streflop::sqrt(static_cast<streflop::Simple>(w*w+v.x*v.x+v.y*v.y+v.z*v.z));
#else #else
return sqrt(w*w+v.x*v.x+v.y*v.y+v.z*v.z); return sqrt(w*w+v.x*v.x+v.y*v.y+v.z*v.z);
#endif #endif
@ -207,7 +207,7 @@ Matrix4f Quaternion::toMatrix4() const{
AxisAngle Quaternion::toAxisAngle() const{ AxisAngle Quaternion::toAxisAngle() const{
float scale= 1.0f/(v.x*v.x + v.y*v.y + v.z*v.z); float scale= 1.0f/(v.x*v.x + v.y*v.y + v.z*v.z);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
return AxisAngle(v*scale, 2*streflop::acosf(w)); return AxisAngle(v*scale, 2*streflop::acosf(static_cast<streflop::Simple>(w)));
#else #else
return AxisAngle(v*scale, 2*acosf(w)); return AxisAngle(v*scale, 2*acosf(w));
#endif #endif

View File

@ -112,7 +112,7 @@ static int get_dist(int delta_x, int delta_y) {
float dx = (float)delta_x; float dx = (float)delta_x;
float dy = (float)delta_y; float dy = (float)delta_y;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
return static_cast<int>(streflop::sqrtf(dx * dx + dy * dy)+0.5); // round correctly return static_cast<int>(streflop::sqrtf(static_cast<streflop::Simple>(dx * dx + dy * dy))+0.5); // round correctly
#else #else
return static_cast<int>(sqrtf(dx * dx + dy * dy)+0.5); // round correctly return static_cast<int>(sqrtf(dx * dx + dy * dy)+0.5); // round correctly
#endif #endif
@ -279,16 +279,16 @@ void MapPreview::pirateChangeHeight(int x, int y, int height, int radius) {
// Determine which gradients to use and take a weighted average // Determine which gradients to use and take a weighted average
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if (streflop::fabs(normIf) > streflop::fabs(normJf)) { if (streflop::fabs(static_cast<streflop::Simple>(normIf)) > streflop::fabs(static_cast<streflop::Simple>(normJf))) {
usedGrad = usedGrad =
gradient[normI[0]] [normJ[0]] * streflop::fabs(normJf) + gradient[normI[0]] [normJ[0]] * streflop::fabs(static_cast<streflop::Simple>(normJf)) +
gradient[normI[0]] [normJ[1]] * (1 - streflop::fabs(normJf)); gradient[normI[0]] [normJ[1]] * (1 - streflop::fabs(static_cast<streflop::Simple>(normJf)));
} }
else if (streflop::fabs(normIf) < streflop::fabs(normJf)) { else if (streflop::fabs(static_cast<streflop::Simple>(normIf)) < streflop::fabs(static_cast<streflop::Simple>(normJf))) {
usedGrad = usedGrad =
gradient[normI[0]] [normJ[0]] * streflop::fabs(normIf) + gradient[normI[0]] [normJ[0]] * streflop::fabs(static_cast<streflop::Simple>(normIf)) +
gradient[normI[1]] [normJ[0]] * (1 - streflop::fabs(normIf)); gradient[normI[1]] [normJ[0]] * (1 - streflop::fabs(static_cast<streflop::Simple>(normIf)));
} }
else { else {
usedGrad = usedGrad =
@ -888,8 +888,8 @@ void MapPreview::sinRandomize(int strenght) {
float normV = static_cast<float>(j) / h; float normV = static_cast<float>(j) / h;
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float sh = (streflop::sinf(normH * sinH1) + streflop::sin(normH * sinH2)) / 2.f; float sh = (streflop::sinf(static_cast<streflop::Simple>(normH * sinH1)) + streflop::sin(static_cast<streflop::Simple>(normH * sinH2))) / 2.f;
float sv = (streflop::sinf(normV * sinV1) + streflop::sin(normV * sinV2)) / 2.f; float sv = (streflop::sinf(static_cast<streflop::Simple>(normV * sinV1)) + streflop::sin(static_cast<streflop::Simple>(normV * sinV2))) / 2.f;
#else #else
float sh = (sinf(normH * sinH1) + sin(normH * sinH2)) / 2.f; float sh = (sinf(normH * sinH1) + sin(normH * sinH2)) / 2.f;
float sv = (sinf(normV * sinV1) + sin(normV * sinV2)) / 2.f; float sv = (sinf(normV * sinV1) + sin(normV * sinV2)) / 2.f;

View File

@ -595,6 +595,11 @@ std::pair<string,string> getFolderTreeContentsCheckSumCacheKey(vector<string> pa
pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, int32 &value) { pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, int32 &value) {
//bool result = false; //bool result = false;
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d for Cache file [%s]\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str());
}
pair<bool,time_t> result = make_pair(false,0); pair<bool,time_t> result = make_pair(false,0);
if(fileExists(crcCacheFile) == true) { if(fileExists(crcCacheFile) == true) {
#ifdef WIN32 #ifdef WIN32
@ -615,6 +620,16 @@ pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, int32 &value) {
result.first = true; result.first = true;
value = crcValue; value = crcValue;
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
struct tm *loctime = localtime (&refreshDate);
char szBuf1[100]="";
strftime(szBuf1,100,"%Y-%m-%d %H:%M:%S",loctime);
SystemFlags::OutputDebug(SystemFlags::debugSystem,
"=-=-=-=- READ CACHE for Cache file [%s] refreshDate = %ld [%s], crcValue = %d\n",
crcCacheFile.c_str(),refreshDate, szBuf1, crcValue);
}
} }
else { else {
time_t now = time(NULL); time_t now = time(NULL);
@ -626,9 +641,23 @@ pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, int32 &value) {
char szBuf2[100]=""; char szBuf2[100]="";
strftime(szBuf2,100,"%Y-%m-%d %H:%M:%S",loctime); strftime(szBuf2,100,"%Y-%m-%d %H:%M:%S",loctime);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"=-=-=-=- NEED TO CALCULATE CRC for Cache file [%s] now = %ld [%s], refreshDate = %ld [%s], crcValue = %d\n",crcCacheFile.c_str(),now, szBuf1, refreshDate, szBuf2, crcValue); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,
"=-=-=-=- NEED TO CALCULATE CRC for Cache file [%s] now = %ld [%s], refreshDate = %ld [%s], crcValue = %d\n",
crcCacheFile.c_str(),now, szBuf1, refreshDate, szBuf2, crcValue);
}
} }
} }
else {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"FILE NOT FOUND(1) for Cache file [%s]\n",crcCacheFile.c_str());
}
}
}
else {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"FILE NOT FOUND(2) for Cache file [%s]\n",crcCacheFile.c_str());
}
} }
return result; return result;

View File

@ -1227,10 +1227,10 @@ int Socket::send(const void *data, int dataSize) {
int lastSocketError = getLastSocketError(); int lastSocketError = getLastSocketError();
if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) { if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText(&lastSocketError).c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText(&lastSocketError).c_str(),dataSize);
} }
else if(bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN && isConnected() == true) { else if(bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN && isConnected() == true) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during send, trying again...\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during send, trying again... dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,dataSize);
int attemptCount = 0; int attemptCount = 0;
time_t tStartTimer = time(NULL); time_t tStartTimer = time(NULL);
@ -1240,7 +1240,12 @@ int Socket::send(const void *data, int dataSize) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount);
if(isConnected() == true) { if(isConnected() == true) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data); struct timeval timeVal;
timeVal.tv_sec = 1;
timeVal.tv_usec = 0;
bool canWrite = isWritable(&timeVal);
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p, canWrite = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data,canWrite);
// MutexSafeWrapper safeMutexSocketDestructorFlag(&inSocketDestructorSynchAccessor,CODE_AT_LINE); // MutexSafeWrapper safeMutexSocketDestructorFlag(&inSocketDestructorSynchAccessor,CODE_AT_LINE);
// if(this->inSocketDestructor == true) { // if(this->inSocketDestructor == true) {
@ -1293,7 +1298,12 @@ int Socket::send(const void *data, int dataSize) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, totalBytesSent = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,totalBytesSent); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, totalBytesSent = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,totalBytesSent);
if(isConnected() == true) { if(isConnected() == true) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data); struct timeval timeVal;
timeVal.tv_sec = 1;
timeVal.tv_usec = 0;
bool canWrite = isWritable(&timeVal);
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p, canWrite = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data,canWrite);
// MutexSafeWrapper safeMutexSocketDestructorFlag(&inSocketDestructorSynchAccessor,CODE_AT_LINE); // MutexSafeWrapper safeMutexSocketDestructorFlag(&inSocketDestructorSynchAccessor,CODE_AT_LINE);
// if(this->inSocketDestructor == true) { // if(this->inSocketDestructor == true) {
@ -1602,13 +1612,18 @@ bool Socket::isReadable() {
return result; return result;
} }
bool Socket::isWritable() { bool Socket::isWritable(struct timeval *timeVal) {
if(isSocketValid() == false) return false; if(isSocketValid() == false) return false;
struct timeval tv; struct timeval tv;
tv.tv_sec= 0; if(timeVal != NULL) {
//tv.tv_usec= 1; tv = *timeVal;
tv.tv_usec= 0; }
else {
tv.tv_sec= 0;
//tv.tv_usec= 1;
tv.tv_usec= 0;
}
fd_set set; fd_set set;
FD_ZERO(&set); FD_ZERO(&set);

View File

@ -445,7 +445,7 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
const float lodBias = max(min(0.0f,4.0f),-4.0f); const float lodBias = max(min(0.0f,4.0f),-4.0f);
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,lodBias); //if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,lodBias);
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
if (streflop::fabs(lodBias) > 0.01f) { if (streflop::fabs(static_cast<streflop::Simple>(lodBias)) > 0.01f) {
#else #else
if (fabs(lodBias) > 0.01f) { if (fabs(lodBias) > 0.01f) {
#endif #endif

View File

@ -521,7 +521,7 @@ bool SoundPlayerDs8::findStrBuffer(Sound *sound, int *bufferIndex){
long dsVolume(float floatVolume){ long dsVolume(float floatVolume){
#ifdef USE_STREFLOP #ifdef USE_STREFLOP
float correctedVol= streflop::log10f(floatVolume*9.f+1.f); float correctedVol= streflop::log10f(static_cast<streflop::Simple>(floatVolume*9.f+1.f));
#else #else
float correctedVol= log10f(floatVolume*9.f+1.f); float correctedVol= log10f(floatVolume*9.f+1.f);
#endif #endif