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


C++ CSystem::GetTopology方法代码示例

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


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

示例1: OnKeyEvent

void CPlayerGameStats::OnKeyEvent (EEventTypes iType, CSpaceObject *pObj, DWORD dwCauseUNID)

//	OnKeyEvent
//
//	Adds a key event involving an object

	{
	ASSERT(pObj);

	CSystem *pSystem = pObj->GetSystem();
	if (pSystem == NULL)
		return;

	//	Get the NodeID where the event happened

	CTopologyNode *pNode = pSystem->GetTopology();
	if (pNode == NULL)
		return;

	const CString &sNodeID = pNode->GetID();

	//	Get the object's type

	CDesignType *pType = pObj->GetType();
	if (pType == NULL)
		return;

	//	Get the object's name

	DWORD dwNameFlags;
	CString sName = pObj->GetName(&dwNameFlags);
	
	//	If the object name is the same as the type name then we don't bother
	//	storing it in the event (to save memory)

	if (strEquals(sName, pType->GetTypeName()))
		{
		sName = NULL_STR;
		dwNameFlags = 0;
		}

	//	Look for the list of events for this NodeID

	TArray<SKeyEventStats> *pEventList = m_KeyEventStats.Set(sNodeID);
	SKeyEventStats *pStats = pEventList->Insert();
	pStats->iType = iType;
	pStats->dwTime = g_pUniverse->GetTicks();
	pStats->dwObjUNID = pObj->GetType()->GetUNID();
	pStats->sObjName = sName;
	pStats->dwObjNameFlags = dwNameFlags;
	pStats->dwCauseUNID = dwCauseUNID;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:52,代码来源:CPlayerGameStats.cpp

示例2: Create

ALERROR CMission::Create (CMissionType *pType,
                          CSpaceObject *pOwner,
                          ICCItem *pCreateData,
                          CMission **retpMission,
                          CString *retsError)

//	Create
//
//	Creates a new mission object. We return ERR_NOTFOUND if the mission could
//	not be created because conditions do not allow it.

{
    CMission *pMission;

    pMission = new CMission;
    if (pMission == NULL)
    {
        *retsError = CONSTLIT("Out of memory");
        return ERR_MEMORY;
    }

    pMission->m_pType = pType;

    //	Initialize

    pMission->m_iStatus = statusOpen;
    pMission->m_fIntroShown = false;
    pMission->m_fDeclined = false;
    pMission->m_fDebriefed = false;
    pMission->m_pOwner = pOwner;

    //	NodeID

    CTopologyNode *pNode = NULL;
    CSystem *pSystem = NULL;
    if ((pSystem = (pOwner ? pOwner->GetSystem() : g_pUniverse->GetCurrentSystem()))
            && (pNode = pSystem->GetTopology()))
        pMission->m_sNodeID = pNode->GetID();

    //	Fire OnCreate

    pMission->m_fInOnCreate = true;

    CSpaceObject::SOnCreate OnCreate;
    OnCreate.pData = pCreateData;
    OnCreate.pOwnerObj = pOwner;
    pMission->FireOnCreate(OnCreate);

    pMission->m_fInOnCreate = false;

    //	If OnCreate destroyed the object then it means that the mission was not
    //	suitable. We return ERR_NOTFOUND

    if (pMission->IsDestroyed())
    {
        delete pMission;
        return ERR_NOTFOUND;
    }

    //	If we haven't subscribed to the owner, do it now

    if (pOwner && !pOwner->FindEventSubscriber(pMission))
        pOwner->AddEventSubscriber(pMission);

    //	Done

    if (retpMission)
        *retpMission = pMission;

    return NOERROR;
}
开发者ID:alanhorizon,项目名称:Transcendence,代码行数:71,代码来源:CMission.cpp


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