mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 14:55:30 +03:00
Added rr_disableemptyrules cvar, which prevents rules from being selected again after their norepeat/speakonce responses are exhausted
This commit is contained in:
parent
4b8da761ce
commit
4e09f4bdf5
@ -12,6 +12,9 @@
|
|||||||
#include "convar.h"
|
#include "convar.h"
|
||||||
#include "fmtstr.h"
|
#include "fmtstr.h"
|
||||||
#include "generichash.h"
|
#include "generichash.h"
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "tier1/mapbase_matchers_base.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
@ -86,6 +89,10 @@ ConVar rr_dumpresponses( "rr_dumpresponses", "0", FCVAR_NONE, "Dump all response
|
|||||||
ConVar rr_debugresponseconcept( "rr_debugresponseconcept", "", FCVAR_NONE, "If set, rr_debugresponses will print only responses testing for the specified concept" );
|
ConVar rr_debugresponseconcept( "rr_debugresponseconcept", "", FCVAR_NONE, "If set, rr_debugresponses will print only responses testing for the specified concept" );
|
||||||
#define RR_DEBUGRESPONSES_SPECIALCASE 4
|
#define RR_DEBUGRESPONSES_SPECIALCASE 4
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
ConVar rr_disableemptyrules( "rr_disableemptyrules", "0", FCVAR_NONE, "Disables rules with no remaining responses, e.g. rules which use norepeat responses." );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -788,6 +795,38 @@ void CResponseSystem::ResetResponseGroups()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CResponseSystem::DisableEmptyRules()
|
||||||
|
{
|
||||||
|
if (rr_disableemptyrules.GetBool() == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for ( ResponseRulePartition::tIndex idx = m_RulePartitions.First() ;
|
||||||
|
m_RulePartitions.IsValid(idx) ;
|
||||||
|
idx = m_RulePartitions.Next(idx) )
|
||||||
|
{
|
||||||
|
Rule &rule = m_RulePartitions[ idx ];
|
||||||
|
|
||||||
|
// Set it as disabled in advance
|
||||||
|
rule.m_bEnabled = false;
|
||||||
|
|
||||||
|
int c2 = rule.m_Responses.Count();
|
||||||
|
for (int s = 0; s < c2; s++)
|
||||||
|
{
|
||||||
|
if (m_Responses[rule.m_Responses[s]].IsEnabled())
|
||||||
|
{
|
||||||
|
// Re-enable it if there's any valid responses
|
||||||
|
rule.m_bEnabled = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Make certain responses unavailable by marking them as depleted
|
// Purpose: Make certain responses unavailable by marking them as depleted
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -863,6 +902,9 @@ int CResponseSystem::SelectWeightedResponseFromResponseGroup( ResponseGroup *g,
|
|||||||
if ( g->IsNoRepeat() )
|
if ( g->IsNoRepeat() )
|
||||||
{
|
{
|
||||||
g->SetEnabled( false );
|
g->SetEnabled( false );
|
||||||
|
#ifdef MAPBASE
|
||||||
|
DisableEmptyRules();
|
||||||
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,6 +241,10 @@ public:
|
|||||||
float LookupEnumeration( const char *name, bool& found );
|
float LookupEnumeration( const char *name, bool& found );
|
||||||
|
|
||||||
ResponseRulePartition::tIndex FindBestMatchingRule( const CriteriaSet& set, bool verbose, float &scoreOfBestMatchingRule );
|
ResponseRulePartition::tIndex FindBestMatchingRule( const CriteriaSet& set, bool verbose, float &scoreOfBestMatchingRule );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
void DisableEmptyRules();
|
||||||
|
#endif
|
||||||
|
|
||||||
float ScoreCriteriaAgainstRule( const CriteriaSet& set, ResponseRulePartition::tRuleDict &dict, int irule, bool verbose = false );
|
float ScoreCriteriaAgainstRule( const CriteriaSet& set, ResponseRulePartition::tRuleDict &dict, int irule, bool verbose = false );
|
||||||
float RecursiveScoreSubcriteriaAgainstRule( const CriteriaSet& set, Criteria *parent, bool& exclude, bool verbose /*=false*/ );
|
float RecursiveScoreSubcriteriaAgainstRule( const CriteriaSet& set, Criteria *parent, bool& exclude, bool verbose /*=false*/ );
|
||||||
|
Loading…
Reference in New Issue
Block a user