本文整理汇总了C++中CNpc::SetUid方法的典型用法代码示例。如果您正苦于以下问题:C++ CNpc::SetUid方法的具体用法?C++ CNpc::SetUid怎么用?C++ CNpc::SetUid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNpc
的用法示例。
在下文中一共展示了CNpc::SetUid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateNpcThread
//.........这里部分代码省略.........
pNpc->m_tDnPer = pNpcTable->m_tDnPer; // NPC Type
pNpc->m_nInitMinX = pNpc->m_nLimitMinX = NpcPosSet.m_LeftX;
pNpc->m_nInitMinY = pNpc->m_nLimitMinZ = NpcPosSet.m_TopZ;
pNpc->m_nInitMaxX = pNpc->m_nLimitMaxX = NpcPosSet.m_RightX;
pNpc->m_nInitMaxY = pNpc->m_nLimitMaxZ = NpcPosSet.m_BottomZ;
// dungeon work
pNpc->m_byDungeonFamily = NpcPosSet.m_DungeonFamily;
pNpc->m_bySpecialType = NpcPosSet.m_SpecialType;
pNpc->m_byRegenType = NpcPosSet.m_RegenType;
pNpc->m_byTrapNumber = NpcPosSet.m_TrapNumber;
if( pNpc->m_byDungeonFamily > 0 ) {
pNpc->m_nLimitMinX = NpcPosSet.m_LimitMinX;
pNpc->m_nLimitMinZ = NpcPosSet.m_LimitMinZ;
pNpc->m_nLimitMaxX = NpcPosSet.m_LimitMaxX;
pNpc->m_nLimitMaxZ = NpcPosSet.m_LimitMaxZ;
}
pNpc->m_pZone = GetZoneByID(pNpc->m_bCurZone);
if (pNpc->GetMap() == NULL) {
AfxMessageBox("Error : CServerDlg,, Invaild zone Index!!");
delete pNpc;
return FALSE;
}
if( !m_arNpc.PutData( pNpc->m_sNid, pNpc) ) {
TRACE("Npc PutData Fail - %d\n", pNpc->m_sNid);
delete pNpc;
pNpc = NULL;
continue;
}
pNpc->SetUid(pNpc->m_fCurX, pNpc->m_fCurZ, pNpc->m_sNid + NPC_BAND);
//
if (pNpc->GetMap()->m_byRoomEvent > 0 && pNpc->m_byDungeonFamily > 0 ) {
pRoom = pNpc->GetMap()->m_arRoomEventArray.GetData( pNpc->m_byDungeonFamily );
if (pRoom == NULL)
{
TRACE("Error : CServerDlg,, Map Room Npc Fail!! : nid=%d, sid=%d, name=%s, fam=%d, zone=%d\n", pNpc->m_sNid+NPC_BAND, pNpc->m_proto->m_sSid, pNpc->m_proto->m_strName, pNpc->m_byDungeonFamily, pNpc->m_bCurZone);
AfxMessageBox("Error : CServerDlg,, Map Room Npc Fail!!");
delete pNpc;
return FALSE;
}
int *pInt = new int;
*pInt = pNpc->m_sNid;
if( !pRoom->m_mapRoomNpcArray.PutData( pNpc->m_sNid, pInt ) ) {
TRACE("### Map - Room Array MonsterNid Fail : nid=%d, sid=%d ###\n", pNpc->m_sNid, pNpc->m_proto->m_sSid);
}
}
m_TotalNPC = nSerial;
if(--nNpcCount > 0) continue;
bMoveNext = TRUE;
nNpcCount = 0;
}
}
nPathSerial = 1;
NpcPosSet.MoveNext();
示例2: LoadSpawnCallback
//.........这里部分代码省略.........
pNpc->m_fCurX = fRandom_X;
pNpc->m_fCurY = 0;
pNpc->m_fCurZ = fRandom_Z;
pNpc->m_sRegenTime = sRegTime * SECOND;
pNpc->m_byDirection = bDirection;
pNpc->m_sMaxPathCount = bDotCnt;
if ((pNpc->m_byMoveType == 2 || pNpc->m_byMoveType == 3) && bDotCnt == 0)
{
pNpc->m_byMoveType = 1;
TRACE("##### ServerDlg:CreateNpcThread - Path type Error : nid=%d, sid=%d, name=%s, acttype=%d, path=%d #####\n", pNpc->m_sNid+NPC_BAND, pNpc->m_proto->m_sSid, pNpc->m_proto->m_strName, pNpc->m_byMoveType, pNpc->m_sMaxPathCount);
}
if (bDotCnt > 0)
{
int index = 0;
for (int l = 0; l < bDotCnt; l++)
{
static char szX[5], szZ[5];
memset(szX, 0, sizeof(szX));
memset(szZ, 0, sizeof(szZ));
memcpy(szX, szPath + index, 4);
index += 4;
memcpy(szZ, szPath + index, 4);
index += 4;
pNpc->m_PathList.pPattenPos[l].x = atoi(szX);
pNpc->m_PathList.pPattenPos[l].z = atoi(szZ);
}
}
pNpc->m_tItemPer = pNpcTable->m_tItemPer; // NPC Type
pNpc->m_tDnPer = pNpcTable->m_tDnPer; // NPC Type
pNpc->m_nInitMinX = pNpc->m_nLimitMinX = iLeftX;
pNpc->m_nInitMinY = pNpc->m_nLimitMinZ = iTopZ;
pNpc->m_nInitMaxX = pNpc->m_nLimitMaxX = iRightX;
pNpc->m_nInitMaxY = pNpc->m_nLimitMaxZ = iBottomZ;
// dungeon work
pNpc->m_byDungeonFamily = bDungeonFamily;
pNpc->m_bySpecialType = bSpecialType;
pNpc->m_byRegenType = bRegenType;
pNpc->m_byTrapNumber = bTrapNumber;
if (pNpc->m_byDungeonFamily > 0)
{
pNpc->m_nLimitMinX = iLimitMinX;
pNpc->m_nLimitMinZ = iLimitMinZ;
pNpc->m_nLimitMaxX = iLimitMaxX;
pNpc->m_nLimitMaxZ = iLimitMaxZ;
}
pNpc->m_pZone = GetZoneByID(pNpc->m_bCurZone);
if (pNpc->GetMap() == NULL)
{
printf(_T("Error: NPC %d in zone %d that does not exist."), sSid, bZoneID);
delete pNpc;
return false;
}
if (!m_arNpc.PutData(pNpc->m_sNid, pNpc))
{
--m_TotalNPC;
TRACE("Npc PutData Fail - %d\n", pNpc->m_sNid);
delete pNpc;
continue;
}
pNpc->SetUid(pNpc->m_fCurX, pNpc->m_fCurZ, pNpc->m_sNid + NPC_BAND);
if (pNpc->GetMap()->m_byRoomEvent > 0 && pNpc->m_byDungeonFamily > 0)
{
pRoom = pNpc->GetMap()->m_arRoomEventArray.GetData(pNpc->m_byDungeonFamily);
if (pRoom == NULL)
{
printf("Error : CServerDlg,, Map Room Npc Fail!!\n");
delete pNpc;
return false;
}
// this is why their CSTLMap class sucks.
int *pInt = new int;
*pInt = pNpc->m_sNid;
if (!pRoom->m_mapRoomNpcArray.PutData(pNpc->m_sNid, pInt))
{
delete pInt;
TRACE("### Map - Room Array MonsterNid Fail : nid=%d, sid=%d ###\n",
pNpc->m_sNid, pNpc->m_proto->m_sSid);
}
}
}
}
return true;
}