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;
void addItem(const std::string &id, int qty=1)
Adds an item to the container.
Definition: ItemContainer.cpp:65
YAML::Node save() const
Saves the item container to YAML.
Definition: ItemContainer.cpp:53
std::map< std::string, int > * getContents()
Gets all the items in the container.
Definition: ItemContainer.cpp:155
int getItem(const std::string &id) const
Gets an item in the container.
Definition: ItemContainer.cpp:104
ItemContainer()
Creates an empty item container.
Definition: ItemContainer.cpp:29
Set of rules and stats for a game.
Definition: Ruleset.h:69
Represents the items contained by a certain entity, like base stores, craft equipment, etc.
Definition: ItemContainer.h:36
~ItemContainer()
Cleans up the item container.
Definition: ItemContainer.cpp:36
int getTotalQuantity() const
Gets the total quantity of items in the container.
Definition: ItemContainer.cpp:126
void load(const YAML::Node &node)
Loads the item container from YAML.
Definition: ItemContainer.cpp:44
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