MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / getItem

Method getItem

src/Savegame/ItemContainer.cpp:104–120  ·  view source on GitHub ↗

* Returns the quantity of an item in the container. * @param id Item ID. * @return Item quantity. */

Source from the content-addressed store, hash-verified

102 * @return Item quantity.
103 */
104int ItemContainer::getItem(const std::string &id) const
105{
106 if (id.empty())
107 {
108 return 0;
109 }
110
111 std::map<std::string, int>::const_iterator it = _qty.find(id);
112 if (it == _qty.end())
113 {
114 return 0;
115 }
116 else
117 {
118 return it->second;
119 }
120}
121
122/**
123 * Returns the total quantity of the items in the container.

Callers 1

getTotalSizeMethod · 0.45

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected