当前位置: 首页>>代码示例>>C++>>正文


C++ CGrayUID::ObjFind方法代码示例

本文整理汇总了C++中CGrayUID::ObjFind方法的典型用法代码示例。如果您正苦于以下问题:C++ CGrayUID::ObjFind方法的具体用法?C++ CGrayUID::ObjFind怎么用?C++ CGrayUID::ObjFind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGrayUID的用法示例。


在下文中一共展示了CGrayUID::ObjFind方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddObj

// Storing one UID in Spawn's m_obj[]
void CItemSpawn::AddObj( CGrayUID uid )
{
	ADDTOCALLSTACK("CitemSpawn:AddObj");
	unsigned char iMax = GetAmount() > 0 ? static_cast<unsigned char>(GetAmount()) : 1;
	iMax += 1;	// We must give a +1 to create a 'free slot'
	bool bIsSpawnChar = GetType() == IT_SPAWN_CHAR;
	if  (bIsSpawnChar )
	{
		if (!uid || !uid.CharFind()->m_pNPC)	// Only adding UIDs...
			return;
	}
	if ( uid.ObjFind()->m_uidSpawnItem.ItemFind() )	//... which doesn't have a SpawnItem already
		return;
	for ( unsigned char i = 0; i < iMax; i++ )
	{
		if ( m_obj[i] == uid )	// Not adding me again
			return;
		if ( !m_obj[i].ObjFind() )
		{
			m_obj[i] = uid;
			if (bIsSpawnChar)
			{
				m_itSpawnChar.m_current++;
				uid.CharFind()->StatFlag_Set(STATF_Spawned);
			}
			uid.ObjFind()->m_uidSpawnItem = GetUID();
			break;
		}
	}
}
开发者ID:zolter,项目名称:Source,代码行数:31,代码来源:CItemSp.cpp

示例2: AddObj

void CItemSpawn::AddObj(CGrayUID uid)
{
	ADDTOCALLSTACK("CitemSpawn:AddObj");
	// NOTE: This function is also called when loading spawn items
	// on server startup. In this case, some objs UID still invalid
	// (not loaded yet) so just proceed without any checks.

	bool bIsSpawnChar = IsType(IT_SPAWN_CHAR);
	if ( !g_Serv.IsLoading() )
	{
		if ( !uid.IsValidUID() )
			return;

		if ( bIsSpawnChar )				// IT_SPAWN_CHAR can only spawn NPCs
		{
			CChar *pChar = uid.CharFind();
			if ( !pChar || !pChar->m_pNPC )
				return;
		}
		else if ( !uid.ItemFind() )		// IT_SPAWN_ITEM can only spawn items
			return;

		CItemSpawn *pPrevSpawn = static_cast<CItemSpawn*>(uid.ObjFind()->m_uidSpawnItem.ItemFind());
		if ( pPrevSpawn )
		{
			if ( pPrevSpawn == this )		// obj already linked to this spawn
				return;
			pPrevSpawn->DelObj(uid);		// obj linked to other spawn, remove the link before proceed
		}
	}

	BYTE iMax = maximum(GetAmount(), 1);
	for (BYTE i = 0; i < iMax; i++ )
	{
		if ( !m_obj[i].IsValidUID() )
		{
			m_obj[i] = uid;
			m_currentSpawned++;

			// objects are linked to the spawn at each server start
			if ( !g_Serv.IsLoading() )
			{
				uid.ObjFind()->m_uidSpawnItem = GetUID();
				if ( bIsSpawnChar )
				{
					CChar *pChar = uid.CharFind();
					ASSERT(pChar->m_pNPC);
					pChar->StatFlag_Set(STATF_Spawned);
					pChar->m_ptHome = GetTopPoint();
					pChar->m_pNPC->m_Home_Dist_Wander = static_cast<WORD>(m_itSpawnChar.m_DistMax);
				}
			}
			break;
		}
	}
	if ( !g_Serv.IsLoading() )
		ResendTooltip();
}
开发者ID:DarkLotus,项目名称:Source,代码行数:58,代码来源:CItemSpawn.cpp

示例3: DelObj

