mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-13 15:27:56 +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_Criteria.RemoveAll();
|
||||
#ifdef MAPBASE
|
||||
// Must purge to avoid issues with reloading the system
|
||||
m_RulePartitions.PurgeAndDeleteElements();
|
||||
#else
|
||||
m_RulePartitions.RemoveAll();
|
||||
#endif
|
||||
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
|
||||
// be a big pain, and the most important rules that need subjects are tlk_remarks anyway.
|
||||
static inline bool CanBucketBySubject( const char * RESTRICT pszSubject )
|
||||
|
@ -433,6 +433,9 @@ namespace ResponseRules
|
||||
|
||||
// dump everything.
|
||||
void RemoveAll();
|
||||
#ifdef MAPBASE
|
||||
void PurgeAndDeleteElements();
|
||||
#endif
|
||||
|
||||
inline Rule &operator[]( tIndex idx );
|
||||
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