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


C++ KeyValues::GetFirstSubKey方法代码示例

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


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

示例1: PrecacheFileWeaponInfoDatabase

void PrecacheFileWeaponInfoDatabase( IFileSystem *filesystem, const unsigned char *pICEKey )
{
	if ( m_WeaponInfoDatabase.Count() )
		return;

	KeyValues *manifest = new KeyValues( "weaponscripts" );
	if ( manifest->LoadFromFile( filesystem, "scripts/weapon_manifest.txt", "GAME" ) )
	{
		for ( KeyValues *sub = manifest->GetFirstSubKey(); sub != NULL ; sub = sub->GetNextKey() )
		{
			if ( !Q_stricmp( sub->GetName(), "file" ) )
			{
				char fileBase[512];
				Q_FileBase( sub->GetString(), fileBase, sizeof(fileBase) );
				WEAPON_FILE_INFO_HANDLE tmp;
#ifdef CLIENT_DLL
				if ( ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey ) )
				{
					gWR.LoadWeaponSprites( tmp );
				}
#else
				ReadWeaponDataFromFileForSlot( filesystem, fileBase, &tmp, pICEKey );
#endif
			}
			else
			{
				Error( "Expecting 'file', got %s\n", sub->GetName() );
			}
		}
	}
	manifest->deleteThis();
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:32,代码来源:weapon_parse.cpp

示例2: CreateVPhysics

