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

Function questParamText

source/game/StarQuestDescriptor.cpp:274–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274String questParamText(QuestParam const& parameter) {
275 if (parameter.name)
276 return *parameter.name;
277
278 auto itemDatabase = Root::singleton().itemDatabase();
279
280 if (parameter.detail.is<QuestItem>()) {
281 QuestItem item = parameter.detail.get<QuestItem>();
282 return itemDatabase->itemShared(item.descriptor())->friendlyName();
283
284 } else if (parameter.detail.is<QuestItemList>()) {
285 QuestItemList itemList = parameter.detail.get<QuestItemList>();
286 StringList itemStrings = itemList.transformed([&itemDatabase](ItemDescriptor const& itemDesc) -> String {
287 return strf("{} {}", itemDesc.count(), itemDatabase->itemShared(itemDesc)->friendlyName());
288 });
289 return itemStrings.join(", ");
290
291 } else {
292 return "";
293 }
294}
295
296template <typename Fun,
297 typename ArgType = typename FunctionTraits<Fun>::template Arg<0>,

Callers

nothing calls this directly

Calls 9

singletonClass · 0.85
strfFunction · 0.85
itemDatabaseMethod · 0.80
itemSharedMethod · 0.80
friendlyNameMethod · 0.45
descriptorMethod · 0.45
transformedMethod · 0.45
countMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected