• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ALLOC_STRING函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ButtonSound

void CBaseButton::Spawn(void)
{
	char *pszSound = ButtonSound(m_sounds);
	PRECACHE_SOUND(pszSound);
	pev->noise = ALLOC_STRING(pszSound);
	Precache();

	if (FBitSet(pev->spawnflags, SF_BUTTON_SPARK_IF_OFF))
	{
		SetThink(&CBaseButton::ButtonSpark);
		pev->nextthink = gpGlobals->time + 0.5;
	}

	SetMovedir(pev);
	pev->movetype = MOVETYPE_PUSH;
	pev->solid = SOLID_BSP;
	SET_MODEL(ENT(pev), STRING(pev->model));

	if (!pev->speed)
		pev->speed = 40;

	if (pev->health > 0)
		pev->takedamage = DAMAGE_YES;

	if (!m_flWait)
		m_flWait = 1;

	if (!m_flLip)
		m_flLip = 4;

	m_toggle_state = TS_AT_BOTTOM;
	m_vecPosition1 = pev->origin;
	m_vecPosition2 = m_vecPosition1 + (pev->movedir * (fabs(pev->movedir.x * (pev->size.x - 2)) + fabs(pev->movedir.y * (pev->size.y - 2)) + fabs(pev->movedir.z * (pev->size.z - 2)) - m_flLip));

	if (((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE))
		m_vecPosition2 = m_vecPosition1;

	m_fStayPushed = m_flWait == -1 ? TRUE : FALSE;
	m_fRotating = FALSE;

	if (FBitSet(pev->spawnflags, SF_BUTTON_TOUCH_ONLY))
	{
		SetTouch(&CBaseButton::ButtonTouch);
	}
	else
	{
		SetTouch(NULL);
		SetUse(&CBaseButton::ButtonUse);
	}
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:50,代码来源:buttons.cpp


示例2: ALLOC_STRING

void CEnvGlobal::KeyValue( KeyValueData *pkvd )
{
	//TODO: what if the keyvalue isn't handled? - Solokiller
	pkvd->fHandled = true;

	if( FStrEq( pkvd->szKeyName, "globalstate" ) )		// State name
		m_globalstate = ALLOC_STRING( pkvd->szValue );
	else if( FStrEq( pkvd->szKeyName, "triggermode" ) )
		m_triggermode = static_cast<TriggerMode>( atoi( pkvd->szValue ) );
	else if( FStrEq( pkvd->szKeyName, "initialstate" ) )
		m_initialstate = atoi( pkvd->szValue );
	else
		CPointEntity::KeyValue( pkvd );
}
开发者ID:swmpdg,项目名称:HLEnhanced,代码行数:14,代码来源:CEnvGlobal.cpp


示例3: if

void CMultiSource::KeyValue(KeyValueData *pkvd)
{
	if (FStrEq(pkvd->szKeyName, "style") || FStrEq(pkvd->szKeyName, "height") || FStrEq(pkvd->szKeyName, "killtarget") || FStrEq(pkvd->szKeyName, "value1") || FStrEq(pkvd->szKeyName, "value2") || FStrEq(pkvd->szKeyName, "value3"))
	{
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "globalstate"))
	{
		m_globalstate = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else
		CPointEntity::KeyValue(pkvd);
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:14,代码来源:buttons.cpp


示例4: RCsprintf

/*
 * RCsprintf - do sprintf with a format string from a resource
 */
int RCsprintf( char *buf, msg_id fmtid, ... )
{
    va_list     al;
    char        *fmtstr;
    int         ret;

    va_start( al, fmtid );
    fmtstr = ALLOC_STRING( fmtid );
    ret = vsprintf( buf, fmtstr, al );
    FREE_STRING( fmtstr );
    va_end( al );
    return( ret );

} /* RCsprintf */
开发者ID:Graham-stott,项目名称:open-watcom-v2,代码行数:17,代码来源:ldstr.c


示例5: KeyValue

//=========================================================
//=========================================================
void CWeaponBox :: KeyValue( KeyValueData *pkvd )
{
	if ( m_cAmmoTypes < MAX_AMMO_SLOTS )
	{
		PackAmmo( ALLOC_STRING(pkvd->szKeyName), atoi(pkvd->szValue) );
		m_cAmmoTypes++;// count this new ammo type.

		pkvd->fHandled = TRUE;
	}
	else
	{
		ALERT ( at_debug, "WeaponBox too full! only %d ammotypes allowed\n", MAX_AMMO_SLOTS );
	}
}
开发者ID:fmoraw,项目名称:SpiritOfHalfLife,代码行数:16,代码来源:weapons.cpp


示例6: Use

//
// CyclerUse - starts a rotation trend
//
void CCycler :: Use ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	if ( FClassnameIs ( pev, "info_commentary" ) )
	{
		pev->skin = 1;

		//stop previous sound
		if (pev->message)
		EMIT_SOUND(ENT(pev), CHAN_ITEM, "common/null.wav", 0.1, ATTN_NORM );
			
		//stop previous message (BUGBUG: This doesn't clear the message)
		UTIL_ShowMessageAll( STRING(ALLOC_STRING("BLANK")));
		
		//play it everywhere
		if (pev->message)				
		EMIT_SOUND(ENT(pev), CHAN_ITEM, STRING(pev->message), 1, ATTN_NORM );

		//send message
		UTIL_ShowMessageAll( STRING(pev->message) );	//strings code

		/*
		if(!bIsPlaying)
		{
			pev->skin = 1;
			bIsPlaying = TRUE;
					
			//play it everywhere
			if (pev->message)				
			EMIT_SOUND(ENT(pev), CHAN_ITEM, STRING(pev->message), 1, ATTN_NORM );

			UTIL_ShowMessageAll( STRING(pev->message) );	//strings code
		}
		else
		{
			pev->skin = 0;
			bIsPlaying = FALSE;
						
		}
		*/
	}
	else
	{
		m_animate = !m_animate;
		if (m_animate)
			pev->framerate = 1.0;
		else
			pev->framerate = 0.0;
	}
}
开发者ID:JoelTroch,项目名称:am_src_rebirth,代码行数:52,代码来源:h_cycler.cpp


示例7: atoi

void CGenericMonster::KeyValue( KeyValueData *pkvd )
{
	if (FStrEq(pkvd->szKeyName, "m_bloodColor"))
	{
		m_bloodColor = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iszGibModel"))
	{
		m_iszGibModel = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else
		CBaseMonster::KeyValue( pkvd );
}
开发者ID:mittorn,项目名称:SoHL-1.2,代码行数:15,代码来源:genericmonster.cpp


示例8: Q_atof

/* <18356f> ../cstrike/dlls/subs.cpp:149 */
void CBaseDelay::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
	if (FStrEq(pkvd->szKeyName, "delay"))
	{
		m_flDelay = Q_atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "killtarget"))
	{
		m_iszKillTarget = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else
		CBaseEntity::KeyValue(pkvd);
}
开发者ID:omertelli,项目名称:ReGameDLL_CS,代码行数:16,代码来源:subs.cpp


示例9: copy_enum_values_to_allocated_buffer

static void copy_enum_values_to_allocated_buffer(struct trace_type_definition *type_definition, struct trace_enum_value **enum_values,
                                                 char **string_table)
{
    struct trace_enum_value *enum_value = type_definition->enum_values;
    while (enum_value->name != NULL) {
        memcpy(*enum_values, enum_value, sizeof(*enum_value));
        ALLOC_STRING((*enum_values)->name, enum_value->name);
        (*enum_values)++;
        enum_value++;
    }

    // Copy the sentinel enum value
    memcpy(*enum_values, enum_value, sizeof(*enum_value));
    (*enum_values)++;
}
开发者ID:Zex,项目名称:traces,代码行数:15,代码来源:trace_user.c


示例10: entity_set_model

static cell AMX_NATIVE_CALL entity_set_model(AMX *amx, cell *params)
{
	int iEnt = params[1];

	CHECK_ENTITY_SIMPLE(iEnt);
	
	edict_t *pEnt = INDEXENT2(iEnt);
	int iLen;
	char *szModel = MF_GetAmxString(amx, params[2], 0, &iLen);
	const char *szStatic = STRING(ALLOC_STRING(szModel));

	SET_MODEL(pEnt, szStatic);

	return 1;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:15,代码来源:entity.cpp


示例11: Call_Void_Str_Bool

cell Call_Void_Str_Bool(AMX *amx, cell *params)
{
	SETUP(2);

	const char *sz3=STRING(ALLOC_STRING(MF_GetAmxString(amx, params[3], 0, NULL)));
	bool b4=*MF_GetAmxAddr(amx, params[4]) ? true : false;

#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void*, int, const char *, bool)>(__func)(pv, 0, sz3, b4);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, const char *, bool)>(__func)(pv, sz3, b4);
#endif

	return 1;
}
开发者ID:reuben,项目名称:amxmodx,代码行数:15,代码来源:call_funcs.cpp


示例12: KeyValue

void CBaseDelay :: KeyValue( KeyValueData *pkvd )
{
	if (FStrEq(pkvd->szKeyName, "delay"))
	{
		m_flDelay = atof( pkvd->szValue );
		pkvd->fHandled = true;
	}
	else if (FStrEq(pkvd->szKeyName, "killtarget"))
	{
		m_iszKillTarget = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = true;
	}
	else
	{
		CBaseEntity::KeyValue( pkvd );
	}
}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:17,代码来源:subs.cpp


示例13: dod_set_model

static cell AMX_NATIVE_CALL dod_set_model(AMX *amx, cell *params) // player,model
{
	int index = params[1];
	CHECK_PLAYER(index);

	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if(!pPlayer->ingame)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Player, Not on Server");
		return 0;
	}

	int length;
	pPlayer->initModel((char*)STRING(ALLOC_STRING(MF_GetAmxString(amx, params[2], 1, &length))));

	return true;
}
开发者ID:Chuvi-w,项目名称:amxmodx,代码行数:17,代码来源:NBase.cpp


示例14: EntvarsKeyvalue

void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd )
{
	const TYPEDESCRIPTION* pField;

	for ( size_t i = 0; i < gEntvarsCount; i++ )
	{
		pField = &gEntvarsDescription[i];

		if ( !stricmp( pField->fieldName, pkvd->szKeyName ) )
		{
			switch( pField->fieldType )
			{
			case FIELD_MODELNAME:
			case FIELD_SOUNDNAME:
			case FIELD_STRING:
				(*(int *)((char *)pev + pField->fieldOffset)) = ALLOC_STRING( pkvd->szValue );
				break;

			case FIELD_TIME:
			case FIELD_FLOAT:
				(*(float *)((char *)pev + pField->fieldOffset)) = atof( pkvd->szValue );
				break;

			case FIELD_INTEGER:
				(*(int *)((char *)pev + pField->fieldOffset)) = atoi( pkvd->szValue );
				break;

			case FIELD_POSITION_VECTOR:
			case FIELD_VECTOR:
				UTIL_StringToVector( (float *)((char *)pev + pField->fieldOffset), pkvd->szValue );
				break;

			default:
			case FIELD_EVARS:
			case FIELD_CLASSPTR:
			case FIELD_EDICT:
			case FIELD_ENTITY:
			case FIELD_POINTER:
				ALERT( at_error, "Bad field in entity!!\n" );
				break;
			}
			pkvd->fHandled = true;
			return;
		}
	}
}
开发者ID:CryoKeen,项目名称:HLEnhanced,代码行数:46,代码来源:util.cpp


示例15: KeyValue

//
// Cache user-entity-field values until spawn is called.
//
void CLight :: KeyValue( KeyValueData* pkvd)
{
	if (FStrEq(pkvd->szKeyName, "m_iOnStyle"))
	{
		m_iOnStyle = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iOffStyle"))
	{
		m_iOffStyle = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iTurnOnStyle"))
	{
		m_iTurnOnStyle = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iTurnOffStyle"))
	{
		m_iTurnOffStyle = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iTurnOnTime"))
	{
		m_iTurnOnTime = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "m_iTurnOffTime"))
	{
		m_iTurnOffTime = atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pitch"))
	{
		pev->angles.x = atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pattern"))
	{
		m_iszPattern = ALLOC_STRING( pkvd->szValue );
		pkvd->fHandled = TRUE;
	}
	else	CBaseEntity::KeyValue( pkvd );
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:47,代码来源:lights.cpp


示例16: KeyValue

void CEnvGlobal :: KeyValue( KeyValueData *pkvd )
{
	if( FStrEq( pkvd->szKeyName, "triggermode" ))
	{
		m_triggermode = Q_atoi( pkvd->szValue );
		pkvd->fHandled = TRUE;
	}
	else if( FStrEq( pkvd->szKeyName, "initialstate" ))
	{
		m_initialstate = Q_atoi( pkvd->szValue );
		pkvd->fHandled = TRUE;
	}
	else if( FStrEq( pkvd->szKeyName, "globalstate" ))
	{
		m_globalstate = ALLOC_STRING( pkvd->szValue );
		pkvd->fHandled = TRUE;
	}
	else BaseClass::KeyValue( pkvd );
}
开发者ID:FWGS,项目名称:XashXT,代码行数:19,代码来源:buttons.cpp


示例17: ASSERT

bool AvHSoundListManager::PrecacheSoundList(const string& inDirName)
{
	bool theReturnValue = false;

	// Check if we have a sound list with this name
	SoundListType::iterator theIter = this->GetSoundList(inDirName);

	// If so, return false
	if(theIter == this->mSoundList.end())
	{
		// If not, read list of all sound files in this directory, add this to the list with theKey as a key
		CStringList theNewSoundList;
		if(this->BuildSoundList(inDirName, theNewSoundList))
		{
			// Save entry
			this->mSoundList.push_back(make_pair(inDirName, theNewSoundList));

			// NOW, precache each sound because it remembers the pointer, so it has to be the final version <sigh>
			SoundListType::iterator theIter = this->GetSoundList(inDirName);
			ASSERT(theIter != this->mSoundList.end());
			
			// Get number of entries
			CStringList& theList = theIter->second;
			int theNumEntries = theList.size();
			for(int i = 0; i < theNumEntries; i++)
			{
				CString& theSoundToPrecache = theIter->second[i];

				int iString = ALLOC_STRING((char*)theSoundToPrecache);//: We cant do "(char*)theSoundToPrecache" directly cause it causes some wierd problems.
				PRECACHE_UNMODIFIED_SOUND((char*)STRING(iString));

				// Success
				theReturnValue = true;
			}
		}
		else
		{
			int a = 0;
		}
	}
	return theReturnValue;
}
开发者ID:Arkshine,项目名称:NS,代码行数:42,代码来源:AvHSoundListManager.cpp


示例18: Q_atoi

// Cache user-entity-field values until spawn is called.
void CLight::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
	if (FStrEq(pkvd->szKeyName, "style"))
	{
		m_iStyle = Q_atoi(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pitch"))
	{
		pev->angles.x = Q_atof(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else if (FStrEq(pkvd->szKeyName, "pattern"))
	{
		m_iszPattern = ALLOC_STRING(pkvd->szValue);
		pkvd->fHandled = TRUE;
	}
	else
		CPointEntity::KeyValue(pkvd);
}
开发者ID:Slinfy97,项目名称:ReGameDLL_CS,代码行数:21,代码来源:lights.cpp


示例19: ALLOC_STRING

void CEnvGlobal::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
	pkvd->fHandled = TRUE;

	// State name
	if (FStrEq(pkvd->szKeyName, "globalstate"))
	{
		m_globalstate = ALLOC_STRING(pkvd->szValue);
	}
	else if (FStrEq(pkvd->szKeyName, "triggermode"))
	{
		m_triggermode = Q_atoi(pkvd->szValue);
	}
	else if (FStrEq(pkvd->szKeyName, "initialstate"))
	{
		m_initialstate = Q_atoi(pkvd->szValue);
	}
	else
		CPointEntity::KeyValue(pkvd);
}
开发者ID:Chuvi-w,项目名称:ReGameDLL_CS,代码行数:20,代码来源:buttons.cpp


示例20: esf_set_model

static cell AMX_NATIVE_CALL esf_set_model(AMX *amx, cell *params) // esf_set_model(index, const model[]); = 2 args
{
	// Set player a new model
	// params[1] = index
	// params[2] = const model

	// Check index
	CHECK_PLAYER(params[ 1 ]);

	// Fetch player pointer
	edict_t* pPlayer = MF_GetPlayerEdict(params[ 1 ]);

	int length;

	// Setting new model to player [ .. ]
	esfmodels[params[1]-1].szModel = (char*)STRING( ALLOC_STRING( MF_GetAmxString(amx, params[2], 1, &length) ) );
	esfmodels[params[1]-1].bSet = true;

	return 1; 
}
开发者ID:tutyamxx,项目名称:ESFX-Module,代码行数:20,代码来源:esfx.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ALLOC_ZVAL函数代码示例发布时间:2022-05-30
下一篇:
C++ ALLOC_N函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap