本文整理汇总了C++中Cbuf_Execute函数的典型用法代码示例。如果您正苦于以下问题:C++ Cbuf_Execute函数的具体用法?C++ Cbuf_Execute怎么用?C++ Cbuf_Execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Cbuf_Execute函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Com_ExecuteCfg
void Com_ExecuteCfg(void)
{
Cbuf_ExecuteText(EXEC_NOW, "exec default.cfg\n");
Cbuf_Execute(); // Always execute after exec to prevent text buffer overflowing
if(!Com_SafeMode())
{
// skip the q3config.cfg and autoexec.cfg if "safe" is on the command line
Cbuf_ExecuteText(EXEC_NOW, "exec " Q3CONFIG_NAME "\n");
Cbuf_Execute();
Cbuf_ExecuteText(EXEC_NOW, "exec autoexec_sp.cfg\n");
Cbuf_Execute();
}
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:14,代码来源:common.cpp
示例2: Sys_AddDefaultConfig
void Sys_AddDefaultConfig(void)
{
FILE *fp;
struct stat st;
size_t len, r;
fp = fopen(SYS_SITE_CFG, "r");
if (!fp) {
return;
}
if (fstat(fileno(fp), &st) == 0) {
len = st.st_size;
if (len >= cmd_buffer.maxsize) {
len = cmd_buffer.maxsize - 1;
}
r = fread(cmd_buffer.text, 1, len, fp);
cmd_buffer.text[r] = 0;
cmd_buffer.cursize = COM_Compress(cmd_buffer.text);
}
fclose(fp);
if (cmd_buffer.cursize) {
Com_Printf("Execing %s\n", SYS_SITE_CFG);
Cbuf_Execute(&cmd_buffer);
}
}
开发者ID:Jenco420,项目名称:q2pro,代码行数:30,代码来源:system.c
示例3: ControlsResetDefaultsFunc
static void ControlsResetDefaultsFunc (void *unused)
{
Cbuf_AddText ("exec default.cfg\n");
Cbuf_Execute ();
ControlsSetMenuItemValues ();
}
开发者ID:raynorpat,项目名称:cake,代码行数:7,代码来源:menu_options_controls.c
示例4: _Host_Frame
/*
==================
Host_Frame
Runs all active servers
==================
*/
void _Host_Frame (float time)
{
if (setjmp (host_abortserver))
return; // something bad happened, or the server disconnected
// keep the random time dependent
rand ();
// decide the simulation time
if (!Host_FilterTime (time))
return; // don't run too fast, or packets will flood out
// get new key events
Sys_SendKeyEvents ();
// process console commands
Cbuf_Execute ();
NET_Poll();
// check for commands typed to the host
Host_GetConsoleCommands ();
if (sv.active)
Host_ServerFrame ();
}
开发者ID:odnarb,项目名称:manquake,代码行数:33,代码来源:host.c
示例5: Cbuf_ExecuteText
/*
============
Cbuf_ExecuteText
============
*/
void Cbuf_ExecuteText(int exec_when, const char *text)
{
switch (exec_when)
{
case EXEC_NOW:
if (text && strlen(text) > 0)
{
Com_DPrintf(S_COLOR_YELLOW "EXEC_NOW %s\n", text);
Cmd_ExecuteString(text);
}
else
{
Com_DPrintf(S_COLOR_YELLOW "EXEC_NOW %s\n", cmd_text.data);
Cbuf_Execute();
}
break;
case EXEC_INSERT:
Cbuf_InsertText(text);
break;
case EXEC_APPEND:
Cbuf_AddText(text);
break;
default:
Com_Error(ERR_FATAL, "Cbuf_ExecuteText: bad exec_when");
}
}
开发者ID:ptitSeb,项目名称:etlegacy,代码行数:31,代码来源:cmd.c
示例6: Cbuf_AddText
void CServerRemoteAccess::SetValue(const char *variable, const char *value)
{
FileHandle_t f;
struct cvar_s *var;
if (!Q_stricmp(variable, "map"))
{
Cbuf_AddText("changelevel ");
Cbuf_AddText((char*)value);
Cbuf_AddText("\n");
Cbuf_Execute();
}
else if (!Q_stricmp(variable, "mapcycle"))
{
f = FS_Open(mapcyclefile.string, "wt");
if (!f)
{
Con_Printf("Couldn't write to read-only file %s, using file _dev_mapcycle.txt instead.\n", mapcyclefile.string);
Cvar_DirectSet(&mapcyclefile, "_temp_mapcycle.txt");
f = FS_Open(mapcyclefile.string, "wt");
}
if (f)
{
FS_Write(value, Q_strlen(value) + 1, 1, f);
FS_Close(f);
}
}
else
{
var = Cvar_FindVar(variable);
if (var)
Cvar_DirectSet(var, value);
}
}
开发者ID:ChunHungLiu,项目名称:rehlds,代码行数:35,代码来源:sv_remoteaccess.cpp
示例7: SAV_GameLoad_f
/**
* @brief Console command to load a savegame
* @sa SAV_GameLoad
*/
static void SAV_GameLoad_f (void)
{
const char *error = NULL;
/* get argument */
if (Cmd_Argc() < 2) {
Com_Printf("Usage: %s <filename>\n", Cmd_Argv(0));
return;
}
/* Check if savegame exists */
if (FS_CheckFile("save/%s.%s", Cmd_Argv(1), SAVEGAME_EXTENSION) <= 0) {
Com_Printf("savegame file '%s' doesn't exist or an empty file\n", Cmd_Argv(1));
return;
}
Com_DPrintf(DEBUG_CLIENT, "load file '%s'\n", Cmd_Argv(1));
/* load and go to map */
if (!SAV_GameLoad(Cmd_Argv(1), &error)) {
Cbuf_Execute(); /* wipe outstanding campaign commands */
cgi->UI_Popup(_("Error"), "%s\n%s", _("Error loading game."), error ? error : "");
Cmd_ExecuteString("game_exit");
}
}
开发者ID:MyWifeRules,项目名称:ufoai-1,代码行数:29,代码来源:cp_save.cpp
示例8: Com_AddLateCommands
/*
=================
Com_AddLateCommands
Adds command line parameters as script statements
Commands lead with a + and continue until another +
Returns qtrue if any late commands were added, which
will keep the demoloop from immediately starting
Assumes +set commands are already filtered out
=================
*/
static qboolean Com_AddLateCommands(void)
{
int i;
char *s;
qboolean ret = qfalse;
for (i = 1; i < com_argc; i++) {
s = com_argv[i];
if (!s) {
continue;
}
if (*s == '+') {
if (ret) {
Cbuf_AddText(&cmd_buffer, "\n");
}
s++;
} else if (ret) {
Cbuf_AddText(&cmd_buffer, " ");
}
Cbuf_AddText(&cmd_buffer, s);
ret = qtrue;
}
if (ret) {
Cbuf_AddText(&cmd_buffer, "\n");
Cbuf_Execute(&cmd_buffer);
}
return ret;
}
开发者ID:jayschwa,项目名称:q2pro,代码行数:43,代码来源:common.c
示例9: SV_Init
/*
====================
SV_Init
====================
*/
void SV_Init (void)
{
Sys_Printf ("Host_Init\n");
Memory_Init (host_parms->membase, host_parms->memsize);
Cbuf_Init ();
Cmd_Init ();
COM_Init ();
FS_Init ();
PR_Init ();
Mod_Init ();
SV_InitNet ();
SV_InitLocal ();
Pmove_Init ();
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
host_hunklevel = Hunk_LowMark ();
Cbuf_InsertText ("exec server.cfg\n");
Cbuf_Execute ();
// unlock the early-set cvars after init
Cvar_UnlockAll ();
host_initialized = true;
Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("%4.1f megabyte heap\n", host_parms->memsize/(1024*1024.0));
Con_Printf ("======== HexenWorld Initialized ========\n");
// process command line arguments
Cmd_StuffCmds_f ();
Cbuf_Execute ();
// if a map wasn't specified on the command line, spawn demo1.map
if (sv.state == ss_dead)
Cmd_ExecuteString ("map demo1", src_command);
if (sv.state == ss_dead)
SV_Error ("Couldn't spawn a server");
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:48,代码来源:sv_main.c
示例10: SV_Frame
/*
==================
SV_Frame
==================
*/
void SV_Frame (float time)
{
static double start, end;
start = Sys_DoubleTime ();
svs.stats.idle += start - end;
// keep the random time dependent
rand ();
// decide the simulation time
realtime += time;
sv.time += time;
// check timeouts
SV_CheckTimeouts ();
// toggle the log buffer if full
SV_CheckLog ();
// move autonomous things around if enough time has passed
SV_Physics ();
// get packets
SV_ReadPackets ();
// check for commands typed to the host
SV_GetConsoleCommands ();
// process console commands
Cbuf_Execute ();
SV_CheckVars ();
// send messages back to the clients that had packets read this frame
SV_SendClientMessages ();
// send a heartbeat to the master if needed
Master_Heartbeat ();
// collect timing statistics
end = Sys_DoubleTime ();
svs.stats.active += end-start;
if (++svs.stats.count == STATFRAMES)
{
svs.stats.latched_active = svs.stats.active;
svs.stats.latched_idle = svs.stats.idle;
svs.stats.latched_packets = svs.stats.packets;
svs.stats.active = 0;
svs.stats.idle = 0;
svs.stats.packets = 0;
svs.stats.count = 0;
}
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:60,代码来源:sv_main.c
示例11: Com_AddConfigFile
void Com_AddConfigFile(const char *name, unsigned flags)
{
qerror_t ret;
ret = Cmd_ExecuteFile(name, flags);
if (ret == Q_ERR_SUCCESS) {
Cbuf_Execute(&cmd_buffer);
} else if (ret != Q_ERR_NOENT) {
Com_WPrintf("Couldn't exec %s: %s\n", name, Q_ErrorString(ret));
}
}
开发者ID:jayschwa,项目名称:q2pro,代码行数:11,代码来源:common.c
示例12: Host_Quit
void Host_Quit (void)
{
// execute user's trigger
TP_ExecTrigger ("f_exit");
Cbuf_Execute();
// save config (conditional)
Config_QuitSave();
// turn off
Host_Shutdown ();
Sys_Quit ();
}
开发者ID:se-sss,项目名称:ezquake-source,代码行数:13,代码来源:host.c
示例13: Cbuf_AddText
//-----------------------------------------------------------------------------
// Purpose: Sets a cvar or value
//-----------------------------------------------------------------------------
void CServerRemoteAccess::SetValue(const char *variable, const char *value)
{
// check for special types
if (!stricmp(variable, "map"))
{
// push a map change command
Cbuf_AddText( va( "changelevel %s\n", value ) );
Cbuf_Execute();
}
else if (!stricmp(variable, "mapcycle"))
{
// write out a new mapcycle file
ConVarRef mapcycle( "mapcyclefile" );
if ( mapcycle.IsValid() )
{
FileHandle_t f = g_pFileSystem->Open(mapcycle.GetString(), "wt");
if (!f)
{
// mapcycle file probably read only, fall pack to temporary file
Msg("Couldn't write to read-only file %s, using file _temp_mapcycle.txt instead.\n", mapcycle.GetString());
mapcycle.SetValue("_temp_mapcycle.txt" );
f = g_pFileSystem->Open(mapcycle.GetString(), "wt");
if (!f)
{
return;
}
}
g_pFileSystem->Write(value, Q_strlen(value) + 1, f);
g_pFileSystem->Close(f);
}
}
else
{
// Stick the cvar set in the command string, so client notification, replication, etc happens
Cbuf_AddText( va("%s %s", variable, value) );
Cbuf_AddText("\n");
Cbuf_Execute();
}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:42,代码来源:sv_remoteaccess.cpp
示例14: CL_UserInputFrame
/*
* CL_UserInputFrame
*/
void CL_UserInputFrame( void )
{
// let the mouse activate or deactivate
IN_Frame();
// get new key events
Sys_SendKeyEvents();
// get new key events from mice or external controllers
IN_Commands();
// process console commands
Cbuf_Execute();
}
开发者ID:tenght,项目名称:qfusion,代码行数:17,代码来源:cl_input.c
示例15: CL_NextDemo
/*
==================
CL_NextDemo
Called when a demo or cinematic finishes
If the "nextdemo" cvar is set, that command will be issued
==================
*/
void CL_NextDemo( void ) {
char v[MAX_STRING_CHARS];
Q_strncpyz( v, Cvar_VariableString ("nextdemo"), sizeof(v) );
v[MAX_STRING_CHARS-1] = 0;
Com_DPrintf("CL_NextDemo: %s\n", v );
if (!v[0]) {
return;
}
Cvar_Set ("nextdemo","");
Cbuf_AddText (v);
Cbuf_AddText ("\n");
Cbuf_Execute();
}
开发者ID:Hasimir,项目名称:jedi-academy-1,代码行数:23,代码来源:cl_main.cpp
示例16: SAV_GameQuickLoad_f
/**
* @brief Loads the quick save slot
* @sa SAV_GameQuickSave_f
*/
static void SAV_GameQuickLoad_f (void)
{
const char *error = NULL;
if (cgi->CL_OnBattlescape()) {
Com_Printf("Could not load the campaign while you are on the battlefield\n");
return;
}
if (!SAV_GameLoad("slotquick", &error)) {
Cbuf_Execute(); /* wipe outstanding campaign commands */
CP_Popup(_("Error"), "%s\n%s", _("Error loading game."), error ? error : "");
} else {
MS_AddNewMessage(_("Campaign loaded"), _("Quicksave campaign was successfully loaded."), MSG_INFO);
CP_CheckBaseAttacks();
}
}
开发者ID:MyWifeRules,项目名称:ufoai-1,代码行数:21,代码来源:cp_save.cpp
示例17: CL_ReadRawNetworkData
qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
{
int msglen = 0;
ASSERT( buffer != NULL );
ASSERT( length != NULL );
*length = 0; // assume we fail
FS_Read( cls.demofile, &msglen, sizeof( int ));
if( msglen < 0 )
{
MsgDev( D_ERROR, "Demo message length < 0\n" );
CL_DemoCompleted();
return false;
}
if( msglen < 8 )
{
MsgDev( D_NOTE, "read runt demo message\n" );
}
if( msglen > NET_MAX_PAYLOAD )
{
MsgDev( D_ERROR, "Demo message %i > %i\n", msglen, NET_MAX_PAYLOAD );
CL_DemoCompleted();
return false;
}
if( msglen > 0 )
{
if( FS_Read( cls.demofile, buffer, msglen ) != msglen )
{
MsgDev( D_ERROR, "Error reading demo message data\n" );
CL_DemoCompleted();
return false;
}
}
*length = msglen;
if( cls.state != ca_active )
Cbuf_Execute();
return true;
}
开发者ID:nekonomicon,项目名称:xash3d,代码行数:46,代码来源:cl_demo.c
示例18: CL_UserInputFrame
/*
* CL_UserInputFrame
*/
void CL_UserInputFrame( void )
{
// let the mouse activate or deactivate
IN_Frame();
// get new key events
Sys_SendKeyEvents();
// get new key events from mice or external controllers
IN_Commands();
// let the game handle touch events
if( cls.key_dest == key_game )
CL_GameModule_TouchFrame();
// process console commands
Cbuf_Execute();
}
开发者ID:ewirch,项目名称:qfusion,代码行数:21,代码来源:cl_input.c
示例19: Cbuf_ExecuteText
/*
============
Cbuf_ExecuteText
============
*/
void EXPORT Cbuf_ExecuteText (int exec_when, char *text)
{
switch (exec_when)
{
case EXEC_NOW:
Cmd_ExecuteString (text);
Cbuf_Execute ();
break;
case EXEC_INSERT:
Cbuf_InsertText (text);
break;
case EXEC_APPEND:
Cbuf_AddText (text);
break;
default:
Com_Error (ERR_FATAL, "Cbuf_ExecuteText: bad exec_when");
}
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:23,代码来源:cmd.c
示例20: CL_SendCommand
/**
* @sa CL_Frame
*/
static void CL_SendCommand (void)
{
/* get new key events */
IN_SendKeyEvents();
/* process console commands */
Cbuf_Execute();
/* send intentions now */
CL_SendChangedUserinfos();
/* fix any cheating cvars */
Cvar_FixCheatVars();
switch (cls.state) {
case ca_disconnected:
/* if the local server is running and we aren't connected then connect */
if (Com_ServerState()) {
cls.servername[0] = '\0';
cls.serverport[0] = '\0';
CL_SetClientState(ca_connecting);
return;
}
break;
case ca_connecting:
if (CL_Milliseconds() - cls.connectTime > cl_connecttimeout->integer) {
if (GAME_IsMultiplayer())
Com_Error(ERR_DROP, "Server is not reachable");
}
break;
case ca_connected:
if (cls.waitingForStart) {
if (CL_Milliseconds() - cls.waitingForStart > cl_connecttimeout->integer) {
Com_Error(ERR_DROP, "Server aborted connection - the server didn't response in %is. You can try to increase the cvar cl_connecttimeout",
cl_connecttimeout->integer / 1000);
} else {
SCR_DrawLoading(100);
}
}
break;
default:
break;
}
}
开发者ID:Astrocoderguy,项目名称:ufoai,代码行数:47,代码来源:cl_main.cpp
注:本文中的Cbuf_Execute函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论