ScummVM API documentation
inventory.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 MADS_INVENTORY_H
23 #define MADS_INVENTORY_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/serializer.h"
28 
29 namespace MADS {
30 
31 enum {
32  PLAYER_INVENTORY = 2, NOWHERE = 1
33 };
34 
35 class MADSEngine;
36 
37 #define MAX_VOCAB 5
38 #define MAX_QUALITIES 4
39 
41 public:
42  int _descId;
43  int _roomNumber;
44  int _article;
45  int _vocabCount;
46  int _qualitiesCount;
47  int syntax;
48 
49  struct {
50  int _vocabId;
51  VerbType _verbType;
52  PrepType _prepType;
53  } _vocabList[MAX_VOCAB];
54 
55  int _qualityId[MAX_QUALITIES];
56  int _qualityValue[MAX_QUALITIES];
57 
62 
66  bool hasQuality(int qualityId) const;
67 
71  void setQuality(int qualityId, int qualityValue);
72 
76  int getQuality(int qualityId) const;
77 };
78 
79 class InventoryObjects : public Common::Array<InventoryObject> {
80 private:
81  MADSEngine *_vm;
82 
83 public:
84  SynchronizedList _inventoryList;
85 
89  InventoryObjects(MADSEngine *vm) : _vm(vm) {}
90 
94  void load();
95 
100 
104  InventoryObject &getItem(int itemIndex) {
105  return (*this)[_inventoryList[itemIndex]];
106  }
107 
111  void setRoom(int objectId, int sceneNumber);
112 
116  bool isInRoom(int objectId) const;
117 
121  bool isInInventory(int objectId) const;
122 
126  void addToInventory(int objectId);
127 
133  void removeFromInventory(int objectId, int newScene);
134 
135  int getIdFromDesc(int objectId);
136 };
137 
138 } // End of namespace MADS
139 
140 #endif /* MADS_INVENTORY_H */
Definition: array.h:52
Definition: resources.h:78
InventoryObject & getItem(int itemIndex)
Definition: inventory.h:104
Definition: inventory.h:79
Definition: serializer.h:79
int getQuality(int qualityId) const
Definition: mads.h:87
bool hasQuality(int qualityId) const
InventoryObjects(MADSEngine *vm)
Definition: inventory.h:89
Definition: inventory.h:40
Definition: action.h:28
void synchronize(Common::Serializer &s)
void setQuality(int qualityId, int qualityValue)