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


C++ AllocPooledString函数代码示例

本文整理汇总了C++中AllocPooledString函数的典型用法代码示例。如果您正苦于以下问题:C++ AllocPooledString函数的具体用法?C++ AllocPooledString怎么用?C++ AllocPooledString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: atoi

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CTeamControlPoint::KeyValue( const char *szKeyName, const char *szValue )
{	
	if ( !Q_strncmp( szKeyName, "team_capsound_", 14 ) )
	{
		int iTeam = atoi(szKeyName+14);
		Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );

		m_TeamData[iTeam].iszCapSound = AllocPooledString(szValue);
	}
	else if ( !Q_strncmp( szKeyName, "team_model_", 11 ) )
	{
		int iTeam = atoi(szKeyName+11);
		Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );

		m_TeamData[iTeam].iszModel = AllocPooledString(szValue);
	}
	else if ( !Q_strncmp( szKeyName, "team_timedpoints_", 17 ) )
	{
		int iTeam = atoi(szKeyName+17);
		Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );

		m_TeamData[iTeam].iTimedPoints = atoi(szValue);
	}
	else if ( !Q_strncmp( szKeyName, "team_bodygroup_", 15 ) )
	{
		int iTeam = atoi(szKeyName+15);
		Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );

		m_TeamData[iTeam].iModelBodygroup = atoi(szValue);
	}
	else if ( !Q_strncmp( szKeyName, "team_icon_", 10 ) )
	{
		int iTeam = atoi(szKeyName+10);
		Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );

		m_TeamData[iTeam].iszIcon = AllocPooledString(szValue);
	}
	else if ( !Q_strncmp( szKeyName, "team_overlay_", 13 ) )
	{
		int iTeam = atoi(szKeyName+13);
		Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );

		m_TeamData[iTeam].iszOverlay = AllocPooledString(szValue);
	}
	else if ( !Q_strncmp( szKeyName, "team_previouspoint_", 19 ) )
	{
		int iTeam;
		int iPoint = 0;
		sscanf( szKeyName+19, "%d_%d", &iTeam, &iPoint );
		Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );
		Assert( iPoint >= 0 && iPoint < MAX_PREVIOUS_POINTS );
		m_TeamData[iTeam].iszPreviousPoint[iPoint] = AllocPooledString(szValue);
	}
	else
	{
		return BaseClass::KeyValue( szKeyName, szValue );
	}

	return true;
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:63,代码来源:team_control_point.cpp

示例2: SetModelName

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CResourceChunk::Spawn( )
{
	// Init model
	if ( IsProcessed() )
	{
		SetModelName( AllocPooledString( sProcessedResourceChunkModel ) );
	}
	else
	{
		SetModelName( AllocPooledString( sResourceChunkModel ) );
	}

	BaseClass::Spawn();

	UTIL_SetSize( this, Vector(-4,-4,-4), Vector(4,4,4) );
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_TRIGGER );
	CollisionProp()->UseTriggerBounds( true, 24 );
	SetCollisionGroup( TFCOLLISION_GROUP_RESOURCE_CHUNK );
	SetGravity( 1.0 );
	SetFriction( 1 );
	SetTouch( ChunkTouch );
	SetThink( ChunkRemove );
	SetNextThink( gpGlobals->curtime + random->RandomFloat( 50.0, 80.0 ) ); // Remove myself the
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:29,代码来源:resource_chunk.cpp

示例3: RunPlayerInit

bool CMapAdd::RunPlayerInit( const char *mapaddMap, const char *szLabel)
{
	if(AllocPooledString(mapaddMap) == AllocPooledString("") || !mapaddMap)
		return false; //Failed to load!
	if(!szLabel)
		szLabel = "Init";
	//FileHandle_t fh = filesystem->Open(szMapadd,"r","MOD");
	// Open the mapadd data file, and abort if we can't
	KeyValues *pMapAdd = new KeyValues( "MapAdd" );
	if(pMapAdd->LoadFromFile( filesystem, mapaddMap, "MOD" ))
	{
		KeyValues *pMapAdd2 = pMapAdd->FindKey(szLabel);
		if(pMapAdd2)
		{
			KeyValues *pMapAddEnt = pMapAdd2->GetFirstTrueSubKey();
			while (pMapAddEnt)
			{
				HandlePlayerEntity(pMapAddEnt, false);
				pMapAddEnt = pMapAddEnt->GetNextTrueSubKey(); //Got to keep this!
			}
		}
	}
	pMapAdd->deleteThis();
	return true;
}
开发者ID:sirmastercombat,项目名称:SirMasters_Mod,代码行数:25,代码来源:mapadd.cpp

