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


C++ Q_strcpy函数代码示例

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


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

示例1: get_name_from_addr

			int get_name_from_addr (struct qsockaddr *addr, char *name)
			{
				struct hostent *hostentry;

				hostentry = gethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr, sizeof(struct in_addr), AF_INET);
				if (hostentry)
				{
					Q_strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1);
					return 0;
				}

				Q_strcpy (name, addr_to_string (addr));
				return 0;
			}
开发者ID:st1x51,项目名称:QuartalEngine,代码行数:14,代码来源:network_psp.cpp

示例2: Host_Tell_f

void Host_Tell_f(void)
{
	client_t *client;
	client_t *save;
	int		j;
	char	*p;
	char	text[64];

	if (cmd_source == src_command)
	{
		Cmd_ForwardToServer ();
		return;
	}

	if (Cmd_Argc () < 3)
		return;

	Q_strcpy(text, host_client->name);
	Q_strcat(text, ": ");

	p = Cmd_Args();

// remove quotes if present
	if (*p == '"')
	{
		p++;
		p[Q_strlen(p)-1] = 0;
	}

// check length & truncate if necessary
	j = sizeof(text) - 2 - Q_strlen(text);  // -2 for /n and null terminator
	if (Q_strlen(p) > j)
		p[j] = 0;

	strcat (text, p);
	strcat (text, "\n");

	save = host_client;
	for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++)
	{
		if (!client->active || !client->spawned)
			continue;
		if (Q_strcasecmp(client->name, Cmd_Argv(1)))
			continue;
		host_client = client;
		SV_ClientPrintf("%s", text);
		break;
	}
	host_client = save;
}
开发者ID:gaojunchen,项目名称:android-4.3-1,代码行数:50,代码来源:host_cmd.cpp

示例3: WINS_GetNameFromAddr

int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name)
{
	struct hostent *hostentry;

	hostentry = pgethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr, sizeof(struct in_addr), AF_INET);
	if (hostentry)
	{
		Q_strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1);
		return 0;
	}

	Q_strcpy (name, WINS_AddrToString (addr));
	return 0;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:14,代码来源:net_wins.cpp

示例4: Q_strcpy

void CServerRemoteAccess::GetMapList(CUtlBuffer &value)
{
	const char *findfn;
	char *extension;
	char curDir[MAX_PATH];
	char mapName[MAX_PATH];
	char mapwild[64];

	Q_strcpy(mapwild, "maps/*.bsp");
	for (findfn = Sys_FindFirst(mapwild, 0); findfn; findfn = Sys_FindNext(0))
	{
		Q_snprintf(curDir, ARRAYSIZE(curDir), "maps/%s", findfn);
#ifdef REHLDS_CHECKS
		curDir[ARRAYSIZE(curDir) - 1] = 0;
#endif

		FS_GetLocalPath(curDir, curDir, ARRAYSIZE(curDir));
		if (Q_strstr(curDir, com_gamedir))
		{
#ifdef REHLDS_CHECKS
			Q_strncpy(mapName, findfn, ARRAYSIZE(mapName));
			mapName[ARRAYSIZE(mapName) - 1] = 0;
#else
			Q_strcpy(mapName, findfn);
#endif
			extension = Q_strstr(mapName, ".bsp");
			if (extension)
				*extension = 0;

			value.PutString(mapName);
			value.PutString("\n");
		}
	}
	Sys_FindClose();

	value.PutChar(0);
}
开发者ID:ChunHungLiu,项目名称:rehlds,代码行数:37,代码来源:sv_remoteaccess.cpp

示例5: SendWeaponAnim

/* <25bb65> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:133 */
bool CFlashbang::ShieldSecondaryFire(int iUpAnim, int iDownAnim)
{
	if (!m_pPlayer->HasShield() || m_flStartThrow > 0)
	{
		return false;
	}

	if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
	{
		m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
		SendWeaponAnim(iDownAnim, UseDecrement() != FALSE);

		Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren");

		m_fMaxSpeed = FLASHBANG_MAX_SPEED;
		m_pPlayer->m_bShieldDrawn = false;
	}
	else
	{
		m_iWeaponState |= WPNSTATE_SHIELD_DRAWN;
		SendWeaponAnim(iUpAnim, UseDecrement() != FALSE);

		Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded");

		m_fMaxSpeed = FLASHBANG_MAX_SPEED_SHIELD;
		m_pPlayer->m_bShieldDrawn = true;
	}

	m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN);
	m_pPlayer->ResetMaxSpeed();

	m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
	m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
	m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;

	return true;
}
开发者ID:Arkshine,项目名称:ReGameDLL_CS,代码行数:38,代码来源:wpn_flashbang.cpp

示例6: Cmd_GetCdCommands

/*
=====================================
Cmd_GetCdCommands

Prints or complete CD command name
=====================================
*/
qboolean Cmd_GetCdCommands( const char *s, char *completedname, int length )
{
	int i, numcdcommands;
	string	cdcommands[8];
	string	matchbuf;

	const char *cd_command[] =
	{
	"info",
	"loop",
	"off",
	"on",
	"pause",
	"play",
	"resume",
	"stop",
	};

	// compare CD command list with current keyword
	for( i = 0, numcdcommands = 0; i < 8; i++ )
	{
		if(( *s == '*' ) || !Q_strnicmp( cd_command[i], s, Q_strlen( s )))
			Q_strcpy( cdcommands[numcdcommands++], cd_command[i] );
	}

	if( !numcdcommands ) return false;
	Q_strncpy( matchbuf, cdcommands[0], MAX_STRING );
	if( completedname && length ) Q_strncpy( completedname, matchbuf, length );
	if( numcdcommands == 1 ) return true;

	for( i = 0; i < numcdcommands; i++ )
	{
		Q_strncpy( matchbuf, cdcommands[i], MAX_STRING );
		Msg( "%16s\n", matchbuf );
	}

	Msg( "\n^3 %i commands found.\n", numcdcommands );

	// cut shortestMatch to the amount common with s
	if( completedname && length )
	{
		for( i = 0; matchbuf[i]; i++ )
		{
			if( Q_tolower( completedname[i] ) != Q_tolower( matchbuf[i] ))
				completedname[i] = 0;
		}
	}
	return true;
}
开发者ID:GAMELASTER,项目名称:xash3d,代码行数:56,代码来源:con_utils.c

示例7: Q_strcpy

//---------------------------------------------------------------------------------
// Purpose: Level Loaded
//---------------------------------------------------------------------------------
void	ManiAutoMap::LevelInit(void)
{
	this->ResetTimeout(mani_automap_timer.GetInt());
	ignore_this_map = false;

	if (set_next_map)
	{
		int map_choice = this->ChooseMap();

		Q_strcpy(forced_nextmap, automap_list[map_choice].map_name);
		Q_strcpy(next_map, automap_list[map_choice].map_name);
		mani_nextmap.SetValue(automap_list[map_choice].map_name);
		override_changelevel = MANI_MAX_CHANGELEVEL_TRIES;
		override_setnextmap = true;

		// Make sure end of map vote doesn't try and override it
		gpManiVote->SysSetMapDecided(true);

		set_next_map = false;
		ignore_this_map = true;
		SetChangeLevelReason("Automap set nextmap");
		LogCommand (NULL, "Autochange set nextmap %s while server idle\n", automap_list[map_choice].map_name);
	}
}
开发者ID:imyzcn,项目名称:mani-admin-plugin,代码行数:27,代码来源:mani_automap.cpp

示例8: Q_strcpy

//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------
void CBindPanel::DrawBindingName()
{
	int iconWide = m_iIconTall * m_fWidthScale * m_fScale;

	int x = (iconWide>>1);
	int y = ( m_iIconTall * m_fScale ) * 0.5f;

	if ( !m_bController && !IsConsole() )
	{
		// Draw the caption
		vgui::surface()->DrawSetTextFont( m_hKeysFont );
		int fontTall = vgui::surface()->GetFontTall( m_hKeysFont );

		char szBinding[ 256 ];
		Q_strcpy( szBinding, m_szKey );

		if ( Q_strcmp( szBinding, "SEMICOLON" ) == 0 )
		{
			Q_strcpy( szBinding, ";" );
		}
		else if ( Q_strlen( szBinding ) == 1 && szBinding[ 0 ] >= 'a' && szBinding[ 0 ] <= 'z' )
		{
			// Make single letters uppercase
			szBinding[ 0 ] += ( 'A' - 'a' );
		}

		wchar wszCaption[ 64 ];
		g_pVGuiLocalize->ConstructString( wszCaption, sizeof(wchar)*64, szBinding, NULL );

		int iWidth = GetScreenWidthForCaption( wszCaption, m_hKeysFont );

		// Draw black text
		vgui::surface()->DrawSetTextColor( 0,0,0, 255 );
		vgui::surface()->DrawSetTextPos( x - (iWidth>>1) - 1, y - (fontTall >>1) - 1 );
		vgui::surface()->DrawUnicodeString( wszCaption );
	}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:39,代码来源:vgui_bindpanel.cpp

示例9: CL_InternetServers_f

/*
=================
CL_InternetServers_f
=================
*/
void CL_InternetServers_f( void )
{
	netadr_t	adr;
	char	fullquery[512] = "\x31\xFF" "0.0.0.0:0\0" "\\gamedir\\";

	MsgDev( D_INFO, "Scanning for servers on the internet area...\n" );
	NET_Config( true ); // allow remote

	if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ) )
		MsgDev( D_INFO, "Can't resolve adr: %s\n", MASTERSERVER_ADR );

	Q_strcpy( &fullquery[21], GI->gamedir );

	NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamedir ) + 22, fullquery, adr );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:20,代码来源:cl_main.c

示例10: S_PlayVol

