Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
powermap.hpp
1 //////////////////////////////
2 //
3 // File: swrs/powermap.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Feb 24 2013
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __SW_POWER_MAP_H_
15 #define __SW_POWER_MAP_H_
16 #include <utility>
17 #include <vector>
18 #include <string>
19 #include <map>
20 #include "swrs/power.hpp"
21 #include "swrs/character.hpp"
22 #include "swrs/optionsmap.hpp"
23 
24 namespace SWRS
25 {
26  class Character;
27  //! map of available magical powers
28  class PowerMap: public OptionsMap
29  {
30  friend class RulesSystem;
31  friend class CharacterImpl;
32  //! class for sets of data for powers
33  typedef std::vector<PowerRecord> PowerIdVector;
34  //! first is name; second is parent id; if id is 0, than it is name of an
35  //! attribute; otherwise we have naame of skill and id of parent attribute
36  typedef std::map<std::string, int> StringMap;
37  //! see typedef of PowerIdVector
38  PowerIdVector powers_vector;
39  //! map names of powers to their datasets
40  StringMap power_names_map;
41  //! initialize power map from file
42  void ReadPowerMap(const char * filename);
43  //! print summary from power data
44  void PrintSummary();
45 
46  //! used for implementation of CharacterImpl::GetPossiblePowerVector
47  const StringMap & GetPowerNamesMap() const { return power_names_map;}
48  public:
49  //! factory method
50  //!\param power_name name of power for which object is about to be generated
51  Power * GeneratePower(const std::string & power_name)const;
52  };
53  //end of class PowerMap
54 }
55 #endif