game(hl1): fix use after scope

This commit is contained in:
nillerusr 2022-08-23 17:33:12 +03:00
parent e11a21ea19
commit 2cb00530c7
3 changed files with 7 additions and 3 deletions

View File

@ -209,7 +209,6 @@ BEGIN_DATADESC( CNPC_HGrunt )
DEFINE_FIELD( m_voicePitch, FIELD_INTEGER ), DEFINE_FIELD( m_voicePitch, FIELD_INTEGER ),
DEFINE_FIELD( m_iSentence, FIELD_INTEGER ), DEFINE_FIELD( m_iSentence, FIELD_INTEGER ),
DEFINE_KEYFIELD( m_iWeapons, FIELD_INTEGER, "weapons" ), DEFINE_KEYFIELD( m_iWeapons, FIELD_INTEGER, "weapons" ),
DEFINE_KEYFIELD( m_SquadName, FIELD_STRING, "netname" ),
DEFINE_FIELD( m_bInBarnacleMouth, FIELD_BOOLEAN ), DEFINE_FIELD( m_bInBarnacleMouth, FIELD_BOOLEAN ),
DEFINE_FIELD( m_flLastEnemySightTime, FIELD_TIME ), DEFINE_FIELD( m_flLastEnemySightTime, FIELD_TIME ),
@ -488,7 +487,7 @@ int CNPC_HGrunt::SquadRecruit( int searchRadius, int maxMembers )
} }
else else
{ {
char szSquadName[64]; static char szSquadName[64];
Q_snprintf( szSquadName, sizeof( szSquadName ), "squad%d\n", g_iSquadIndex ); Q_snprintf( szSquadName, sizeof( szSquadName ), "squad%d\n", g_iSquadIndex );
m_SquadName = MAKE_STRING( szSquadName ); m_SquadName = MAKE_STRING( szSquadName );

View File

@ -994,7 +994,7 @@ int CNPC_Houndeye::SquadRecruit( int searchRadius, int maxMembers )
} }
else else
{ {
char szSquadName[64]; static char szSquadName[64];
Q_snprintf( szSquadName, sizeof( szSquadName ), "squad%d\n", s_iSquadIndex ); Q_snprintf( szSquadName, sizeof( szSquadName ), "squad%d\n", s_iSquadIndex );
m_SquadName = MAKE_STRING( szSquadName ); m_SquadName = MAKE_STRING( szSquadName );

View File

@ -383,6 +383,11 @@ END_DATADESC()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CNPCMaker::CNPCMaker( void ) CNPCMaker::CNPCMaker( void )
{ {
m_strHintGroup = NULL_STRING;
m_RelationshipString = NULL_STRING;
m_ChildTargetName = NULL_STRING;
m_iszNPCClassname = NULL_STRING
m_SquadName = NULL_STRING;
m_spawnEquipment = NULL_STRING; m_spawnEquipment = NULL_STRING;
} }