本文整理汇总了C++中CGameObject::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::getParent方法的具体用法?C++ CGameObject::getParent怎么用?C++ CGameObject::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::getParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doCreate
bool CHistoryManager::doCreate( SAction* action, bool redo )
{
IDoc *pDoc = getIView()->getDocument();
CSerializable *pObject = &action->object1;
pObject->setCursorRecord(0);
if ( redo == false )
{
SSerializableRec *pObjectID = pObject->getProperty("objectID");
if ( pObjectID == NULL )
return false;
long objID = -1;
sscanf( pObjectID->data, "%ld", &objID );
CGameObject* pObj = pDoc->searchObject( objID );
if ( pObj == NULL )
return false;
CZone *pZone = (CZone*) pObj->getParent();
pZone->removeObject( pObj );
}
else
{
SSerializableRec *pParentID = pObject->getProperty("parentID");
SSerializableRec *pObjectTemplate = pObject->getProperty("objectTemplate");
SSerializableRec *pObjectType = pObject->getProperty("objectType");
if ( pParentID == NULL )
return false;
long parentID = -1;
sscanf( pParentID->data, "%ld", &parentID );
CGameObject* pParent = pDoc->searchObject( parentID );
if ( pParent == NULL )
return false;
if ( pParent->getObjectType() != CGameObject::ZoneObject )
return false;
CZone *pZone = (CZone*) pParent;
wchar_t objTemplate[1024];
uiString::convertUTF8ToUnicode(pObjectTemplate->data, objTemplate);
CGameObject *pObj = NULL;
if ( strcmp( pObjectType->data, strOfObjType( CGameObject::GameObject ) ) == 0 )
pObj = pZone->createObject( objTemplate );
else if ( strcmp( pObjectType->data, strOfObjType( CGameObject::CameraObject ) ) == 0 )
pObj = pZone->createCamera();
else if ( strcmp( pObjectType->data, strOfObjType( CGameObject::WaypointObject ) ) == 0 )
pObj = pZone->createWaypoint();
else if ( strcmp( pObjectType->data, strOfObjType( CGameObject::TriggerObject ) ) == 0 )
pObj = pZone->createTrigger();
else if ( strcmp( pObjectType->data, strOfObjType( CGameObject::LightObject ) ) == 0 )
pObj = pZone->createLight();
if ( pObj )
{
pObj->updateData( pObject );
pZone->setSortObject( true );
}
}
return true;
}