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

Method modifyResourcePercentage

source/game/StarStatSet.cpp:206–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206float StatSet::modifyResourcePercentage(String const& resourceName, float resourcePercentage) {
207 auto& resource = getResource(resourceName);
208 if (!resource.maxValue)
209 throw StatusException::format(
210 "modifyResourcePercentage called on resource '{}' which has no maximum", resourceName);
211 return resource.setValue(resource.value + resourcePercentage * *resource.maxValue);
212}
213
214void StatSet::update(float dt) {
215 // We use two intermediate values for calculating the effective stat value.

Callers

nothing calls this directly

Calls 2

formatFunction · 0.50
setValueMethod · 0.45

Tested by

no test coverage detected