示例4: DoEntFire

static void DoEntFire( const char *pszTarget, const char *pszAction, const char *pszValue, float delay, HSCRIPT hActivator, HSCRIPT hCaller )
{
	const char *target = "", *action = "Use";
	variant_t value;

	target = STRING( AllocPooledString( pszTarget ) );

	// Don't allow them to run anything on a point_servercommand unless they're the host player. Otherwise they can ent_fire
	// and run any command on the server. Admittedly, they can only do the ent_fire if sv_cheats is on, but 
	// people complained about users resetting the rcon password if the server briefly turned on cheats like this:
	//    give point_servercommand
	//    ent_fire point_servercommand command "rcon_password mynewpassword"
	if ( gpGlobals->maxClients > 1 && V_stricmp( target, "point_servercommand" ) == 0 )
	{
		return;
	}

	if ( *pszAction )
	{
		action = STRING( AllocPooledString( pszAction ) );
	}
	if ( *pszValue )
	{
		value.SetString( AllocPooledString( pszValue ) );
	}
	if ( delay < 0 )
	{
		delay = 0;
	}

	g_EventQueue.AddEvent( target, action, value, delay, ToEnt(hActivator), ToEnt(hCaller) );
}
开发者ID:SCell555,项目名称:hl2-asw-port,代码行数:32,代码来源:vscript_server.cpp

示例5: DoEntFireByInstanceHandle

//--------------------------------------------------------------------------------------------------
// Use an entity's script instance to add an entity IO event (used for firing events on unnamed entities from vscript)
//--------------------------------------------------------------------------------------------------
static void DoEntFireByInstanceHandle( HSCRIPT hTarget, const char *pszAction, const char *pszValue, float delay, HSCRIPT hActivator, HSCRIPT hCaller )
{
	const char *action = "Use";
	variant_t value;

	if ( *pszAction )
	{
		action = STRING( AllocPooledString( pszAction ) );
	}
	if ( *pszValue )
	{
		value.SetString( AllocPooledString( pszValue ) );
	}
	if ( delay < 0 )
	{
		delay = 0;
	}

	CBaseEntity* pTarget = ToEnt(hTarget);

	if ( !pTarget )
	{
		Warning( "VScript error: DoEntFire was passed an invalid entity instance.\n" );
		return;
	}

	g_EventQueue.AddEvent( pTarget, action, value, delay, ToEnt(hActivator), ToEnt(hCaller) );
}
开发者ID:SCell555,项目名称:hl2-asw-port,代码行数:31,代码来源:vscript_server.cpp

示例6: AllocPooledString

//-----------------------------------------------------------------------------
// Purpose: Setup the patch
// Input  : nEntIndex - index of the edict that owns the sound channel
//			channel - This is a sound channel (CHAN_ITEM, CHAN_STATIC)
//			*pSoundName - string name of the wave "weapons/sound.wav"
//			attenuation - attenuation of this sound (not animated)
//-----------------------------------------------------------------------------
void CSoundPatch::Init( IRecipientFilter *pFilter, CBaseEntity *pEnt, int channel, const char *pSoundName, 
			soundlevel_t soundlevel )
{
	m_hEnt = pEnt;
	m_entityChannel = channel;
	m_iszSoundName = AllocPooledString( pSoundName );
	m_volume.SetValue( 0 );
	m_soundlevel = soundlevel;
	m_pitch.SetValue( 0 );
	m_isPlaying = false;
	m_shutdownTime = 0;
	m_flLastTime = 0;
	m_Filter.Init( pFilter );

	// Get the volume from the script
	CSoundParameters params;
	if ( !Q_stristr( pSoundName, ".wav" ) &&
		CBaseEntity::GetParametersForSound( pSoundName, params ) )
	{
		m_flScriptVolume = params.volume;
	}
	else
	{
		m_flScriptVolume = 1.0;
	}

#ifdef _DEBUG
	m_iszClassName = AllocPooledString( pEnt->GetClassname() );
#endif
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:37,代码来源:soundenvelope.cpp

示例7: m_szHexname

TrackInfo_t::TrackInfo_t( const char *szFilename, const char *szHexname, const char *szAlbum, const char *szArtist, const char *szGenre )
: m_szHexname( AllocPooledString( szHexname ) )
, m_szFilename( AllocPooledString( szFilename ))
, m_szAlbum( szAlbum )
, m_szArtist( szArtist )
, m_szGenre( szGenre )
, m_bIsMarkedForDeletion( false )
{}
开发者ID:Randdalf,项目名称:bliink,代码行数:8,代码来源:c_asw_jukebox.cpp

示例8: Warning

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamControlPoint::Spawn( void )
{
	// Validate our default team
	if ( m_iDefaultOwner < 0 || m_iDefaultOwner >= GetNumberOfTeams() )
	{
		Warning( "team_control_point '%s' has bad point_default_owner.\n", GetDebugName() );
		m_iDefaultOwner = TEAM_UNASSIGNED;
	}

#ifdef TF_DLL
	if ( m_iszCaptureStartSound == NULL_STRING )
	{
		m_iszCaptureStartSound = AllocPooledString( "Hologram.Start" );
	}
	if ( m_iszCaptureEndSound == NULL_STRING )
	{
		m_iszCaptureEndSound = AllocPooledString( "Hologram.Stop" );
	}
	if ( m_iszCaptureInProgress == NULL_STRING )
	{
		m_iszCaptureInProgress = AllocPooledString( "Hologram.Move" );
	}
	if ( m_iszCaptureInterrupted == NULL_STRING )
	{
		m_iszCaptureInterrupted = AllocPooledString( "Hologram.Interrupted" );
	}
#endif

	Precache();

	InternalSetOwner( m_iDefaultOwner, false );	//init the owner of this point

	SetActive( !m_bStartDisabled );

	BaseClass::Spawn();

	SetPlaybackRate( 1.0 );
	SetThink( &CTeamControlPoint::AnimThink );
	SetNextThink( gpGlobals->curtime + 0.1f );

	if ( FBitSet( m_spawnflags, SF_CAP_POINT_HIDE_MODEL ) )
	{
		AddEffects( EF_NODRAW );
	}

	if ( FBitSet( m_spawnflags, SF_CAP_POINT_HIDE_SHADOW ) )
	{
		AddEffects( EF_NOSHADOW );
	}

	m_flLastContestedAt = -1;

	m_pCaptureInProgressSound = NULL;


}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:59,代码来源:team_control_point.cpp

示例9: AllocPooledString

void CASW_Holdout_Wave_Entry::LoadFromKeyValues( KeyValues *pKeys )
{
	m_flSpawnDelay = pKeys->GetFloat( "SpawnDelay", 1.0f );
	m_iszAlienClass = AllocPooledString( pKeys->GetString( "AlienClass" ) );
	m_nQuantity = pKeys->GetInt( "Quantity", 1 );
	m_flSpawnDuration = pKeys->GetFloat( "SpawnDuration", 0.0f );
	m_nModifiers = pKeys->GetInt( "Modifiers", 0 );	// TODO: Turn this into a string parser for the bit flag names
	m_iszSpawnGroupName = AllocPooledString( pKeys->GetString( "SpawnGroup" ) );
	m_hSpawnGroup = NULL;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:10,代码来源:asw_holdout_wave.cpp

示例10:

CBaseEntity *CAI_Relationship::FindEntityForProceduralName( string_t iszName, CBaseEntity *pActivator, CBaseEntity *pCaller )
{
	// Handle the activator token
	if ( iszName == AllocPooledString( ACTIVATOR_KEYNAME ) )
		return pActivator;

	// Handle the caller token
	if ( iszName == AllocPooledString( CALLER_KEYNAME ) )
		return pCaller;

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

示例11: AllocPooledString

bool CNPCSimpleTalker::KeyValue( const char *szKeyName, const char *szValue )
{
	if (FStrEq(szKeyName, "UseSentence"))
	{
		m_iszUse = AllocPooledString(szValue);
	}
	else if (FStrEq(szKeyName, "UnUseSentence"))
	{
		m_iszUnUse = AllocPooledString(szValue);
	}
	else 
		return BaseClass::KeyValue( szKeyName, szValue );

	return true;
}
开发者ID:Denzeriko,项目名称:hl2-mod,代码行数:15,代码来源:npc_talker.cpp

示例12: ASWGameResource

void CASW_Campaign_Save::UpdateLastCommanders()
{
	// save which marines the players have selected
	// add which marines he has selected
	CASW_Game_Resource *pGameResource = ASWGameResource();
	if ( !pGameResource )
		return;

	// first check there were some marines selected (i.e. we're not in the campaign lobby map)
	int iNumMarineResources = 0;
	for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
	{
		if (pGameResource->GetMarineResource(i))
			iNumMarineResources++;
	}
	if ( iNumMarineResources <= 0 )
		return;
	
	char buffer[256];
	for (int i=0;i<ASW_NUM_MARINE_PROFILES;i++)
	{
		// look for a marine info for this marine
		bool bFound = false;
		for (int k=0;k<pGameResource->GetMaxMarineResources();k++)
		{
			CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(k);
			if (pMR && pMR->GetProfileIndex() == i && pMR->GetCommander())
			{
				CASW_Player *pPlayer = pMR->GetCommander();
				if (pPlayer)
				{
					// store the commander who has this marine
					Q_snprintf(buffer, sizeof(buffer), "%s%s",pPlayer->GetPlayerName(), pPlayer->GetASWNetworkID());
					m_LastCommanders[i] = AllocPooledString(buffer);
					m_LastMarineResourceSlot[i] = k;
					m_LastPrimaryMarines[i] = pPlayer->IsPrimaryMarine(i);
					bFound = true;
					break;
				}
			}
		}
		if (!bFound)
		{
			m_LastCommanders[i] = AllocPooledString("");
			m_LastMarineResourceSlot[i] = 0;
		}
	}
}
开发者ID:jtanx,项目名称:ch1ckenscoop,代码行数:48,代码来源:asw_campaign_save.cpp

示例13: SetWidth

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CEnvLaser::KeyValue( const char *szKeyName, const char *szValue )
{
	if (FStrEq(szKeyName, "width"))
	{
		SetWidth( atof(szValue) );
	}
	else if (FStrEq(szKeyName, "NoiseAmplitude"))
	{
		SetNoise( atoi(szValue) );
	}
	else if (FStrEq(szKeyName, "TextureScroll"))
	{
		SetScrollRate( atoi(szValue) );
	}
	else if (FStrEq(szKeyName, "texture"))
	{
		SetModelName( AllocPooledString(szValue) );
	}
	else
	{
		BaseClass::KeyValue( szKeyName, szValue );
	}

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

示例14: infected_health

//====================================================================
// Creación en el mapa
//====================================================================
void CAP_PlayerInfected::Spawn()
{
	ConVarRef infected_health("sk_infected_health");
	int iMaxHealth = infected_health.GetInt() + RandomInt( 1, 5 );

	CB_MeleeCharacter::SetOuter( this );
	BaseClass::Spawn();

	// El Director será el responsable de crearnos
	// Mientras tanto seremos invisibles y no nos moveremos
	AddEffects( EF_NODRAW );
	AddFlag( FL_FREEZING );
	SetCollisionGroup( COLLISION_GROUP_NONE );
	m_takedamage = DAMAGE_NO;

	// Esto hará que el Director lo tome como uno de sus hijos
	SetName( AllocPooledString(DIRECTOR_CHILD_NAME) );

	// Seleccionamos un color para nuestra ropa
	SetClothColor();

	// Establecemos la salud
	SetMaxHealth( iMaxHealth );
	SetHealth( iMaxHealth );

	// Más información
	m_iNextIdleSound	= IDLE_SOUND_INTERVAL;
	m_iNextAttack		= ATTACK_INTERVAL;

	// Solicitamos un lugar para el Spawn
	RegisterThinkContext( "RequestDirectorSpawn" );
	SetContextThink( &CAP_PlayerInfected::RequestDirectorSpawn, gpGlobals->curtime, "RequestDirectorSpawn" );
}
开发者ID:InfoSmart,项目名称:InSource,代码行数:36,代码来源:ap_player_infected.cpp

示例15: SetupParentsForSpawnList

void SetupParentsForSpawnList( int nEntities, HierarchicalSpawn_t *pSpawnList )
{
	int nEntity;
	for (nEntity = nEntities - 1; nEntity >= 0; nEntity--)
	{
		CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
		if ( pEntity )
		{
			if ( strchr(STRING(pEntity->m_iParent), ',') )
			{
				char szToken[256];
				const char *pAttachmentName = nexttoken(szToken, STRING(pEntity->m_iParent), ',');
				pEntity->m_iParent = AllocPooledString(szToken);
				CBaseEntity *pParent = gEntList.FindEntityByName( NULL, pEntity->m_iParent );

				// setparent in the spawn pass instead - so the model will have been set & loaded
				pSpawnList[nEntity].m_pDeferredParent = pParent;
				pSpawnList[nEntity].m_pDeferredParentAttachment = pAttachmentName;
			}
			else
			{
				CBaseEntity *pParent = gEntList.FindEntityByName( NULL, pEntity->m_iParent );

				if ((pParent != NULL) && (pParent->edict() != NULL))
				{
					pEntity->SetParent( pParent ); 
				}
			}
		}
	}
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:31,代码来源:mapentities.cpp


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