这篇教程C++ Cvar_VariableString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Cvar_VariableString函数的典型用法代码示例。如果您正苦于以下问题:C++ Cvar_VariableString函数的具体用法?C++ Cvar_VariableString怎么用?C++ Cvar_VariableString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Cvar_VariableString函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Sys_RetrieveDLLstatic HINSTANCE Sys_RetrieveDLL( const char *gamename ){ char *basepath = Cvar_VariableString( "fs_basepath" ); char *homepath = Cvar_VariableString( "fs_homepath" ); char *cdpath = Cvar_VariableString( "fs_cdpath" ); char *gamedir = Cvar_VariableString( "fs_game" ); // Try basepath/fs_game char *fn = FS_BuildOSPath( basepath, gamedir, gamename ); HINSTANCE retVal = LoadLibrary( fn ); if(retVal) goto successful; if( homepath[0] ) { // Try homepath/fs_game fn = FS_BuildOSPath( homepath, gamedir, gamename ); retVal = LoadLibrary( fn ); if(retVal) goto successful; } if( cdpath[0] ) { // Try cdpath/fs_game fn = FS_BuildOSPath( cdpath, gamedir, gamename ); retVal = LoadLibrary( fn ); if(retVal) goto successful; } // Try base folder if mod is loaded but not found if (gamedir[0] ) { // Try basepath/base fn = FS_BuildOSPath( basepath, OPENJKGAME, gamename ); retVal = LoadLibrary( fn ); if(retVal) goto successful; if( homepath[0] ) { // Try homepath/base fn = FS_BuildOSPath( homepath, OPENJKGAME, gamename ); retVal = LoadLibrary( fn ); if(retVal) goto successful; } if( cdpath[0] ) { // Try cdpath/fs_game fn = FS_BuildOSPath( cdpath, OPENJKGAME, gamename ); retVal = LoadLibrary( fn ); if(retVal) goto successful; } } // Try basepath fn = va( "%s/%s", basepath, gamename ); retVal = LoadLibrary( fn ); if(retVal) goto successful; if( homepath[0] ) { // Try homepath fn = va( "%s/%s", homepath, gamename ); retVal = LoadLibrary( fn ); if(retVal) goto successful; } if( cdpath[0] ) { // Try cdpath/fs_game fn = va( "%s/%s", cdpath, gamename ); retVal = LoadLibrary( fn ); if(retVal) goto successful; }#ifdef _DEBUG // Try exepath (cwd) fn = NULL; retVal = LoadLibrary( gamename ); if(retVal) goto successful;#endifsuccessful: Com_DPrintf("LoadLibrary (%s)/n", fn?fn:gamename); return retVal;}
开发者ID:Keldonas,项目名称:OpenJK,代码行数:88,
示例2: SV_ServerRecord_f/*==============SV_ServerRecord_fBegins server demo recording. Every entity and every message will berecorded, but no playerinfo will be stored. Primarily for demo merging.==============*/void SV_ServerRecord_f (void){ char name[MAX_OSPATH]; byte buf_data[32768]; sizebuf_t buf; int len; int i; if (Cmd_Argc() != 2) { Com_Printf ("serverrecord <demoname>/n"); return; } if (svs.demofile) { Com_Printf ("Already recording./n"); return; } if (sv.state != ss_game) { Com_Printf ("You must be in a level to record./n"); return; } // // open the demo file // Com_sprintf (name, sizeof(name), "%s/demos/%s.dm2", FS_Gamedir(), Cmd_Argv(1)); Com_Printf ("recording to %s./n", name); FS_CreatePath (name); svs.demofile = fopen (name, "wb"); if (!svs.demofile) { Com_Printf ("ERROR: couldn't open./n"); return; } // setup a buffer to catch all multicasts SZ_Init (&svs.demo_multicast, svs.demo_multicast_buf, sizeof(svs.demo_multicast_buf)); // // write a single giant fake message with all the startup info // SZ_Init (&buf, buf_data, sizeof(buf_data)); // // serverdata needs to go over for all types of servers // to make sure the protocol is right, and to set the gamedir // // send the serverdata MSG_WriteByte (&buf, svc_serverdata); MSG_WriteLong (&buf, PROTOCOL_VERSION); MSG_WriteLong (&buf, svs.spawncount); // 2 means server demo MSG_WriteByte (&buf, 2); // demos are always attract loops MSG_WriteString (&buf, Cvar_VariableString ("gamedir")); MSG_WriteShort (&buf, -1); // send full levelname MSG_WriteString (&buf, sv.configstrings[CS_NAME]); for (i=0 ; i<MAX_CONFIGSTRINGS ; i++) if (sv.configstrings[i][0]) { MSG_WriteByte (&buf, svc_configstring); MSG_WriteShort (&buf, i); MSG_WriteString (&buf, sv.configstrings[i]); } // write it to the demo file Com_DPrintf ("signon message length: %i/n", buf.cursize); len = LittleLong (buf.cursize); fwrite (&len, 4, 1, svs.demofile); fwrite (buf.data, buf.cursize, 1, svs.demofile); // the rest of the demo file will be individual frames}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:87,
示例3: SVD_StartDemoFile/*Start a server-side demo.This does it all, create the file and adjust the demo-relatedstuff in client_t.This is mostly ripped from sv_client.c/SV_SendClientGameStateand cl_main.c/CL_Record_f.*/static void SVD_StartDemoFile(client_t *client, const char *path) { int i, len; entityState_t *base, nullstate; msg_t msg; byte buffer[MAX_MSGLEN]; fileHandle_t file;#ifdef USE_DEMO_FORMAT_42 char *s; int v, size;#endif Com_DPrintf("SVD_StartDemoFile/n"); assert(!client->demo_recording); // create the demo file and write the necessary header file = FS_FOpenFileWrite(path); assert(file != 0); /* File_write_header_demo // ADD this fx */ /* HOLBLIN entete demo */ #ifdef USE_DEMO_FORMAT_42 //@Barbatos: get the mod version from the server s = Cvar_VariableString("g_modversion"); size = strlen(s); len = LittleLong(size); FS_Write(&len, 4, file); FS_Write(s, size, file); v = LittleLong(DEMO_VERSION); FS_Write (&v, 4, file); len = 0; len = LittleLong(len); FS_Write(&len, 4, file); FS_Write(&len, 4, file); #endif /* END HOLBLIN entete demo */ MSG_Init(&msg, buffer, sizeof(buffer)); MSG_Bitstream(&msg); // XXX server code doesn't do this, client code does MSG_WriteLong(&msg, client->lastClientCommand); // TODO: or is it client->reliableSequence? MSG_WriteByte(&msg, svc_gamestate); MSG_WriteLong(&msg, client->reliableSequence); for (i = 0; i < MAX_CONFIGSTRINGS; i++) { if (sv.configstrings[i][0]) { MSG_WriteByte(&msg, svc_configstring); MSG_WriteShort(&msg, i); MSG_WriteBigString(&msg, sv.configstrings[i]); } } Com_Memset(&nullstate, 0, sizeof(nullstate)); for (i = 0 ; i < MAX_GENTITIES; i++) { base = &sv.svEntities[i].baseline; if (!base->number) { continue; } MSG_WriteByte(&msg, svc_baseline); MSG_WriteDeltaEntity(&msg, &nullstate, base, qtrue); } MSG_WriteByte(&msg, svc_EOF); MSG_WriteLong(&msg, client - svs.clients); MSG_WriteLong(&msg, sv.checksumFeed); MSG_WriteByte(&msg, svc_EOF); // XXX server code doesn't do this, SV_Netchan_Transmit adds it! len = LittleLong(client->netchan.outgoingSequence - 1); FS_Write(&len, 4, file); len = LittleLong (msg.cursize); FS_Write(&len, 4, file); FS_Write(msg.data, msg.cursize, file); #ifdef USE_DEMO_FORMAT_42 // add size of packet in the end for backward play /* holblin */ FS_Write(&len, 4, file); #endif FS_Flush(file); // adjust client_t to reflect demo started client->demo_recording = qtrue; client->demo_file = file; client->demo_waiting = qtrue; client->demo_backoff = 1; client->demo_deltas = 0;}
开发者ID:CoolOppo,项目名称:ioq3-for-UrbanTerror-4,代码行数:99,
示例4: CL_SystemInfoChanged//.........这里部分代码省略.........==================*/void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s, *t; char key[BIG_INFO_KEY]; char value[BIG_INFO_VALUE]; qboolean gameSet; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; // NOTE TTimo: // when the serverId changes, any further messages we send to the server will use this new serverId // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=475 // in some cases, outdated cp commands might get sent with this news serverId cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); // don't set any vars when playing a demo if ( clc.demoplaying ) { return; }#ifdef USE_VOIP#ifdef LEGACY_PROTOCOL if(clc.compat) clc.voipEnabled = qfalse; else#endif { s = Info_ValueForKey( systemInfo, "sv_voip" ); if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER || Cvar_VariableValue("ui_singlePlayerActive")) clc.voipEnabled = qfalse; else clc.voipEnabled = atoi(s); }#endif s = Info_ValueForKey( systemInfo, "sv_cheats" ); cl_connectedToCheatServer = atoi( s ); if ( !cl_connectedToCheatServer ) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey( systemInfo, "sv_paks" ); t = Info_ValueForKey( systemInfo, "sv_pakNames" ); FS_PureServerSetLoadedPaks( s, t ); s = Info_ValueForKey( systemInfo, "sv_referencedPaks" ); t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" ); FS_PureServerSetReferencedPaks( s, t ); gameSet = qfalse; // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { int cvar_flags; Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } // ehw! if (!Q_stricmp(key, "fs_game")) { if(FS_CheckDirTraversal(value)) { Com_Printf(S_COLOR_YELLOW "WARNING: Server sent invalid fs_game value %s/n", value); continue; } gameSet = qtrue; } if((cvar_flags = Cvar_Flags(key)) == CVAR_NONEXISTENT) Cvar_Get(key, value, CVAR_SERVER_CREATED | CVAR_ROM); else { // If this cvar may not be modified by a server discard the value. if(!(cvar_flags & (CVAR_SYSTEMINFO | CVAR_SERVER_CREATED | CVAR_USER_CREATED))) {//#ifndef STANDALONE if(Q_stricmp(key, "g_synchronousClients") && Q_stricmp(key, "pmove_fixed") && Q_stricmp(key, "pmove_msec"))//#endif { Com_Printf(S_COLOR_YELLOW "WARNING: server is not allowed to set %s=%s/n", key, value); continue; } } Cvar_SetSafe(key, value); } } // if game folder should not be set and it is set at the client side if ( !gameSet && *Cvar_VariableString("fs_game") ) { Cvar_Set( "fs_game", "" ); } cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" );}
开发者ID:Lrns123,项目名称:jkaq3,代码行数:101,
示例5: CL_ParseDownload/** * @brief A download message has been received from the server */void CL_ParseDownload(msg_t *msg){ int size; unsigned char data[MAX_MSGLEN]; int block; if (!*cls.download.downloadTempName) { Com_Printf("Server sending download, but no download was requested/n"); CL_AddReliableCommand("stopdl"); return; } // read the data block = MSG_ReadShort(msg); // unfortunately DLTYPE_WWW is -1 FIXME: change this someday! //if (block < 0) //{ //Com_Error(ERR_DROP, "CL_ParseDownload: Server sending invalid download data"); //} // www dl, if we haven't acknowledged the download redirect yet if (block == DLTYPE_WWW) { if (!cls.download.bWWWDl) { // server is sending us a www download Q_strncpyz(cls.download.originalDownloadName, cls.download.downloadName, sizeof(cls.download.originalDownloadName)); Q_strncpyz(cls.download.downloadName, MSG_ReadString(msg), sizeof(cls.download.downloadName)); cls.download.downloadSize = MSG_ReadLong(msg); cls.download.downloadFlags = MSG_ReadLong(msg); if (cls.download.downloadFlags & (1 << DL_FLAG_URL)) { Sys_OpenURL(cls.download.downloadName, qtrue); Cbuf_ExecuteText(EXEC_APPEND, "quit/n"); CL_AddReliableCommand("wwwdl bbl8r"); // not sure if that's the right msg cls.download.bWWWDlAborting = qtrue; return; } Cvar_SetValue("cl_downloadSize", cls.download.downloadSize); Com_DPrintf("Server redirected download: %s/n", cls.download.downloadName); cls.download.bWWWDl = qtrue; // activate wwwdl client loop CL_AddReliableCommand("wwwdl ack"); // make sure the server is not trying to redirect us again on a bad checksum if (strstr(cls.download.badChecksumList, va("@%s", cls.download.originalDownloadName))) { Com_Printf("refusing redirect to %s by server (bad checksum)/n", cls.download.downloadName); CL_AddReliableCommand("wwwdl fail"); cls.download.bWWWDlAborting = qtrue; return; } // make downloadTempName an OS path Q_strncpyz(cls.download.downloadTempName, FS_BuildOSPath(Cvar_VariableString("fs_homepath"), cls.download.downloadTempName, ""), sizeof(cls.download.downloadTempName)); cls.download.downloadTempName[strlen(cls.download.downloadTempName) - 1] = '/0'; if (!DL_BeginDownload(cls.download.downloadTempName, cls.download.downloadName)) { // setting bWWWDl to false after sending the wwwdl fail doesn't work // not sure why, but I suspect we have to eat all remaining block -1 that the server has sent us // still leave a flag so that CL_WWWDownload is inactive // we count on server sending us a gamestate to start up clean again CL_AddReliableCommand("wwwdl fail"); cls.download.bWWWDlAborting = qtrue; Com_Printf("Failed to initialize download for '%s'/n", cls.download.downloadName); } // Check for a disconnected download // we'll let the server disconnect us when it gets the bbl8r message if (cls.download.downloadFlags & (1 << DL_FLAG_DISCON)) { CL_AddReliableCommand("wwwdl bbl8r"); cls.download.bWWWDlDisconnected = qtrue; } return; } else { // server keeps sending that message till we acknowledge it, eat and ignore //MSG_ReadLong( msg ); MSG_ReadString(msg); MSG_ReadLong(msg); MSG_ReadLong(msg); return; } } if (!block) { // block zero is special, contains file size cls.download.downloadSize = MSG_ReadLong(msg); Cvar_SetValue("cl_downloadSize", cls.download.downloadSize); if (cls.download.downloadSize < 0) { Com_Error(ERR_DROP, "%s", MSG_ReadString(msg)); return; }//.........这里部分代码省略.........
开发者ID:dstaesse,项目名称:etlegacy,代码行数:101,
示例6: Win_PrintCvarMatches/*==============Win_PrintCvarMatchesydnar: to display cvar values==============*/static void Win_PrintCvarMatches( const char *s ) { if ( !Q_stricmpn( s, win_currentMatch, win_acLength ) ) { Sys_Print( va( " ^9%s = ^5%s^0/n", s, Cvar_VariableString( s ) ) ); }}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:12,
示例7: SV_MapRestart_f/*================SV_MapRestart_fCompletely restarts a level, but doesn't send a new gamestate to the clients.This allows fair starts with variable load times.================*/static void SV_MapRestart_f( void ) { int i; client_t *client; char *denied; qboolean isBot; int delay = 0; gamestate_t new_gs, old_gs; // NERVE - SMF int worldspawnflags; // DHM - Nerve int nextgt; // DHM - Nerve sharedEntity_t *world; // make sure we aren't restarting twice in the same frame if ( com_frameTime == sv.serverId ) { return; } // make sure server is running if ( !com_sv_running->integer ) { Com_Printf( "Server is not running./n" ); return; } if ( sv.restartTime ) { return; } // DHM - Nerve :: Check for invalid gametype sv_gametype = Cvar_Get( "g_gametype", "5", CVAR_SERVERINFO | CVAR_LATCH ); nextgt = sv_gametype->integer; world = SV_GentityNum( ENTITYNUM_WORLD ); worldspawnflags = world->r.worldflags; if ( ( nextgt == GT_WOLF && ( worldspawnflags & 1 ) ) || ( nextgt == GT_WOLF_STOPWATCH && ( worldspawnflags & 2 ) ) || ( ( nextgt == GT_WOLF_CP || nextgt == GT_WOLF_CPH ) && ( worldspawnflags & 4 ) ) ) { if ( !( worldspawnflags & 1 ) ) { Cvar_Set( "g_gametype", "5" ); } else { Cvar_Set( "g_gametype", "7" ); } sv_gametype = Cvar_Get( "g_gametype", "5", CVAR_SERVERINFO | CVAR_LATCH ); } // dhm if ( Cmd_Argc() > 1 ) { delay = atoi( Cmd_Argv( 1 ) ); } if ( delay ) { sv.restartTime = svs.time + delay * 1000; SV_SetConfigstring( CS_WARMUP, va( "%i", sv.restartTime ) ); return; } // NERVE - SMF - read in gamestate or just default to GS_PLAYING old_gs = atoi( Cvar_VariableString( "gamestate" ) ); if ( Cmd_Argc() > 2 ) { new_gs = atoi( Cmd_Argv( 2 ) ); } else { new_gs = GS_PLAYING; } if ( !SV_TransitionGameState( new_gs, old_gs, delay ) ) { return; } // check for changes in variables that can't just be restarted // check for maxclients change if ( sv_maxclients->modified ) { char mapname[MAX_QPATH]; Com_Printf( "sv_maxclients variable change -- restarting./n" ); // restart the map the slow way Q_strncpyz( mapname, Cvar_VariableString( "mapname" ), sizeof( mapname ) ); SV_SpawnServer( mapname, qfalse ); return; } // toggle the server bit so clients can detect that a // map_restart has happened svs.snapFlagServerBit ^= SNAPFLAG_SERVERCOUNT; // generate a new serverid // TTimo - don't update restartedserverId there, otherwise we won't deal correctly with multiple map_restart sv.serverId = com_frameTime; Cvar_Set( "sv_serverid", va( "%i", sv.serverId ) );//.........这里部分代码省略.........
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:101,
示例8: Cvar_VariableStringconst char *FS_ReferencedUpdateName() { char *fs_game = Cvar_VariableString("fs_game"); if(!*fs_game) fs_game = "main"; return va("%s/%s", fs_game, CL_UPDATE_PAK_BASENAME);}
开发者ID:EndlessClan,项目名称:CoDExtended,代码行数:6,
示例9: SVC_Info/*================SVC_InfoResponds with a short info message that should be enough to determineif a user is interested in a server to do a full status================*/void SVC_Info( netadr_t from ) { int i, count; char *gamedir; char infostring[MAX_INFO_STRING]; char *antilag; // DHM - Nerve#ifdef UPDATE_SERVER return;#endif // ignore if we are in single player if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER ) { return; } // don't count privateclients count = 0; for ( i = sv_privateClients->integer ; i < sv_maxclients->integer ; i++ ) { if ( svs.clients[i].state >= CS_CONNECTED ) { count++; } } infostring[0] = 0; // echo back the parameter to status. so servers can use it as a challenge // to prevent timed spoofed reply packets that add ghost servers Info_SetValueForKey( infostring, "challenge", Cmd_Argv( 1 ) ); Info_SetValueForKey( infostring, "protocol", va( "%i", PROTOCOL_VERSION ) ); Info_SetValueForKey( infostring, "hostname", sv_hostname->string ); Info_SetValueForKey( infostring, "mapname", sv_mapname->string ); Info_SetValueForKey( infostring, "clients", va( "%i", count ) ); Info_SetValueForKey( infostring, "sv_maxclients", va( "%i", sv_maxclients->integer - sv_privateClients->integer ) ); Info_SetValueForKey( infostring, "gametype", va( "%i", sv_gametype->integer ) ); Info_SetValueForKey( infostring, "pure", va( "%i", sv_pure->integer ) ); if ( sv_minPing->integer ) { Info_SetValueForKey( infostring, "minPing", va( "%i", sv_minPing->integer ) ); } if ( sv_maxPing->integer ) { Info_SetValueForKey( infostring, "maxPing", va( "%i", sv_maxPing->integer ) ); } gamedir = Cvar_VariableString( "fs_game" ); if ( *gamedir ) { Info_SetValueForKey( infostring, "game", gamedir ); } Info_SetValueForKey( infostring, "sv_allowAnonymous", va( "%i", sv_allowAnonymous->integer ) ); // Rafael gameskill Info_SetValueForKey( infostring, "gameskill", va( "%i", sv_gameskill->integer ) ); // done Info_SetValueForKey( infostring, "friendlyFire", va( "%i", sv_friendlyFire->integer ) ); // NERVE - SMF Info_SetValueForKey( infostring, "maxlives", va( "%i", sv_maxlives->integer ? 1 : 0 ) ); // NERVE - SMF Info_SetValueForKey( infostring, "tourney", va( "%i", sv_tourney->integer ) ); // NERVE - SMF Info_SetValueForKey( infostring, "gamename", GAMENAME_STRING ); // Arnout: to be able to filter out Quake servers // TTimo antilag = Cvar_VariableString( "g_antilag" ); if ( antilag ) { Info_SetValueForKey( infostring, "g_antilag", antilag ); } NET_OutOfBandPrint( NS_SERVER, from, "infoResponse/n%s", infostring );}
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:76,
示例10: Cmd_CleanHomepath_f/** * @brief Recursively removes files matching a given pattern from homepath. * * Useful for removing incomplete downloads and other garbage. * Files listed in the com_cleanWhitelist cvar are protected from deletion. * Additionally, executable and configuration files are protected unless 'force' * argument is passed to this command. */void Cmd_CleanHomepath_f(void){ int i, j, patternFiles = 0, delFiles = 0, totalFiles = 0; char path[MAX_OSPATH]; qboolean force = qfalse, pretend = qfalse; // *.so and *.dll are denied per default in FS_Remove but throw a Com_Error() -> game aborts const char whitelist[] = ".txt .cfg .dat .gm .way .so .dll"; if (Cmd_Argc() < 3) { // files in fs_homepath are downloaded again when required - but better print a warning for inexperienced users Com_Printf("usage: clean [force | pretend] [modname / all] [pattern 1] [pattern n]/n" "example: clean all *tmp */zzz* etmain/etkey/n" "Warning: This command deletes files in fs_homepath. If you are not sure how to use this command do not play with fire!/n"); return; } // if home- and basepath are same better don't start to clean ... if (FS_IsSamePath(Cvar_VariableString("fs_homepath"), Cvar_VariableString("fs_basepath"))) { Com_Printf("Invalid configuration to run clean cmd - 'fs_homepath' and 'fs_basepath' are equal./n"); return; } // avoid unreferenced pk3 runtime issues (not on HD but still referenced in game)#ifndef DEDICATED if (cls.state != CA_DISCONNECTED) { Com_Printf("You are connected to a server - enter '/disconnect' to run '/clean'./n"); return; }#else if (com_sv_running && com_sv_running->integer) { Com_Printf("Server is running - enter '/killserver' to run '/clean'./n"); return; }#endif // DEDICATED Cvar_VariableStringBuffer("fs_homepath", path, sizeof(path)); // if there are any command options, they must be at the very beginning for (i = 1; i < Cmd_Argc(); i++) { if (!Q_stricmp(Cmd_Argv(i), "force") || !Q_stricmp(Cmd_Argv(i), "f")) { force = qtrue; continue; } if (!Q_stricmp(Cmd_Argv(i), "pretend") || !Q_stricmp(Cmd_Argv(i), "p")) { pretend = qtrue; continue; } break; } // if the first argument is "all" or "*", search the whole homepath if (Q_stricmp(Cmd_Argv(i), "all") && Q_stricmp(Cmd_Argv(i), "*")) { Q_strcat(path, sizeof(path), va("%c%s", PATH_SEP, Cmd_Argv(i))); // check if it points to a valid directory if (FS_OSStatFile(path) != 1) { Com_Printf("Cannot commence cleaning, because /"%s/" is not a valid directory under fs_homepath (%s)/n", Cmd_Argv(i), path); return; } } for (i++; i < Cmd_Argc(); i++) { char **pFiles = NULL; pFiles = Sys_ListFiles(path, NULL, Cmd_Argv(i), &patternFiles, qtrue); Com_Printf("Found %i files matching the pattern /"%s/" under %s/n", patternFiles, Cmd_Argv(i), path); for (j = 0; j < patternFiles; j++) { char *tokens; char tmp_whitelist[MAX_OSPATH]; qboolean whitelisted = qfalse; totalFiles++; Q_strncpyz(tmp_whitelist, (force ? Cvar_VariableString("com_cleanwhitelist") : va("%s %s", Cvar_VariableString("com_cleanwhitelist"), whitelist)), sizeof(tmp_whitelist)); // Check if this file is in the whitelist//.........这里部分代码省略.........
开发者ID:caytan,项目名称:etlegacy,代码行数:101,
示例11: Key_Console//.........这里部分代码省略......... if (key == K_TAB) { if(keydown[K_CTRL]) // append to the cvar its value { int cvar_len, cvar_str_len, chars_to_move; char k; char cvar[MAX_INPUTLINE]; const char *cvar_str; // go to the start of the variable while(--key_linepos) { k = key_line[key_linepos]; if(k == '/"' || k == ';' || k == ' ' || k == '/'') break; } key_linepos++; // save the variable name in cvar for(cvar_len=0; (k = key_line[key_linepos + cvar_len]) != 0; cvar_len++) { if(k == '/"' || k == ';' || k == ' ' || k == '/'') break; cvar[cvar_len] = k; } if (cvar_len==0) return; cvar[cvar_len] = 0; // go to the end of the cvar key_linepos += cvar_len; // save the content of the variable in cvar_str cvar_str = Cvar_VariableString(cvar); cvar_str_len = strlen(cvar_str); if (cvar_str_len==0) return; // insert space and cvar_str in key_line chars_to_move = strlen(&key_line[key_linepos]); if (key_linepos + 1 + cvar_str_len + chars_to_move < MAX_INPUTLINE) { if (chars_to_move) memmove(&key_line[key_linepos + 1 + cvar_str_len], &key_line[key_linepos], chars_to_move); key_line[key_linepos++] = ' '; memcpy(&key_line[key_linepos], cvar_str, cvar_str_len); key_linepos += cvar_str_len; key_line[key_linepos + chars_to_move] = 0; } else Con_Printf("Couldn't append cvar value, edit line too long./n"); return; } // Enhanced command completion // by EvilTypeGuy [email C++ Cvar_VariableValue函数代码示例 C++ Cvar_VariableIntegerValue函数代码示例
|