本文整理汇总了C++中Q_strncatz函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_strncatz函数的具体用法?C++ Q_strncatz怎么用?C++ Q_strncatz使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_strncatz函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CG_AddPrint_Cmd_f
/*
* CG_AddPrint_Cmd_f
*/
static void CG_AddPrint_Cmd_f( void ) {
cg_subtitle_t *sub;
sub = CG_Democam_RegisterSubtitle();
if( !sub ) {
CG_Printf( "DemoCam Error: Failed to allocate the subtitle\n" );
return;
}
if( trap_Cmd_Argc() > 1 ) {
char str[MAX_STRING_CHARS]; // one line of the console can't handle more than this
int i;
str[0] = 0;
for( i = 1; i < trap_Cmd_Argc(); i++ ) {
Q_strncatz( str, trap_Cmd_Argv( i ), sizeof( str ) );
if( i < trap_Cmd_Argc() - 1 ) {
Q_strncatz( str, " ", sizeof( str ) );
}
}
sub->text = CG_CopyString( str );
} else {
sub->text = CG_CopyString( "" );
}
sub->highprint = true;
}
开发者ID:Picmip,项目名称:qfusion,代码行数:31,代码来源:cg_democams.cpp
示例2: _printplayerlist
void _printplayerlist (edict_t * self, char *buf,
qboolean (*markthis) (edict_t * self, edict_t * other))
{
int count = 0, i;
edict_t *other;
char dummy, tmpbuf[32];
Q_strncatz (buf, " # Name\n", MAX_STRING_CHARS);
Q_strncatz (buf, "------------------------------------\n", MAX_STRING_CHARS);
for (i = 1; i <= game.maxclients; i++)
{
other = &g_edicts[i];
if (other->client && other != self && other->inuse)
{
if (markthis (self, other) == true)
dummy = '*';
else
dummy = ' ';
sprintf (tmpbuf, "%2i %c%s\n", i, dummy, other->client->pers.netname);
count++;
Q_strncatz (buf, tmpbuf, MAX_STRING_CHARS);
}
}
if (!count)
Q_strncatz (buf, "None\n", MAX_STRING_CHARS);
Q_strncatz (buf, "\n", MAX_STRING_CHARS);
}
开发者ID:hifi-unmaintained,项目名称:aq2-tng-old,代码行数:28,代码来源:a_vote.c
示例3: Cmd_Say_f
/*
* Cmd_Say_f
*/
void Cmd_Say_f( edict_t *ent, bool arg0, bool checkflood )
{
char *p;
char text[2048];
size_t arg0len = 0;
#ifdef AUTHED_SAY
if( sv_mm_enable->integer && ent->r.client && ent->r.client->mm_session <= 0 )
{
// unauthed players are only allowed to chat to public at non play-time
if( GS_MatchState() == MATCH_STATE_PLAYTIME )
{
G_PrintMsg( ent, "%s", S_COLOR_YELLOW "You must authenticate to be able to communicate to other players during the match.\n");
return;
}
}
#endif
if( checkflood )
{
if( CheckFlood( ent, false ) )
return;
}
if( ent->r.client && ( ent->r.client->muted & 1 ) )
return;
if( trap_Cmd_Argc() < 2 && !arg0 )
return;
text[0] = 0;
if( arg0 )
{
Q_strncatz( text, trap_Cmd_Argv( 0 ), sizeof( text ) );
Q_strncatz( text, " ", sizeof( text ) );
arg0len = strlen( text );
Q_strncatz( text, trap_Cmd_Args(), sizeof( text ) );
}
else
{
p = trap_Cmd_Args();
if( *p == '"' )
{
if( p[strlen( p )-1] == '"' )
p[strlen( p )-1] = 0;
p++;
}
Q_strncatz( text, p, sizeof( text ) );
}
// don't let text be too long for malicious reasons
text[arg0len + (MAX_CHAT_BYTES - 1)] = 0;
if( !Q_stricmp( text, "gg" ) || !Q_stricmp( text, "good game" ) )
G_AwardFairPlay( ent );
G_ChatMsg( NULL, ent, false, "%s", text );
}
开发者ID:DenMSC,项目名称:qfusion,代码行数:63,代码来源:g_cmds.cpp
示例4: _printplayerlist
void _printplayerlist (edict_t * self, char *buf,
qboolean (*markthis) (edict_t * self, edict_t * other))
{
int count = 0, i;
edict_t *other;
char dummy, tmpbuf[32];
Q_strncatz (buf, " # Name\n", MAX_STRING_CHARS);
Q_strncatz (buf, "------------------------------------\n", MAX_STRING_CHARS);
for (i = 0, other = g_edicts + 1; i < game.maxclients; i++, other++)
{
if (!other->inuse || !other->client || other->client->pers.mvdspec)
continue;
if (other == self)
continue;
if (markthis (self, other) == true)
dummy = '*';
else
dummy = ' ';
sprintf (tmpbuf, "%2i %c%s\n", i, dummy, other->client->pers.netname);
count++;
Q_strncatz (buf, tmpbuf, MAX_STRING_CHARS);
}
if (!count)
Q_strncatz (buf, "None\n", MAX_STRING_CHARS);
Q_strncatz (buf, "\n", MAX_STRING_CHARS);
}
开发者ID:Raptor007,项目名称:aq2-tng,代码行数:30,代码来源:a_vote.c
示例5: _Cmd_Rules_f
void _Cmd_Rules_f (edict_t * self, char *argument)
{
char section[32], mbuf[1024], *p, buf[30][INI_STR_LEN];
int i, j = 0;
ini_t ini;
strcpy (mbuf, "\n");
if (*argument)
Q_strncpyz(section, argument, sizeof(section));
else
strcpy (section, "main");
if (OpenIniFile (GAMEVERSION "/prules.ini", &ini))
{
i = ReadIniSection (&ini, section, buf, 30);
while (j < i)
{
p = buf[j++];
if (*p == '.')
p++;
Q_strncatz(mbuf, p, sizeof(mbuf));
Q_strncatz(mbuf, "\n", sizeof(mbuf));
}
CloseIniFile (&ini);
}
if (!j)
gi.cprintf (self, PRINT_MEDIUM, "No rules on %s available\n", section);
else
gi.cprintf (self, PRINT_MEDIUM, "%s", mbuf);
}
开发者ID:DusteDdk,项目名称:aq2-tng-bk,代码行数:30,代码来源:a_xcmds.c
示例6: Cmd_Teamname_f
void Cmd_Teamname_f(edict_t * ent)
{
int i, argc, teamNum;
char temp[32];
team_t *team;
if (!matchmode->value) {
gi.cprintf(ent, PRINT_HIGH, "This command needs matchmode to be enabled\n");
return;
}
if(ctf->value) {
gi.cprintf(ent, PRINT_HIGH, "You can't change teamnames in ctf mode\n");
return;
}
teamNum = ent->client->resp.team;
if (teamNum == NOTEAM) {
gi.cprintf( ent, PRINT_HIGH, "You need to be on a team for that...\n" );
return;
}
team = &teams[teamNum];
if (team->captain != ent) {
gi.cprintf( ent, PRINT_HIGH, "You need to be a captain for that\n" );
return;
}
if (team->ready) {
gi.cprintf( ent, PRINT_HIGH, "You can't use this while 'ready'\n" );
return;
}
if (team_round_going || team_game_going) {
gi.cprintf(ent, PRINT_HIGH, "You can't use this while playing\n");
return;
}
argc = gi.argc();
if (argc < 2) {
gi.cprintf( ent, PRINT_HIGH, "Your team name is %s\n", team->name );
return;
}
Q_strncpyz(temp, gi.argv(1), sizeof(temp));
for (i = 2; i <= argc; i++) {
Q_strncatz(temp, " ", sizeof(temp));
Q_strncatz(temp, gi.argv(i), sizeof(temp));
}
temp[18] = 0;
if (!temp[0])
strcpy( temp, "noname" );
gi.dprintf("%s (team %i) is now known as %s\n", team->name, teamNum, temp);
IRC_printf(IRC_T_GAME, "%n (team %i) is now known as %n", team->name, teamNum, temp);
strcpy(team->name, temp);
gi.cprintf(ent, PRINT_HIGH, "New team name: %s\n", team->name);
}
开发者ID:Maniac-,项目名称:aq2-tng,代码行数:60,代码来源:a_match.c
示例7: G_Teams_Invite_f
/*
* G_Teams_Invite_f
*/
void G_Teams_Invite_f( edict_t *ent )
{
char *text;
edict_t *toinvite;
int team;
if( ( !ent->r.inuse || !ent->r.client ) )
return;
text = trap_Cmd_Argv( 1 );
if( !text || !strlen( text ) )
{
int i;
edict_t *e;
char msg[1024];
msg[0] = 0;
Q_strncatz( msg, "Usage: invite <player>\n", sizeof( msg ) );
Q_strncatz( msg, "- List of current players:\n", sizeof( msg ) );
for( i = 0, e = game.edicts+1; i < gs.maxclients; i++, e++ )
{
if( !e->r.inuse )
continue;
Q_strncatz( msg, va( "%3i: %s\n", PLAYERNUM( e ), e->r.client->netname ), sizeof( msg ) );
}
G_PrintMsg( ent, "%s", msg );
return;
}
team = ent->s.team;
if( !G_Teams_TeamIsLocked( team ) )
{
G_PrintMsg( ent, "Your team is not locked.\n" );
return;
}
toinvite = G_PlayerForText( text );
if( !toinvite )
{
G_PrintMsg( ent, "No such player.\n" );
return;
}
if( G_Teams_PlayerIsInvited( team, toinvite ) )
{
G_PrintMsg( ent, "%s%s is already invited to your team.\n", toinvite->r.client->netname, S_COLOR_WHITE );
return;
}
G_Teams_InvitePlayer( team, toinvite );
G_PrintMsg( NULL, "%s%s invited %s%s to team %s%s.\n", ent->r.client->netname, S_COLOR_WHITE,
toinvite->r.client->netname, S_COLOR_WHITE, GS_TeamName( team ), S_COLOR_WHITE );
}
开发者ID:tenght,项目名称:qfusion,代码行数:63,代码来源:g_gameteams.cpp
示例8: GetLastKilledTarget
void GetLastKilledTarget (edict_t * self, char *buf)
{
int kills, i;
kills = ReadKilledPlayers (self);
if (!kills) {
strcpy (buf, "nobody");
return;
}
strcpy (buf, self->client->resp.last_killed_target[0]->client->pers.netname);
for (i = 1; i < kills; i++)
{
if (i == kills - 1)
Q_strncatz(buf, " and ", PARSE_BUFSIZE);
else
Q_strncatz(buf, ", ", PARSE_BUFSIZE);
Q_strncatz(buf, self->client->resp.last_killed_target[i]->client->
pers.netname, PARSE_BUFSIZE);
}
ResetKills (self);
}
开发者ID:DusteDdk,项目名称:aq2-tng-bk,代码行数:26,代码来源:a_xgame.c
示例9: CopyServerTitle
void CopyServerTitle(char *buf, int size, const serverStatus_t *status)
{
char map[64], *s;
int clients, len, mlen, i, maxLen;
s = Info_ValueForKey(status->infostring, "hostname");
Q_strncpyz(buf, s, size);
s = Info_ValueForKey(status->infostring, "mapname");
clients = atoi(Info_ValueForKey(status->infostring, "maxclients"));
Com_sprintf(map, sizeof(map), " %-10s %2i/%2i", s, status->numPlayers, clients );
len = strlen(buf);
mlen = strlen(map);
maxLen = min(titleMax, size);
if(len + mlen > maxLen) {
if(maxLen < mlen-3)
buf[0] = 0;
else
buf[maxLen-mlen-3] = 0;
Q_strncatz(buf, "...", size);
}
else
{
for(i = len; i < maxLen-mlen; i++)
buf[i] = ' ';
buf[i] = 0;
}
Q_strncatz(buf, map, size);
}
开发者ID:q3aql,项目名称:quake2,代码行数:33,代码来源:ui_joinserver.c
示例10: StartServerActionFunc
static void StartServerActionFunc( menucommon_t *unused )
{
char *str;
char mapname[MAX_CONFIGSTRING_CHARS];
char starservercmd[MAX_STRING_CHARS];
m_listitem_t *mapitem;
mapitem = UI_FindItemInScrollListWithId( &mapList, mapList_cur_idx );
if( !mapitem || !mapitem->name )
return;
trap_Cvar_Set( "g_gametype", startserver_gametype_names[m_gametype] );
trap_Cvar_SetValue( "sv_skilllevel", m_skill );
trap_Cvar_SetValue( "sv_cheats", m_cheats );
trap_Cvar_SetValue( "sv_public", m_public );
str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_hostname" ) );
if( str ) trap_Cvar_Set( "sv_hostname", str );
str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_maxplayers" ) );
if( str ) trap_Cvar_Set( "sv_maxclients", str );
// game stuff, overriding local gametype config
starservercmd[0] = '\0';
Q_strncatz( starservercmd, va( "g_instagib %i;", m_instagib ), sizeof( starservercmd ) );
trap_Cvar_SetValue( "g_instagib", (float)m_instagib );
str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_timelimit" ) );
if( str )
{
Q_strncatz( starservercmd, va( "g_timelimit %s;", str ), sizeof( starservercmd ) );
trap_Cvar_Set( "g_timelimit", str );
}
str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_scorelimit" ) );
if( str )
{
Q_strncatz( starservercmd, va( "g_scorelimit %s;", str ), sizeof( starservercmd ) );
trap_Cvar_Set( "g_scorelimit", str );
}
str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_numbots" ) );
if( str )
{
Q_strncatz( starservercmd, va( "g_numbots %s;", str ), sizeof( starservercmd ) );
trap_Cvar_Set( "g_numbots", str );
}
trap_Cvar_ForceSet( "ui_startservercmd", starservercmd );
if( uis.serverState )
trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" );
if( trap_ML_GetMapByNum( (int)((size_t)mapitem->data), mapname, sizeof( mapname ) ) )
trap_Cvar_ForceSet( "ui_startserver_lastselectedmap", mapname );
trap_Cmd_ExecuteText( EXEC_APPEND, va( "map \"%s\"\n", mapitem->name ) );
}
开发者ID:Racenet,项目名称:racesow,代码行数:58,代码来源:ui_startserver.c
示例11: MapsList_ChooseMap
static void MapsList_ChooseMap( menucommon_t *menuitem )
{
char path[MAX_CONFIGSTRING_CHARS + 6]; // wsw: Medar: could do this in not so ugly way
m_listitem_t *item;
menucommon_t *mapitem;
char mapinfo[MAX_CONFIGSTRING_CHARS];
const char *mapname, *fullname;
int id = ( menuitem ? menuitem->localdata[1] : mapList_cur_idx );
mapitem = UI_MenuItemByName( "m_startserver_map" );
if( mapitem )
Q_strncpyz( mapitem->title, "initial map", sizeof( mapitem->title ) );
mapList_suggested_gametype = 0;
item = UI_FindItemInScrollListWithId( &mapList, id );
if( item && item->name )
{
if( !trap_ML_GetMapByNum( (int)((size_t)item->data), mapinfo, sizeof( mapinfo ) ) )
return;
mapname = mapinfo;
fullname = mapinfo + strlen( mapname ) + 1;
if( menuitem )
{
mapList_cur_idx = id;
trap_Cvar_ForceSet( "ui_startserver_lastselectedmap", "" );
}
if( mapitem )
{
Q_strncatz( mapitem->title, ": " S_COLOR_WHITE, sizeof( mapitem->title ) );
if( !trap_Cvar_Value( "ui_maplist_sortmethod" ) )
Q_strncatz( mapitem->title, mapname, sizeof( mapitem->title ) );
else
Q_strncatz( mapitem->title, *fullname ? fullname : mapname, sizeof( mapitem->title ) );
}
#ifdef SUGGEST_MAP_GAMETYPE
mapList_suggested_gametype = SuggestGameType( mapname );
// if( m_gametypes_item )
// {
// m_gametypes_item->curvalue = mapList_suggested_gametype;
// M_GametypeFunc( m_gametypes_item );
// }
#endif
Q_snprintfz( path, sizeof( path ), "levelshots/%s.jpg", mapname );
s_levelshot = trap_R_RegisterLevelshot( path, trap_R_RegisterPic( PATH_UKNOWN_MAP_PIC ), NULL );
}
}
开发者ID:Racenet,项目名称:racesow,代码行数:51,代码来源:ui_startserver.c
示例12: Q_snprintfz
char *G_Gametype_GENERIC_ScoreboardMessage( void )
{
char entry[MAX_TOKEN_CHARS];
size_t len;
int i;
edict_t *e;
int carrierIcon;
*scoreboardString = 0;
len = 0;
Q_snprintfz( entry, sizeof(entry), "&t %i 0 0 ", TEAM_PLAYERS );
if( SCOREBOARD_MSG_MAXSIZE - len > strlen( entry ) )
{
Q_strncatz( scoreboardString, entry, sizeof( scoreboardString ) );
len = strlen( scoreboardString );
}
// players
for( i = 0; i < teamlist[TEAM_PLAYERS].numplayers; i++ )
{
e = game.edicts + teamlist[TEAM_PLAYERS].playerIndices[i];
if( e->s.effects & EF_CARRIER )
carrierIcon = trap_ImageIndex( ( e->s.team == TEAM_BETA ) ? PATH_ALPHAFLAG_ICON : PATH_BETAFLAG_ICON );
else if( e->s.effects & EF_QUAD )
carrierIcon = trap_ImageIndex( PATH_QUAD_ICON );
else if( e->s.effects & EF_SHELL )
carrierIcon = trap_ImageIndex( PATH_SHELL_ICON );
else if( e->s.effects & EF_REGEN )
carrierIcon = trap_ImageIndex( PATH_REGEN_ICON );
else
carrierIcon = 0;
Q_snprintfz( entry, sizeof( entry ), "&p %i %i %i %i %i ",
PLAYERNUM( e ),
e->r.client->level.stats.score,
e->r.client->r.ping > 999 ? 999 : e->r.client->r.ping,
carrierIcon,
( level.ready[PLAYERNUM( e )] || GS_MatchState() >= MATCH_STATE_PLAYTIME ) ? trap_ImageIndex( PATH_VSAY_YES_ICON ) : 0
);
if( SCOREBOARD_MSG_MAXSIZE - len > strlen( entry ) )
{
Q_strncatz( scoreboardString, entry, sizeof( scoreboardString ) );
len = strlen( scoreboardString );
}
}
return scoreboardString;
}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:51,代码来源:g_gametypes.cpp
示例13: TV_Cmd_Spectators_f
/*
* TV_Cmd_Spectators_f
*/
static void TV_Cmd_Spectators_f( client_t *client )
{
int i;
int count = 0;
int start = 0;
char line[64];
char msg[1024];
client_t *cl;
relay_t *relay = client->relay;
int maxclients = tv_maxclients->integer;
if( Cmd_Argc() > 1 )
start = atoi( Cmd_Argv( 1 ) );
clamp( start, 0, maxclients - 1 );
// print information
msg[0] = 0;
for( i = start; i < maxclients; i++ )
{
cl = &tvs.clients[i];
if( cl->state >= CS_SPAWNED )
{
if( cl->relay != client->relay )
continue;
Q_snprintfz( line, sizeof( line ), "%s%s%s\n", count ? " " : "", S_COLOR_WHITE, cl->name );
if( strlen( line ) + strlen( msg ) > sizeof( msg ) - 100 )
{
// can't print all of them in one packet
Q_strncatz( msg, " ...\n", sizeof( msg ) );
break;
}
if( !count )
Q_strncatz( msg, "---------------\n", sizeof( msg ) );
Q_strncatz( msg, line, sizeof( msg ) );
count++;
}
}
if( count )
Q_strncatz( msg, "---------------\n", sizeof( msg ) );
Q_strncatz( msg, va( "%i %s\n", count, Cmd_Argv( 0 ) ), sizeof( msg ) );
TV_Downstream_Msg( client, relay, NULL, false, "%s", msg );
if( i < maxclients )
TV_Downstream_Msg( client, relay, NULL, false, "Type '%s %i' for more %s\n", Cmd_Argv( 0 ), i, Cmd_Argv( 0 ) );
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:53,代码来源:tv_downstream_clcmd.c
示例14: Cmd_Say_f
/*
* Cmd_Say_f
*/
void Cmd_Say_f( edict_t *ent, qboolean arg0, qboolean checkflood )
{
char *p;
char text[2048];
if( checkflood )
{
if( CheckFlood( ent, qfalse ) )
return;
}
if( ent->r.client && ent->r.client->muted & 1 )
return;
if( trap_Cmd_Argc() < 2 && !arg0 )
return;
text[0] = 0;
if( arg0 )
{
Q_strncatz( text, trap_Cmd_Argv( 0 ), sizeof( text ) );
Q_strncatz( text, " ", sizeof( text ) );
Q_strncatz( text, trap_Cmd_Args(), sizeof( text ) );
}
else
{
p = trap_Cmd_Args();
if( *p == '"' )
{
if( p[strlen( p )-1] == '"' )
p[strlen( p )-1] = 0;
p++;
}
Q_strncatz( text, p, sizeof( text ) );
}
// don't let text be too long for malicious reasons
if( strlen( text ) > 150 )
text[150] = 0;
G_ChatMsg( NULL, ent, qfalse, "%s", text );
// racesow
RS_ircSendMessage( va( "%s", COM_RemoveColorTokens(( ent->r.client->netname ) )),
va( "%s", COM_RemoveColorTokens(( text)) ) );
// !racesow
}
开发者ID:j0ki,项目名称:racesow,代码行数:52,代码来源:g_cmds.c
示例15: xMenu_New
qboolean
xMenu_New (edict_t * ent, char *title, char *subtitle,
void (*DoAddMenu) (edict_t * ent, int fromix))
{
if (!DoAddMenu)
return false;
if (!X_MENU)
{
//no menu yet, allocate memory for it...
X_MENU = gi.TagMalloc (sizeof (xmenu_t), TAG_GAME);
if (!X_MENU)
{
gi.dprintf ("Error allocating xmenu space\n");
return false;
}
}
X_MENU->DoAddMenu = DoAddMenu;
X_MENU->xmenucount = 2;
X_MENU->xmenutop = 0;
//memset(xmenuentries, 0, sizeof(xmenuentries));
strcpy (X_MENU->xmenuentries[0].name, "*");
if (title)
Q_strncatz(X_MENU->xmenuentries[0].name, title, XMENU_TITLE_MAX);
else
Q_strncatz(X_MENU->xmenuentries[0].name, "Menu", XMENU_TITLE_MAX);
if (subtitle)
Q_strncpyz(X_MENU->xmenuentries[1].name, subtitle, XMENU_TITLE_MAX);
else
Q_strncpyz(X_MENU->xmenuentries[1].name, "make your choice", XMENU_TITLE_MAX);
X_MENU->xmenuentries[0].SelectFunc = NULL;
X_MENU->xmenuentries[1].SelectFunc = NULL;
DoAddMenu (ent, 0);
if (X_MENU->xmenucount > 2)
{
xMenu_Set (ent);
if (ent->client->menu)
PMenu_Close (ent);
PMenu_Open (ent, X_MENU->themenu, 5, XMENU_END_ENTRY);
return true;
}
return false;
}
开发者ID:DusteDdk,项目名称:aq2-tng-bk,代码行数:48,代码来源:a_xmenu.c
示例16: decoder_register
static void decoder_register( snd_decoder_t *decoder )
{
decoder->next = decoders;
decoders = decoder;
if( extensionlist_size - strlen( extensionlist ) - 1 < strlen( decoder->ext ) + 1 )
{
char *oldlist = extensionlist;
extensionlist_size = max( extensionlist_size * 2, (int)( strlen( extensionlist ) + strlen( decoder->ext ) + 1 + 1 ) );
extensionlist = S_Malloc( extensionlist_size );
Q_strncpyz( extensionlist, oldlist, extensionlist_size );
S_Free( oldlist );
}
Q_strncatz( extensionlist, " ", extensionlist_size );
Q_strncatz( extensionlist, decoder->ext, extensionlist_size );
}
开发者ID:codetwister,项目名称:qfusion,代码行数:16,代码来源:snd_decoder.c
示例17: SV_Download_f
/*
* SV_Download_f
* Download command issued from server
*/
static void SV_Download_f( void )
{
qboolean success;
char *s;
char url[MAX_STRING_CHARS], filepath[MAX_QPATH], writepath[MAX_QPATH];
if( Cmd_Argc() != 2 )
{
Com_Printf( "Usage: %s <url>\n", Cmd_Argv( 0 ) );
Com_Printf( "Downloads .pk3 or .pak from URL to gamedir and adds it to the server\n" );
Com_Printf( "Note, server will not function properly while downloading\n" );
return;
}
s = Cmd_Argv( 1 );
if( !Com_GlobMatch( "*://*", s, qfalse ) )
Q_strncpyz( url, "http://", sizeof( url ) );
else
url[0] = 0;
Q_strncatz( url, s, sizeof( url ) );
s = strrchr( url, '/' );
if( !s )
{
Com_Printf( "%s: invalid URL\n", Cmd_Argv( 0 ) );
return;
}
Q_strncpyz( filepath, va( "%s/%s", FS_GameDirectory(), s + 1 ), sizeof( filepath ) );
Q_strncpyz( writepath, va( "%s.tmp", filepath ), sizeof( writepath ) );
if( !FS_CheckPakExtension( writepath ) )
{
Com_Printf( "Missing or invalid archive extension. Only download of pack files is supported\n" );
return;
}
Com_Printf( "download url: %s\n", url );
webDownloadPercentPrint = 0;
success = Web_Get( url, NULL, writepath, qtrue, 60 * 30, 60, SV_WebDownloadProgress, qfalse );
if( !success )
{
Com_Printf( "Server web download failed\n" );
return;
}
if( !FS_MoveBaseFile( writepath, filepath ) )
{
Com_Printf( "Couldn't rename the downloaded file. Download failed\n" );
return;
}
Com_Printf( "Download successful\n" );
// update the map list, which also does a filesystem rescan
ML_Update();
}
开发者ID:Racenet,项目名称:racesow,代码行数:64,代码来源:sv_ccmds.c
示例18: assert
/*
* CL_SetSoundExtension
*/
static char *CL_SetSoundExtension( const char *name )
{
unsigned int i;
char *finalname;
size_t finalname_size, maxlen;
const char *extension;
assert( name );
if( COM_FileExtension( name ) )
return TempCopyString( name );
maxlen = 0;
for( i = 0; i < NUM_SOUND_EXTENSIONS; i++ )
{
if( strlen( SOUND_EXTENSIONS[i] ) > maxlen )
maxlen = strlen( SOUND_EXTENSIONS[i] );
}
finalname_size = strlen( name ) + maxlen + 1;
finalname = Mem_TempMalloc( finalname_size );
Q_strncpyz( finalname, name, finalname_size );
extension = FS_FirstExtension( finalname, SOUND_EXTENSIONS, NUM_SOUND_EXTENSIONS );
if( extension )
Q_strncatz( finalname, extension, finalname_size );
// if not found, we just pass it without the extension
return finalname;
}
开发者ID:Kaperstone,项目名称:warsow,代码行数:33,代码来源:cl_sound.c
示例19: SV_ConSay_f
/*
==================
SV_ConSay_f
==================
*/
void SV_ConSay_f(void)
{
client_t *client;
int j;
char *p;
char text[1024];
if (Cmd_Argc () < 2)
return;
// strncpy (text, "console: ");
Q_strncpyz (text, "console: ", sizeof(text));
p = Cmd_Args();
if (*p == '"')
{
p++;
p[strlen(p)-1] = 0;
}
// strncat(text, p);
Q_strncatz(text, p, sizeof(text));
for (j = 0, client = svs.clients; j < maxclients->value; j++, client++)
{
if (client->state != cs_spawned)
continue;
SV_ClientPrintf(client, PRINT_CHAT, "%s\n", text);
}
}
开发者ID:Kiln707,项目名称:KMQuake2,代码行数:35,代码来源:sv_ccmds.c
示例20: Cmd_Kicklist_f
void Cmd_Kicklist_f(edict_t *ent)
{
char buf[MAX_STRING_CHARS], tbuf[256];
if (!use_kickvote->value) {
gi.cprintf(ent, PRINT_HIGH, "Kick voting is disabled.\n");
return;
}
strcpy(buf, "Available players to kick:\n\n");
_printplayerlist(ent, buf, _vkMarkThis);
// adding vote settings
Com_sprintf (tbuf, sizeof(tbuf), "Vote rules: %i client%s min. (currently %i),\n" \
"%.1f%% must have voted overall (currently %.1f%%)\n" \
"and %.1f%% on the same (currently %.1f%% on %s),\n" \
"kicked players %s be temporarily banned.\n\n",
(int) (kickvote_min->value),
(kickvote_min->value == 1) ? "" : "s",
_numclients(),
kickvote_need->value, Allkickvotes,
kickvote_pass->value, Mostkickpercent,
Mostkickvotes == NULL ? "nobody" : Mostkickvotes->client->pers.netname,
kickvote_tempban ? "will" : "won't");
// double percent sign! cprintf will process them as format strings.
Q_strncatz(buf, tbuf, sizeof(buf));
gi.cprintf(ent, PRINT_MEDIUM, "%s", buf);
}
开发者ID:Raptor007,项目名称:aq2-tng,代码行数:29,代码来源:a_vote.c
注:本文中的Q_strncatz函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论