//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
bool CNPC_Furniture::CreateVPhysics( void )
{
#ifndef HL2_DLL
	return false;
#endif

	if ( !m_BoneFollowerManager.GetNumBoneFollowers() )
	{
		KeyValues *modelKeyValues = new KeyValues("");
		if ( modelKeyValues->LoadFromBuffer( modelinfo->GetModelName( GetModel() ), modelinfo->GetModelKeyValueText( GetModel() ) ) )
		{
			// Do we have a bone follower section?
			KeyValues *pkvBoneFollowers = modelKeyValues->FindKey("bone_followers");
			if ( pkvBoneFollowers )
			{
				// Loop through the list and create the bone followers
				KeyValues *pBone = pkvBoneFollowers->GetFirstSubKey();
				while ( pBone )
				{
					// Add it to the list
					const char *pBoneName = pBone->GetString();
					m_BoneFollowerManager.AddBoneFollower( this, pBoneName );

					pBone = pBone->GetNextKey();
				}
			}
		}
		modelKeyValues->deleteThis();
	}

	return true;
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:35,代码来源:genericmonster.cpp

示例3: LoadUniqueKeyList

void VMFExporter::LoadUniqueKeyList()
{
    m_UniqueKeys.RemoveAll();
    m_NodeIDKeys.RemoveAll();

    // Open the manifest file, and read the particles specified inside it
    KeyValues *manifest = new KeyValues( UNIQUE_KEYS_FILE );
    if ( manifest->LoadFromFile( g_pFullFileSystem, UNIQUE_KEYS_FILE, "GAME" ) )
    {
        for ( KeyValues *sub = manifest->GetFirstSubKey(); sub != NULL; sub = sub->GetNextKey() )
        {
            if ( !Q_stricmp( sub->GetName(), "key" ) )
            {
                m_UniqueKeys.AddToTail( sub->GetString() );
                continue;
            }
            if ( !Q_stricmp( sub->GetName(), "NodeID" ) )
            {
                m_NodeIDKeys.AddToTail( sub->GetString() );
                continue;
            }

            Warning( "VMFExporter::LoadUniqueKeyList:  Manifest '%s' with bogus file type '%s', expecting 'key' or 'NodeID'\n", UNIQUE_KEYS_FILE, sub->GetName() );
        }
    }
    else
    {
        Warning( "VMFExporter: Unable to load manifest file '%s'\n", UNIQUE_KEYS_FILE );
    }

    manifest->deleteThis();
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:32,代码来源:VMFExporter.cpp

示例4: GetNumMissionsInCampaign

int CASW_Mission_Chooser_Source_Local::GetNumMissionsInCampaign( int iCampaignIndex )
{
	if (!m_bBuiltMapList)
		BuildMapList();

	ASW_Mission_Chooser_Mission* pCampaign = GetCampaign( iCampaignIndex );
	if ( !pCampaign )
		return 0;

	KeyValues *pCampaignDetails = GetCampaignDetails( pCampaign->m_szMissionName );
	if ( !pCampaignDetails )
		return 0;

	CUtlVector<KeyValues*> aMissionKeys;
	bool bSkippedFirst = false;
	for ( KeyValues *pMission = pCampaignDetails->GetFirstSubKey(); pMission; pMission = pMission->GetNextKey() )
	{
		if ( !Q_stricmp( pMission->GetName(), "MISSION" ) )
		{
			if ( !bSkippedFirst )
			{
				bSkippedFirst = true;
			}
			else
			{
				aMissionKeys.AddToTail( pMission );
			}
		}
	}

	return aMissionKeys.Count();
}
开发者ID:Randdalf,项目名称:bliink,代码行数:32,代码来源:asw_mission_chooser_source_local.cpp

示例5: LoadSurfaceProperties

//-----------------------------------------------------------------------------
// Purpose: Loads the surface properties database into the physics DLL
//-----------------------------------------------------------------------------
void LoadSurfaceProperties( void )
{
	CreateInterfaceFn physicsFactory = GetPhysicsFactory();
	if ( !physicsFactory )
		return;

	physprops = (IPhysicsSurfaceProps *)physicsFactory( VPHYSICS_SURFACEPROPS_INTERFACE_VERSION, NULL );

	const char *SURFACEPROP_MANIFEST_FILE = "scripts/surfaceproperties_manifest.txt";
	KeyValues *manifest = new KeyValues( SURFACEPROP_MANIFEST_FILE );
	if ( manifest->LoadFromFile( g_pFileSystem, SURFACEPROP_MANIFEST_FILE, "GAME" ) )
	{
		for ( KeyValues *sub = manifest->GetFirstSubKey(); sub != NULL; sub = sub->GetNextKey() )
		{
			if ( !Q_stricmp( sub->GetName(), "file" ) )
			{
				// Add
				LoadSurfacePropFile( sub->GetString() );
				continue;
			}
		}
	}

	manifest->deleteThis();
}
开发者ID:DeathByNukes,项目名称:source-sdk-2013,代码行数:28,代码来源:textures.cpp

示例6: LoadLocalTimes

void CClientTimesDisplay::LoadLocalTimes(KeyValues *kv)
{
    if (!m_bLocalTimesLoaded || m_bLocalTimesNeedUpdate)
    {
        //Clear the local times for a refresh
        m_vLocalTimes.RemoveAll();

        //Load from .tim file
        KeyValues *pLoaded = new KeyValues("local");
        char fileName[MAX_PATH];

        Q_snprintf(fileName, MAX_PATH, "maps/%s.tim", g_pGameRules->MapName() ? g_pGameRules->MapName() : "FIXME");

        if (pLoaded->LoadFromFile(filesystem, fileName, "MOD"))
        {
            DevLog("Loading from file %s...\n", fileName);
            for (KeyValues* kvLocalTime = pLoaded->GetFirstSubKey(); kvLocalTime; kvLocalTime = kvLocalTime->GetNextKey())
            {
                Time t = Time(kvLocalTime);
                m_vLocalTimes.AddToTail(t);
            }
            m_bLocalTimesLoaded = true;
            m_bLocalTimesNeedUpdate = false;
        }
        pLoaded->deleteThis();
    }

    //Convert
    if (!m_vLocalTimes.IsEmpty())
        ConvertLocalTimes(kv);
}
开发者ID:xDShot,项目名称:game,代码行数:31,代码来源:ClientTimesDisplay.cpp

示例7: smn_KvGotoFirstSubKey

static cell_t smn_KvGotoFirstSubKey(IPluginContext *pCtx, const cell_t *params)
{
	Handle_t hndl = static_cast<Handle_t>(params[1]);
	HandleError herr;
	HandleSecurity sec;
	KeyValueStack *pStk;

	sec.pOwner = NULL;
	sec.pIdentity = g_pCoreIdent;

	if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
		!= HandleError_None)
	{
		return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
	}

	KeyValues *pSubKey = pStk->pCurRoot.front();
	KeyValues *pFirstSubKey;
	if (params[2])
	{
		pFirstSubKey = pSubKey->GetFirstTrueSubKey();
	} else {
		pFirstSubKey = pSubKey->GetFirstSubKey();
	}

	if (!pFirstSubKey)
	{
		return 0;
	}
	pStk->pCurRoot.push(pFirstSubKey);

	return 1;
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:33,代码来源:smn_keyvalues.cpp

示例8: AddAndParseBuildPoint

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseObject::AddAndParseBuildPoint( int iAttachmentNumber, KeyValues *pkvBuildPoint )
{
	int iPoint = AddBuildPoint( iAttachmentNumber );

	
	m_BuildPoints[iPoint].m_bPutInAttachmentSpace = (pkvBuildPoint->GetInt( "PutInAttachmentSpace", 0 ) != 0);

	// Now see if we've got a set of valid objects specified
	KeyValues *pkvValidObjects = pkvBuildPoint->FindKey( "valid_objects" );
	if ( pkvValidObjects )
	{
		KeyValues *pkvObject = pkvValidObjects->GetFirstSubKey();
		while ( pkvObject )
		{
			const char *pSpecifiedObject = pkvObject->GetName();
			int iLenObjName = Q_strlen( pSpecifiedObject );

			// Find the object index for the name
			for ( int i = 0; i < OBJ_LAST; i++ )
			{
				if ( !Q_strncasecmp( GetObjectInfo( i )->m_pClassName, pSpecifiedObject, iLenObjName) )
				{
					AddValidObjectToBuildPoint( iPoint, i );
					break;
				}
			}

			pkvObject = pkvObject->GetNextKey();
		}
	}
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:34,代码来源:baseobject_shared.cpp

示例9: AddSoundScapeFile

void C_SoundscapeSystem::AddSoundScapeFile( const char *filename )
{
	KeyValues *script = new KeyValues( filename );
#ifndef _XBOX
	if ( script->LoadFromFile( filesystem, filename ) )
#else
	if ( filesystem->LoadKeyValues( *script, IFileSystem::TYPE_SOUNDSCAPE, filename, "GAME" ) )
#endif
	{
		// parse out all of the top level sections and save their names
		KeyValues *pKeys = script;
		while ( pKeys )
		{
			// save pointers to all sections in the root
			// each one is a soundscape
			if ( pKeys->GetFirstSubKey() )
			{
				m_soundscapes.AddToTail( pKeys );
			}
			pKeys = pKeys->GetNextKey();
		}

		// Keep pointer around so we can delete it at exit
		m_SoundscapeScripts.AddToTail( script );
	}
	else
	{
		script->deleteThis();
	}
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:30,代码来源:c_soundscape.cpp

示例10: PhysParseSurfaceData

void PhysParseSurfaceData( IPhysicsSurfaceProps *pProps, IFileSystem *pFileSystem )
{
	KeyValues *manifest = new KeyValues( SURFACEPROP_MANIFEST_FILE );
	if ( manifest->LoadFromFile( pFileSystem, SURFACEPROP_MANIFEST_FILE, "GAME" ) )
	{
		for ( KeyValues *sub = manifest->GetFirstSubKey(); sub != NULL; sub = sub->GetNextKey() )
		{
			if ( !Q_stricmp( sub->GetName(), "file" ) )
			{
				// Add
				AddSurfacepropFile( sub->GetString(), pProps, pFileSystem );
				continue;
			}

			Warning( "surfaceprops::Init:  Manifest '%s' with bogus file type '%s', expecting 'file'\n", 
				SURFACEPROP_MANIFEST_FILE, sub->GetName() );
		}
	}
	else
	{
		Error( "Unable to load manifest file '%s'\n", SURFACEPROP_MANIFEST_FILE );
	}

	manifest->deleteThis();
}
开发者ID:detoxhby,项目名称:lambdawars,代码行数:25,代码来源:physics_shared.cpp

示例11: LoadFromKeyValues

void CRoomTemplate::LoadFromKeyValues( const char *pRoomName, KeyValues *pKeyValues )
{
    m_nTilesX = pKeyValues->GetInt( "TilesX", 1 );
    m_nTilesY = pKeyValues->GetInt( "TilesY", 1 );
    SetSpawnWeight( pKeyValues->GetInt( "SpawnWeight", MIN_SPAWN_WEIGHT ) );

    SetFullName( pRoomName );

    Q_strncpy( m_Description, pKeyValues->GetString( "RoomTemplateDescription", "" ), m_nMaxDescriptionLength );
    Q_strncpy( m_Soundscape, pKeyValues->GetString( "Soundscape", "" ), m_nMaxSoundscapeLength );

    SetTileType( pKeyValues->GetInt( "TileType", ASW_TILETYPE_UNKNOWN ) );

    m_Tags.RemoveAll();

    // search through all the exit subsections
    KeyValues *pkvSubSection = pKeyValues->GetFirstSubKey();
    bool bClearedExits = false;
    while ( pkvSubSection )
    {
        // mission details
        if ( Q_stricmp(pkvSubSection->GetName(), "EXIT")==0 )
        {
            if ( !bClearedExits )
            {
                // if we haven't cleared previous exits yet then do so now
                m_Exits.PurgeAndDeleteElements();
                bClearedExits = true;
            }
            CRoomTemplateExit *pExit = new CRoomTemplateExit();
            pExit->m_iXPos = pkvSubSection->GetInt("XPos");
            pExit->m_iYPos = pkvSubSection->GetInt("YPos");
            pExit->m_ExitDirection = (ExitDirection_t) pkvSubSection->GetInt("ExitDirection");
            pExit->m_iZChange = pkvSubSection->GetInt("ZChange");
            Q_strncpy( pExit->m_szExitTag, pkvSubSection->GetString( "ExitTag" ), sizeof( pExit->m_szExitTag ) );
            pExit->m_bChokepointGrowSource = !!pkvSubSection->GetInt("ChokeGrow", 0);

            // discard exits outside the room bounds
            if ( pExit->m_iXPos < 0 || pExit->m_iYPos < 0 || pExit->m_iXPos >= m_nTilesX || pExit->m_iYPos >= m_nTilesY )
            {
                delete pExit;
            }
            else
            {
                m_Exits.AddToTail(pExit);
            }
        }
        else if ( Q_stricmp(pkvSubSection->GetName(), "Tags")==0 && TagList() )
        {
            for ( KeyValues *sub = pkvSubSection->GetFirstSubKey(); sub != NULL; sub = sub->GetNextKey() )
            {
                if ( !Q_stricmp( sub->GetName(), "tag" ) )
                {
                    AddTag( sub->GetString() );
                }
            }
        }
        pkvSubSection = pkvSubSection->GetNextKey();
    }
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:60,代码来源:RoomTemplate.cpp

示例12: ProcessEntity

bool VMFExporter::ProcessEntity( KeyValues *pEntityKeys )
{
    for ( KeyValues *pKeys = pEntityKeys->GetFirstSubKey(); pKeys; )
    {
        if ( pKeys->GetFirstSubKey() )
        {
            if ( !Q_stricmp( pKeys->GetName(), "solid" ) )
            {
                if ( !ProcessSolid( pKeys ) )
                    return false;
            }
            else if ( !Q_stricmp( pKeys->GetName(), "connections" ) )
            {
                if ( !ProcessConnections( pKeys ) )
                    return false;
            }
            else if ( !Q_stricmp( pKeys->GetName(), "editor" ) )	// remove editor keys
            {
                KeyValues *pRemoveKey = pKeys;
                pKeys = pKeys->GetNextKey();
                pEntityKeys->RemoveSubKey( pRemoveKey );
                pRemoveKey->deleteThis();
                continue;
            }
        }
        else
        {
            if ( !ProcessEntityKey( pKeys ) )
                return false;
        }
        pKeys = pKeys->GetNextKey();
    }

    return true;
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:35,代码来源:VMFExporter.cpp

示例13: ResetDisplayStats

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_TFHintManager::ResetDisplayStats( void )
{
	if ( !m_pkvHintDisplayStats )
	{
		Assert( 0 );
		return;
	}

	KeyValues *kv = m_pkvHintDisplayStats->GetFirstSubKey();
	while ( kv )
	{
		KeyValues *subKey = kv->GetFirstSubKey();
		if ( subKey && stricmp( subKey->GetName(), "times_shown") )
		{
			while ( subKey )
			{
				subKey->SetString( "times_shown", "0" );
				subKey = subKey->GetNextKey();
			}
		}
		else
		{
			kv->SetString( "times_shown", "0" );
		}

		kv = kv->GetNextKey();
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:31,代码来源:c_tf_hintmanager.cpp

示例14: AddLevelContainer

bool VMFExporter::AddLevelContainer()
{
    KeyValues *pLevelContainerKeys = new KeyValues( "LevelContainer" );
    if ( !pLevelContainerKeys->LoadFromFile( g_pFullFileSystem, "tilegen/roomtemplates/levelcontainer.vmf.no_func_detail", "GAME" ) )
        return false;

    m_bWritingLevelContainer = true;

    // set the extents of the map
    m_pMapLayout->GetExtents(m_iMapExtents_XMin, m_iMapExtents_XMax, m_iMapExtents_YMin, m_iMapExtents_YMax);
    Msg( "Layout extents: Topleft: %f %f - Lower right: %f %f\n", m_iMapExtents_XMin, m_iMapExtents_YMin, m_iMapExtents_XMax, m_iMapExtents_YMax );
    // adjust to be relative to the centre of the map
    int half_map_size = MAP_LAYOUT_TILES_WIDE * 0.5f;
    m_iMapExtents_XMin -= half_map_size;
    m_iMapExtents_XMax -= half_map_size;
    m_iMapExtents_YMin -= half_map_size;
    m_iMapExtents_YMax -= half_map_size;
    // pad them by 2 blocks, so the player doesn't move his camera into the wall when at an edge block
    m_iMapExtents_XMin -= 2;
    m_iMapExtents_XMax += 2;
    m_iMapExtents_YMin -= 2;
    m_iMapExtents_YMax += 2;

    Msg( "   Adjusted to: Topleft: %d %d - Lower right: %d %d\n", m_iMapExtents_XMin, m_iMapExtents_YMin, m_iMapExtents_XMax, m_iMapExtents_YMax );

    // find world keys
    KeyValues *pWorldKeys = NULL;
    for ( KeyValues *pKeys = pLevelContainerKeys; pKeys; pKeys = pKeys->GetNextKey() )
    {
        const char *szName = pKeys->GetName();
        if ( !Q_stricmp( szName, "world" ) )
        {
            pWorldKeys = pKeys;
            break;
        }
    }
    if ( !pWorldKeys || !ProcessWorld( pWorldKeys ) )
    {
        Q_snprintf( m_szLastExporterError, sizeof(m_szLastExporterError), "Failed to copy level container\n" );
        return false;
    }

    m_bWritingLevelContainer = false;

    for ( KeyValues *pKeys = pWorldKeys->GetFirstSubKey(); pKeys; pKeys = pKeys->GetNextKey() )
    {
        const char *szName = pKeys->GetName();
        if ( !Q_stricmp( szName, "solid" ) )
        {
            m_pExportWorldKeys->AddSubKey( pKeys->MakeCopy() );
        }
    }
    pLevelContainerKeys->deleteThis();

    m_pTemplateKeys->deleteThis();
    m_pTemplateKeys = NULL;

    return true;
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:59,代码来源:VMFExporter.cpp

示例15: FrameUpdatePostEntityThink

	virtual void FrameUpdatePostEntityThink( void )
	{
		// Wait until we're all spawned in
		if ( gpGlobals->curtime < 5 )
			return;

		if ( m_bIssuedNextMapCommand )
			return;

		if ( !m_bParsedMapFile )
		{
			m_bParsedMapFile = true;

			// See if we've got a camera file to import cameras from
			char szFullName[512];
			Q_snprintf(szFullName,sizeof(szFullName), "maps/%s.txt", STRING( gpGlobals->mapname ));
			KeyValues *pkvMapCameras = new KeyValues( "MapCameras" );
			if ( pkvMapCameras->LoadFromFile( filesystem, szFullName, "MOD" ) )
			{
				Warning( "Devshots: Loading point_devshot_camera positions from %s. \n", szFullName );

				// Get each camera, and add it to our list
				KeyValues *pkvCamera = pkvMapCameras->GetFirstSubKey();
				while ( pkvCamera )
				{
					// Get camera name
					const char *pCameraName = pkvCamera->GetName();

					// Make a camera, and move it to the position specified
					CPointDevShotCamera	*pCamera = (CPointDevShotCamera*)CreateEntityByName( "point_devshot_camera" );
					Assert( pCamera );
					pCamera->KeyValue( "cameraname", pCameraName );
					pCamera->KeyValue( "origin", pkvCamera->GetString( "origin", "0 0 0" ) );
					pCamera->KeyValue( "angles", pkvCamera->GetString( "angles", "0 0 0" ) );
					pCamera->KeyValue( "FOV", pkvCamera->GetString( "FOV", "75" ) );
					DispatchSpawn( pCamera );
					pCamera->Activate();

					// Move to next camera
					pkvCamera = pkvCamera->GetNextKey();
				}
			}

			if ( !g_iDevShotCameraCount )
			{
				Warning( "Devshots: No point_devshot_camera in %s. Moving to next map.\n", STRING( gpGlobals->mapname ) );

				CBasePlayer *pPlayer = UTIL_GetLocalPlayerOrListenServerHost();
				if ( pPlayer )
				{
					engine->ClientCommand( pPlayer->edict(), "devshots_nextmap" );
					m_bIssuedNextMapCommand = true;
					return;
				}
			}
		}
	}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:57,代码来源:point_devshot_camera.cpp


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