本文整理汇总了C++中Q_strcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_strcpy函数的具体用法?C++ Q_strcpy怎么用?C++ Q_strcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_strcpy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Cvar_RegisterVariable
/* <189df> ../engine/cvar.c:391 */
void EXT_FUNC Cvar_RegisterVariable(cvar_t *variable)
{
char *oldstr;
cvar_t *v, *c;
cvar_t dummyvar;
if (Cvar_FindVar(variable->name))
{
Con_Printf("Can't register variable \"%s\", already defined\n", variable->name);
return;
}
if (Cmd_Exists(variable->name))
{
Con_Printf(__FUNCTION__ ": \"%s\" is a command\n", variable->name);
return;
}
oldstr = variable->string;
// Alloc string, so it will not dissapear on side modules unloading and to maintain the same name during run
variable->string = (char *)Z_Malloc(Q_strlen(variable->string) + 1);
Q_strcpy(variable->string, oldstr);
variable->value = (float)Q_atof(oldstr);
dummyvar.name = " ";
dummyvar.next = cvar_vars;
v = cvar_vars;
c = &dummyvar;
// Insert with alphabetic order
while (v)
{
if (Q_stricmp(v->name, variable->name) > 0)
{
break;
}
c = v;
v = v->next;
}
c->next = variable;
variable->next = v;
cvar_vars = dummyvar.next;
}
开发者ID:Adidasman1,项目名称:rehlds,代码行数:48,代码来源:cvar.cpp
示例17: Cmd_GetTexturemodes
/*
=====================================
Cmd_GetTexturemodes
Prints or complete sound filename
=====================================
*/
qboolean Cmd_GetTexturemodes( const char *s, char *completedname, int length )
{
int i, numtexturemodes;
string texturemodes[6]; // keep an actual ( sizeof( gl_texturemode) / sizeof( gl_texturemode[0] ))
string matchbuf;
const char *gl_texturemode[] =
{
"GL_LINEAR",
"GL_LINEAR_MIPMAP_LINEAR",
"GL_LINEAR_MIPMAP_NEAREST",
"GL_NEAREST",
"GL_NEAREST_MIPMAP_LINEAR",
"GL_NEAREST_MIPMAP_NEAREST",
};
// compare gamelist with current keyword
for( i = 0, numtexturemodes = 0; i < 6; i++ )
{
if(( *s == '*' ) || !Q_strnicmp( gl_texturemode[i], s, Q_strlen( s )))
Q_strcpy( texturemodes[numtexturemodes++], gl_texturemode[i] );
}
if( !numtexturemodes ) return false;
Q_strncpy( matchbuf, gl_texturemode[0], MAX_STRING );
if( completedname && length ) Q_strncpy( completedname, matchbuf, length );
if( numtexturemodes == 1 ) return true;
for( i = 0; i < numtexturemodes; i++ )
{
Q_strncpy( matchbuf, texturemodes[i], MAX_STRING );
Msg( "%16s\n", matchbuf );
}
Msg( "\n^3 %i filters found.\n", numtexturemodes );
// 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:ShaunNoWay,项目名称:xash3d,代码行数:54,代码来源:con_utils.c
示例18: Q_strcpy
sfxcache_t *S_LoadSound (sfx_t *s)
{
char namebuffer[512];
byte *data;
wavinfo_t info;
int len;
float stepscale;
sfxcache_t *sc;
byte stackbuf[1*1024]; // avoid dirtying the cache heap
// see if still in memory
sc = (sfxcache_t*)Cache_Check(&s->cache);
if(sc)
return sc;
// load it in
Q_strcpy(namebuffer,Global.cSoundPath);
Q_strcat(namebuffer,s->name);
data = COM_LoadStackFile(namebuffer, stackbuf, sizeof(stackbuf));
if (!data)
{
Con_Warning("Couldn't load %s\n", namebuffer);
return NULL;
}
info = GetWavinfo (s->name, data, com_filesize);
stepscale = (float)info.rate / shm->speed;
len = info.samples / stepscale;
len = len * info.width * info.channels;
sc = (sfxcache_t*)Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name);
if (!sc)
return NULL;
sc->length = info.samples;
sc->loopstart = info.loopstart;
sc->speed = info.rate;
sc->width = info.width;
sc->stereo = info.channels;
ResampleSfx (s, sc->speed, sc->width, data + info.dataofs);
return sc;
}
开发者ID:Acidburn0zzz,项目名称:KatanaEngine,代码行数:47,代码来源:engine_audiomem.c
示例19: Movie_Start_f
void Movie_Start_f (void)
{
char name[MAX_OSPATH], path[256]; //qb: jqavi was MAX_FILELENGTH
int i;
if (Cmd_Argc() != 2) //qb: autogenerate file name if none is given.
{
Q_strcpy(name,"qbs8_000.avi"); //qb: screenshots dir
for (i=0 ; i<=999 ; i++)
{
name[5] = i/100 + '0';
name[6] = (i/10)%10 + '0';
name[7] = i%10 + '0';
sprintf (path, "%s/%s/%s", com_gamedir, "screenshots", name);
if (Sys_FileTime(path) == -1)
break; // file doesn't exist
}
if (i==1000)
{
Con_Printf ("Movie_Start_f: Too many AVI files in directory.\n");
return;
}
}
else
{
Q_strncpyz (name, Cmd_Argv(1), sizeof(name));
COM_ForceExtension (name, ".avi");
}
hack_ctr = capture_hack.value;
Q_snprintfz (path, sizeof(path), "%s/%s/%s", com_gamedir, "screenshots", name);
if (!(moviefile = fopen(path, "wb")))
{
COM_CreatePath (path);
if (!(moviefile = fopen(path, "wb")))
{
Con_Printf ("ERROR: Couldn't open %s\n", name);
return;
}
}
movie_is_capturing = Capture_Open (path);
if (movie_is_capturing)
Con_DPrintf("Capturing video %s\n", path); //qb: is printed on the vid, so only in debug mode.
else
Con_Printf("Movie_Start_f: Movie capture open failed.\n");
}
开发者ID:dommul,项目名称:super8,代码行数:47,代码来源:movie.c
示例20: Q_strcpy
unsigned short CCountedStringPool::ReferenceStringHandle( const char* pIntrinsic )
{
if( pIntrinsic == NULL )
return INVALID_ELEMENT;
unsigned short nHashBucketIndex = (HashStringCaseless( pIntrinsic ) % HASH_TABLE_SIZE);
unsigned short nCurrentBucket = m_HashTable[ nHashBucketIndex ];
// Does the bucket already exist?
if( nCurrentBucket != INVALID_ELEMENT )
{
for( ; nCurrentBucket != INVALID_ELEMENT ; nCurrentBucket = m_Elements[nCurrentBucket].nNextElement )
{
if( !Q_stricmp( pIntrinsic, m_Elements[nCurrentBucket].pString ) )
{
// Anyone who hits 65k references is permanant
if( m_Elements[nCurrentBucket].nReferenceCount < MAX_REFERENCE )
{
m_Elements[nCurrentBucket].nReferenceCount ++ ;
}
return nCurrentBucket;
}
}
}
if( m_FreeListStart != INVALID_ELEMENT )
{
nCurrentBucket = m_FreeListStart;
m_FreeListStart = m_Elements[nCurrentBucket].nNextElement;
}
else
{
nCurrentBucket = m_Elements.AddToTail();
}
m_Elements[nCurrentBucket].nReferenceCount = 1;
// Insert at the beginning of the bucket:
m_Elements[nCurrentBucket].nNextElement = m_HashTable[ nHashBucketIndex ];
m_HashTable[ nHashBucketIndex ] = nCurrentBucket;
m_Elements[nCurrentBucket].pString = new char[Q_strlen( pIntrinsic ) + 1];
Q_strcpy( m_Elements[nCurrentBucket].pString, pIntrinsic );
return nCurrentBucket;
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:46,代码来源:stringpool.cpp
注:本文中的Q_strcpy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论