本文整理汇总了C++中Cvar_InfoString函数的典型用法代码示例。如果您正苦于以下问题:C++ Cvar_InfoString函数的具体用法?C++ Cvar_InfoString怎么用?C++ Cvar_InfoString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Cvar_InfoString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SV_Serverinfo_f
/*
===========
SV_Serverinfo_f
Examine the serverinfo string
===========
*/
static void SV_Serverinfo_f( void ) {
Com_Printf ("Server info settings:\n");
Info_Print ( Cvar_InfoString( CVAR_SERVERINFO ) );
if ( !com_sv_running->integer ) {
Com_Printf( "Server is not running.\n" );
}
}
示例2: CL_Clientinfo_f
/*
==============
CL_Clientinfo_f
==============
*/
void CL_Clientinfo_f( void ) {
Com_Printf( "--------- Client Information ---------\n" );
Com_Printf( "state: %i\n", cls.state );
Com_Printf( "Server: %s\n", cls.servername );
Com_Printf ("User info settings:\n");
Info_Print( Cvar_InfoString( CVAR_USERINFO ) );
Com_Printf( "--------------------------------------\n" );
}
示例3: SV_GetServerinfo
/*
===============
SV_GetServerinfo
===============
*/
void SV_GetServerinfo( char* buffer, int bufferSize )
{
if ( bufferSize < 1 )
{
Com_Error( ERR_DROP, "SV_GetServerinfo: bufferSize == %i", bufferSize );
}
Q_strncpyz( buffer, Cvar_InfoString( CVAR_SERVERINFO ), bufferSize );
}
示例4: SVC_Status
void SVC_Status( netadr_t* from ) {
char player[1024];
char status[MAX_MSGLEN];
int i;
client_t *cl;
int/*playerState_t*/ *ps;
int statusLength;
int playerLength;
char infostring[MAX_INFO_STRING];
int custom_mod = 0;
char *fs_game = Cvar_VariableString("fs_game");
if(fs_game && *fs_game)
custom_mod = 1;
challenge_t* challenge;
if ( !SV_VerifyChallenge( Cmd_Argv( 1 ) ) ) {
return;
}
strcpy( infostring, Cvar_InfoString( 4 )); //1.5 uses 8196
Info_SetValueForKey( infostring, "challenge", Cmd_Argv( 1 ) );
status[0] = 0;
statusLength = 0;
for ( i = 0 ; i < sv_maxclients->integer ; i++ ) {
cl = getclient(i);
if ( cl->state >= CS_CONNECTED ) {
//ps = SV_GameClientNum( i );
Com_sprintf( player, sizeof( player ), "%i %i \"%s\"\n",
SV_GetClientScore(cl), cl->ping, cl->name );
playerLength = strlen( player );
if ( statusLength + playerLength >= sizeof( status ) ) {
break; // can't hold any more
}
strcpy( status + statusLength, player );
statusLength += playerLength;
}
}
#if CODPATCH == 5
if(sv_disableClientConsole->integer)
Info_SetValueForKey(infostring, "con_disabled", va("%i", sv_disableClientConsole->integer));
#endif
char *g_password = Cvar_VariableString("g_password");
Info_SetValueForKey(infostring, "pswrd", va("%i", (g_password && *g_password) ? 1 : 0));
Info_SetValueForKey(infostring, "mod", va("%i", custom_mod));
NET_OutOfBandPrint( NS_SERVER, *from, "statusResponse\n%s\n%s", infostring, status );
}
示例5: SVC_Status
/*
================
SVC_Status
Responds with all the info that qplug or qspy can see about the server
and all connected players. Used for getting detailed information after
the simple info query.
================
*/
void SVC_Status( netadr_t from ) {
char player[1024];
char status[MAX_MSGLEN];
int i;
client_t *cl;
playerState_t *ps;
int statusLength;
int playerLength;
char infostring[MAX_INFO_STRING];
// ignore if we are in single player
if ( Cvar_VariableValue( "g_gametype" ) == GT_SINGLE_PLAYER ) {
return;
}
// DHM - Nerve
#ifdef UPDATE_SERVER
return;
#endif
strcpy( infostring, Cvar_InfoString( CVAR_SERVERINFO ) );
// echo back the parameter to status. so master servers can use it as a challenge
// to prevent timed spoofed reply packets that add ghost servers
Info_SetValueForKey( infostring, "challenge", Cmd_Argv( 1 ) );
// add "demo" to the sv_keywords if restricted
if ( Cvar_VariableValue( "fs_restrict" ) ) {
char keywords[MAX_INFO_STRING];
Com_sprintf( keywords, sizeof( keywords ), "demo %s",
Info_ValueForKey( infostring, "sv_keywords" ) );
Info_SetValueForKey( infostring, "sv_keywords", keywords );
}
status[0] = 0;
statusLength = 0;
for ( i = 0 ; i < sv_maxclients->integer ; i++ ) {
cl = &svs.clients[i];
if ( cl->state >= CS_CONNECTED ) {
ps = SV_GameClientNum( i );
Com_sprintf( player, sizeof( player ), "%i %i \"%s\"\n",
ps->persistant[PERS_SCORE], cl->ping, cl->name );
playerLength = strlen( player );
if ( statusLength + playerLength >= sizeof( status ) ) {
break; // can't hold any more
}
strcpy( status + statusLength, player );
statusLength += playerLength;
}
}
NET_OutOfBandPrint( NS_SERVER, from, "statusResponse\n%s\n%s", infostring, status );
}
示例6: CL_CheckUserinfo
/*
==================
CL_CheckUserinfo
==================
*/
void CL_CheckUserinfo( void ) {
if ( cls.state < CA_CHALLENGING ) {
return;
}
// send a reliable userinfo update if needed
if ( cvar_modifiedFlags & CVAR_USERINFO ) {
cvar_modifiedFlags &= ~CVAR_USERINFO;
CL_AddReliableCommand( va("userinfo \"%s\"", Cvar_InfoString( CVAR_USERINFO ) ) );
}
}
示例7: SV_Systeminfo_f
/*
===========
SV_Systeminfo_f
Examine the systeminfo string
===========
*/
static void SV_Systeminfo_f( void )
{
// make sure server is running
if ( !com_sv_running->integer )
{
Com_Printf(_( "Server is not running.\n" ));
return;
}
Com_Printf(_( "System info settings:\n" ));
Info_Print( Cvar_InfoString( CVAR_SYSTEMINFO | CVAR_SERVERINFO_NOUPDATE, qfalse ) );
}
示例8: Tracker_requestWeaponStats
/**
* @brief Request weapon stats data from mod
*/
void Tracker_requestWeaponStats(void)
{
int i;
qboolean onlybots = qtrue;
char *P;
if (!maprunning)
{
return;
}
strcpy(infostring, Cvar_InfoString(CVAR_SERVERINFO | CVAR_SERVERINFO_NOUPDATE));
P = Info_ValueForKey(infostring, "P");
strcpy(expect, "ws");
for (i = 0; i < sv_maxclients->value; i++)
{
if (svs.clients[i].state == CS_ACTIVE)
{
if (svs.clients[i].netchan.remoteAddress.type != NA_BOT)
{
onlybots = qfalse;
querycl = i;
}
expectnum++;
}
}
if (expectnum > 0)
{
Tracker_Send("wsc %i", expectnum);
for (i = 0; i < sv_maxclients->value; i++)
{
if (svs.clients[i].state == CS_ACTIVE)
{
// send basic data is client is spectator
if (P[i] == '3' || (svs.clients[i].netchan.remoteAddress.type == NA_BOT && onlybots))
{
Tracker_Send("ws %i 0 0 0\\%s", i, Tracker_createClientInfo(i));
}
}
}
if (querycl >= 0)
{
SV_ExecuteClientCommand(&svs.clients[querycl], "statsall", qtrue, qfalse);
}
}
}
示例9: SVC_Status
/*
================
SVC_Status
Responds with all the info that qplug or qspy can see about the server
and all connected players. Used for getting detailed information after
the simple info query.
================
*/
void SVC_Status( netadr_t from, const Cmd::Args& args )
{
char player[ 1024 ];
char status[ MAX_MSGLEN ];
int i;
client_t *cl;
playerState_t *ps;
int statusLength;
int playerLength;
char infostring[ MAX_INFO_STRING ];
//bani - bugtraq 12534
if ( args.Argc() > 1 && !SV_VerifyChallenge( args.Argv(1).c_str() ) )
{
return;
}
Q_strncpyz( infostring, Cvar_InfoString( CVAR_SERVERINFO, false ), MAX_INFO_STRING );
if ( args.Argc() > 1 )
{
// echo back the parameter to status. so master servers can use it as a challenge
// to prevent timed spoofed reply packets that add ghost servers
Info_SetValueForKey( infostring, "challenge", args.Argv(1).c_str(), false );
}
status[ 0 ] = 0;
statusLength = 0;
for ( i = 0; i < sv_maxclients->integer; i++ )
{
cl = &svs.clients[ i ];
if ( cl->state >= CS_CONNECTED )
{
ps = SV_GameClientNum( i );
Com_sprintf( player, sizeof( player ), "%i %i \"%s\"\n", ps->persistant[ PERS_SCORE ], cl->ping, cl->name );
playerLength = strlen( player );
if ( statusLength + playerLength >= (int) sizeof( status ) )
{
break; // can't hold any more
}
strcpy( status + statusLength, player );
statusLength += playerLength;
}
}
NET_OutOfBandPrint( NS_SERVER, from, "statusResponse\n%s\n%s", infostring, status );
}
示例10: CL_CheckForResend
/*
=================
CL_CheckForResend
Resend a connect message if the last one has timed out
=================
*/
void CL_CheckForResend( void ) {
int port;
char info[MAX_INFO_STRING];
// if ( cls.state == CA_CINEMATIC )
if ( cls.state == CA_CINEMATIC || CL_IsRunningInGameCinematic())
{
return;
}
// resend if we haven't gotten a reply yet
if ( cls.state < CA_CONNECTING || cls.state > CA_CHALLENGING ) {
return;
}
if ( cls.realtime - clc.connectTime < RETRANSMIT_TIMEOUT ) {
return;
}
clc.connectTime = cls.realtime; // for retransmit requests
clc.connectPacketCount++;
// requesting a challenge
switch ( cls.state ) {
case CA_CONNECTING:
UI_UpdateConnectionString( va("(%i)", clc.connectPacketCount ) );
NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "getchallenge");
break;
case CA_CHALLENGING:
// sending back the challenge
port = Cvar_VariableIntegerValue("qport");
UI_UpdateConnectionString( va("(%i)", clc.connectPacketCount ) );
Q_strncpyz( info, Cvar_InfoString( CVAR_USERINFO ), sizeof( info ) );
Info_SetValueForKey( info, "protocol", va("%i", PROTOCOL_VERSION ) );
Info_SetValueForKey( info, "qport", va("%i", port ) );
Info_SetValueForKey( info, "challenge", va("%i", clc.challenge ) );
NET_OutOfBandPrint( NS_CLIENT, clc.serverAddress, "connect \"%s\"", info );
// the most current userinfo has been sent, so watch for any
// newer changes to userinfo variables
cvar_modifiedFlags &= ~CVAR_USERINFO;
break;
default:
Com_Error( ERR_FATAL, "CL_CheckForResend: bad cls.state" );
}
}
示例11: SVC_Status
/*
================
SVC_Status
Responds with all the info that qplug or qspy can see about the server
and all connected players. Used for getting detailed information after
the simple info query.
================
*/
void SVC_Status( netadr_t from ) {
char player[1024];
char status[MAX_MSGLEN];
int i;
client_t *cl;
int statusLength;
int playerLength;
int score;
char infostring[MAX_INFO_STRING];
strcpy( infostring, Cvar_InfoString( CVAR_SERVERINFO ) );
// 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) );
status[0] = 0;
statusLength = 0;
for (i=0 ; i < 1 ; i++) {
cl = &svs.clients[i];
if ( cl->state >= CS_CONNECTED ) {
if ( cl->gentity && cl->gentity->client ) {
score = cl->gentity->client->persistant[PERS_SCORE];
} else {
score = 0;
}
Com_sprintf (player, sizeof(player), "%i %i \"%s\"\n",
score, cl->ping, cl->name);
playerLength = strlen(player);
if (statusLength + playerLength >= sizeof(status) ) {
break; // can't hold any more
}
strcpy (status + statusLength, player);
statusLength += playerLength;
}
}
NET_OutOfBandPrint( NS_SERVER, from, "statusResponse\n%s\n%s", infostring, status );
}
示例12: SV_SpawnServer
//.........这里部分代码省略.........
for (i=0 ; i<sv_maxclients->integer ; i++) {
// send the new gamestate to all connected clients
if (svs.clients[i].state >= CS_CONNECTED) {
char *denied;
if ( svs.clients[i].netchan.remoteAddress.type == NA_BOT ) {
if ( killBots ) {
SV_DropClient( &svs.clients[i], "" );
continue;
}
isBot = qtrue;
}
else {
isBot = qfalse;
}
// connect the client again
denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, i, qfalse, isBot ) ); // firstTime = qfalse
if ( denied ) {
// this generally shouldn't happen, because the client
// was connected before the level change
SV_DropClient( &svs.clients[i], denied );
} else {
if( !isBot ) {
// when we get the next packet from a connected client,
// the new gamestate will be sent
svs.clients[i].state = CS_CONNECTED;
}
else {
client_t *client;
sharedEntity_t *ent;
client = &svs.clients[i];
client->state = CS_ACTIVE;
ent = SV_GentityNum( i );
ent->s.number = i;
client->gentity = ent;
client->deltaMessage = -1;
client->nextSnapshotTime = svs.time; // generate a snapshot immediately
VM_Call( gvm, GAME_CLIENT_BEGIN, i );
}
}
}
}
// run another frame to allow things to look at all the players
VM_Call( gvm, GAME_RUN_FRAME, svs.time );
SV_BotFrame( svs.time );
svs.time += 100;
if ( sv_pure->integer ) {
// the server sends these to the clients so they will only
// load pk3s also loaded at the server
p = FS_LoadedPakChecksums();
Cvar_Set( "sv_paks", p );
if (strlen(p) == 0) {
Com_Printf( "WARNING: sv_pure set but no PK3 files loaded\n" );
}
p = FS_LoadedPakNames();
Cvar_Set( "sv_pakNames", p );
// if a dedicated pure server we need to touch the cgame because it could be in a
// seperate pk3 file and the client will need to load the latest cgame.qvm
if ( com_dedicated->integer ) {
SV_TouchCGame();
}
}
else {
Cvar_Set( "sv_paks", "" );
Cvar_Set( "sv_pakNames", "" );
}
// the server sends these to the clients so they can figure
// out which pk3s should be auto-downloaded
p = FS_ReferencedPakChecksums();
Cvar_Set( "sv_referencedPaks", p );
p = FS_ReferencedPakNames();
Cvar_Set( "sv_referencedPakNames", p );
// save systeminfo and serverinfo strings
Q_strncpyz( systemInfo, Cvar_InfoString_Big( CVAR_SYSTEMINFO ), sizeof( systemInfo ) );
cvar_modifiedFlags &= ~CVAR_SYSTEMINFO;
SV_SetConfigstring( CS_SYSTEMINFO, systemInfo );
SV_SetConfigstring( CS_SERVERINFO, Cvar_InfoString( CVAR_SERVERINFO ) );
cvar_modifiedFlags &= ~CVAR_SERVERINFO;
// any media configstring setting now should issue a warning
// and any configstring changes should be reliably transmitted
// to all clients
sv.state = SS_GAME;
// send a heartbeat now so the master will get up to date info
SV_Heartbeat_f();
Hunk_SetMark();
Com_Printf ("-----------------------------------\n");
}
示例13: SV_Frame
void SV_Frame( int msec,float fractionMsec ) {
int frameMsec;
int startTime=0;
// the menu kills the server with this cvar
if ( sv_killserver->integer ) {
SV_Shutdown ("Server was killed.\n");
Cvar_Set( "sv_killserver", "0" );
return;
}
if ( !com_sv_running->integer ) {
return;
}
extern void SE_CheckForLanguageUpdates(void);
SE_CheckForLanguageUpdates(); // will fast-return else load different language if menu changed it
// allow pause if only the local client is connected
if ( SV_CheckPaused() ) {
return;
}
// go ahead and let time slip if the server really hitched badly
if ( msec > 1000 ) {
Com_DPrintf( "SV_Frame: Truncating msec of %i to 1000\n", msec );
msec = 1000;
}
// if it isn't time for the next frame, do nothing
if ( sv_fps->integer < 1 ) {
Cvar_Set( "sv_fps", "10" );
}
frameMsec = 1000 / sv_fps->integer ;
sv.timeResidual += msec;
sv.timeResidualFraction+=fractionMsec;
if (sv.timeResidualFraction>=1.0f)
{
sv.timeResidualFraction-=1.0f;
if (cl_newClock&&cl_newClock->integer)
{
sv.timeResidual++;
}
}
if ( sv.timeResidual < frameMsec ) {
return;
}
// if time is about to hit the 32nd bit, restart the
// level, which will force the time back to zero, rather
// than checking for negative time wraparound everywhere.
// 2giga-milliseconds = 23 days, so it won't be too often
if ( sv.time > 0x70000000 ) {
SV_Shutdown( "Restarting server due to time wrapping" );
Com_Printf("You win. if you can play this long and not die, you deserve to win.\n");
return;
}
// update infostrings if anything has been changed
if ( cvar_modifiedFlags & CVAR_SERVERINFO ) {
SV_SetConfigstring( CS_SERVERINFO, Cvar_InfoString( CVAR_SERVERINFO ) );
cvar_modifiedFlags &= ~CVAR_SERVERINFO;
}
if ( cvar_modifiedFlags & CVAR_SYSTEMINFO ) {
SV_SetConfigstring( CS_SYSTEMINFO, Cvar_InfoString( CVAR_SYSTEMINFO ) );
cvar_modifiedFlags &= ~CVAR_SYSTEMINFO;
}
if ( com_speeds->integer ) {
startTime = Sys_Milliseconds ();
}
// SV_BotFrame( sv.time );
// run the game simulation in chunks
while ( sv.timeResidual >= frameMsec ) {
sv.timeResidual -= frameMsec;
sv.time += frameMsec;
G2API_SetTime(sv.time,G2T_SV_TIME);
// let everything in the world think and move
ge->RunFrame( sv.time );
}
if ( com_speeds->integer ) {
time_game = Sys_Milliseconds () - startTime;
}
SG_TestSave(); // returns immediately if not active, used for fake-save-every-cycle to test (mainly) Icarus disk code
// check timeouts
SV_CheckTimeouts ();
// update ping based on the last known frame from all clients
SV_CalcPings ();
// send messages back to the clients
SV_SendClientMessages ();
}
示例14: SV_SpawnServer
//.........这里部分代码省略.........
// this generally shouldn't happen, because the client
// was connected before the level change
SV_DropClient( &svs.clients[ i ], denied );
}
else
{
if ( !isBot )
{
// when we get the next packet from a connected client,
// the new gamestate will be sent
svs.clients[ i ].state = CS_CONNECTED;
}
else
{
client_t *client;
sharedEntity_t *ent;
client = &svs.clients[ i ];
client->state = CS_ACTIVE;
ent = SV_GentityNum( i );
ent->s.number = i;
client->gentity = ent;
client->deltaMessage = -1;
client->nextSnapshotTime = svs.time; // generate a snapshot immediately
VM_Call( gvm, GAME_CLIENT_BEGIN, i );
}
}
}
}
// run another frame to allow things to look at all the players
VM_Call( gvm, GAME_RUN_FRAME, svs.time );
SV_BotFrame( svs.time );
svs.time += FRAMETIME;
if ( sv_pure->integer )
{
// the server sends these to the clients so they will only
// load pk3s also loaded at the server
p = FS_LoadedPakChecksums();
Cvar_Set( "sv_paks", p );
if ( strlen( p ) == 0 )
{
Com_Printf( "WARNING: sv_pure set but no PK3 files loaded\n" );
}
p = FS_LoadedPakNames();
Cvar_Set( "sv_pakNames", p );
// if a dedicated pure server we need to touch the cgame because it could be in a
// seperate pk3 file and the client will need to load the latest cgame.qvm
if ( com_dedicated->integer )
{
SV_TouchCGame();
}
}
else
{
Cvar_Set( "sv_paks", "" );
Cvar_Set( "sv_pakNames", "" );
}
// the server sends these to the clients so they can figure
// out which pk3s should be auto-downloaded
// NOTE: we consider the referencedPaks as 'required for operation'
// we want the server to reference the mp_bin pk3 that the client is expected to load from
SV_TouchCGameDLL();
p = FS_ReferencedPakChecksums();
Cvar_Set( "sv_referencedPaks", p );
p = FS_ReferencedPakNames();
Cvar_Set( "sv_referencedPakNames", p );
// save systeminfo and serverinfo strings
cvar_modifiedFlags &= ~CVAR_SYSTEMINFO;
SV_SetConfigstring( CS_SYSTEMINFO, Cvar_InfoString_Big( CVAR_SYSTEMINFO ) );
SV_SetConfigstring( CS_SERVERINFO, Cvar_InfoString( CVAR_SERVERINFO | CVAR_SERVERINFO_NOUPDATE ) );
cvar_modifiedFlags &= ~CVAR_SERVERINFO;
// any media configstring setting now should issue a warning
// and any configstring changes should be reliably transmitted
// to all clients
sv.state = SS_GAME;
// send a heartbeat now so the master will get up to date info
SV_Heartbeat_f();
Hunk_SetMark();
SV_UpdateConfigStrings();
Cvar_Set( "sv_serverRestarting", "0" );
Com_Printf( "-----------------------------------\n" );
}
示例15: CLQ2_Userinfo_f
static void CLQ2_Userinfo_f() {
common->Printf( "User info settings:\n" );
Info_Print( Cvar_InfoString( CVAR_USERINFO, MAX_INFO_STRING_Q2, MAX_INFO_KEY_Q2,
MAX_INFO_VALUE_Q2, true, false ) );
}