Beispiel #1
0
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));
	}
}
Beispiel #2
0
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));
	}
}
Beispiel #3
0
bool ItemAttributes::hasAttribute(itemAttrTypes type) const
{
	if(!validateIntAttrType(type))
		return false;

	Attribute* attr = getAttrConst(type);
	if(attr){
		return true;
	}

	return false;
}
Beispiel #4
0
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;
	}
}