ScummVM API documentation
container.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 ULTIMA8_WORLD_CONTAINER_H
23#define ULTIMA8_WORLD_CONTAINER_H
24
25#include "common/list.h"
26#include "ultima/ultima8/world/item.h"
27#include "ultima/ultima8/usecode/intrinsics.h"
28#include "ultima/ultima8/misc/classtype.h"
29
30namespace Ultima {
31namespace Ultima8 {
32
33class UCList;
34
35class Container : public Item {
36 friend class ItemFactory;
37 friend class ContainerGump;
38 friend class PaperdollGump;
39public:
40 Container();
41 ~Container() override;
42
43 ENABLE_RUNTIME_CLASSTYPE()
44
45
49 virtual bool CanAddItem(Item *item, bool checkwghtvol = false);
50
55 virtual bool addItem(Item *item, bool checkwghtvol = false);
56
60 virtual bool removeItem(Item *item);
61
65 virtual bool moveItemToEnd(Item *item);
66
71
74
76 void setFlagRecursively(uint32 mask) override;
77
83 void containerSearch(UCList *itemlist, const uint8 *loopscript,
84 uint32 scriptsize, bool recurse) const;
85
89 Item *getFirstItemWithShape(uint16 shapeno, bool recurse);
90
94 void getItemsWithShapeFamily(Common::Array<Item *> &itemlist, uint16 family, bool recurse);
95
98 uint32 getTotalWeight() const override;
99
101 virtual uint32 getCapacity() const;
102
104 virtual uint32 getContentVolume() const;
105
108 ObjId assignObjId() override;
109
111 void clearObjId() override;
112
114 void destroy(bool delnow = false) override;
115
116 Common::String dumpInfo() const override;
117
118 bool loadData(Common::ReadStream *rs, uint32 version);
119 void saveData(Common::WriteStream *ws) override;
120
121 INTRINSIC(I_removeContents);
122 INTRINSIC(I_destroyContents);
123
124protected:
125 Common::List<Item *> _contents;
126};
127
128} // End of namespace Ultima8
129} // End of namespace Ultima
130
131#endif
Definition: str.h:38
Definition: container_gump.h:37
Definition: container.h:35
virtual uint32 getCapacity() const
Get the container's capacity.
Common::String dumpInfo() const override
dump some info about this object to a string
void destroy(bool delnow=false) override
Destroy self.
virtual bool addItem(Item *item, bool checkwghtvol=false)
ObjId assignObjId() override
void clearObjId() override
Clear objIDs of self and contents.
void getItemsWithShapeFamily(Common::Array< Item * > &itemlist, uint16 family, bool recurse)
void containerSearch(UCList *itemlist, const uint8 *loopscript, uint32 scriptsize, bool recurse) const
void setFlagRecursively(uint32 mask) override
Set flag on container and all its contents recursively.
virtual bool CanAddItem(Item *item, bool checkwghtvol=false)
virtual bool moveItemToEnd(Item *item)
uint32 getTotalWeight() const override
virtual uint32 getContentVolume() const
Get the total volume used up by the container's current contents.
void destroyContents()
Destroy all contents.
Item * getFirstItemWithShape(uint16 shapeno, bool recurse)
virtual bool removeItem(Item *item)
Definition: item_factory.h:34
Definition: item.h:42
Definition: paperdoll_gump.h:36
Definition: uc_list.h:45
Definition: algorithm.h:29