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

Method SetAttributeInt

OsiInterface/DivInterface.cpp:173–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171 }
172
173 bool CRPGStatsManager::SetAttributeInt(CRPGStats_Object * object, const char * attributeName, int32_t value)
174 {
175 int attributeIndex;
176 auto typeInfo = GetAttributeInfo(object, attributeName, attributeIndex);
177 if (typeInfo == nullptr) {
178 Debug("CRPGStatsManager::SetAttributeInt(): Couldn't fetch type info for %s.%s", object->Name, attributeName);
179 return false;
180 }
181
182 if (strcmp(typeInfo->Name.Str, "ConstantInt") == 0) {
183 object->IndexedProperties[attributeIndex] = value;
184 }
185 else if (typeInfo->Values.ItemCount > 0) {
186 if (value > 0 && value < (int)typeInfo->Values.ItemCount) {
187 object->IndexedProperties[attributeIndex] = value;
188 }
189 else {
190 Debug("CRPGStatsManager::SetAttributeInt(): Couldn't set %s.%s: Enum index out of range", object->Name, attributeName);
191 return false;
192 }
193 }
194 else {
195 Debug("CRPGStatsManager::SetAttributeInt(): Couldn't set %s.%s: Inappropriate type", object->Name, attributeName);
196 return false;
197 }
198
199 return true;
200 }
201
202 uint32_t murmur3_32(const uint8_t* key, size_t len, uint32_t seed)
203 {

Callers

nothing calls this directly

Calls 1

DebugFunction · 0.85

Tested by

no test coverage detected