本文整理汇总了C++中KeyValues::GetNextKey方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyValues::GetNextKey方法的具体用法?C++ KeyValues::GetNextKey怎么用?C++ KeyValues::GetNextKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValues
的用法示例。
在下文中一共展示了KeyValues::GetNextKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: smn_KvGotoNextKey
static cell_t smn_KvGotoNextKey(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();
if (params[2])
{
pSubKey = pSubKey->GetNextTrueSubKey();
} else {
pSubKey = pSubKey->GetNextKey();
}
if (!pSubKey)
{
return 0;
}
pStk->pCurRoot.pop();
pStk->pCurRoot.push(pSubKey);
return 1;
}
示例2: BuildKVData_R
void CCompiledKeyValuesWriter::BuildKVData_R( KeyValues *kv, int parent )
{
// Add self
KVInfo_t info;
info.key = m_StringTable.AddString( kv->GetName() );
info.value = m_StringTable.AddString( kv->GetString() );
info.SetSubTree( kv->GetFirstSubKey() != NULL ? true : false );
info.SetParent( parent );
int newParent = m_Data.AddToTail( info );
// Then add children
for ( KeyValues *sub = kv->GetFirstSubKey(); sub; sub = sub->GetNextKey() )
{
BuildKVData_R( sub, newParent );
}
// Then add peers
if ( parent == -1 )
{
if ( kv->GetNextKey() )
{
BuildKVData_R( kv->GetNextKey(), parent );
}
}
}
示例3: 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();
}
}
示例4: ParseModelResInfo
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseModelPanel::ParseModelResInfo( KeyValues *inResourceData )
{
m_bForcePos = ( inResourceData->GetInt( "force_pos", 0 ) == 1 );
m_BMPResData.m_pszModelName = ReadAndAllocStringValue( inResourceData, "modelname" );
m_BMPResData.m_pszModelName_HWM = ReadAndAllocStringValue( inResourceData, "modelname_hwm" );
m_BMPResData.m_pszVCD = ReadAndAllocStringValue( inResourceData, "vcd" );
m_BMPResData.m_angModelPoseRot.Init( inResourceData->GetFloat( "angles_x", 0.0f ), inResourceData->GetFloat( "angles_y", 0.0f ), inResourceData->GetFloat( "angles_z", 0.0f ) );
m_BMPResData.m_vecOriginOffset.Init( inResourceData->GetFloat( "origin_x", 110.0 ), inResourceData->GetFloat( "origin_y", 5.0 ), inResourceData->GetFloat( "origin_z", 5.0 ) );
m_BMPResData.m_vecFramedOriginOffset.Init( inResourceData->GetFloat( "frame_origin_x", 110.0 ), inResourceData->GetFloat( "frame_origin_y", 5.0 ), inResourceData->GetFloat( "frame_origin_z", 5.0 ) );
m_BMPResData.m_vecViewportOffset.Init();
m_BMPResData.m_nSkin = inResourceData->GetInt( "skin", -1 );
m_BMPResData.m_bUseSpotlight = ( inResourceData->GetInt( "spotlight", 0 ) == 1 );
m_angPlayer = m_BMPResData.m_angModelPoseRot;
m_vecPlayerPos = m_BMPResData.m_vecOriginOffset;
for ( KeyValues *pData = inResourceData->GetFirstSubKey(); pData != NULL; pData = pData->GetNextKey() )
{
if ( !Q_stricmp( pData->GetName(), "animation" ) )
{
ParseModelAnimInfo( pData );
}
else if ( !Q_stricmp( pData->GetName(), "attached_model" ) )
{
ParseModelAttachInfo( pData );
}
}
}
示例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();
}
示例6: 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();
}
}
示例7: 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();
}
}
}
示例8: SetupList
// fills in the target list panel with buttons for each of the entries in the desired list
bool SwarmopediaTopics::SetupList(SwarmopediaPanel *pPanel, const char *szDesiredList)
{
// look through our KeyValues for the desired list
KeyValues *pkvList = GetSubkeyForList(szDesiredList);
if (!pkvList)
{
Msg("Swarmopedia error: Couldn't find list %s\n", szDesiredList);
return false;
}
// now go through every LISTENTRY in the subkey we found, adding it to the list panel
int iPlayerUnlockLevel = 999; // todo: have this check a convar that measures how far through the jacob campaign the player has got
while ( pkvList )
{
if (Q_stricmp(pkvList->GetName(), "LISTENTRY")==0)
{
const char *szEntryName = pkvList->GetString("Name");
const char *szArticleTarget = pkvList->GetString("ArticleTarget");
const char *szListTarget = pkvList->GetString("ListTarget");
int iEntryUnlockLevel = pkvList->GetInt("UnlockLevel");
int iSectionHeader = pkvList->GetInt("SectionHeader");
if (iEntryUnlockLevel == 0 || iEntryUnlockLevel < iPlayerUnlockLevel)
{
pPanel->AddListEntry(szEntryName, szArticleTarget, szListTarget, iSectionHeader);
}
}
pkvList = pkvList->GetNextKey();
}
return true;
}
示例9: ProcessGenericRecursive
bool VMFExporter::ProcessGenericRecursive( KeyValues *pKey )
{
const char *szKey = pKey->GetName();
const char *szValue = pKey->GetString();
if ( !Q_stricmp( szKey, "startposition" ) )
{
Vector Origin;
int nRead = sscanf(szValue, "[%f %f %f]", &Origin[0], &Origin[1], &Origin[2]);
if (nRead != 3)
return false;
// move the points to where our room is
Origin += GetCurrentRoomOffset();
char buffer[256];
Q_snprintf(buffer, sizeof(buffer), "[%f %f %f]", Origin[0], Origin[1], Origin[2]);
pKey->SetStringValue( buffer );
}
if ( pKey->GetFirstSubKey() ) // if this keyvalues entry has subkeys, then process them
{
for ( KeyValues *pKeys = pKey->GetFirstSubKey(); pKeys; pKeys = pKeys->GetNextKey() )
{
if ( !ProcessGenericRecursive( pKeys ) )
return false;
}
}
return true;
}
示例10: 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;
}
示例11: 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();
}
示例12: LoadFromKeyValues
void CASW_Holdout_Wave::LoadFromKeyValues( int nWaveNumber, KeyValues *pKeys )
{
m_Entries.PurgeAndDeleteElements();
m_nTotalAliens = 0;
m_nWaveNumber = nWaveNumber;
m_iszWaveName = AllocPooledString( pKeys->GetString( "Name", "Unknown" ) );
m_nEnvironmentModifiers = pKeys->GetInt( "EnvironmentModifiers" ); // TODO: Turn this into a string parser for the bit flag names
m_bWaveHasResupply = pKeys->GetBool( "Resupply", false );
for ( KeyValues *pKey = pKeys->GetFirstSubKey(); pKey; pKey = pKey->GetNextKey() )
{
if ( !Q_stricmp( pKey->GetName(), "ENTRY" ) )
{
if ( asw_holdout_debug.GetBool() )
{
Msg( " Loading a wave entry\n" );
}
CASW_Holdout_Wave_Entry *pEntry = new CASW_Holdout_Wave_Entry();
pEntry->LoadFromKeyValues( pKey );
m_Entries.AddToTail( pEntry );
m_nTotalAliens += pEntry->GetQuantity();
}
}
}
示例13: 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();
}
示例14: ApplySettings
//-----------------------------------------------------------------------------
// Purpose: sets up the button/command bindings
//-----------------------------------------------------------------------------
void CControllerMap::ApplySettings( KeyValues *inResourceData )
{
BaseClass::ApplySettings( inResourceData );
// loop through all the data adding items to the menu
for (KeyValues *dat = inResourceData->GetFirstSubKey(); dat != NULL; dat = dat->GetNextKey())
{
if ( !Q_stricmp( dat->GetName(), "button" ) )
{
const char *buttonName = dat->GetString( "name", "" );
int keycode = StringToButtonCode( buttonName );
if ( keycode != -1 )
{
button_t b;
b.cmd = CUtlSymbol( dat->GetString( "command", "" ) );
// text and icon are optional - their existence means this button
// should be displayed in the footer panel.
const char *helpText = dat->GetString( "text", NULL );
if ( helpText )
{
b.text = CUtlSymbol( helpText );
b.icon = CUtlSymbol( dat->GetString( "icon", NULL ) );
}
m_buttonMap.Insert( keycode, b );
}
}
}
}
示例15: AddRoomTemplateSolids
bool VMFExporter::AddRoomTemplateSolids( const CRoomTemplate *pRoomTemplate )
{
// open its vmf file
char roomvmfname[MAX_PATH];
Q_snprintf(roomvmfname, sizeof(roomvmfname), "tilegen/roomtemplates/%s/%s.vmf",
pRoomTemplate->m_pLevelTheme->m_szName,
pRoomTemplate->GetFullName() );
m_pTemplateKeys = new KeyValues( "RoomTemplateVMF" );
m_pTemplateKeys->LoadFromFile( g_pFullFileSystem, roomvmfname, "GAME" );
// look for world key
for ( KeyValues *pKeys = m_pTemplateKeys; pKeys; pKeys = pKeys->GetNextKey() )
{
if ( !Q_stricmp( pKeys->GetName(), "world" ) ) // find the world key in our room template
{
if ( !ProcessWorld( pKeys ) ) // fix up solid positions
{
Q_snprintf( m_szLastExporterError, sizeof(m_szLastExporterError), "Failed to copy world from room %s\n", pRoomTemplate->GetFullName() );
return false;
}
for ( KeyValues *pSubKey = pKeys->GetFirstSubKey(); pSubKey; pSubKey = pSubKey->GetNextKey() ) // convert each solid to a func_detail entity
{
if ( !Q_stricmp( pSubKey->GetName(), "solid" ) )
{
if ( IsDisplacementBrush( pSubKey ) )
{
// add to world section
m_pExportWorldKeys->AddSubKey( pSubKey->MakeCopy() );
}
else
{
// put into entity section as a func_detail
KeyValues *pFuncDetail = new KeyValues( "entity" );
pFuncDetail->SetInt( "id", ++m_iEntityCount );
pFuncDetail->SetString( "classname", "func_detail" );
pFuncDetail->AddSubKey( pSubKey->MakeCopy() );
m_pExportKeys->AddSubKey( pFuncDetail );
}
}
}
}
}
m_pTemplateKeys->deleteThis();
m_pTemplateKeys = NULL;
return true;
}