Got rid of many annoying warnings MSVC7.1 was reporting

This commit is contained in:
Pavol Marko 2005-08-27 09:55:32 +00:00
parent e15761b79a
commit 462916d00f
6 changed files with 37 additions and 37 deletions

View File

@ -170,7 +170,7 @@ void EventsMngr::ClEvent::registerFilter(char *filter)
// rest of line // rest of line
tmpCond->sValue.assign(value); tmpCond->sValue.assign(value);
tmpCond->fValue = atof(value); tmpCond->fValue = static_cast<float>(atof(value));
tmpCond->iValue = atoi(value); tmpCond->iValue = atoi(value);
tmpCond->next = NULL; tmpCond->next = NULL;
@ -465,9 +465,9 @@ float EventsMngr::getArgFloat(int a) const
switch(m_ParseVault[a].type) switch(m_ParseVault[a].type)
{ {
case MSG_INTEGER: case MSG_INTEGER:
return m_ParseVault[a].iValue; return static_cast<float>(m_ParseVault[a].iValue);
case MSG_STRING: case MSG_STRING:
return atof(m_ParseVault[a].sValue); return static_cast<float>(atof(m_ParseVault[a].sValue));
default: default:
return m_ParseVault[a].fValue; return m_ParseVault[a].fValue;
} }

View File

@ -613,7 +613,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
NEXT_PARAM(); NEXT_PARAM();
cell *tmpCell = get_amxaddr(amx, params[parm++]); cell *tmpCell = get_amxaddr(amx, params[parm++]);
while (tmpPtr-tmpString < sizeof(tmpString) && *tmpCell) while (tmpPtr-tmpString < sizeof(tmpString) && *tmpCell)
*tmpPtr++ = *tmpCell++; *tmpPtr++ = static_cast<char>(*tmpCell++);
*tmpPtr = 0; *tmpPtr = 0;
_snprintf(outptr, sizeof(outbuf)-(outptr-outbuf)-1, format, tmpString); _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; char *ptr = format+1;
if (*src != '%') if (*src != '%')
{ {
while (*src != 0 && ptr-format<sizeof(format) && !isalpha(*ptr++ = *src++)) while (*src != 0 && ptr-format<sizeof(format) && !isalpha(*ptr++ = static_cast<char>(*src++)))
/*nothing*/; /*nothing*/;
*ptr = 0; *ptr = 0;
ZEROTERM(format); ZEROTERM(format);
@ -700,7 +700,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
NEXT_PARAM(); NEXT_PARAM();
cell *tmpCell = get_amxaddr(amx, params[parm++]); cell *tmpCell = get_amxaddr(amx, params[parm++]);
while (tmpPtr-tmpString<sizeof(tmpString) && *tmpCell) while (tmpPtr-tmpString<sizeof(tmpString) && *tmpCell)
*tmpPtr++ = *tmpCell++; *tmpPtr++ = static_cast<char>(*tmpCell++);
*tmpPtr = 0; *tmpPtr = 0;
_snprintf(outptr, sizeof(outbuf)-(outptr-outbuf)-1, format, tmpString); _snprintf(outptr, sizeof(outbuf)-(outptr-outbuf)-1, format, tmpString);
ZEROTERM(outbuf); ZEROTERM(outbuf);
@ -738,7 +738,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
else else
{ {
CHECK_OUTPTR(1); CHECK_OUTPTR(1);
*outptr++ = *src; *outptr++ = static_cast<char>(*src);
} }
++src; ++src;
} }

View File

