Fix client warnings

This commit is contained in:
mittorn 2016-03-26 19:21:08 +00:00
parent 59e468ef91
commit 7d3da75ef7
30 changed files with 57 additions and 46 deletions

View File

@ -91,7 +91,7 @@ SRCS+=./input_xash3d.cpp
SRCS+=./scoreboard.cpp
SRCS+=./MOTD.cpp
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls
DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -fpermissive -w
DEFINES = -Wextra -Wno-missing-field-initializers -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -fpermissive
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
$(LOCAL_PATH)/../common \

View File

@ -129,7 +129,7 @@ int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
BEGIN_READ( pbuf, iSize );
int is_finished = READ_BYTE();
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) );
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - 1 );
if ( is_finished )
{

View File

@ -911,7 +911,8 @@ void CStudioModelRenderer::StudioSetupBones ( void )
for (i = 0; i < m_pStudioHeader->numbones; i++)
{
for( int j = 0; j < LEGS_BONES_COUNT; j++ )
int j;
for( j = 0; j < LEGS_BONES_COUNT; j++ )
{
if( !strcmp( pbones[i].name, legs_bones[j] ))
break;

View File

@ -104,14 +104,14 @@ inline int TextMessageDrawChar( int x, int y, int number, int r, int g, in
inline int DrawConsoleString( int x, int y, const char *string )
{
if( hud_textmode->value == 1 )
return gHUD.DrawHudString( x, y, 9999, (char*)string, 255*g_hud_text_color[0], 255*g_hud_text_color[1], 255*g_hud_text_color[2]);
return gHUD.DrawHudString( x, y, 9999, (char*)string, (int)(255.0*g_hud_text_color[0]), (int)(255.0*g_hud_text_color[1]), (int)(255.0*g_hud_text_color[2]));
return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string );
}
inline void GetConsoleStringSize( const char *string, int *width, int *height )
{
if( hud_textmode->value == 1 )
*height = 13, *width = gHUD.DrawHudStringLen(string);
*height = 13, *width = gHUD.DrawHudStringLen((char*)string);
else
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
}

View File

@ -157,6 +157,7 @@ int CHudDeathNotice :: Draw( float flTime )
// This message handler may be better off elsewhere
int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbuf )
{
int i;
m_iFlags |= HUD_ACTIVE;
BEGIN_READ( pbuf, iSize );
@ -166,12 +167,12 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
char killedwith[32];
strcpy( killedwith, "d_" );
strncat( killedwith, READ_STRING(), 32 );
strncat( killedwith, READ_STRING(), 31 );
gHUD.m_Spectator.DeathMessage(victim);
for ( int i = 0; i < MAX_DEATHNOTICES; i++ )
for ( i = 0; i < MAX_DEATHNOTICES; i++ )
{
if ( rgDeathNoticeList[i].iId == 0 )
break;

View File

@ -64,9 +64,9 @@ int CHudGeiger::MsgFunc_Geiger(const char *pszName, int iSize, void *pbuf)
int CHudGeiger::Draw (float flTime)
{
int pct;
float flvol;
float flvol = 0;
int rg[3];
int i;
int i = 0;
if (m_iGeigerRange < 1000 && m_iGeigerRange > 0)
{

View File

@ -379,6 +379,7 @@ int CHudHealth::DrawDamage(float flTime)
{
int r, g, b, a;
DAMAGE_IMAGE *pdmg;
int i;
if (!m_bitsDamage)
return 1;
@ -390,7 +391,7 @@ int CHudHealth::DrawDamage(float flTime)
ScaleColors(r, g, b, a);
// Draw all the items
for (int i = 0; i < NUM_DMG_TYPES; i++)
for ( i = 0; i < NUM_DMG_TYPES; i++)
{
if (m_bitsDamage & giDmgFlags[i])
{

View File

@ -288,7 +288,7 @@ Only produces random numbers to match the server ones.
*/
Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker, int shared_rand )
{
float x, y, z;
float x = 0, y = 0, z;
for ( ULONG iShot = 1; iShot <= cShots; iShot++ )
{
@ -579,7 +579,7 @@ void CBasePlayerWeapon::PrintState( void )
COM_Log( "c:\\hl.log", "%i ", m_iClip );
}
int RandomLong( int a, int b )
long int RandomLong( long int a, long int b )
{
return gEngfuncs.pfnRandomLong(a, b);
}

View File

@ -304,10 +304,11 @@ void CHud :: VidInit( void )
if (m_pSpriteList)
{
int j;
// count the number of sprites of the appropriate res
m_iSpriteCount = 0;
client_sprite_t *p = m_pSpriteList;
for ( int j = 0; j < m_iSpriteCountAllRes; j++ )
for ( j = 0; j < m_iSpriteCountAllRes; j++ )
{
if ( p->iRes == m_iRes )
m_iSpriteCount++;
@ -340,13 +341,14 @@ void CHud :: VidInit( void )
}
else
{
int j;
// we have already have loaded the sprite reference from hud.txt, but
// we need to make sure all the sprites have been loaded (we've gone through a transition, or loaded a save game)
client_sprite_t *p = m_pSpriteList;
// count the number of sprites of the appropriate res
m_iSpriteCount = 0;
for ( int j = 0; j < m_iSpriteCountAllRes; j++ )
for ( j = 0; j < m_iSpriteCountAllRes; j++ )
{
if ( p->iRes == m_iRes )
m_iSpriteCount++;

View File

@ -64,6 +64,7 @@ int CHudMenu :: VidInit( void )
int CHudMenu :: Draw( float flTime )
{
int i;
// check for if menu is set to disappear
if ( m_flShutoffTime > 0 )
{
@ -83,7 +84,7 @@ int CHudMenu :: Draw( float flTime )
// count the number of newlines
int nlc = 0;
for ( int i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
for ( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
{
if ( g_szMenuString[i] == '\n' )
nlc++;

View File

@ -140,7 +140,7 @@ int CHudMessage::YPosition( float y, int height )
void CHudMessage::MessageScanNextChar( void )
{
int srcRed, srcGreen, srcBlue, destRed, destGreen, destBlue;
int srcRed, srcGreen, srcBlue, destRed = 0, destGreen = 0, destBlue = 0;
int blend;
srcRed = m_parms.pMessage->r1;
@ -319,7 +319,7 @@ int CHudMessage::Draw( float fTime )
{
int i, drawn;
client_textmessage_t *pMessage;
float endTime;
float endTime = 0;
drawn = 0;

View File

@ -142,7 +142,7 @@ char* READ_STRING( void )
break;
string[l] = c;
l++;
} while (l < sizeof(string)-1);
} while (l < (int)sizeof(string)-1);
string[l] = 0;

View File

@ -162,10 +162,11 @@ int CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf )
void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex )
{
int i;
ConsolePrint( pszBuf );
// find an empty string slot
for ( int i = 0; i < MAX_LINES; i++ )
for ( i = 0; i < MAX_LINES; i++ )
{
if ( ! *g_szLineBuffer[i] )
break;

View File

@ -526,7 +526,7 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb
if ( j > m_iNumTeams )
{ // they aren't in a listed team, so make a new one
// search through for an empty team slot
for ( int j = 1; j <= m_iNumTeams; j++ )
for ( j = 1; j <= m_iNumTeams; j++ )
{
if ( g_TeamInfo[j].name[0] == '\0' )
break;

View File

@ -106,8 +106,9 @@ int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *p
// add the icon to the icon list, and set it's drawing color
void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue )
{
int i;
// check to see if the sprite is in the current list
for ( int i = 0; i < MAX_ICONSPRITES; i++ )
for ( i = 0; i < MAX_ICONSPRITES; i++ )
{
if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
break;

View File

@ -147,7 +147,7 @@ void CCrowbar::PrimaryAttack()
{
if (! Swing( 1 ))
{
SetThink( &SwingAgain );
SetThink( &CCrowbar::SwingAgain );
pev->nextthink = gpGlobals->time + 0.1;
}
}
@ -306,7 +306,7 @@ int CCrowbar::Swing( int fFirst )
#endif
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
SetThink( &Smack );
SetThink( &CCrowbar::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;

View File

@ -79,7 +79,7 @@ public:
inline void AnimateAndDie( float framerate )
{
SetThink( &AnimateUntilDead);
SetThink( &CSprite::AnimateUntilDead );
pev->framerate = framerate;
pev->dmgtime = gpGlobals->time + (m_maxFrame / framerate);
pev->nextthink = gpGlobals->time;
@ -168,7 +168,7 @@ public:
static CBeam *BeamCreate( const char *pSpriteName, int width );
inline void LiveForTime( float time ) { SetThink( &SUB_Remove); pev->nextthink = gpGlobals->time + time; }
inline void LiveForTime( float time ) { SetThink( &CBaseEntity::SUB_Remove ); pev->nextthink = gpGlobals->time + time; }
inline void BeamDamageInstant( TraceResult *ptr, float damage )
{
pev->dmg = damage;

View File

@ -281,7 +281,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
#endif
float timedist;
float timedist = 0;
switch ( m_fireMode )
{

View File

@ -103,7 +103,7 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ )
{
// no more grenades!
m_pPlayer->pev->weapons &= ~(1<<WEAPON_HANDGRENADE);
SetThink( &DestroyItem );
SetThink( &CHandGrenade::DestroyItem );
pev->nextthink = gpGlobals->time + 0.1;
}

View File

@ -292,7 +292,7 @@ public:
void SetCustomDecalFrames( int nFrames );
int GetCustomDecalFrames( void );
void CBasePlayer::TabulateAmmo( void );
void TabulateAmmo( void );
float m_flStartCharge;
float m_flAmmoStartCharge;

View File

@ -284,7 +284,7 @@ void CRpgRocket :: FollowThink( void )
void CRpg::Reload( void )
{
int iResult;
int iResult = 0;
if ( m_iClip == 1 )
{

View File

@ -77,9 +77,9 @@ void CSatchelCharge :: Spawn( void )
UTIL_SetSize(pev, Vector( -4, -4, -4), Vector(4, 4, 4)); // Uses point-sized, and can be stepped over
UTIL_SetOrigin( pev, pev->origin );
SetTouch( &SatchelSlide );
SetUse( &DetonateUse );
SetThink( &SatchelThink );
SetTouch( &CSatchelCharge::SatchelSlide );
SetUse( &CSatchelCharge::DetonateUse );
SetThink( &CSatchelCharge::SatchelThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->gravity = 0.5;
@ -322,7 +322,7 @@ void CSatchel::Holster( int skiplocal /* = 0 */ )
if ( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] && !m_chargeReady )
{
m_pPlayer->pev->weapons &= ~(1<<WEAPON_SATCHEL);
SetThink( &DestroyItem );
SetThink( &CSatchel::DestroyItem );
pev->nextthink = gpGlobals->time + 0.1;
}
}

View File

@ -483,7 +483,7 @@ void CSqueak::Holster( int skiplocal /* = 0 */ )
if ( !m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] )
{
m_pPlayer->pev->weapons &= ~(1<<WEAPON_SNARK);
SetThink( &DestroyItem );
SetThink( &CSqueak::DestroyItem );
pev->nextthink = gpGlobals->time + 0.1;
return;
}

View File

@ -420,7 +420,7 @@ void CTripmine::Holster( int skiplocal /* = 0 */ )
{
// out of mines
m_pPlayer->pev->weapons &= ~(1<<WEAPON_TRIPMINE);
SetThink( &DestroyItem );
SetThink( &CTripmine::DestroyItem );
pev->nextthink = gpGlobals->time + 0.1;
}

View File

@ -248,7 +248,7 @@ typedef enum { ignore_monsters=1, dont_ignore_monsters=0, missile=2 } IGNORE_MON
typedef enum { ignore_glass=1, dont_ignore_glass=0 } IGNORE_GLASS;
extern void UTIL_TraceLine (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr);
extern void UTIL_TraceLine (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr);
typedef enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 };
enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 };
extern void UTIL_TraceHull (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr);
extern TraceResult UTIL_GetGlobalTrace (void);
extern void UTIL_TraceModel (const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr);

View File

@ -486,7 +486,7 @@ public:
int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
HasWeapon( CBasePlayerItem *pCheckItem );
bool HasWeapon( CBasePlayerItem *pCheckItem );
BOOL PackWeapon( CBasePlayerItem *pWeapon );
BOOL PackAmmo( int iszName, int iCount );

View File

@ -93,6 +93,11 @@ typedef struct client_textmessage_s
const char *pMessage;
} client_textmessage_t;
#if __MSC_VER == 1200
#define longlong_t __int64
#else
#define longlong_t long long
#endif
typedef struct hud_player_info_s
{
char *name;
@ -106,7 +111,7 @@ typedef struct hud_player_info_s
short topcolor;
short bottomcolor;
unsigned long long m_nSteamID;
unsigned longlong_t m_nSteamID_1;
} hud_player_info_t;
typedef struct cl_enginefuncs_s

View File

@ -34,12 +34,6 @@
// This is conveniently done for them in extdll.h
//
#ifdef _WIN32
#define DLLEXPORT __stdcall
#else
#define DLLEXPORT /* */
#endif
typedef enum
{
at_notice,

View File

@ -81,6 +81,7 @@ typedef struct physent_s
vec3_t vuser3;
vec3_t vuser4;
} physent_t;
typedef struct hull_s hull_t;
typedef struct playermove_s
{
@ -195,7 +196,7 @@ typedef struct playermove_s
int (*PM_TruePointContents)( float *p );
int (*PM_HullPointContents)( struct hull_s *hull, int num, float *p );
pmtrace_t (*PM_PlayerTrace)( float *start, float *end, int traceFlags, int ignore_pe );
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehulll, int ignore_pe );
pmtrace_t *(*PM_TraceLine)( float *start, float *end, int flags, int usehulll, int ignore_pe );
long (*RandomLong)( long lLow, long lHigh );
float (*RandomFloat)( float flLow, float flHigh );
int (*PM_GetModelType)( struct model_s *mod );

View File

@ -24,6 +24,9 @@
#include <stdio.h> // NULL
#include <math.h> // sqrt
#include <string.h> // strcpy
#ifdef stricmp
#include <strings.h> // strncasecmp
#endif
#include <stdlib.h> // atoi
#include <ctype.h> // isspace