本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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 );
}
示例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 );
}
示例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;
}
}
示例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 );
}
示例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
}
示例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 );
}
示例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();
}
示例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 );
}