本文整理汇总了C++中CVariable::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ CVariable::SetName方法的具体用法?C++ CVariable::SetName怎么用?C++ CVariable::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVariable
的用法示例。
在下文中一共展示了CVariable::SetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AtomicSetGlobal
BOOL DETOUR_CGameSprite::AtomicSetGlobal(Action& a) {
IECString sArg = a.m_s1;
sArg.MakeUpper();
IECString sScope = sArg.Left(6);
IECString sVariable = sArg.Right(sArg.GetLength() - 6);
CVariable varNew;
BOOL bIncrement = a.m_wOpcode == ACTION_INCREMENT_GLOBAL;
int nNewValue;
CGameSprite* pTarget = NULL;
Object oOverride = a.m_oOverride;
if (!oOverride.MatchCriteria(*g_poAny, FALSE, FALSE, FALSE) ||
!oOverride.m_sName.IsEmpty() ||
oOverride.m_oids.m_id1 != OBJECT_NOTHING) {
oOverride.DecodeIdentifiers(*this);
pTarget = (CGameSprite*)&oOverride.FindTargetOfType(*this, CGAMEOBJECT_TYPE_SPRITE, FALSE);
if (pTarget) {
a.m_oOverride = *g_poAny;
} else {
return TRUE;
}
} else {
pTarget = this;
}
if (a.m_wOpcode == ACTION_SG) {
sScope = "GLOBAL";
sVariable = sArg;
}
if (!sScope.Compare("GLOBAL")) {
CVariable& var = g_pChitin->GetInfGame().m_GlobalVariables.Find(sVariable);
if (&var != NULL) {
var.m_nValue = bIncrement ? var.m_nValue + a.m_i : a.m_i;
nNewValue = var.m_nValue;
} else {
varNew.SetName(sVariable);
varNew.m_nValue = a.m_i;
nNewValue = varNew.m_nValue;
g_pChitin->GetInfGame().m_GlobalVariables.Add(varNew);
}
CMessageModifyVariable* pMsg = new CMessageModifyVariable(
sVariable,
sScope,
nNewValue,
0,
pTarget->m_e,
pTarget->m_e);
g_pChitin->m_MessageHandler.AddMessage(*pMsg, FALSE);
return TRUE;
}
if (!sScope.Compare("LOCALS")) {
if (pTarget->GetType() == CGAMEOBJECT_TYPE_CREATURE) {
CVariable& var = ((CCreatureObject*)pTarget)->m_pLocalVariables->Find(sVariable);
if (&var != NULL) {
var.m_nValue = bIncrement ? var.m_nValue + a.m_i : a.m_i;
nNewValue = var.m_nValue;
} else {
varNew.SetName(sVariable);
varNew.m_nValue = a.m_i;
nNewValue = varNew.m_nValue;
((CCreatureObject*)pTarget)->m_pLocalVariables->Add(varNew); //64A2E8
}
CMessageModifyVariable* pMsg = new CMessageModifyVariable(
sVariable,
sScope,
nNewValue,
0,
pTarget->m_e,
pTarget->m_e);
g_pChitin->m_MessageHandler.AddMessage(*pMsg, FALSE);
return TRUE;
} else {
LPCTSTR lpsz = "CGameSprite_AtomicSetGlobal(): pTarget not CGAMEOBJECT_TYPE_CREATURE for setting LOCALS\r\n";
L.timestamp();
L.append(lpsz);
console.write(lpsz);
return TRUE;
}
}
if (!sScope.Compare("MYAREA")) {
sScope = pTarget->m_pArea->m_rAreaName.FormatToString();
}
CArea& area = g_pChitin->GetInfGame().GetLoadedArea(sScope);
if (&area != NULL) {
CVariable& var = area.m_mapAreaVariables.Find(sVariable);
if (&var != NULL) {
var.m_nValue = bIncrement ? var.m_nValue + a.m_i : a.m_i;
nNewValue = var.m_nValue;
} else {
varNew.SetName(sVariable);
varNew.m_nValue = a.m_i;
nNewValue = varNew.m_nValue;
//.........这里部分代码省略.........