@ -270,9 +270,9 @@ static cell AMX_NATIVE_CALL set_hudmessage(AMX *amx, cell *params) /* 11 param
g_hudset.r2 = 255; g_hudset.r2 = 255;
g_hudset.g2 = 255; g_hudset.g2 = 255;
g_hudset.b2 = 250; g_hudset.b2 = 250;
g_hudset.r1 = params[1]; g_hudset.r1 = static_cast<byte>(params[1]);
g_hudset.g1 = params[2]; g_hudset.g1 = static_cast<byte>(params[2]);
g_hudset.b1 = params[3]; g_hudset.b1 = static_cast<byte>(params[3]);
g_hudset.x = amx_ctof(params[4]); g_hudset.x = amx_ctof(params[4]);
g_hudset.y = amx_ctof(params[5]); g_hudset.y = amx_ctof(params[5]);
g_hudset.effect = params[6]; 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 ); ANGLEVECTORS( fang, v_forward, v_right, NULL );
pEdict->v.velocity = pEdict->v.velocity + v_forward * 220 + Vector(0,0,200); pEdict->v.velocity = pEdict->v.velocity + v_forward * 220 + Vector(0,0,200);
} }
pEdict->v.punchangle.x = RANDOM_LONG(-10,10); pEdict->v.punchangle.x = static_cast<vec_t>(RANDOM_LONG(-10,10));
pEdict->v.punchangle.y = RANDOM_LONG(-10,10); pEdict->v.punchangle.y = static_cast<vec_t>(RANDOM_LONG(-10,10));
pEdict->v.health -= power; pEdict->v.health -= power;
int armor = (int)pEdict->v.armorvalue; int armor = (int)pEdict->v.armorvalue;
armor -= power; armor -= power;
if (armor < 0) armor = 0; if (armor < 0) armor = 0;
pEdict->v.armorvalue = armor; pEdict->v.armorvalue = static_cast<float>(armor);
pEdict->v.dmg_inflictor = pEdict; pEdict->v.dmg_inflictor = pEdict;
if (g_bmod_cstrike){ if (g_bmod_cstrike){
static const char *cs_sound[4] = { 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; return 0;
} }
cpOrigin = get_amxaddr(amx,params[3]); cpOrigin = get_amxaddr(amx,params[3]);
vecOrigin[0] = *cpOrigin; vecOrigin[0] = static_cast<float>(*cpOrigin);
vecOrigin[1] = *(cpOrigin+1); vecOrigin[1] = static_cast<float>(*(cpOrigin+1));
vecOrigin[2] = *(cpOrigin+2); vecOrigin[2] = static_cast<float>(*(cpOrigin+2));
MESSAGE_BEGIN( params[1], params[2] , vecOrigin ); MESSAGE_BEGIN( params[1], params[2] , vecOrigin );
break; break;
case MSG_ONE_UNRELIABLE: 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 */ static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */
{ {
WRITE_ANGLE( params[1] ); WRITE_ANGLE( static_cast<float>(params[1]) );
return 1; return 1;
} }
static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */ static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */
{ {
WRITE_COORD( params[1] ); WRITE_COORD( static_cast<float>(params[1]) );
return 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]); float base = amx_ctof(params[1]);
if ( base < 0.1 ) if ( base < 0.1f )
base = 0.1; base = 0.1f;
char* temp = get_amxstring(amx,params[6],0,a); 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 *cpVec1 = get_amxaddr(amx,params[1]);
cell *cpVec2 = get_amxaddr(amx,params[2]); cell *cpVec2 = get_amxaddr(amx,params[2]);
Vector vec1 = Vector(cpVec1[0],cpVec1[1],cpVec1[2]); Vector vec1 = Vector((float)cpVec1[0],(float)cpVec1[1],(float)cpVec1[2]);
Vector vec2 = Vector(cpVec2[0],cpVec2[1],cpVec2[2]); Vector vec2 = Vector((float)cpVec2[0],(float)cpVec2[1],(float)cpVec2[2]);
int iDist = (int)((vec1 - vec2).Length()); int iDist = (int)((vec1 - vec2).Length());
return iDist; 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; Vector v_src = edict->v.origin + edict->v.view_ofs;
ANGLEVECTORS( edict->v.v_angle , v_forward, NULL, NULL ); ANGLEVECTORS( edict->v.v_angle , v_forward, NULL, NULL );
TraceResult trEnd; TraceResult trEnd;
Vector v_dest = v_src + v_forward * params[4]; Vector v_dest = v_src + v_forward * static_cast<float>(params[4]);
TRACE_LINE( v_src , v_dest, 0 , edict, &trEnd ); TRACE_LINE( v_src , v_dest, 0 , edict, &trEnd );
*cpId = FNullEnt(trEnd.pHit) ? 0 : ENTINDEX(trEnd.pHit); *cpId = FNullEnt(trEnd.pHit) ? 0 : ENTINDEX(trEnd.pHit);
*cpBody = trEnd.iHitgroup; *cpBody = trEnd.iHitgroup;
@ -2181,8 +2181,8 @@ static cell AMX_NATIVE_CALL force_unmodified(AMX *amx, cell *params)
int a; int a;
cell *cpVec1 = get_amxaddr(amx,params[2]); cell *cpVec1 = get_amxaddr(amx,params[2]);
cell *cpVec2 = get_amxaddr(amx,params[3]); cell *cpVec2 = get_amxaddr(amx,params[3]);
Vector vec1 = Vector(cpVec1[0],cpVec1[1],cpVec1[2]); Vector vec1 = Vector((float)cpVec1[0],(float)cpVec1[1],(float)cpVec1[2]);
Vector vec2 = Vector(cpVec2[0],cpVec2[1],cpVec2[2]); Vector vec2 = Vector((float)cpVec2[0],(float)cpVec2[1],(float)cpVec2[2]);
char* filename = get_amxstring(amx,params[4],0,a); char* filename = get_amxstring(amx,params[4],0,a);
ForceObject* aaa = new ForceObject(filename , (FORCE_TYPE)((int)(params[1])) , vec1 , vec2 , amx); ForceObject* aaa = new ForceObject(filename , (FORCE_TYPE)((int)(params[1])) , vec1 , vec2 , amx);