void CItemSpawn::DelObj(CGrayUID uid)
{
	ADDTOCALLSTACK("CitemSpawn:DelObj");
	if ( !uid.IsValidUID() )
		return;

	BYTE iMax = GetCount();
	for ( BYTE i = 0; i < iMax; i++ )
	{
		if ( m_obj[i] != uid )
			continue;

		CObjBase *pObj = uid.ObjFind();
		pObj->m_uidSpawnItem.InitUID();

		m_currentSpawned--;
		if ( GetType() == IT_SPAWN_CHAR )
			uid.CharFind()->StatFlag_Clear(STATF_Spawned);

		while ( m_obj[i + 1].IsValidUID() )				// searching for any entry higher than this one...
		{
			m_obj[i] = m_obj[i + 1];					// and moving it 1 position to keep values 'together'.
			i++;
		}
		m_obj[i].InitUID();								// Finished moving higher entries (if any) so we free the last entry.
		break;
	}
	ResendTooltip();
}
开发者ID:DarkLotus,项目名称:Source,代码行数:29,代码来源:CItemSpawn.cpp

示例4: AddObj

void CItemSpawn::AddObj( CGrayUID uid )
{
	ADDTOCALLSTACK("CitemSpawn:AddObj");
	unsigned char iMax = GetAmount() > 0 ? static_cast<unsigned char>(GetAmount()) : 1;
	bool bIsSpawnChar = GetType() == IT_SPAWN_CHAR;
	if (!uid)
		return;

	if ( bIsSpawnChar )
	{
		if ( !uid.CharFind()->m_pNPC)	// Only adding NPCs to IT_SPAWN_CHAR..
			return;
		if ( uid.CharFind()->m_uidSpawnItem.ItemFind() )	//... if they doesn't have a SpawnItem already.
			return;
	} else if( !uid.ItemFind() )		// Only adding Items to IT_SPAWN_ITEM
		return;

	for ( unsigned char i = 0; i < iMax; i++ )
	{
		if ( m_obj[i] == uid )	// Not adding me again
			return;
		if ( !m_obj[i].ObjFind() )
		{
			m_obj[i] = uid;
			if (bIsSpawnChar)
			{
				m_itSpawnChar.m_current++;
				uid.CharFind()->StatFlag_Set(STATF_Spawned);
			}
			uid.ObjFind()->m_uidSpawnItem = GetUID();
			break;
		}
	}
}
开发者ID:leandrorenato,项目名称:Source,代码行数:34,代码来源:CItemSpawn.cpp

示例5: addGumpDialogProps

bool CClient::addGumpDialogProps( CGrayUID uid )
{
	ADDTOCALLSTACK("CClient::addGumpDialogProps");
	// put up a prop dialog for the object.
	CObjBase * pObj = uid.ObjFind();
	if ( pObj == NULL )
		return false;
	if ( m_pChar == NULL )
		return( false );
	if ( ! m_pChar->CanTouch( pObj ))	// probably a security issue.
		return( false );

	m_Prop_UID = m_Targ_UID = uid;
	if ( uid.IsChar() )
		addSkillWindow(static_cast<SKILL_TYPE>(g_Cfg.m_iMaxSkill), true);

	TCHAR *pszMsg = Str_GetTemp();
	strcpy(pszMsg, pObj->IsItem() ? "d_ITEMPROP1" : "d_CHARPROP1" );

	RESOURCE_ID rid = g_Cfg.ResourceGetIDType(RES_DIALOG, pszMsg);
	if ( ! rid.IsValidUID())
		return false;

	Dialog_Setup( CLIMODE_DIALOG, rid, 0, pObj );
	return( true );
}
开发者ID:shiryux,项目名称:Source,代码行数:26,代码来源:CClientDialog.cpp

示例6: r_LoadVal

