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 INVENTORY_H
23
#define INVENTORY_H
24
25
#include "common/array.h"
26
#include "common/ptr.h"
27
#include "common/rect.h"
28
#include "common/scummsys.h"
29
#include "common/str.h"
30
31
namespace
Common
{
32
class
ReadStream;
33
class
WriteStream;
34
}
// namespace Common
35
36
namespace
AGDS
{
37
class
Object;
38
using
ObjectPtr =
Common::SharedPtr<Object>
;
39
class
AGDSEngine;
40
41
class
Inventory
{
42
class
AGDSEngine
*_engine;
43
struct
Entry {
44
Common::String
name;
45
bool
hasObject;
46
ObjectPtr
object;
47
48
void
reset() {
49
name.
clear
();
50
hasObject =
false
;
51
object
.reset();
52
}
53
};
54
using
EntriesType
=
Common::Array<Entry>
;
55
EntriesType
_entries;
56
bool
_enabled;
57
bool
_visible;
58
59
public
:
60
static
const
int
kMaxSize = 35;
61
62
Inventory
(
AGDSEngine
*engine);
63
~
Inventory
();
64
65
void
load(
Common::ReadStream
&stream);
66
void
save(
Common::WriteStream
&stream)
const
;
67
68
bool
enabled()
const
{
69
return
_enabled;
70
}
71
void
enable(
bool
enabled) {
72
_enabled = enabled;
73
}
74
75
bool
visible()
const
{
76
return
_visible;
77
}
78
79
void
visible(
bool
visible);
80
81
int
add(
const
Common::String
&name);
82
int
add(
const
ObjectPtr
&
object
);
83
bool
remove
(
const
Common::String
&name);
84
void
removeGaps();
85
86
bool
has(
int
index)
const
;
87
ObjectPtr
get
(
int
index);
88
int
find
(
const
Common::String
&name)
const
;
89
ObjectPtr
find
(
const
Common::Point
pos)
const
;
90
91
int
free()
const
;
92
void
clear();
93
94
const
EntriesType
&entries()
const
{
95
return
_entries;
96
}
97
98
uint maxSize()
const
{
99
return
_entries.
size
();
100
}
101
};
102
103
}
// End of namespace AGDS
104
105
#endif
/* AGDS_INVENTORY_H */
Common::BaseString::clear
void clear()
Common::String
Definition:
str.h:59
Common::WriteStream
Definition:
stream.h:77
Common::Array< Entry >
Common::find
In find(In first, In last, const T &v)
Definition:
algorithm.h:225
AGDS::Inventory
Definition:
inventory.h:41
AGDS
Definition:
agds.h:58
Common
Definition:
algorithm.h:29
Common::Point
Definition:
rect.h:144
Common::Array::size
size_type size() const
Definition:
array.h:316
Common::ReadStream
Definition:
stream.h:385
Common::SharedPtr< Object >
AGDS::AGDSEngine
Definition:
agds.h:81
engines
agds
inventory.h
Generated on Wed Dec 10 2025 09:10:01 for ScummVM API documentation by
1.8.13