View File

@ -123,7 +123,7 @@ void Client_TextMsg(void* mValue)
// g_newround_time = g_game_timeleft + CVAR_GET_FLOAT("mp_freezetime"); // g_newround_time = g_game_timeleft + CVAR_GET_FLOAT("mp_freezetime");
} }
else if ( g_game_timeleft == -3 ) else if ( g_game_timeleft == -3 )
g_game_restarting = atoi( msg ) * 60; g_game_restarting = atoi( msg ) * 60.0f;
break; break;
} }
case 3:{ case 3:{

View File

@ -260,11 +260,11 @@ int C_Spawn( edict_t *pent )
} }
// ###### Init time and freeze tasks // ###### Init time and freeze tasks
g_game_timeleft = g_bmod_dod ? 1 : 0; g_game_timeleft = g_bmod_dod ? 1.0f : 0.0f;
g_task_time = gpGlobals->time + 99999.0; g_task_time = gpGlobals->time + 99999.0f;
g_auth_time = gpGlobals->time + 99999.0; g_auth_time = gpGlobals->time + 99999.0f;
#ifdef MEMORY_TEST #ifdef MEMORY_TEST
g_next_memreport_time = gpGlobals->time + 99999.0; g_next_memreport_time = gpGlobals->time + 99999.0f;
#endif #endif
g_players_num = 0; g_players_num = 0;
@ -731,7 +731,7 @@ void C_StartFrame_Post( void )
{ {
if (g_auth_time < gpGlobals->time ) if (g_auth_time < gpGlobals->time )
{ {
g_auth_time = gpGlobals->time + 0.7; g_auth_time = gpGlobals->time + 0.7f;
CList<CPlayer*>::iterator a = g_auth.begin(); CList<CPlayer*>::iterator a = g_auth.begin();
@ -814,7 +814,7 @@ void C_StartFrame_Post( void )
if (g_task_time > gpGlobals->time) if (g_task_time > gpGlobals->time)
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
g_task_time = gpGlobals->time + 0.1; g_task_time = gpGlobals->time + 0.1f;
g_tasksMngr.startFrame(); g_tasksMngr.startFrame();
@ -836,7 +836,7 @@ void C_MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict
#endif #endif
int stop = (int)ed->v.armorvalue; int stop = (int)ed->v.armorvalue;
*z = stop; *z = stop;
ed->v.armorvalue = stop; ed->v.armorvalue = (float)stop;
} }
mPlayerIndex = ENTINDEX(ed); mPlayerIndex = ENTINDEX(ed);

View File

@ -405,9 +405,9 @@ char* fo_getargstr(AMX *amx, int swap, int pos)
char* b = buffer[swap]; char* b = buffer[swap];
int a = 0; int a = 0;
do { do {
value = src_value + a++ * sizeof(cell); value = src_value + a++ * sizeof(cell);
value = *(cell *)(data+(int)value); value = *(cell *)(data+(int)value);
*b++ = value; *b++ = static_cast<char>(value);
} while (value); } while (value);
return buffer[swap]; return buffer[swap];
@ -468,7 +468,7 @@ static cell AMX_NATIVE_CALL amx_strtok(AMX *amx, cell *params)
int leftMax = params[3]; int leftMax = params[3];
int rightMax = params[5]; int rightMax = params[5];
//token //token
char token = params[6]; char token = static_cast<char>(params[6]);
//trim //trim
int trim = params[7]; int trim = params[7];
for (i=0; i<(unsigned int)len; i++) for (i=0; i<(unsigned int)len; i++)