本文整理汇总了C++中Trigger::DecodeIdentifiers方法的典型用法代码示例。如果您正苦于以下问题:C++ Trigger::DecodeIdentifiers方法的具体用法?C++ Trigger::DecodeIdentifiers怎么用?C++ Trigger::DecodeIdentifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trigger
的用法示例。
在下文中一共展示了Trigger::DecodeIdentifiers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DETOUR_EvaluateTrigger
//.........这里部分代码省略.........
} else {
if (pCre->GetDerivedStats().m_ProtSplLvlDec[tTemp.m_i].m_bOn)
nNumProt = pCre->GetDerivedStats().m_ProtSplLvlDec[tTemp.m_i].m_nCount;
}
bResult = nNumProt > (unsigned int)tTemp.m_i2;
}
break;
case TRIGGER_NUM_IMMUNE_SPELL_LEVEL_LT:
{
nFindTargetResult = FindTargetCreature(tTemp, &pCre);
if (pCre == NULL) break;
if (tTemp.m_i < 0) break;
if (tTemp.m_i > 9) break;
unsigned int nNumProt = 0;
if (pCre->GetDerivedStats().m_bProtSplLvl[tTemp.m_i]) {
nNumProt = UINT_MAX;
} else {
if (pCre->GetDerivedStats().m_ProtSplLvlDec[tTemp.m_i].m_bOn)
nNumProt = pCre->GetDerivedStats().m_ProtSplLvlDec[tTemp.m_i].m_nCount;
}
bResult = nNumProt < (unsigned int)tTemp.m_i2;
}
break;
case TRIGGER_TIME_STOP_COUNTER:
bResult = g_pChitin->GetInfGame().m_nTimeStopObjectsTicksLeft == tTemp.m_i;
break;
case TRIGGER_TIME_STOP_COUNTER_GT:
bResult = g_pChitin->GetInfGame().m_nTimeStopObjectsTicksLeft > tTemp.m_i;
break;
case TRIGGER_TIME_STOP_COUNTER_LT:
bResult = g_pChitin->GetInfGame().m_nTimeStopObjectsTicksLeft < tTemp.m_i;
break;
case TRIGGER_TIME_STOP_OBJECT:
tTemp.DecodeIdentifiers(*this);
pSprite = (CGameSprite*)&tTemp.m_o.FindTargetOfType(*this, CGAMEOBJECT_TYPE_SPRITE, FALSE);
if (pSprite == NULL) break;
bResult = pSprite->m_e == g_pChitin->GetInfGame().m_eTimeStopExempt;
break;
case TRIGGER_NUM_TRAPPING_SPELL_LEVEL:
{
nFindTargetResult = FindTargetCreature(tTemp, &pCre);
if (pCre == NULL) break;
if (tTemp.m_i < 0) break;
if (tTemp.m_i > 9) break;
unsigned int nNumTrap = 0;
if (pCre->GetDerivedStats().m_SplTrapLvl[tTemp.m_i].m_bOn)
nNumTrap = pCre->GetDerivedStats().m_SplTrapLvl[tTemp.m_i].m_nCount;
bResult = nNumTrap == tTemp.m_i2;
}
break;
case TRIGGER_NUM_TRAPPING_SPELL_LEVEL_GT:
{
nFindTargetResult = FindTargetCreature(tTemp, &pCre);
if (pCre == NULL) break;
if (tTemp.m_i < 0) break;
if (tTemp.m_i > 9) break;
unsigned int nNumTrap = 0;
if (pCre->GetDerivedStats().m_SplTrapLvl[tTemp.m_i].m_bOn)
nNumTrap = pCre->GetDerivedStats().m_SplTrapLvl[tTemp.m_i].m_nCount;
bResult = nNumTrap > (unsigned int)tTemp.m_i2;
}
break;
case TRIGGER_NUM_TRAPPING_SPELL_LEVEL_LT:
{
nFindTargetResult = FindTargetCreature(tTemp, &pCre);
if (pCre == NULL) break;
示例2: DETOUR_Evaluate
BOOL DETOUR_CScriptBlock::DETOUR_Evaluate(CTriggerList& triggers, CGameSprite& sprite) {
if (0) IECString("DETOUR_CScriptBlock::DETOUR_Evaluate");
//normal trigger variables
BOOL bResult = FALSE;
int nOr = 0;
bool bBreak = false;
//NextTriggerObject() variables
BOOL bOverrideObject = FALSE;
Object oOverride;
CGameSprite* pOverrideSprite = NULL;
//Eval() variables
BOOL bOverrideInt[] = { FALSE, FALSE };
int nOverride[] = { 0, 0 };
BOOL bOverrideStr[] = { FALSE, FALSE };
IECString sOverride[2];
POSITION pos = m_lTriggers.GetHeadPosition();
if (pos == NULL) return TRUE;
while (pos != NULL && !bBreak) {
if (nOr <= 0) bResult = FALSE; //AND
Trigger* pt = (Trigger*)m_lTriggers.GetNext(pos);
Trigger tCopy = *pt;
switch (tCopy.m_wOpcode) {
case TRIGGER_NEXT_TRIGGER_OBJECT:
oOverride = tCopy.m_o;
oOverride.DecodeIdentifiers(sprite);
pOverrideSprite = (CGameSprite*)&oOverride.FindTargetOfType((CGameObject&)sprite, CGAMEOBJECT_TYPE_SPRITE, FALSE);
bOverrideObject = TRUE;
break;
case TRIGGER_ASSIGN:
{
IECString sStatement = tCopy.m_s1;
CGameSprite* pSpriteTarget = (bOverrideObject && pOverrideSprite) ? pOverrideSprite : &sprite;
if (tCopy.m_i2 >= 0 && tCopy.m_i2 < BLOCK_VAR_ARRAY_SIZE) {
if (tCopy.m_i == ARGTYPE_INT) {
ParseStatement(tCopy.m_i2, tCopy.m_i, sStatement, *pSpriteTarget, pRuleEx->m_TriggerVars);
} else if (tCopy.m_i == ARGTYPE_STR) {
ParseStatement(tCopy.m_i2, tCopy.m_i, sStatement, *pSpriteTarget, pRuleEx->m_TriggerVars);
}
}
//clean up
bOverrideObject = FALSE;
pOverrideSprite = NULL;
break;
} //TRIGGER_ASSIGN
case TRIGGER_EVAL:
{
IECString sExpression = ParseBlockVariables(tCopy.m_s1, tCopy.m_i, pRuleEx->m_TriggerVars);
int nLoc = (tCopy.m_i2 - 1) & 1;
if (tCopy.m_i == ARGTYPE_INT) {
int nValue = 0;
MathPresso::Expression mpExp;
MathPresso::mresult_t mpResult = mpExp.create(pRuleEx->m_mpContext, (LPCTSTR)sExpression);
if (mpResult == MathPresso::MRESULT_OK) {
nValue = mpExp.evaluate(NULL);
} else {
LPCTSTR lpsz = "Trigger Eval(): bad expression \"%s\" (error %d)\r\n";
L.timestamp();
L.appendf(lpsz, (LPCTSTR)sExpression, (int)mpResult);
console.writef(lpsz, (LPCTSTR)sExpression, (int)mpResult);
}
bOverrideInt[nLoc] = TRUE;
nOverride[nLoc] = nValue;
} else if (tCopy.m_i == ARGTYPE_STR) {
bOverrideStr[nLoc] = TRUE;
sOverride[nLoc] = sExpression;
}
break;
} //TRIGGER_EVAL
default:
//set OR value
if (tCopy.m_wOpcode == TRIGGER_OR) {
nOr = tCopy.m_i;
} else nOr--;
//substitute trigger parameters
if (bOverrideInt[0]) {
tCopy.m_i = nOverride[0];
nOverride[0] = 0;
bOverrideInt[0] = FALSE;
}
if (bOverrideInt[1]) {
tCopy.m_i2 = nOverride[1];
nOverride[1] = 0;
bOverrideInt[1] = FALSE;
}
if (bOverrideStr[0]) {
//.........这里部分代码省略.........