game(hl1): fix use after scope

This commit is contained in:
nillerusr 2022-08-23 17:33:12 +03:00
parent 8c5992c921
commit 340e7a3f34
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_iSentence, FIELD_INTEGER ),
DEFINE_KEYFIELD( m_iWeapons, FIELD_INTEGER, "weapons" ),
DEFINE_KEYFIELD( m_SquadName, FIELD_STRING, "netname" ),
DEFINE_FIELD( m_bInBarnacleMouth, FIELD_BOOLEAN ),
DEFINE_FIELD( m_flLastEnemySightTime, FIELD_TIME ),
@ -488,7 +487,7 @@ int CNPC_HGrunt::SquadRecruit( int searchRadius, int maxMembers )
}
else
{
char szSquadName[64];
static char szSquadName[64];
Q_snprintf( szSquadName, sizeof( szSquadName ), "squad%d\n", g_iSquadIndex );
m_SquadName = MAKE_STRING( szSquadName );

View file

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

View file

@ -383,6 +383,11 @@ END_DATADESC()
//-----------------------------------------------------------------------------
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;
}