本文整理汇总了C++中Skill::isLoaded方法的典型用法代码示例。如果您正苦于以下问题:C++ Skill::isLoaded方法的具体用法?C++ Skill::isLoaded怎么用?C++ Skill::isLoaded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skill
的用法示例。
在下文中一共展示了Skill::isLoaded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: autoStartGame
//.........这里部分代码省略.........
ObjectList * pServerPlayers = pServer->getSolver()->getPlayersList();
// Create neutral player
char sName[NAME_MAX_CHARS];
i18n->getText("NEUTRA", sName, NAME_MAX_CHARS);
Player * pPlayer = new Player(0, 0, pServer->getSolver()->getGlobalSpellsPtr());
wsafecpy(pPlayer->m_sProfileName, NAME_MAX_CHARS, sName);
pPlayer->m_Color = rgb(0.5, 0.5, 0.5);
wsafecpy(pPlayer->m_sBanner, 64, "blason1");
pServer->getSolver()->setNeutralPlayer(pPlayer);
// Human players
int playerId = 1;
for (int fdfdf = 0; fdfdf < 2; fdfdf++)
{
// Create player object
pPlayer = new Player(playerId, 0, pServer->getSolver()->getGlobalSpellsPtr());
snprintf(pPlayer->m_sProfileName, NAME_MAX_CHARS, "test%d", playerId);
Profile * pProfile = m_pLocalClient->getDataFactory()->findProfile(pPlayer->m_sProfileName);
AvatarData * pAvatar = (AvatarData*) pProfile->getAvatarsList()->getFirst(0);
pPlayer->m_Color = rgb(1, 1, 1);
pAvatar->getBanner(pPlayer->m_sBanner, 64);
pServerPlayers->addLast(pPlayer);
// Set Avatar
CoordsMap pos = pMapReader->getPlayerPosition(playerId-1);
pServer->getSolver()->setInitialAvatar(pAvatar->clone(m_pLocalClient), pPlayer, pos);
// Add spells that are equipped
Profile::SpellData * pSpellDesc = (Profile::SpellData*) pProfile->getSpellsList()->getFirst(0);
while (pSpellDesc != NULL)
{
AvatarData * pOwner = pSpellDesc->m_pOwner;
if (pOwner != NULL && strcmp(pAvatar->m_sEdition, pOwner->m_sEdition) == 0
&& strcmp(pAvatar->m_sObjectId, pOwner->m_sObjectId) == 0)
pServer->getSolver()->addInitialPlayerSpell(pPlayer, pSpellDesc->m_sEdition, pSpellDesc->m_sName);
pSpellDesc = (Profile::SpellData*) pProfile->getSpellsList()->getNext(0);
}
// Add equipped artifacts
Artifact * pArtifact = (Artifact*) pProfile->getArtifactsList()->getFirst(0);
while (pArtifact != NULL)
{
AvatarData * pOwner = pArtifact->m_pOwner;
if (pOwner != NULL && strcmp(pAvatar->m_sEdition, pOwner->m_sEdition) == 0
&& strcmp(pAvatar->m_sObjectId, pOwner->m_sObjectId) == 0)
{
Unit * pAvatarInGame = pPlayer->getAvatar();
assert(pAvatarInGame != NULL);
ArtifactEffect * pEffect = (ArtifactEffect*) pArtifact->getArtifactEffects()->getFirst(0);
while (pEffect != NULL)
{
switch (pEffect->getType())
{
case ARTIFACT_EFFECT_CHARAC:
{
bool bFound = true;
long val = pAvatarInGame->getValue(((ArtifactEffect_Charac*)pEffect)->m_sKey, false, &bFound);
if (bFound)
pAvatarInGame->setBaseValue(((ArtifactEffect_Charac*)pEffect)->m_sKey, max(0, val + ((ArtifactEffect_Charac*)pEffect)->m_iModifier));
else
{
char sError[1024];
snprintf(sError, 1024, "Warning: artifact %s tries to modify characteristic that doesn't exist (%s)", pArtifact->m_sObjectId, ((ArtifactEffect_Charac*)pEffect)->m_sKey);
m_pLocalClient->getDebug()->notifyErrorMessage(sError);
}
break;
}
case ARTIFACT_EFFECT_SPELL:
{
Spell * pSpell = m_pLocalClient->getDataFactory()->findSpell(((ArtifactEffect_Spell*)pEffect)->m_sSpellEdition, ((ArtifactEffect_Spell*)pEffect)->m_sSpellName);
if (pSpell != NULL)
pServer->getSolver()->addInitialPlayerSpell(pPlayer, ((ArtifactEffect_Spell*)pEffect)->m_sSpellEdition, ((ArtifactEffect_Spell*)pEffect)->m_sSpellName);
else
{
char sError[1024];
snprintf(sError, 1024, "Warning: artifact %s tries to add spell that doesn't exist (%s)", pArtifact->m_sObjectId, ((ArtifactEffect_Spell*)pEffect)->m_sSpellName);
m_pLocalClient->getDebug()->notifyErrorMessage(sError);
}
break;
}
case ARTIFACT_EFFECT_SKILL:
{
Skill * pSkill = new Skill(((ArtifactEffect_Skill*)pEffect)->m_sSkillEdition, ((ArtifactEffect_Skill*)pEffect)->m_sSkillName, ((ArtifactEffect_Skill*)pEffect)->m_sSkillParameters, pServer->getDebug());
if (pSkill != NULL && pSkill->isLoaded())
pAvatarInGame->addSkill(pSkill);
else
{
char sError[1024];
snprintf(sError, 1024, "Warning: artifact %s tries to add skill that doesn't exist or that can't be loaded (%s)", pArtifact->m_sObjectId, ((ArtifactEffect_Skill*)pEffect)->m_sSkillName);
m_pLocalClient->getDebug()->notifyErrorMessage(sError);
}
break;
}
}
pEffect = (ArtifactEffect*) pArtifact->getArtifactEffects()->getNext(0);
}
}
pArtifact = (Artifact*) pProfile->getArtifactsList()->getNext(0);
}
playerId++;
}
delete pMapReader;
pServer->onInitFinished();
}