本文整理汇总了C++中CInstance::setInstanceNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ CInstance::setInstanceNumber方法的具体用法?C++ CInstance::setInstanceNumber怎么用?C++ CInstance::setInstanceNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInstance
的用法示例。
在下文中一共展示了CInstance::setInstanceNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerDynamis
int CInstanceHandler::registerDynamis(uint16 id, CCharEntity* PChar) {
if(!hasFreeInstance()) {
return -1;
}
CInstance* PInstance = instanceutils::loadInstance(this,id);
if(PInstance==NULL) {
return -1;
}
for(int i=0; i<m_MaxInstances; i++) {
if(m_Instances[i]==NULL) {
PInstance->setInstanceNumber(i+1);
break;
}
}
if(PInstance->addPlayerToDynamis(PChar)) {
ShowDebug("InstanceHandler ::1 Added %s to the valid players list for Dynamis %i Instance %i \n",
PChar->GetName(),id,PInstance->getInstanceNumber());
}
m_Instances[PInstance->getInstanceNumber()-1] = PInstance;
PInstance->init();
PInstance->setDynaUniqueID();
luautils::OnBcnmRegister(PChar,PInstance);
return PInstance->getInstanceNumber();
}
示例2: registerBcnm
int CInstanceHandler::registerBcnm(uint16 id, CCharEntity* PChar) {
if(!hasFreeInstance()) {
return -1;
}
CInstance* PInstance = instanceutils::loadInstance(this,id);
if(PInstance==NULL) {
return -1;
}
for(int i=0; i<m_MaxInstances; i++) {
if(m_Instances[i]==NULL) {
PInstance->setInstanceNumber(i+1);
break;
}
}
switch(PInstance->getMaxParticipants()) {
case 1:
if(PInstance->addPlayerToBcnm(PChar)) {
ShowDebug("InstanceHandler ::1 Added %s to the valid players list for BCNM %i Instance %i \n",
PChar->GetName(),id,PInstance->getInstanceNumber());
}
break;
case 3:
if(PChar->PParty == NULL) { //just add the initiator
if(PInstance->addPlayerToBcnm(PChar)) {
ShowDebug("InstanceHandler ::3 Added %s to the valid players list for BCNM %i Instance %i \n",
PChar->GetName(),id,PInstance->getInstanceNumber());
}
}
else {
int numRegistered = 0;
for(int j=0; j<PChar->PParty->members.size(); j++) {
if(PInstance->addPlayerToBcnm((CCharEntity*)PChar->PParty->members.at(j))) {
ShowDebug("InstanceHandler ::3 Added %s to the valid players list for BCNM %i Instance %i \n",
PChar->PParty->members.at(j)->GetName(),id,PInstance->getInstanceNumber());
numRegistered++;
}
if(numRegistered>=3) {
break;
}
}
}
break;
case 6:
if(PChar->PParty == NULL) { //just add the initiator
if(PInstance->addPlayerToBcnm(PChar)) {
ShowDebug("InstanceHandler ::6 Added %s to the valid players list for BCNM %i Instance %i \n",
PChar->GetName(),id,PInstance->getInstanceNumber());
}
}
else {
for(int j=0; j<PChar->PParty->members.size(); j++) {
if(PInstance->addPlayerToBcnm((CCharEntity*)PChar->PParty->members.at(j))) {
ShowDebug("InstanceHandler ::6 Added %s to the valid players list for BCNM %i Instance %i \n",
PChar->PParty->members.at(j)->GetName(),id,PInstance->getInstanceNumber());
}
}
}
break;
case 12:
ShowDebug("BCNMs for 12 people are not implemented yet.\n");
break;
case 18:
if(PChar->PParty == NULL) { //1 player entering 18 man bcnm
if(PInstance->addPlayerToBcnm(PChar)) {
ShowDebug("InstanceHandler ::18 Added %s to the valid players list for BCNM %i Instance %i \n",
PChar->GetName(),id,PInstance->getInstanceNumber());
}
} else { //alliance entering 18 man bcnm
if(PChar->PParty->m_PAlliance != NULL)
{
for(uint8 a = 0; a < PChar->PParty->m_PAlliance->partyList.size(); ++a)
{
for(uint8 j=0; j<PChar->PParty->m_PAlliance->partyList.at(a)->members.size(); j++) {
if(PInstance->addPlayerToBcnm((CCharEntity*)PChar->PParty->m_PAlliance->partyList.at(a)->members.at(j))) {
ShowDebug("InstanceHandler ::18 Added %s to the valid players list for BCNM %i Instance %i \n",
PChar->PParty->m_PAlliance->partyList.at(a)->members.at(j)->GetName(),id,PInstance->getInstanceNumber());
}
}
}
} else { //single party entering 18 man bcnm
for(uint8 j=0; j<PChar->PParty->members.size(); j++) {
if(PInstance->addPlayerToBcnm((CCharEntity*)PChar->PParty->members.at(j))) {
ShowDebug("InstanceHandler ::18 Added %s to the valid players list for BCNM %i Instance %i \n",
PChar->PParty->members.at(j)->GetName(),id,PInstance->getInstanceNumber());
}
}
}
}
break;
default:
ShowDebug("Unknown max participants value %i \n",PInstance->getMaxParticipants());
}
if(!PInstance->isReserved()) { //no player met the criteria for entering, so revoke the previous permission.
ShowDebug("No player has met the requirements for entering the BCNM.\n");
delete PInstance;
return -1;
//.........这里部分代码省略.........