| 118 | } |
| 119 | |
| 120 | void StatSet::addResource(String resourceName, MVariant<String, float> max, MVariant<String, float> delta) { |
| 121 | auto pair = m_resources.insert({std::move(resourceName), Resource{std::move(max), std::move(delta), false, 0.0f, {}}}); |
| 122 | if (!pair.second) |
| 123 | throw StatusException::format("Added duplicate resource named '{}' in StatSet", resourceName); |
| 124 | update(0.0f); |
| 125 | } |
| 126 | |
| 127 | void StatSet::removeResource(String const& resourceName) { |
| 128 | if (!m_resources.remove(resourceName)) |