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

Method giveResourceValue

source/game/StarStatSet.cpp:163–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163float StatSet::giveResourceValue(String const& resourceName, float amount) {
164 if (auto r = m_resources.ptr(resourceName)) {
165 float previousValue = r->value;
166 r->setValue(r->value + amount);
167 return r->value - previousValue;
168 }
169 return 0;
170}
171
172bool StatSet::consumeResourceValue(String const& resourceName, float amount) {
173 return consumeResourceValue(resourceName, amount, false);

Callers 1

giveResourceMethod · 0.80

Calls 2

ptrMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected