ScummVM API documentation
armor.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA4_GAME_ARMOR_H
23 #define ULTIMA4_GAME_ARMOR_H
24 
25 #include "ultima/ultima4/filesys/savegame.h"
26 #include "common/str.h"
27 
28 namespace Ultima {
29 namespace Ultima4 {
30 
31 class ConfigElement;
32 class Armors;
33 
34 class Armor {
35  friend class Armors;
36 public:
37  // Getters
38  ArmorType getType() const {
39  return _type;
40  }
41  const Common::String &getName() const {
42  return _name;
43  }
44  int getDefense() const {
45  return _defense;
46  }
48  bool canWear(ClassType klass) const {
49  return _canUse & (1 << klass);
50  }
51 
52 private:
53  Armor(ArmorType armorType, const ConfigElement &conf);
54 
55  ArmorType _type;
56  Common::String _name;
57  byte _canUse;
58  int _defense;
59  //unsigned short _mask;
60 };
61 
62 class Armors : public Common::Array<Armor *> {
63 private:
64  void loadConf();
65  bool _confLoaded;
66 public:
70  Armors();
71 
75  ~Armors();
76 
80  const Armor *get(ArmorType a);
81 
85  const Armor *get(const Common::String &name);
86 };
87 
88 extern Armors *g_armors;
89 
90 } // End of namespace Ultima4
91 } // End of namespace Ultima
92 
93 #endif
Definition: armor.h:62
Definition: str.h:59
int getDefense() const
Definition: armor.h:44
Definition: config.h:126
Definition: array.h:52
bool canWear(ClassType klass) const
Definition: armor.h:48
Definition: detection.h:27
Definition: armor.h:34
ArmorType getType() const
Definition: armor.h:38
const Common::String & getName() const
Definition: armor.h:41