bool CIwGameString::operator== (const CIwGameString &op) { if (Data == NULL) return false; if (AutoHash && op.isAutohash()) { if (DataHash == op.getHash()) return true; } else { if (strcmp(op.c_str(), Data) == 0) return true; } return false; }
bool CIwGameUISlider::setProperty(unsigned int element_name, CIwGameString& data, bool delta) { if (CIwGameUIBase::setProperty(element_name, data, delta)) return true; float float_pool[8]; if (element_name == CIwGameXomlNames::SliderSize_Hash) { SliderSize = data.GetAsInt(); } else if (element_name == CIwGameXomlNames::Value_Hash) { Value = data.GetAsFloat(); } else if (element_name == CIwGameXomlNames::ValueRange_Hash) { data.GetAsListOfFloat(float_pool); ValueRange.x = float_pool[0]; ValueRange.y = float_pool[1]; } else if (element_name == CIwGameXomlNames::SliderType_Hash) { unsigned int type_hash = data.getHash(); if (type_hash == IW_GAME_HASH("vertical")) SliderType = SliderType_Vertical; else SliderType = SliderType_Horizontal; } else return false; return true; }
bool CIwGameModifierManager::LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node) { if (parent->getClassTypeHash() != CIwGameXomlNames::Actor_Hash && parent->getClassTypeHash() != CIwGameXomlNames::Scene_Hash) { CIwGameError::LogError("Error: XOML - Modifiers list needs to be declared inside an actor or scene"); return false; } if (parent->getClassTypeHash() == CIwGameXomlNames::Actor_Hash) { CIwGameActor* actor = (CIwGameActor*)parent; actor->setModifiers(this); } else if (parent->getClassTypeHash() == CIwGameXomlNames::Scene_Hash) { CIwGameScene* scene = (CIwGameScene*)parent; scene->setModifiers(this); } // Process modifiers list attributes for (CIwGameXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++) { unsigned int name_hash = (*it)->getName().getHash(); if (name_hash == CIwGameXomlNames::Name_Hash) { setName((*it)->GetValue().c_str()); } } // Prrocess modifiers for (CIwGameXmlNode::_Iterator it2 = node->begin(); it2 != node->end(); ++it2) { unsigned int name_hash = (*it2)->GetName().getHash(); if (name_hash == CIwGameXomlNames::Modifier_Hash) { CIwGameString name; CIwGameString params[4]; bool active = true; for (CIwGameXmlNode::_AttribIterator it = (*it2)->attribs_begin(); it != (*it2)->attribs_end(); ++it) { unsigned int attrib_hash = (*it)->getName().getHash(); if (attrib_hash == CIwGameXomlNames::Name_Hash) name = (*it)->GetValue(); else if (attrib_hash == CIwGameXomlNames::Active_Hash) active = (*it)->GetValueAsBool(); else if (attrib_hash == CIwGameXomlNames::Param1_Hash) params[0] = (*it)->GetValue(); else if (attrib_hash == CIwGameXomlNames::Param2_Hash) params[1] = (*it)->GetValue(); else if (attrib_hash == CIwGameXomlNames::Param3_Hash) params[2] = (*it)->GetValue(); else if (attrib_hash == CIwGameXomlNames::Param4_Hash) params[3] = (*it)->GetValue(); } // Find the modifiers creator IIwGameModifierCreator* creator = IW_GAME_MODS->findCreator(name.getHash()); if (creator != NULL) { IIwGameModifier* mod = creator->CreateInstance(); if (mod != NULL) { mod->setName(name.c_str()); mod->setActive(active); for (int t = 0; t < 4; t++) mod->setParameter(t, params[t]); addModifier(mod); } } else CIwGameError::LogError("Warning: XOML - Modifier not found - ", name.c_str()); } } return true; }