diff --git a/amxmodx/CEvent.cpp b/amxmodx/CEvent.cpp index 769ae38e..0da13367 100755 --- a/amxmodx/CEvent.cpp +++ b/amxmodx/CEvent.cpp @@ -170,7 +170,7 @@ void EventsMngr::ClEvent::registerFilter(char *filter) // rest of line tmpCond->sValue.assign(value); - tmpCond->fValue = atof(value); + tmpCond->fValue = static_cast(atof(value)); tmpCond->iValue = atoi(value); tmpCond->next = NULL; @@ -465,9 +465,9 @@ float EventsMngr::getArgFloat(int a) const switch(m_ParseVault[a].type) { case MSG_INTEGER: - return m_ParseVault[a].iValue; + return static_cast(m_ParseVault[a].iValue); case MSG_STRING: - return atof(m_ParseVault[a].sValue); + return static_cast(atof(m_ParseVault[a].sValue)); default: return m_ParseVault[a].fValue; } diff --git a/amxmodx/CLang.cpp b/amxmodx/CLang.cpp index 050d6362..c2e11ad8 100755 --- a/amxmodx/CLang.cpp +++ b/amxmodx/CLang.cpp @@ -613,7 +613,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) NEXT_PARAM(); cell *tmpCell = get_amxaddr(amx, params[parm++]); while (tmpPtr-tmpString < sizeof(tmpString) && *tmpCell) - *tmpPtr++ = *tmpCell++; + *tmpPtr++ = static_cast(*tmpCell++); *tmpPtr = 0; _snprintf(outptr, sizeof(outbuf)-(outptr-outbuf)-1, format, tmpString); @@ -688,7 +688,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) char *ptr = format+1; if (*src != '%') { - while (*src != 0 && ptr-format(*src++))) /*nothing*/; *ptr = 0; ZEROTERM(format); @@ -700,7 +700,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) NEXT_PARAM(); cell *tmpCell = get_amxaddr(amx, params[parm++]); while (tmpPtr-tmpString(*tmpCell++); *tmpPtr = 0; _snprintf(outptr, sizeof(outbuf)-(outptr-outbuf)-1, format, tmpString); ZEROTERM(outbuf); @@ -738,7 +738,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) else { CHECK_OUTPTR(1); - *outptr++ = *src; + *outptr++ = static_cast(*src); } ++src; } diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 31150b16..a300d462 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -270,9 +270,9 @@ static cell AMX_NATIVE_CALL set_hudmessage(AMX *amx, cell *params) /* 11 param g_hudset.r2 = 255; g_hudset.g2 = 255; g_hudset.b2 = 250; - g_hudset.r1 = params[1]; - g_hudset.g1 = params[2]; - g_hudset.b1 = params[3]; + g_hudset.r1 = static_cast(params[1]); + g_hudset.g1 = static_cast(params[2]); + g_hudset.b1 = static_cast(params[3]); g_hudset.x = amx_ctof(params[4]); g_hudset.y = amx_ctof(params[5]); g_hudset.effect = params[6]; @@ -1112,13 +1112,13 @@ static cell AMX_NATIVE_CALL user_slap(AMX *amx, cell *params) /* 2 param */ ANGLEVECTORS( fang, v_forward, v_right, NULL ); pEdict->v.velocity = pEdict->v.velocity + v_forward * 220 + Vector(0,0,200); } - pEdict->v.punchangle.x = RANDOM_LONG(-10,10); - pEdict->v.punchangle.y = RANDOM_LONG(-10,10); + pEdict->v.punchangle.x = static_cast(RANDOM_LONG(-10,10)); + pEdict->v.punchangle.y = static_cast(RANDOM_LONG(-10,10)); pEdict->v.health -= power; int armor = (int)pEdict->v.armorvalue; armor -= power; if (armor < 0) armor = 0; - pEdict->v.armorvalue = armor; + pEdict->v.armorvalue = static_cast(armor); pEdict->v.dmg_inflictor = pEdict; if (g_bmod_cstrike){ static const char *cs_sound[4] = { @@ -1249,9 +1249,9 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */ return 0; } cpOrigin = get_amxaddr(amx,params[3]); - vecOrigin[0] = *cpOrigin; - vecOrigin[1] = *(cpOrigin+1); - vecOrigin[2] = *(cpOrigin+2); + vecOrigin[0] = static_cast(*cpOrigin); + vecOrigin[1] = static_cast(*(cpOrigin+1)); + vecOrigin[2] = static_cast(*(cpOrigin+2)); MESSAGE_BEGIN( params[1], params[2] , vecOrigin ); break; case MSG_ONE_UNRELIABLE: @@ -1305,13 +1305,13 @@ static cell AMX_NATIVE_CALL write_entity(AMX *amx, cell *params) /* 1 param */ static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */ { - WRITE_ANGLE( params[1] ); + WRITE_ANGLE( static_cast(params[1]) ); return 1; } static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */ { - WRITE_COORD( params[1] ); + WRITE_COORD( static_cast(params[1]) ); return 1; } @@ -1748,8 +1748,8 @@ static cell AMX_NATIVE_CALL set_task(AMX *amx, cell *params) /* 2 param */ float base = amx_ctof(params[1]); - if ( base < 0.1 ) - base = 0.1; + if ( base < 0.1f ) + base = 0.1f; char* temp = get_amxstring(amx,params[6],0,a); @@ -2045,8 +2045,8 @@ static cell AMX_NATIVE_CALL get_distance(AMX *amx, cell *params) /* 2 param */ { cell *cpVec1 = get_amxaddr(amx,params[1]); cell *cpVec2 = get_amxaddr(amx,params[2]); - Vector vec1 = Vector(cpVec1[0],cpVec1[1],cpVec1[2]); - Vector vec2 = Vector(cpVec2[0],cpVec2[1],cpVec2[2]); + Vector vec1 = Vector((float)cpVec1[0],(float)cpVec1[1],(float)cpVec1[2]); + Vector vec2 = Vector((float)cpVec2[0],(float)cpVec2[1],(float)cpVec2[2]); int iDist = (int)((vec1 - vec2).Length()); return iDist; } @@ -2120,7 +2120,7 @@ static cell AMX_NATIVE_CALL get_user_aiming(AMX *amx, cell *params) /* 4 param * Vector v_src = edict->v.origin + edict->v.view_ofs; ANGLEVECTORS( edict->v.v_angle , v_forward, NULL, NULL ); TraceResult trEnd; - Vector v_dest = v_src + v_forward * params[4]; + Vector v_dest = v_src + v_forward * static_cast(params[4]); TRACE_LINE( v_src , v_dest, 0 , edict, &trEnd ); *cpId = FNullEnt(trEnd.pHit) ? 0 : ENTINDEX(trEnd.pHit); *cpBody = trEnd.iHitgroup; @@ -2181,8 +2181,8 @@ static cell AMX_NATIVE_CALL force_unmodified(AMX *amx, cell *params) int a; cell *cpVec1 = get_amxaddr(amx,params[2]); cell *cpVec2 = get_amxaddr(amx,params[3]); - Vector vec1 = Vector(cpVec1[0],cpVec1[1],cpVec1[2]); - Vector vec2 = Vector(cpVec2[0],cpVec2[1],cpVec2[2]); + Vector vec1 = Vector((float)cpVec1[0],(float)cpVec1[1],(float)cpVec1[2]); + Vector vec2 = Vector((float)cpVec2[0],(float)cpVec2[1],(float)cpVec2[2]); char* filename = get_amxstring(amx,params[4],0,a); ForceObject* aaa = new ForceObject(filename , (FORCE_TYPE)((int)(params[1])) , vec1 , vec2 , amx); diff --git a/amxmodx/emsg.cpp b/amxmodx/emsg.cpp index d9c22a31..85909a25 100755 --- a/amxmodx/emsg.cpp +++ b/amxmodx/emsg.cpp @@ -123,7 +123,7 @@ void Client_TextMsg(void* mValue) // g_newround_time = g_game_timeleft + CVAR_GET_FLOAT("mp_freezetime"); } else if ( g_game_timeleft == -3 ) - g_game_restarting = atoi( msg ) * 60; + g_game_restarting = atoi( msg ) * 60.0f; break; } case 3:{ diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 85670843..b8f06fd7 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -260,11 +260,11 @@ int C_Spawn( edict_t *pent ) } // ###### Init time and freeze tasks - g_game_timeleft = g_bmod_dod ? 1 : 0; - g_task_time = gpGlobals->time + 99999.0; - g_auth_time = gpGlobals->time + 99999.0; + g_game_timeleft = g_bmod_dod ? 1.0f : 0.0f; + g_task_time = gpGlobals->time + 99999.0f; + g_auth_time = gpGlobals->time + 99999.0f; #ifdef MEMORY_TEST - g_next_memreport_time = gpGlobals->time + 99999.0; + g_next_memreport_time = gpGlobals->time + 99999.0f; #endif g_players_num = 0; @@ -731,7 +731,7 @@ void C_StartFrame_Post( void ) { if (g_auth_time < gpGlobals->time ) { - g_auth_time = gpGlobals->time + 0.7; + g_auth_time = gpGlobals->time + 0.7f; CList::iterator a = g_auth.begin(); @@ -814,7 +814,7 @@ void C_StartFrame_Post( void ) if (g_task_time > gpGlobals->time) RETURN_META(MRES_IGNORED); - g_task_time = gpGlobals->time + 0.1; + g_task_time = gpGlobals->time + 0.1f; g_tasksMngr.startFrame(); @@ -836,7 +836,7 @@ void C_MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict #endif int stop = (int)ed->v.armorvalue; *z = stop; - ed->v.armorvalue = stop; + ed->v.armorvalue = (float)stop; } mPlayerIndex = ENTINDEX(ed); diff --git a/amxmodx/string.cpp b/amxmodx/string.cpp index 8d3c970a..8fdfd2c0 100755 --- a/amxmodx/string.cpp +++ b/amxmodx/string.cpp @@ -405,9 +405,9 @@ char* fo_getargstr(AMX *amx, int swap, int pos) char* b = buffer[swap]; int a = 0; do { - value = src_value + a++ * sizeof(cell); - value = *(cell *)(data+(int)value); - *b++ = value; + value = src_value + a++ * sizeof(cell); + value = *(cell *)(data+(int)value); + *b++ = static_cast(value); } while (value); return buffer[swap]; @@ -468,7 +468,7 @@ static cell AMX_NATIVE_CALL amx_strtok(AMX *amx, cell *params) int leftMax = params[3]; int rightMax = params[5]; //token - char token = params[6]; + char token = static_cast(params[6]); //trim int trim = params[7]; for (i=0; i<(unsigned int)len; i++)