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

Method setResourcePercentage

source/game/StarStatSet.cpp:199–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199float StatSet::setResourcePercentage(String const& resourceName, float resourcePercentage) {
200 auto& resource = getResource(resourceName);
201 if (!resource.maxValue)
202 throw StatusException::format("setResourcePersentage called on resource '{}' which has no maximum", resourceName);
203 return resource.setValue(resourcePercentage * *resource.maxValue);
204}
205
206float StatSet::modifyResourcePercentage(String const& resourceName, float resourcePercentage) {
207 auto& resource = getResource(resourceName);

Callers

nothing calls this directly

Calls 2

formatFunction · 0.50
setValueMethod · 0.45

Tested by

no test coverage detected