Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
factionmatrix.h
1 #pragma once
2 #include <list>
3 #include <map>
4 #include <memory>
5 #include <unordered_map>
6 #include <utility>
7 
8 #include "utils/pairhash.h"
9 
10 class Faction;
11 class FactionRelation;
12 
13 
15 public:
16  FactionMatrix();
17  ~FactionMatrix();
18 
19  Faction& pirateFaction();
20  Faction& policeFaction();
21  Faction& playerFaction();
22  Faction& unknownFaction();
23 
24  Faction& getFaction(const std::string& factionName);
25  void addFaction(std::shared_ptr<Faction> faction);
26 
27  FactionRelation& getRelation(Faction& factionA, Faction& factionB);
28  FactionRelation& getRelationToPlayer(Faction& faction);
29 
30 protected:
31  std::unordered_map<std::string, std::shared_ptr<Faction>> m_factions;
32  std::unordered_map<std::pair<Faction*, Faction*>, std::shared_ptr<FactionRelation>> m_relations;
33 
34  void setupRelations();
35  std::pair<Faction*, Faction*> uniquePair(Faction& factionA, Faction& factionB);
36 };
37 
Definition: faction.h:10
Definition: factionrelation.h:16
Definition: factionmatrix.h:14