bool CItemSpawn::r_LoadVal(CScript & s)
{
	ADDTOCALLSTACK("CitemSpawn:r_LoadVal");
	EXC_TRY("LoadVal");

	if (g_Serv.IsLoading())
	{
		if (!strnicmp(s.GetKey(), "more2", 5))	//More2 shouldn't be loaded as it's being set with ADDOBJ
			return true;
	}
	int iCmd = FindTableSorted(s.GetKey(), sm_szLoadKeys, COUNTOF(sm_szLoadKeys) - 1);
	if (iCmd < 0)
		return CItem::r_LoadVal(s);

	switch (iCmd)
	{
		case ISPW_ADDOBJ:
		{
			CGrayUID uid = static_cast<CGrayUID>(s.GetArgVal());
			if ( uid.ObjFind() )
				AddObj(uid);
			return true;
		}
		case ISPW_DELOBJ:
		{
			CGrayUID uid = static_cast<CGrayUID>(s.GetArgVal());
			if (uid.ObjFind())
				DelObj(uid);
			return true;
		}
		case ISPW_RESET:
			KillChildren();
			return true;
		case ISPW_START:
			SetTimeout(0);
			return true;
		case ISPW_STOP:
			KillChildren();
			SetTimeout(-1);
			return true;
		default:
			break;
	}
	EXC_CATCH;
	return false;
}
开发者ID:leandrorenato,项目名称:Source,代码行数:46,代码来源:CItemSpawn.cpp

示例7: r_GetRef

bool CScriptObj::r_GetRef( LPCTSTR & pszKey, CScriptObj * & pRef )
{
	// A key name that just links to another object.
	if ( !strnicmp(pszKey, "SERV.", 5) && strnicmp(pszKey, "SERV.NEW", 8) )
	{
		pszKey += 5;
		pRef = &g_Serv;
		return true;
	}
	else if ( !strnicmp(pszKey, "UID.", 4) )
	{
		pszKey += 4;
		CGrayUID uid = (DWORD)Exp_GetVal(pszKey);
		SKIP_SEPERATORS(pszKey);
		pRef = uid.ObjFind();
		return true;
	}
	else if ( ! strnicmp( pszKey, "OBJ.", 4 ))
	{
		pszKey += 4;
		pRef = ( (DWORD)g_World.m_uidObj ) ? g_World.m_uidObj.ObjFind() : NULL;
		return true;
	}
	else if ( !strnicmp(pszKey, "NEW.", 4) )
	{
		pszKey += 4;
		pRef = ( (DWORD)g_World.m_uidNew ) ? g_World.m_uidNew.ObjFind() : NULL;
		return true;
	}
	else if ( !strnicmp(pszKey, "I.", 2) )
	{
		pszKey += 2;
		pRef = this;
		return true;
	}
	return false;
}
开发者ID:GenerationOfWorlds,项目名称:Sphere,代码行数:37,代码来源:CScriptObj.cpp

示例8: OnTriggerRun


