mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-06-05 02:12:10 +03:00
Fixed new response system sometimes crashing on rule lookup when the system is reloaded by rr_reloadresponsesystems or map-specific talker files
This commit is contained in:
parent
aa4d02fcbf
commit
80c26ea186
@ -246,7 +246,12 @@ void CResponseSystem::Clear()
|
|||||||
{
|
{
|
||||||
m_Responses.RemoveAll();
|
m_Responses.RemoveAll();
|
||||||
m_Criteria.RemoveAll();
|
m_Criteria.RemoveAll();
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Must purge to avoid issues with reloading the system
|
||||||
|
m_RulePartitions.PurgeAndDeleteElements();
|
||||||
|
#else
|
||||||
m_RulePartitions.RemoveAll();
|
m_RulePartitions.RemoveAll();
|
||||||
|
#endif
|
||||||
m_Enumerations.RemoveAll();
|
m_Enumerations.RemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +88,20 @@ void ResponseRulePartition::RemoveAll( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
void ResponseRulePartition::PurgeAndDeleteElements()
|
||||||
|
{
|
||||||
|
for ( int bukkit = 0 ; bukkit < N_RESPONSE_PARTITIONS ; ++bukkit )
|
||||||
|
{
|
||||||
|
for ( int i = m_RuleParts[bukkit].FirstInorder(); i != m_RuleParts[bukkit].InvalidIndex(); i = m_RuleParts[bukkit].NextInorder( i ) )
|
||||||
|
{
|
||||||
|
delete m_RuleParts[bukkit][ i ];
|
||||||
|
}
|
||||||
|
m_RuleParts[bukkit].Purge();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// don't bucket "subject" criteria that prefix with operators, since stripping all that out again would
|
// don't bucket "subject" criteria that prefix with operators, since stripping all that out again would
|
||||||
// be a big pain, and the most important rules that need subjects are tlk_remarks anyway.
|
// be a big pain, and the most important rules that need subjects are tlk_remarks anyway.
|
||||||
static inline bool CanBucketBySubject( const char * RESTRICT pszSubject )
|
static inline bool CanBucketBySubject( const char * RESTRICT pszSubject )
|
||||||
|
@ -433,6 +433,9 @@ namespace ResponseRules
|
|||||||
|
|
||||||
// dump everything.
|
// dump everything.
|
||||||
void RemoveAll();
|
void RemoveAll();
|
||||||
|
#ifdef MAPBASE
|
||||||
|
void PurgeAndDeleteElements();
|
||||||
|
#endif
|
||||||
|
|
||||||
inline Rule &operator[]( tIndex idx );
|
inline Rule &operator[]( tIndex idx );
|
||||||
int Count( void ); // number of elements inside, but you can't iterate from 0 to this
|
int Count( void ); // number of elements inside, but you can't iterate from 0 to this
|
||||||
|
Loading…
x
Reference in New Issue
Block a user