Remove unneeded strcpy usage.

This commit is contained in:
Night Owl 2017-07-11 02:24:19 +05:00
parent 7bba3a124a
commit 1c1d9ae183
3 changed files with 11 additions and 12 deletions

View File

@ -283,7 +283,7 @@ unsigned short stub_PrecacheEvent( int type, const char *s )
return 0; return 0;
} }
const char *stub_NameForFunction( unsigned int function ) const char *stub_NameForFunction( void *function )
{ {
return "func"; return "func";
} }

View File

@ -34,7 +34,7 @@ void HUD_SetMaxSpeed( const struct edict_s *ed, float speed );
int stub_PrecacheModel( const char* s ); int stub_PrecacheModel( const char* s );
int stub_PrecacheSound( const char* s ); int stub_PrecacheSound( const char* s );
unsigned short stub_PrecacheEvent( int type, const char *s ); unsigned short stub_PrecacheEvent( int type, const char *s );
const char *stub_NameForFunction( unsigned int function ); const char *stub_NameForFunction( void *function );
void stub_SetModel( struct edict_s *e, const char *m ); void stub_SetModel( struct edict_s *e, const char *m );
extern cvar_t *cl_lw; extern cvar_t *cl_lw;

View File

@ -1695,7 +1695,7 @@ void EV_TrainPitchAdjust( event_args_t *args )
int pitch; int pitch;
int stop; int stop;
char sz[256]; const char *pszSound;
idx = args->entindex; idx = args->entindex;
@ -1711,36 +1711,35 @@ void EV_TrainPitchAdjust( event_args_t *args )
switch( noise ) switch( noise )
{ {
case 1: case 1:
strcpy( sz, "plats/ttrain1.wav" ); pszSound = "plats/ttrain1.wav";
break; break;
case 2: case 2:
strcpy( sz, "plats/ttrain2.wav" ); pszSound = "plats/ttrain2.wav";
break; break;
case 3: case 3:
strcpy( sz, "plats/ttrain3.wav" ); pszSound = "plats/ttrain3.wav";
break; break;
case 4: case 4:
strcpy( sz, "plats/ttrain4.wav"); pszSound = "plats/ttrain4.wav";
break; break;
case 5: case 5:
strcpy( sz, "plats/ttrain6.wav"); pszSound = "plats/ttrain6.wav";
break; break;
case 6: case 6:
strcpy( sz, "plats/ttrain7.wav"); pszSound = "plats/ttrain7.wav";
break; break;
default: default:
// no sound // no sound
strcpy( sz, "" );
return; return;
} }
if( stop ) if( stop )
{ {
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, sz ); gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, pszSound );
} }
else else
{ {
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, sz, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch ); gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, pszSound, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch );
} }
} }