MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / addResource

Method addResource

source/game/StarStatSet.cpp:120–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void 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
127void StatSet::removeResource(String const& resourceName) {
128 if (!m_resources.remove(resourceName))

Callers 2

StatCollectionMethod · 0.80
TESTFunction · 0.80

Calls 2

formatFunction · 0.50
insertMethod · 0.45

Tested by 1

TESTFunction · 0.64