void S_PlayVol(void)
{
	static int hash=543;
	int i;
	float vol;
	char name[256];
	sfx_t	*sfx;
	
	i = 1;
	while (i<Cmd_Argc())
	{
		if (!Q_strrchr(Cmd_Argv(i), '.'))
		{
			Q_strcpy(name, Cmd_Argv(i));
			Q_strcat(name, ".wav");
		}
		else
			Q_strcpy(name, Cmd_Argv(i));
		sfx = S_PrecacheSound(name);
		vol = Q_atof(Cmd_Argv(i+1));
		S_StartSound(hash++, 0, sfx, listener_origin, vol, 1.0);
		i+=2;
	}
}
开发者ID:strelkovsky,项目名称:QuakeRefresh,代码行数:24,代码来源:snd_dma.c

示例11: Q_strlen

void CNodeCallback::RestoreFromKeyValues_Specific( KeyValues *pKV )
{
	const char *cbname = pKV->GetString( "sz_callbackname" );

	if ( Q_strlen( cbname ) )
	{
		delete [] szCallbackName;
		szCallbackName = new char [ Q_strlen( cbname ) + 1 ];
		Q_strcpy( szCallbackName, cbname );
	}

	iNumComponents = pKV->GetInt( "i_numc", iNumComponents );

	UpdateNode();
	OnUpdateHierachy( NULL, NULL );
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:16,代码来源:vnode_callback.cpp

示例12: COM_ExtractFilePath

/*
============
COM_ExtractFilePath
============
*/
void COM_ExtractFilePath( const char *path, char *dest )
{
	const char	*src;
	src = path + Q_strlen( path ) - 1;

	// back up until a \ or the start
	while( src != path && !(*(src - 1) == '\\' || *(src - 1) == '/' ))
		src--;

	if( src != path )
	{
		memcpy( dest, path, src - path );
		dest[src - path - 1] = 0; // cutoff backslash
	}
	else Q_strcpy( dest, "" ); // file without path
}
开发者ID:emileb,项目名称:XashXT,代码行数:21,代码来源:common.cpp

示例13: CL_InternetServers_f

/*
=================
CL_InternetServers_f
=================
*/
void CL_InternetServers_f( void )
{
	netadr_t	adr;
	char	fullquery[512] = MS_SCAN_REQUEST;

	MsgDev( D_INFO, "Scanning for servers on the internet area...\n" );
	NET_Config( true ); // allow remote

	if( !NET_StringToAdr( sv_master->string, &adr ) )
	{
		MsgDev( D_INFO, "Can't resolve adr: %s\n", sv_master->string );
		return;
	}

	NET_SendPacket( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strcpy( fullquery + sizeof( MS_SCAN_REQUEST ) - 1, GI->gamedir ), fullquery, adr );
}
开发者ID:Reedych,项目名称:xash3d,代码行数:21,代码来源:cl_main.c

示例14: Q_strcpy

CGEWebRequest::CGEWebRequest( const char *addr, WEBRQST_CLBK callback /*=NULL*/ )
{	
	m_pAddress = new char[Q_strlen(addr)+1];
	Q_strcpy( m_pAddress, addr );

	m_pError = new char[CURL_ERROR_SIZE+1];
	m_pError[0] = '\0';

	m_bFinished = false;

	m_pCallback = callback;

	// Start the thread
	SetName( "GEWebRequest" );
	Start();
}
开发者ID:Entropy-Soldier,项目名称:ges-legacy-code,代码行数:16,代码来源:ge_webrequest.cpp

示例15: Delta_InitFields

void Delta_InitFields( void )
{
	char		*afile, *pfile;
	string		encodeDll, encodeFunc, token;
	delta_info_t	*dt;

	afile = FS_LoadFile( DELTA_PATH, NULL, false );
	if( !afile )
	{
		static string	errormsg;

		Q_snprintf( errormsg, sizeof( errormsg ), "DELTA_Load: couldn't load file %s\n", DELTA_PATH );
		Sys_Error( errormsg );
	}

	pfile = afile;

	while(( pfile = COM_ParseFile( pfile, token )) != NULL )
	{
		dt = Delta_FindStruct( token );
		if( dt == NULL )
		{
			Sys_Error( "delta.lst: unknown struct %s\n", token );
		}

		pfile = COM_ParseFile( pfile, encodeDll );

		if( !Q_stricmp( encodeDll, "none" ))
			Q_strcpy( encodeFunc, "null" );
		else pfile = COM_ParseFile( pfile, encodeFunc );

		// jump to '{'
		pfile = COM_ParseFile( pfile, token );
		if( token[0] != '{' )
		{
			Sys_Error( "delta.lst: missing '{' in section %s\n", dt->pName );
		}

		Delta_ParseTable( &pfile, dt, encodeDll, encodeFunc );
	}
	Mem_Free( afile );

	// adding some requrid fields fields that user may forget or don't know how to specified
	Delta_AddField( "event_t", "velocity[0]", DT_SIGNED | DT_FLOAT, 16, 8.0f, 1.0f );
	Delta_AddField( "event_t", "velocity[1]", DT_SIGNED | DT_FLOAT, 16, 8.0f, 1.0f );
	Delta_AddField( "event_t", "velocity[2]", DT_SIGNED | DT_FLOAT, 16, 8.0f, 1.0f );
}
开发者ID:Xash3DLinux,项目名称:xash3dlinux,代码行数:47,代码来源:net_encode.c


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