OpenXcom  1.0
Open-source clone of the original X-Com
RuleInventory.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_RULEINVENTORY_H
20 #define OPENXCOM_RULEINVENTORY_H
21 
22 #include <string>
23 #include <vector>
24 #include <map>
25 #include <yaml-cpp/yaml.h>
26 
27 namespace OpenXcom
28 {
29 
30 struct RuleSlot
31 {
32  int x, y;
33 };
34 
35 enum InventoryType { INV_SLOT, INV_HAND, INV_GROUND };
36 
37 class RuleItem;
38 
45 {
46 private:
47  std::string _id;
48  int _x, _y;
49  InventoryType _type;
50  std::vector<RuleSlot> _slots;
51  std::map<std::string, int> _costs;
52  int _listOrder;
53 public:
54  static const int SLOT_W = 16;
55  static const int SLOT_H = 16;
56  static const int HAND_W = 2;
57  static const int HAND_H = 3;
59  RuleInventory(const std::string &id);
61  ~RuleInventory();
63  void load(const YAML::Node& node, int listOrder);
65  std::string getId() const;
67  int getX() const;
69  int getY() const;
71  InventoryType getType() const;
73  std::vector<struct RuleSlot> *getSlots();
75  bool checkSlotInPosition(int *x, int *y) const;
77  bool fitItemInSlot(RuleItem *item, int x, int y) const;
79  int getCost(RuleInventory *slot) const;
80  int getListOrder() const;
81 };
82 
83 }
84 
85 #endif
Definition: RuleInventory.h:30
Represents a specific type of item.
Definition: RuleItem.h:41
COPYING:
Definition: BaseInfoState.cpp:40
Represents a specific section of the inventory, containing information like available slots and scree...
Definition: RuleInventory.h:44