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


C++ CServerDE::GetObjectName方法代码示例

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


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

示例1: Copy

DBOOL PathListData::Copy(HOBJECT hPathPoint)
{
	CServerDE* pServerDE = BaseClass::GetServerDE();
	if (!hPathPoint || !pServerDE) return DFALSE;

    // Get the Object Position
	pServerDE->GetObjectPos(hPathPoint, &m_vPos);
	char* pName = pServerDE->GetObjectName(hPathPoint);
	if (pName)
	{
		m_hstrName = pServerDE->CreateString(pName);
	}
    
    // Get the Objects action
    PathPoint *pPathPoint = (PathPoint*)pServerDE->HandleToObject(hPathPoint);

    HSTRING hstrAction = pPathPoint->GetActionTarget();
	if (hstrAction)
	{
		m_hstrActionTarget = pServerDE->CopyString(hstrAction);
	}

    hstrAction = pPathPoint->GetActionMessage();
	if (hstrAction)
	{
		m_hstrActionMessage = pServerDE->CopyString(hstrAction);
	}

	return DTRUE;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:30,代码来源:PathListData.cpp

示例2: CreateWorldModelDebris

void CDestructableBrush::CreateWorldModelDebris()
{
	CServerDE* pServerDE = GetServerDE();
	if (!pServerDE);

	char* pName = pServerDE->GetObjectName(m_hObject);
	if (!pName || !pName[0]) return;

	// Find all the debris objects...
	int nNum = 0;

	char strKey[128]; memset(strKey, 0, 128);
	char strNum[18];  memset(strNum, 0, 18);

	HCLASS hWMDebris = pServerDE->GetClass("WorldModelDebris");

	while (1)
	{
		// Create the keyname string...

		sprintf(strKey, "%sdebris%d", pName, nNum);
		
		// Find any debris with that name...

		ObjectList* pTempKeyList = pServerDE->FindNamedObjects(strKey);
		ObjectLink* pLink = pTempKeyList->m_pFirstLink;
		if (!pLink) return;
		
		while (pLink)
		{
			if (pServerDE->IsKindOf(pServerDE->GetObjectClass(pLink->m_hObject), hWMDebris))
			{
				WorldModelDebris* pDebris = (WorldModelDebris*)pServerDE->HandleToObject(pLink->m_hObject);
				if (!pDebris) break;

//				DVector vVel, vRotPeriods;
//				VEC_SET(vVel, pServerDE->Random(-200.0f, 200.0f), 
//							  pServerDE->Random(100.0f, 300.0f),
//							  pServerDE->Random(-200.0f, 200.0f) );

//				VEC_SET(vRotPeriods, pServerDE->Random(-1.0f, 1.0f),
//						pServerDE->Random(-1.0f, 1.0f), pServerDE->Random(-1.0f, 1.0f));

//				pDebris->Start(&vRotPeriods, &vVel);
				pDebris->Start();
			}

			pLink = pLink->m_pNext;
		}

		pServerDE->RelinquishList (pTempKeyList);
		
		// Increment the counter...

		nNum++;
	}
}
开发者ID:bsmr-games,项目名称:Blood2,代码行数:57,代码来源:DestructableBrush.cpp

示例3: ObjectTouch

void ObjectiveTrigger::ObjectTouch (HOBJECT hObj)
{
	CServerDE* pServerDE = GetServerDE();
	if (!pServerDE) return;

	// ignore everything but characters derived from BaseCharacter

	if (!IsBaseCharacter (hObj)) return;

	HCLASS hClassObj = pServerDE->GetObjectClass(hObj);
	
	// If we're AI, make sure we can activate this trigger...

	if (!m_bAITriggerable)
	{
		HCLASS hClassAI = pServerDE->GetClass("BaseAI");
		if ( pServerDE->IsKindOf(hClassObj, hClassAI) )
		{
			return;
		}
	}
	else if (m_hstrAIName) // See if only a specific AI can trigger it...
	{
		char* pAIName  = pServerDE->GetStringData(m_hstrAIName);
		char* pObjName = pServerDE->GetObjectName(hObj);

		if (pAIName && pObjName)
		{
			if ( stricmp(pAIName, pObjName) != 0)
			{
				return;
			}
		}
	}
	
	// If we're the player, make sure we can activate this trigger...

	if (!m_bPlayerTriggerable)
	{
		HCLASS hClassPlayer = pServerDE->GetClass("CPlayerObj");

		if ( pServerDE->IsKindOf(hClassObj, hClassPlayer) )
		{
			return;
		}
	}
	
	// send the mission objective message now

	Trigger();
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:51,代码来源:ObjectiveTrigger.cpp

示例4: ObjectTouch

void Trigger::ObjectTouch(HOBJECT hObj)
{
	CServerDE* pServerDE = GetServerDE();
	if (!pServerDE) return;

	HCLASS hClassBaseCharacter = pServerDE->GetClass("CBaseCharacter");
	HCLASS hClassObj		   = pServerDE->GetObjectClass(hObj);
	HCLASS hClassAI			   = pServerDE->GetClass("BaseAI");


	// Only AI and players can trigger things...

	if (!pServerDE->IsKindOf(hClassObj, hClassBaseCharacter))
	{
		return;
	}


	// If we're AI, make sure we can activate this trigger...

	if (m_bAITriggerable)
	{
		if ( pServerDE->IsKindOf(hClassObj, hClassAI) )
		{
			if (m_hstrAIName) // See if only a specific AI can trigger it...
			{
				char* pAIName  = pServerDE->GetStringData(m_hstrAIName);
				char* pObjName = pServerDE->GetObjectName(hObj);

				if (pAIName && pObjName)
				{
					if ( stricmp(pAIName, pObjName) != 0 )
					{
						return;
					}
				} 
			}
		}
	}
	else  // Not AI triggerable
	{
		if ( pServerDE->IsKindOf(hClassObj, hClassAI) )
		{
			return;
		}
	}


	// If we're the player, make sure we can activate this trigger...

	if (!m_bPlayerTriggerable)
	{
		HCLASS hClassPlayer = pServerDE->GetClass("CPlayerObj");

		if ( pServerDE->IsKindOf(hClassObj, hClassPlayer) )
		{
			return;
		}
	}


	// Okay ready to trigger.  Make sure we've waited long enough before triggering...

	DFLOAT fTime = pServerDE->GetTime();

	if (fTime >= m_fLastTouchTime + m_fTriggerDelay)
	{
		m_fLastTouchTime = fTime;
		DoTrigger(hObj, DTRUE);
	}

}
开发者ID:Arc0re,项目名称:lithtech,代码行数:72,代码来源:Trigger.cpp


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