19 #ifndef OPENXCOM_ITEMCONTAINER_H
20 #define OPENXCOM_ITEMCONTAINER_H
24 #include <yaml-cpp/yaml.h>
39 std::map<std::string, int> _qty;
46 void load(
const YAML::Node& node);
48 YAML::Node
save()
const;
50 void addItem(
const std::string &
id,
int qty = 1);
52 void removeItem(
const std::string &
id,
int qty = 1);
54 int getItem(
const std::string &
id)
const;
Represents the items contained by a certain entity, like base stores, craft equipment,...
Definition: ItemContainer.h:37
int getTotalQuantity() const
Gets the total quantity of items in the container.
Definition: ItemContainer.cpp:126
~ItemContainer()
Cleans up the item container.
Definition: ItemContainer.cpp:36
ItemContainer()
Creates an empty item container.
Definition: ItemContainer.cpp:29
void addItem(const std::string &id, int qty=1)
Adds an item to the container.
Definition: ItemContainer.cpp:65
void load(const YAML::Node &node)
Loads the item container from YAML.
Definition: ItemContainer.cpp:44
YAML::Node save() const
Saves the item container to YAML.
Definition: ItemContainer.cpp:53
int getItem(const std::string &id) const
Gets an item in the container.
Definition: ItemContainer.cpp:104
double getTotalSize(const Ruleset *rule) const
Gets the total size of items in the container.
Definition: ItemContainer.cpp:141
void removeItem(const std::string &id, int qty=1)
Removes an item from the container.
Definition: ItemContainer.cpp:83
std::map< std::string, int > * getContents()
Gets all the items in the container.
Definition: ItemContainer.cpp:155
Set of rules and stats for a game.
Definition: Ruleset.h:70
COPYING:
Definition: BaseInfoState.cpp:41