//.........这里部分代码省略.........
				CChar * pCharThis = dynamic_cast <CChar *> (this);
				if ( pCharThis )
				{
					if ( s.HasArgs() )
					{
						if ( iCmd == SK_FORCHARLAYER )
							iRet = pCharThis->OnCharTrigForLayerLoop( s, pSrc, pArgs, pResult, (LAYER_TYPE) s.GetArgVal() );
						else
							iRet = pCharThis->OnCharTrigForMemTypeLoop( s, pSrc, pArgs, pResult, s.GetArgVal() );
						break;
					}
				}
			}
		case SK_FORCONT:
			{
				EXC_SET(m_ExcKeys[11]);
				if ( s.HasArgs() )
				{
					TCHAR * ppArgs[2];
					TCHAR * tempPoint;
					TCHAR 	*porigValue = Str_GetTemp();
					
					int iArgQty = Str_ParseCmds( (TCHAR*) s.GetArgRaw(), ppArgs, COUNTOF(ppArgs), " \t," );
					
					if ( iArgQty >= 1 )
					{
						strcpy(porigValue, ppArgs[0]);
						tempPoint = porigValue;
						ParseText( tempPoint, pSrc, 0, pArgs );
						
						CGrayUID pCurUid = (DWORD) Exp_GetVal(tempPoint);
						if ( pCurUid.IsValidUID() )
						{
							CObjBase * pObj = pCurUid.ObjFind();
							if ( pObj && pObj->IsContainer() )
							{
								CContainer * pContThis = dynamic_cast <CContainer *> (pObj);
								
								CScriptLineContext StartContext = s.GetContext();
								CScriptLineContext EndContext = StartContext;
								iRet = pContThis->OnGenericContTriggerForLoop( s, pSrc, pArgs, pResult, StartContext, EndContext, ppArgs[1] != NULL ? Exp_GetVal(ppArgs[1]) : 255 );
								break;
							}
						}
					}
				}
			}
		case SK_FORCONTID:
		case SK_FORCONTTYPE:
			{
				EXC_SET(m_ExcKeys[12]);
				CContainer * pCont = dynamic_cast <CContainer *> (this);
				if ( pCont )
				{
					if ( s.HasArgs() )
					{
						LPCTSTR pszKey = s.GetArgRaw();
						SKIP_SEPERATORS(pszKey);
					
						TCHAR * ppArgs[2];
						Str_ParseCmds( (TCHAR*) pszKey, ppArgs, COUNTOF(ppArgs), " \t," );

						CScriptLineContext StartContext = s.GetContext();
						CScriptLineContext EndContext = StartContext;
#ifdef _WIN32
						iRet = pCont->OnContTriggerForLoop( s, pSrc, pArgs, pResult, StartContext, EndContext, g_Cfg.ResourceGetID( ( iCmd == SK_FORCONTID ) ? RES_ITEMDEF : RES_TYPEDEF, ppArgs[0] ), 0, ppArgs[1] != NULL ? Exp_GetVal( ppArgs[1] ) : 255 );
开发者ID:GenerationOfWorlds,项目名称:Sphere,代码行数:67,代码来源:CScriptObj.cpp

示例9: r_Verb


//.........这里部分代码省略.........
			if ( pChar )
				closeUIWindow(pChar, 0x1);
			break;
		}
		case CV_CLOSEPROFILE:
		{
			CChar *pChar = m_pChar;
			if ( s.HasArgs() )
			{
				CGrayUID uid = static_cast<CGrayUID>(s.GetArgVal());
				pChar = uid.CharFind();
			}
			if ( pChar )
				closeUIWindow(pChar, 0x8);
			break;
		}
		case CV_CLOSESTATUS:
		{
			CChar *pChar = m_pChar;
			if ( s.HasArgs() )
			{
				CGrayUID uid = static_cast<CGrayUID>(s.GetArgVal());
				pChar = uid.CharFind();
			}
			if ( pChar )
				closeUIWindow(pChar, 0x2);
			break;
		}
		case CV_DYE:
		{
			if ( s.HasArgs() )
			{
				CGrayUID uid = static_cast<CGrayUID>(s.GetArgVal());
				CObjBase *pObj = uid.ObjFind();
				if ( pObj )
					addDyeOption(pObj);
			}
			break;
		}
		case CV_EVERBTARG:
		{
			m_Prompt_Text = s.GetArgStr();
			addPromptConsole(CLIMODE_PROMPT_TARG_VERB, m_Targ_Text.IsEmpty() ? "Enter the verb" : "Enter the text", m_Targ_UID);
			break;
		}
		case CV_EXTRACT:
		{
			// sort of like EXPORT but for statics.
			// Opposite of the "UNEXTRACT" command
			if ( !s.HasArgs() )
			{
				SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_EXTRACT_USAGE));
			}
			else
			{
				TCHAR *ppArgs[2];
				Str_ParseCmds(s.GetArgStr(), ppArgs, COUNTOF(ppArgs));

				m_Targ_Text = ppArgs[0];				// point at the options (if any)
				m_tmTile.m_ptFirst.InitPoint();			// clear this first
				m_tmTile.m_Code = CV_EXTRACT;			// set extract code
				m_tmTile.m_id = Exp_GetVal(ppArgs[1]);	// extract id
				addTarget(CLIMODE_TARG_TILE, g_Cfg.GetDefaultMsg(DEFMSG_SELECT_EXTRACT_AREA), true);
			}
			break;
		}
开发者ID:Sphereserver,项目名称:Source,代码行数:67,代码来源:CClient.cpp


注:本文中的CGrayUID::ObjFind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。