* Returns the quantity of an item in the container. * @param id Item ID. * @return Item quantity. */
| 102 | * @return Item quantity. |
| 103 | */ |
| 104 | int 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. |