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 "ultima/shared/std/containers.h"
27 #include "ultima/shared/std/string.h"
28 
29 namespace Ultima {
30 namespace Ultima4 {
31 
32 class ConfigElement;
33 class Armors;
34 
35 class Armor {
36  friend class Armors;
37 public:
38  // Getters
39  ArmorType getType() const {
40  return _type;
41  }
42  const Common::String &getName() const {
43  return _name;
44  }
45  int getDefense() const {
46  return _defense;
47  }
49  bool canWear(ClassType klass) const {
50  return _canUse & (1 << klass);
51  }
52 
53 private:
54  Armor(ArmorType armorType, const ConfigElement &conf);
55 
56  ArmorType _type;
57  Common::String _name;
58  byte _canUse;
59  int _defense;
60  //unsigned short _mask;
61 };
62 
63 class Armors : public Std::vector<Armor *> {
64 private:
65  void loadConf();
66  bool _confLoaded;
67 public:
71  Armors();
72 
76  ~Armors();
77 
81  const Armor *get(ArmorType a);
82 
86  const Armor *get(const Common::String &name);
87 };
88 
89 extern Armors *g_armors;
90 
91 } // End of namespace Ultima4
92 } // End of namespace Ultima
93 
94 #endif
Definition: armor.h:63
Definition: str.h:59
int getDefense() const
Definition: armor.h:45
Definition: config.h:127
bool canWear(ClassType klass) const
Definition: armor.h:49
Definition: detection.h:27
Definition: armor.h:35
ArmorType getType() const
Definition: armor.h:39
const Common::String & getName() const
Definition: armor.h:42
Definition: containers.h:38