From 2cb00530c720ae8a0c09eede7948911157fe57c2 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Tue, 23 Aug 2022 17:33:12 +0300 Subject: [PATCH] game(hl1): fix use after scope --- game/server/hl1/hl1_npc_hgrunt.cpp | 3 +-- game/server/hl1/hl1_npc_houndeye.cpp | 2 +- game/server/monstermaker.cpp | 5 +++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/game/server/hl1/hl1_npc_hgrunt.cpp b/game/server/hl1/hl1_npc_hgrunt.cpp index 375ddf73..f2b7bf12 100644 --- a/game/server/hl1/hl1_npc_hgrunt.cpp +++ b/game/server/hl1/hl1_npc_hgrunt.cpp @@ -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 ); diff --git a/game/server/hl1/hl1_npc_houndeye.cpp b/game/server/hl1/hl1_npc_houndeye.cpp index 10ae1895..f9bbed2e 100644 --- a/game/server/hl1/hl1_npc_houndeye.cpp +++ b/game/server/hl1/hl1_npc_houndeye.cpp @@ -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 ); diff --git a/game/server/monstermaker.cpp b/game/server/monstermaker.cpp index 98f1e02f..585e6637 100644 --- a/game/server/monstermaker.cpp +++ b/game/server/monstermaker.cpp @@ -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; }