BVB Source Codes

CRYENGINE Show TacticalPointQuery.h Source code

Return Download CRYENGINE: download TacticalPointQuery.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /********************************************************************
  4.    ---------------------------------------------------------------------
  5.    File name:   TacticalPointQuery.h
  6.    $Id$
  7.    $DateTime$
  8.    Description: Classes for constructing new TPS queries
  9.    ---------------------------------------------------------------------
  10.    History:
  11.    - 30:07:2007 : Separated out by Matthew Jack
  12.  
  13.  *********************************************************************/
  14.  
  15. #pragma once
  16.  
  17. #ifndef __TacticalPointQuery_H__
  18.         #define __TacticalPointQuery_H__
  19.  
  20.         #if _MSC_VER > 1000
  21.                 #pragma once
  22.         #endif
  23.         #include "TacticalPointQueryEnum.h"
  24.  
  25. class CCriterion
  26. {
  27. public:
  28.         CCriterion();
  29.         ~CCriterion() {}
  30.  
  31.         void SetQuery(TTacticalPointQuery query)          // The Query, be it for Generation, Conditions or Weights
  32.         { m_eQuery = query; }
  33.         void SetLimits(TTacticalPointQuery limits)        // The Limits flags, if any
  34.         { m_eLimits = limits; }
  35.         void SetObject(TTacticalPointQuery object)
  36.         { m_eObject = object; }
  37.         void SetObjectAux(TTacticalPointQuery objectAux)
  38.         { m_eObjectAux = objectAux; }
  39.         void SetValue(float fVal)                       // Note that this overwrites any bool value
  40.         { m_fValue = fVal; }
  41.         void SetValue(bool bVal)                          // Note that this overwrites any float value
  42.         { m_bValue = bVal; }
  43.         void SetValue(ETPSRelativeValueSource nVal)     // Note that this DOES NOT overwrite any float or bool value
  44.         { m_nRelativeValueSource = nVal; }
  45.  
  46.         TTacticalPointQuery     GetQuery() const
  47.         { return m_eQuery; }
  48.         TTacticalPointQuery     GetLimits() const
  49.         { return m_eLimits; }
  50.         TTacticalPointQuery     GetObject() const
  51.         { return m_eObject; }
  52.         TTacticalPointQuery     GetObjectAux() const
  53.         { return m_eObjectAux; }
  54.         float                   GetValueAsFloat() const
  55.         { return m_fValue; }
  56.         bool                    GetValueAsBool() const
  57.         { return m_bValue; }
  58.         ETPSRelativeValueSource GetValueAsRelativeValueSource() const
  59.         { return m_nRelativeValueSource; }
  60.  
  61.         bool IsValid() const;                       // Checks that all settings (apart from value) make sense
  62.  
  63. private:
  64.  
  65.         TTacticalPointQuery m_eQuery;         // Just the query (unpacked for debugging purposes)
  66.         TTacticalPointQuery m_eLimits;        // Just the limits (unpacked for debugging purposes)
  67.         TTacticalPointQuery m_eObject;        // The Object of the Query, if any (unpacked for debugging purposes)
  68.         TTacticalPointQuery m_eObjectAux;     // Auxiliary object used in some Generation queries (unpacked for debugging purposes)
  69.         // E.g. Object we hide from for hidespot generation
  70.         union
  71.         {
  72.                 float m_fValue;
  73.                 bool  m_bValue;
  74.         };
  75.         ETPSRelativeValueSource m_nRelativeValueSource;
  76. };
  77.  
  78. //---------------------------------------------------------------------------------------//
  79.  
  80. class COptionCriteria
  81. {
  82. public:
  83.         struct SParameters
  84.         {
  85.                 float  fDensity;
  86.                 float  fHeight;
  87.                 float  fHorizontalSpacing;
  88.                 int    iObjectsType;
  89.                 string sSignalToSend;
  90.                 string tagPointPostfix;
  91.                 string extenderStringParamenter;
  92.                 string sNavigationAgentType;
  93.  
  94.                 SParameters()
  95.                         : fDensity(1.0f)
  96.                         , fHeight(0.0f)
  97.                         , fHorizontalSpacing(1.0f)
  98.                         , iObjectsType(-1)
  99.                 {
  100.                 }
  101.         };
  102.  
  103.         COptionCriteria() {};
  104.         ~COptionCriteria() {};
  105.  
  106.         // Returns true iff parsed successfully
  107.         bool AddToParameters(const char* sSpec, float fValue);
  108.         bool AddToParameters(const char* sSpec, bool bValue);
  109.         bool AddToParameters(const char* sSpec, const char* sValue);
  110.  
  111.         // Returns true iff parsed successfully
  112.         bool AddToGeneration(const char* sSpec, float fValue);
  113.         bool AddToGeneration(const char* sSpec, ETPSRelativeValueSource nSource);
  114.  
  115.         // fValue/bValue: value for comparison against result
  116.         // Returns true iff parsed successfully
  117.         bool AddToConditions(const char* sSpec, float fValue);
  118.         bool AddToConditions(const char* sSpec, bool bValue);
  119.  
  120.         // fWeight: weight multiplier for the result of this query; can be negative
  121.         // Returns true iff parsed successfully
  122.         bool                           AddToWeights(const char* sSpec, float fWeight);
  123.  
  124.         const std::vector<CCriterion>& GetAllGeneration() const { return m_vGeneration; }
  125.         const std::vector<CCriterion>& GetAllConditions() const { return m_vConditions; }
  126.         const std::vector<CCriterion>& GetAllWeights() const    { return m_vWeights; }
  127.  
  128.         const SParameters*             GetParams(void) const    { return &m_params; }
  129.  
  130.         string                         GetDescription() const;
  131.  
  132.         bool                           IsValid() const;
  133.  
  134. private:
  135.         CCriterion GetCriterion(const char* sSpec);
  136.  
  137.         SParameters             m_params;
  138.  
  139.         std::vector<CCriterion> m_vGeneration;
  140.         std::vector<CCriterion> m_vConditions;
  141.         std::vector<CCriterion> m_vWeights;
  142. };
  143.  
  144. //---------------------------------------------------------------------------------------//
  145.  
  146. class CTacticalPointQuery
  147. {
  148. public:
  149.         CTacticalPointQuery(const char* psName);
  150.         ~CTacticalPointQuery();
  151.  
  152.         // Adds one of the options for choosing a point
  153.         // Each will be tried in the order they were added until a valid point is found
  154.         void AddOption(const COptionCriteria& option);
  155.  
  156.         bool IsValid() const;
  157.  
  158.         // Get the name of this query
  159.         const char* GetName() const { return m_sName.c_str(); }
  160.  
  161.         // NULL on option outside of range
  162.         COptionCriteria*       GetOption(int i);
  163.         // NULL on option outside of range
  164.         const COptionCriteria* GetOption(int i) const;
  165.  
  166. private:
  167.         std::vector<COptionCriteria> m_vOptions;
  168.         string                       m_sName; // Also in map - why store twice? Storing it's ID might be better
  169. };
  170.  
  171. #endif // __TacticalPointQuery_H__
  172.  
downloadTacticalPointQuery.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top