void ItemAttributes::increaseIntAttr(itemAttrTypes type, int32_t value) { if(!validateIntAttrType(type)) return; Attribute* attr = getAttr(type); if(attr){ attr->value = reinterpret_cast<void*>(static_cast<ptrdiff_t>(static_cast<uint32_t>(0xFFFFFFFF & reinterpret_cast<ptrdiff_t>(attr->value)) + value)); } }
void ItemAttributes::setIntAttr(itemAttrTypes type, int32_t value) { if (!validateIntAttrType(type)) { return; } Attribute* attr = getAttr(type); if (attr) { attr->value = reinterpret_cast<void*>(static_cast<ptrdiff_t>(value)); } }
bool ItemAttributes::hasAttribute(itemAttrTypes type) const { if(!validateIntAttrType(type)) return false; Attribute* attr = getAttrConst(type); if(attr){ return true; } return false; }
uint32_t ItemAttributes::getIntAttr(itemAttrTypes type) const { if (!validateIntAttrType(type)) { return 0; } Attribute* attr = getAttrConst(type); if (attr) { return static_cast<uint32_t>(0xFFFFFFFF & reinterpret_cast<ptrdiff_t>(attr->value)); } else { return 0; } }