ScummVM API documentation
ItemCollection.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 /*
23  * This code is based on the CRAB engine
24  *
25  * Copyright (c) Arvind Raja Yadav
26  *
27  * Licensed under MIT
28  *
29  */
30 
31 #ifndef CRAB_ITEMCOLLECTION_H
32 #define CRAB_ITEMCOLLECTION_H
33 
34 #include "crab/item/ItemMenu.h"
35 #include "crab/stat/StatDrawHelper.h"
36 
37 namespace Crab {
38 
39 namespace pyrodactyl {
40 namespace item {
41 // All the items owned by characters controlled by the player
43  // The items for all player characters
45 
46  // The reference information for these menus used to display these items
47 
48  // The reference item slot
49  ItemSlot _ref;
50 
51  // This vector stores the increments in x,y for each new slot
52  Vector2i _inc;
53 
54  // The dimensions of the menu
55  uint _rows, _cols;
56 
57  // Draw item description when user clicks an item to select it
58  pyrodactyl::ui::ItemDesc _itemInfo;
59 
60  // Should we enable keyboard for the menus
61  bool _useKeyboard;
62 
63 public:
64  ItemCollection() {
65  _rows = 1;
66  _cols = 1;
67  _useKeyboard = true;
68  }
69 
70  ~ItemCollection() {}
71 
72  void load(rapidxml::xml_node<char> *node);
73 
74  void handleEvents(const Common::String &charId, const Common::Event &event);
75 
76  void init(const Common::String &charId);
77  void draw(const Common::String &charId);
78 
79  // Requires: id of the character, the item information
80  void add(const Common::String &charId, Item &itemData);
81 
82  // Requires: id of the character from which to remove the item, and id of the item
83  void del(const Common::String &charId, const Common::String &itemId);
84 
85  // Requires: id of the character, the name of the container and name of the item
86  bool has(const Common::String &charId, const Common::String &container, const Common::String &itemId);
87 
88  void loadState(rapidxml::xml_node<char> *node);
89  void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
90 
91  void setUI();
92 };
93 } // End of namespace item
94 } // End of namespace pyrodactyl
95 
96 } // End of namespace Crab
97 
98 #endif // CRAB_ITEMCOLLECTION_H
Definition: ItemDesc.h:40
Definition: str.h:59
Definition: ItemCollection.h:42
Definition: Item.h:42
Definition: ItemSlot.h:46
Definition: hashmap.h:85
Definition: events.h:199
Definition: moveeffect.h:37