BVB Source Codes

CRYENGINE Show FactionMap.h Source code

Return Download CRYENGINE: download FactionMap.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #pragma once
  4.  
  5. #include <CryAISystem/IFactionMap.h>
  6.  
  7. class CFactionXmlDataSource : public IFactionDataSource
  8. {
  9. public:
  10.         CFactionXmlDataSource(const char* szFileName)
  11.                 : m_fileName(szFileName)
  12.         {}
  13.  
  14.         // IFactionDataSource
  15.         virtual bool Load(IFactionMap& factionMap) override;
  16.         // ~IFactionDataSource
  17.  
  18. private:
  19.         string m_fileName;
  20. };
  21.  
  22. class CFactionMap : public IFactionMap
  23. {
  24.         friend class CFactionXmlDataSource;
  25.  
  26.         enum { maxFactionCount = 32 };
  27.  
  28.         typedef std::unordered_map<uint8, string>                                                       FactionNamesById;
  29.         typedef std::unordered_map<string, uint8, stl::hash_stricmp<string>, stl::hash_stricmp<string>> FactionIdsByName;
  30.  
  31. public:
  32.         typedef IFactionMap::ReactionType EReaction;
  33.  
  34.         CFactionMap();
  35.  
  36.         // IFactionMap
  37.         virtual uint32      GetFactionCount() const override;
  38.         virtual uint32      GetMaxFactionCount() const override;
  39.  
  40.         virtual const char* GetFactionName(uint8 factionId) const override;
  41.         virtual uint8       GetFactionID(const char* szName) const override;
  42.  
  43.         virtual uint8       CreateOrUpdateFaction(const char* szName, uint32 reactionsCount, const uint8* pReactions) override;
  44.         virtual void        RemoveFaction(const char* szName) override;
  45.  
  46.         virtual void        SetReaction(uint8 factionOne, uint8 factionTwo, IFactionMap::ReactionType reaction) override;
  47.         virtual EReaction   GetReaction(uint8 factionOne, uint8 factionTwo) const override;
  48.  
  49.         virtual void        SetDataSource(IFactionDataSource* pDataSource, EDataSourceLoad bLoad) override;
  50.         virtual void        RemoveDataSource(IFactionDataSource* pDataSource) override;
  51.  
  52.         virtual void        Reload() override;
  53.         // ~IFactionMap
  54.  
  55.         void Clear();
  56.         void Serialize(TSerialize ser);
  57.  
  58. private:
  59.         static bool GetReactionType(const char* szReactionName, EReaction* pReactionType);
  60.  
  61.         static CFactionXmlDataSource s_defaultXmlDataSource;
  62.  
  63.         IFactionDataSource*          m_pDataSource;
  64.         FactionNamesById             m_namesById;
  65.         FactionIdsByName             m_idsByName;
  66.         uint8                        m_reactions[maxFactionCount][maxFactionCount];
  67. };
  68.  
downloadFactionMap.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