MCPcopy Create free account
hub / github.com/Norbyte/ositools / StatGetAttributeInt

Function StatGetAttributeInt

OsiInterface/Functions/StatFunctions.cpp:42–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 }
41
42 bool StatGetAttributeInt(OsiArgumentDesc & args)
43 {
44 auto statName = args[0].String;
45 auto attributeName = args[1].String;
46
47 auto stats = gOsirisProxy->GetLibraryManager().GetStats();
48 if (stats == nullptr) {
49 return false;
50 }
51
52 auto object = stats->objects.Find(statName);
53 if (object == nullptr) {
54 OsiError("Stat object '" << statName << "' does not exist");
55 return false;
56 }
57
58 auto value = stats->GetAttributeInt(object, attributeName);
59 if (!value) {
60 OsiError("Attribute '" << attributeName << "' not found on object '" << statName << "'");
61 return false;
62 }
63
64 args[2].Int32 = *value;
65 return true;
66 }
67
68 bool StatGetAttributeString(OsiArgumentDesc & args)
69 {

Callers

nothing calls this directly

Calls 3

GetStatsMethod · 0.80
GetAttributeIntMethod · 0.80
FindMethod · 0.45

Tested by

no test coverage detected