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

Function CreateCustomStatInternal

OsiInterface/Functions/CustomStatFunctions.cpp:151–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149 }
150
151 void CreateCustomStatInternal(char const * name, char const * description)
152 {
153 eocnet::CustomStatsDefinitionSyncMessage msg;
154 msg.MessageId = NetMessage::NETMSG_CUSTOM_STATS_DEFINITION_CREATE;
155
156 // FIXME - memory leak!
157 msg.StatDefns.Set.Buf = GameAlloc<eocnet::CustomStatDefinitionSyncInfo>(1);
158 msg.StatDefns.Set.Capacity = 1;
159 msg.StatDefns.Set.Size = 1;
160
161 std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
162 std::wstring wstrName = converter.from_bytes(name);
163 std::wstring wstrDescription = converter.from_bytes(description);
164
165 auto & defn = msg.StatDefns.Set.Buf[0];
166 defn.Name.Set(wstrName);
167 defn.Description.Set(wstrDescription);
168
169 ProcessCustomStatsMessage(&msg);
170 }
171
172 bool CreateCustomStat(OsiArgumentDesc & args)
173 {

Callers 1

CreateCustomStatFunction · 0.85

Calls 2

SetMethod · 0.80

Tested by

no test coverage detected