Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

  1. /// @file response_system.cpp
  2. /// This file contains the unmanaged code implementing the editor's version
  3. /// of a response-system.
  4. #include "stdafx.h"
  5. using namespace ResponseRules;
  6. const char *ResponseSystemImplementationCLI::GetScriptFile( void )
  7. {
  8. return NULL;
  9. }
  10. #pragma managed(push, off)
  11. void ResponseSystemImplementationCLI::PrecacheResponses( bool bEnable )
  12. {
  13. // precaching is meaningless in the editor
  14. Assert(false);
  15. }
  16. void ResponseSystemImplementationCLI::Release( )
  17. {
  18. // precaching is meaningless in the editor
  19. Assert(false);
  20. }
  21. int ResponseSystemImplementationCLI::CountRules()
  22. {
  23. return m_RulePartitions.Count();
  24. }
  25. /// Resets the output vector and overwrites it entirely.
  26. /// <remarks>
  27. /// Meant to be the same algorithm as CResponseSystem::FindBestMatchingRule().
  28. /// </remarks>
  29. void ResponseSystemImplementationCLI::FindAllRulesMatchingCriteria( CUtlSortVector<RuleAndScorePair_t, RuleAndScorePair_t::LessFunc> * RESTRICT outputList, const CriteriaSet& set, IResponseFilter *pFilter /*= NULL */ )
  30. {
  31. outputList->RemoveAll();
  32. outputList->EnsureCapacity(16);
  33. ResponseRulePartition::tRuleDict &rules = m_RulePartitions.GetDictForCriteria( set );
  34. int c = rules.Count();
  35. int i;
  36. for ( i = 0; i < c; i++ )
  37. {
  38. float score = ScoreCriteriaAgainstRule( set, rules, i, false );
  39. outputList->Insert( RuleAndScorePair_t( m_RulePartitions.IndexFromDictElem( &rules, i ), score ));
  40. }
  41. }
  42. #pragma managed(pop)