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  * Additional copyright for this file:
8  * Copyright (C) 1995-1997 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef PEGASUS_ITEMS_INVENTORY_H
26 #define PEGASUS_ITEMS_INVENTORY_H
27 
28 #include "pegasus/types.h"
29 #include "pegasus/items/itemlist.h"
30 
31 namespace Pegasus {
32 
33 class Item;
34 
35 // Inventories have a "current item". This item is the default item the player can
36 // use. In a text adventure system, the current item would be "it", as in
37 // "Hit the troll with it," where "it" would refer to some weapon which is the current
38 // item. In a graphic adventure, the current item would be the item the user selects
39 // to use with the mouse or other pointing device.
40 
41 class Inventory {
42 public:
43  Inventory();
44  virtual ~Inventory();
45 
46  WeightType getWeightLimit();
47  void setWeightLimit(WeightType limit);
48  WeightType getWeight();
49 
50  virtual InventoryResult addItem(Item *item);
51  virtual InventoryResult removeItem(Item *item);
52  virtual InventoryResult removeItem(ItemID id);
53  virtual bool itemInInventory(Item *item);
54  virtual bool itemInInventory(ItemID id);
55  virtual Item *getItemAt(int32 index);
56  virtual ItemID getItemIDAt(int32 index);
57  virtual Item *findItemByID(ItemID id);
58  virtual int32 findIndexOf(Item *item);
59  virtual int32 findIndexOf(ItemID id);
60  int32 getNumItems();
61  virtual void removeAllItems();
62 
63  void setOwnerID(const ActorID id);
64  ActorID getOwnerID() const;
65 
66  uint32 getReferenceCount() { return _referenceCount; }
67 
68 protected:
69  WeightType _weightLimit;
70  ActorID _ownerID;
71  ItemList _inventoryList;
72 
73 private:
74  uint32 _referenceCount;
75 };
76 
77 } // End of namespace Pegasus
78 
79 #endif
Definition: itemlist.h:41
Definition: item.h:294
Definition: inventory.h:41
Definition: ai_action.h:33