本文整理汇总了C++中CIwGameString::getHash方法的典型用法代码示例。如果您正苦于以下问题:C++ CIwGameString::getHash方法的具体用法?C++ CIwGameString::getHash怎么用?C++ CIwGameString::getHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIwGameString
的用法示例。
在下文中一共展示了CIwGameString::getHash方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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;
}
示例2: setProperty
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;
}
示例3: LoadFromXoml
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;
}