|
UFO: Alien Invasion
|
Script command processing module Command text buffering. Any number of commands can be added in a frame, from several different sources. Most commands come from either keyBindings or console line input, but remote servers can also send across commands and entire text files can be accessed. More...

Go to the source code of this file.
Data Structures | |
| struct | cmd_alias_t |
| struct | cmd_function_t |
Macros | |
| #define | ALIAS_HASH_SIZE 32 |
| #define | MAX_ALIAS_NAME 32 |
| #define | ALIAS_LOOP_COUNT 16 |
| #define | CMD_BUFFER_SIZE 8192 |
| #define | CMD_HASH_SIZE 32 |
Typedefs | |
| typedef std::vector< CmdListenerPtr > | CmdListeners |
Functions | |
| void | Cmd_ForwardToServer (void) |
| adds the current command line as a clc_stringcmd to the client message. things like action, turn, etc, are commands directed to the server, so when they are typed in at the console, they will need to be forwarded. | |
| static void | Cmd_Open_f (void) |
| Reopens the command buffer for writing. | |
| static void | Cmd_Close_f (void) |
| Will no longer add any command to command buffer ...until cmd_close is false again. | |
| static void | Cmd_Wait_f (void) |
| Causes execution of the remainder of the command buffer to be delayed until next frame. This allows commands like: bind g "impulse 5; +attack; wait; -attack; impulse 2". | |
| void | Cbuf_Init (void) |
| allocates an initial text buffer that will grow as needed | |
| void | Cbuf_Shutdown (void) |
| void | Cbuf_AddText (const char *format,...) |
| Adds command text at the end of the buffer. | |
| void | Cbuf_InsertText (const char *text) |
| Adds command text immediately after the current command. | |
| void | Cbuf_CopyToDefer (void) |
| Defers any outstanding commands. | |
| void | Cbuf_InsertFromDefer (void) |
| Copies back any deferred commands. | |
| void | Cbuf_Execute (void) |
| Pulls off terminated lines of text from the command buffer and sends them through Cmd_ExecuteString. Stops when the buffer is empty. Normally called once per frame, but may be explicitly invoked. Do not call inside a command function! | |
| void | Cbuf_AddEarlyCommands (bool clear) |
| Adds command line parameters as script statements Commands lead with a +, and continue until another + Set commands are added early, so they are guaranteed to be set before the client and server initialize for the first time. Other commands are added late, after all initialization is complete. | |
| bool | Cbuf_AddLateCommands (void) |
| Adds command line parameters as script statements. | |
| static void | Cmd_Exec_f (void) |
| static void | Cmd_Echo_f (void) |
| Just prints the rest of the line to the console. | |
| static void | Cmd_Alias_f (void) |
| Creates a new command that executes a command string (possibly ; separated). | |
| void | Cmd_WriteAliases (qFILE *f) |
| Write lines containing "aliasa alias value" for all aliases with the archive flag set to true. | |
| int | Cmd_Argc (void) |
Return the number of arguments of the current command. "command parameter" will result in a argc of 2, not 1. | |
| const char * | Cmd_Argv (int arg) |
| Returns a given argument. | |
| const char * | Cmd_Args (void) |
| Returns a single string containing argv(1) to argv(argc()-1). | |
| void * | Cmd_Userdata (void) |
| Return the userdata of the called command. | |
| void | Cmd_BufClear (void) |
| Clears the argv vector and set argc to zero. | |
| void | Cmd_TokenizeString (const char *text, bool macroExpand, bool replaceWhitespaces) |
| Parses the given string into command line tokens. | |
| static cmd_function_t * | Cmd_TableFind (const char *cmdName) |
| const char * | Cmd_GetCommandDesc (const char *cmdName) |
| Returns the command description for a given command. | |
| bool | Cmd_GenericCompleteFunction (char const *candidate, char const *partial, char const **match) |
| void | Cmd_AddParamCompleteFunction (const char *cmdName, int(*function)(const char *partial, const char **match)) |
| void * | Cmd_GetUserdata (const char *cmdName) |
| Fetches the userdata for a console command. | |
| void | Cmd_AddUserdata (const char *cmdName, void *userdata) |
| Adds userdata to the console command. | |
| void | Cmd_AddCommand (const char *cmdName, xcommand_t function, const char *desc) |
| Add a new command to the script interface. | |
| void | Cmd_RemoveCommand (const char *cmdName) |
| Removes a command from script interface. | |
| void | Cmd_TableCheck (void) |
| Check both the functiontable and the associated hashtable for invalid entries. | |
| void | Cmd_TableAddList (const cmdList_t *cmdList) |
| void | Cmd_TableRemoveList (const cmdList_t *cmdList) |
| void | Cmd_RegisterCmdListener (CmdListenerPtr listener) |
| Registers a command listener. | |
| void | Cmd_UnRegisterCmdListener (CmdListenerPtr listener) |
| Unregisters a command listener. | |
| bool | Cmd_Exists (const char *cmdName) |
| Checks whether a function exists already. | |
| int | Cmd_CompleteCommandParameters (const char *command, const char *partial, const char **match) |
| Unix like tab completion for console commands parameters. | |
| int | Cmd_CompleteCommand (const char *partial, const char **match) |
| Unix like tab completion for console commands. | |
| void | Cmd_vExecuteString (const char *fmt, va_list ap) |
| void | Cmd_ExecuteString (const char *text,...) |
| A complete command line has been parsed, so try to execute it. | |
| static void | Cmd_Help_f (void) |
| Display some help about cmd and cvar usage. | |
| static void | Cmd_List_f (void) |
| List all available script interface functions. | |
| static int | Cmd_CompleteExecCommand (const char *partial, const char **match) |
| Autocomplete function for exec command. | |
| void | Cmd_Dummy_f (void) |
| Dummy binding if you don't want unknown commands forwarded to the server. | |
| void | Cmd_Init (void) |
| void | Cmd_Shutdown (void) |
Variables | |
| static CmdListeners | cmdListeners |
| static cmd_alias_t * | cmd_alias |
| static cmd_alias_t * | cmd_alias_hash [ALIAS_HASH_SIZE] |
| static bool | cmdWait |
| static bool | cmdClosed |
| static int | alias_count |
| static sizebuf_t | cmd_text |
| static byte | cmd_text_buf [CMD_BUFFER_SIZE] |
| static char | defer_text_buf [CMD_BUFFER_SIZE] |
| static int | cmd_argc |
| static char * | cmd_argv [MAX_STRING_TOKENS] |
| static char | cmd_args [MAX_STRING_CHARS] |
| static void * | cmd_userdata |
| static cmd_function_t * | cmd_functions |
| static cmd_function_t * | cmd_functions_hash [CMD_HASH_SIZE] |
Script command processing module Command text buffering. Any number of commands can be added in a frame, from several different sources. Most commands come from either keyBindings or console line input, but remote servers can also send across commands and entire text files can be accessed.
The + command line options are also added to the command buffer.
Command execution takes a null terminated string, breaks it into tokens, then searches for a command or variable that matches the first token.
Definition in file cmd.cpp.
| #define ALIAS_HASH_SIZE 32 |
Definition at line 40 of file cmd.cpp.
Referenced by Cmd_Alias_f(), and Cmd_vExecuteString().
| #define ALIAS_LOOP_COUNT 16 |
Definition at line 60 of file cmd.cpp.
Referenced by Cmd_vExecuteString().
| #define CMD_BUFFER_SIZE 8192 |
Definition at line 101 of file cmd.cpp.
Referenced by Cbuf_AddText().
| #define CMD_HASH_SIZE 32 |
Definition at line 475 of file cmd.cpp.
Referenced by Cmd_AddCommand(), Cmd_CompleteCommandParameters(), Cmd_RemoveCommand(), Cmd_TableCheck(), Cmd_TableFind(), and Cmd_vExecuteString().
| #define MAX_ALIAS_NAME 32 |
Definition at line 42 of file cmd.cpp.
Referenced by Cmd_Alias_f().
| typedef std::vector<CmdListenerPtr> CmdListeners |
| void Cbuf_AddEarlyCommands | ( | bool | clear | ) |
Adds command line parameters as script statements Commands lead with a +, and continue until another + Set commands are added early, so they are guaranteed to be set before the client and server initialize for the first time. Other commands are added late, after all initialization is complete.
adds all the +set commands from the command line
Definition at line 275 of file cmd.cpp.
References Cbuf_AddText(), Com_Argc(), Com_Argv(), Com_ClearArgv(), i, and Q_streq.
Referenced by Cbuf_AddText(), and Qcommon_Init().
| bool Cbuf_AddLateCommands | ( | void | ) |
Adds command line parameters as script statements.
adds all the remaining + commands from the command line
Definition at line 298 of file cmd.cpp.
References Cbuf_AddText(), Com_Argc(), Com_Argv(), i, Mem_AllocTypeN, Mem_Free, and Q_strcat().
Referenced by Cbuf_AddText(), and Qcommon_Init().
| void Cbuf_AddText | ( | const char * | format, |
| ... ) |
Adds command text at the end of the buffer.
Definition at line 126 of file cmd.cpp.
References CMD_BUFFER_SIZE, cmd_text, cmd_text_buf, cmdClosed, Com_DPrintf(), Com_Printf(), DEBUG_COMMANDS, format(), len, Q_strstart(), Q_vsnprintf(), and SZ_Write().
Referenced by cgame_import_t::__attribute__(), _wrap_cmd(), Cbuf_AddEarlyCommands(), Cbuf_AddLateCommands(), Cbuf_InsertText(), CL_BattlescapeRadarGenerateAll(), CL_ConnectionlessPacket(), CL_ParseServerMessage(), CLMN_Mods_f(), FS_InitFilesystem(), GAME_Abort_f(), GAME_GetImportData(), Irc_Connect_f(), Irc_Proto_Msg(), Key_Console(), Key_Event(), Qcommon_Init(), SEQ_ExecuteCommand(), SV_Frame(), SV_InitGameProgs(), SV_NextMapcycle(), and UI_ExecuteAction().
Defers any outstanding commands.
These two functions are used to defer any pending commands while a map is being loaded.
Used when loading a map, for example. Copies then clears the command buffer to a temporary area.
Definition at line 191 of file cmd.cpp.
References cmd_text, cmd_text_buf, and defer_text_buf.
Referenced by Cbuf_AddText(), and SV_Map().
Pulls off
terminated lines of text from the command buffer and sends them through Cmd_ExecuteString. Stops when the buffer is empty. Normally called once per frame, but may be explicitly invoked. Do not call inside a command function!
\n terminated lines of text from the command buffer and sends them through Cmd_ExecuteString, stopping when the buffer is empty. Normally called once per frame, but may be explicitly invoked. Definition at line 214 of file cmd.cpp.
References alias_count, Cmd_ExecuteString(), cmd_text, cmdWait, and i.
Referenced by Cbuf_AddText(), Cbuf_Execute_timer(), CL_ParseServerMessage(), CL_SendCommand(), GAME_GetImportData(), Qcommon_Init(), UFO_ExecuteTestWindow(), and cgame_import_t::void().
allocates an initial text buffer that will grow as needed
Definition at line 109 of file cmd.cpp.
References cmd_text, cmd_text_buf, and SZ_Init().
Referenced by Qcommon_Init(), and TEST_Init().
Copies back any deferred commands.
Definition at line 201 of file cmd.cpp.
References Cbuf_InsertText(), and defer_text_buf.
Referenced by Cbuf_AddText(), SV_Begin_f(), and SV_StartMatch_f().
| void Cbuf_InsertText | ( | const char * | text | ) |
Adds command text immediately after the current command.
when a command wants to issue other commands immediately, the text is
\n to the text Definition at line 157 of file cmd.cpp.
References Cbuf_AddText(), cmd_text, Mem_AllocTypeN, Mem_Free, Q_strnull(), SZ_Clear(), and SZ_Write().
Referenced by Cbuf_AddText(), Cbuf_InsertFromDefer(), Cmd_Exec_f(), and Cmd_vExecuteString().
Definition at line 117 of file cmd.cpp.
References cmd_text, and SZ_Init().
Referenced by TEST_Shutdown().
| void Cmd_AddCommand | ( | const char * | cmdName, |
| xcommand_t | function, | ||
| const char * | desc ) |
Add a new command to the script interface.
called by the init functions of other parts of the program to register commands and functions to call for them. The cmd_name is referenced later, so it should not be in temp memory if function is nullptr, the command will be forwarded to the server as a clc_stringcmd instead of executed locally
| [in] | cmdName | The name the command is available via script interface |
| [in] | function | The function pointer |
| [in] | desc | A short description of what the cmd does. It is shown for e.g. the tab completion or the command list. |
Definition at line 744 of file cmd.cpp.
References cmd_functions, cmd_functions_hash, CMD_HASH_SIZE, Cmd_TableFind(), cmdListeners, com_cmdSysPool, Com_DPrintf(), Com_HashKey(), Com_Printf(), cmd_function_t::completeParam, Cvar_GetString(), DEBUG_COMMANDS, cmd_function_t::description, cmd_function_t::function, hash, HASH_Add, i, Mem_PoolAllocType, cmd_function_t::name, cmd_function_t::next, and Q_strvalid.
Referenced by ACTOR_InitStartup(), CL_BattlescapeRadarInit(), CL_CameraInit(), CL_InitLocal(), CL_ServerEventsInit(), CLMN_Init(), Cmd_Init(), Cmd_TableAddList(), Con_Init(), Cvar_Init(), GAME_GetImportData(), GAME_InitStartup(), HUD_InitCallbacks(), HUD_InitStartup(), IN_Init(), INV_InitCallbacks(), INV_InitStartup(), Irc_Init(), Key_Init(), NET_Init(), uiConFuncNode::onLoaded(), PTL_InitStartup(), Qcommon_Init(), S_Init(), SCR_Init(), CampaignTest::SetUpTestCase(), SV_InitOperatorCommands(), SV_MapcycleInit(), TEAM_InitStartup(), TEST_F(), TOTD_InitStartup(), TUT_InitStartup(), UI_Init(), UI_InitActions(), UI_InitData(), UI_InitWindows(), UI_RegisterAbstractNode(), UI_RegisterEditorNode(), UI_RegisterGeoscapeNode(), UI_RegisterMaterialEditorNode(), UI_RegisterModelNode(), VID_Init(), WEB_CGameCommands(), and WEB_InitStartup().
| void Cmd_AddParamCompleteFunction | ( | const char * | cmdName, |
| int(* | function )(const char *partial, const char **match) ) |
| [in] | cmdName | The name the command we want to add the complete function |
| [in] | function | The complete function pointer |
Definition at line 679 of file cmd.cpp.
References Cmd_TableFind(), and cmd_function_t::completeParam.
Referenced by Cmd_Init(), GAME_GetImportData(), Key_Init(), M_Init(), S_Init(), SV_InitOperatorCommands(), UI_InitWindows(), and UI_RegisterEditorNode().
Adds userdata to the console command.
| [in] | cmdName | The name the command we want to add edit |
| [in] | userdata | for this function |
Definition at line 724 of file cmd.cpp.
References Cmd_TableFind(), and cmd_function_t::userdata.
Referenced by uiConFuncNode::onLoaded().
Creates a new command that executes a command string (possibly ; separated).
Definition at line 393 of file cmd.cpp.
References ALIAS_HASH_SIZE, cmd_alias_t::archive, cmd_alias, cmd_alias_hash, Cmd_Argc(), Cmd_Argv(), com_aliasSysPool, Com_HashKey(), Com_Printf(), hash, cmd_alias_t::hash_next, i, len, MAX_ALIAS_NAME, MAX_STRING_CHARS, Mem_Free, Mem_PoolAllocType, Mem_PoolStrDup, cmd_alias_t::name, cmd_alias_t::next, Q_strcat(), Q_streq, Q_strncpyz(), and cmd_alias_t::value.
Referenced by Cmd_Init().
Return the number of arguments of the current command. "command parameter" will result in a argc of 2, not 1.
The functions that execute commands get their parameters with these functions. Cmd_Argv() will return an empty string, not a nullptr if arg > argc, so string operations are always safe.
Definition at line 505 of file cmd.cpp.
References cmd_argc.
Referenced by CL_ActorSelect_f(), CL_ActorTargetAlign_f(), CL_CamSetAngles_f(), CL_CamSetZoom_f(), CL_ConnectionlessPacket(), CL_Env_f(), CL_ForwardToServer_f(), CL_GetTipOfTheDay_f(), CL_OpenURL_f(), CL_PressKey_f(), CL_SetRatioFilter_f(), Cmd_Alias_f(), Cmd_Echo_f(), Cmd_Exec_f(), Cmd_ForwardToServer(), Cmd_List_f(), Cmd_vExecuteString(), Com_DeveloperSet_f(), Com_WriteConfig_f(), Cvar_Add_f(), Cvar_Command(), Cvar_Copy_f(), Cvar_Define_f(), Cvar_Del_f(), Cvar_List_f(), Cvar_Mod_f(), Cvar_Set_f(), Cvar_SetOld_f(), Cvar_Switch_f(), GAME_ActorSelect_f(), GAME_AutoTeam_f(), GAME_GetImportData(), GAME_LoadTeam_f(), GAME_SaveTeam_f(), GAME_SetMode_f(), GAME_TeamDelete_f(), GAME_ToggleActorForTeam_f(), HUD_DisplayActions_f(), HUD_DisplayFiremodes_f(), HUD_ExecuteAction_f(), HUD_FireWeapon_f(), HUD_PopupFiremodeReservation_f(), HUD_RemainingTUs_f(), HUD_SelectReactionFiremode_f(), HUD_ShotReserve_f(), cgame_import_t::int(), game_import_t::int(), INV_UpdateActorLoad_f(), INV_UpdateObject_f(), Irc_Client_Join_f(), Irc_Client_Kick_f(), Irc_Client_Mode_f(), Irc_Client_Msg_f(), Irc_Client_Part_f(), Irc_Client_PrivMsg_f(), Irc_Client_Topic_f(), Irc_Client_Who_f(), Irc_Client_Whois_f(), Irc_Client_Whowas_f(), Irc_Connect_f(), Irc_UserClick_f(), Irc_UserRightClick_f(), Key_Bind_f(), Key_Unbind_f(), Key_WriteBindings_f(), M_Change_f(), M_Play_f(), R_ScreenShot(), R_ScreenShot_f(), S_Play_f(), SCR_TimeRefresh_f(), SV_InitGameProgs(), SV_Kick_f(), SV_Map_f(), SV_MapcycleAdd_f(), SV_ServerCommand_f(), SV_UserInfo_f(), SVC_RemoteCommand(), TUT_ListClick_f(), UI_AddCvarListener_f(), UI_AddListener_f(), UI_CloseWindow_f(), UI_DebugTree_f(), UI_EditorNodeExtract_f(), UI_ExecuteLuaConFunc(), UI_GeoscapeNodeScroll_f(), UI_GeoscapeNodeZoom_f(), UI_GetParamNumber(), UI_InitStack_f(), UI_ListMaps_f(), UI_MaterialEditorChangeValue_f(), UI_MaterialEditorNewStage_f(), UI_MaterialEditorRemoveStage_f(), UI_MaterialEditorSelectStage_f(), UI_Popup_f(), UI_PopWindow_f(), UI_PushChildWindow_f(), UI_PushDropDownWindow_f(), UI_PushWindow_f(), UI_RemoveCvarListener_f(), UI_RemoveListener_f(), UI_ResetData_f(), UI_SelectMap_f(), WEB_Auth_f(), WEB_DeleteCGame_f(), WEB_DownloadCGame_f(), WEB_ListCGame_f(), and WEB_UploadCGame_f().
| const char * Cmd_Args | ( | void | ) |
Returns a single string containing argv(1) to argv(argc()-1).
Definition at line 526 of file cmd.cpp.
References cmd_args.
Referenced by CL_ConnectionlessPacket(), CL_ForwardToServer_f(), Cmd_ForwardToServer(), GAME_GetImportData(), Irc_Client_Kick_f(), Irc_Client_Mode_f(), Irc_Client_Msg_f(), Irc_Client_PrivMsg_f(), Irc_Client_Topic_f(), SV_InitGameProgs(), and SV_ServerCommand_f().
| const char * Cmd_Argv | ( | int | arg | ) |
Returns a given argument.
| [in] | arg | The argument at position arg in cmd_argv. 0 will return the command name. |
cmd_argv Definition at line 516 of file cmd.cpp.
References cmd_argc, and cmd_argv.
Referenced by CL_ActorSelect_f(), CL_ActorTargetAlign_f(), CL_CamSetAngles_f(), CL_CamSetZoom_f(), CL_ConnectionlessPacket(), CL_Env_f(), CL_ForwardToServer_f(), CL_OpenURL_f(), CL_PressKey_f(), CL_SetRatioFilter_f(), Cmd_Alias_f(), Cmd_Echo_f(), Cmd_Exec_f(), Cmd_ForwardToServer(), Cmd_List_f(), Cmd_vExecuteString(), Com_DeveloperSet_f(), Com_WriteConfig_f(), Cvar_Add_f(), Cvar_Command(), Cvar_Copy_f(), Cvar_Define_f(), Cvar_Del_f(), Cvar_List_f(), Cvar_Mod_f(), Cvar_Set_f(), Cvar_SetOld_f(), Cvar_Switch_f(), GAME_ActorSelect_f(), GAME_AutoTeam_f(), GAME_GetImportData(), GAME_LoadTeam_f(), GAME_SaveTeam_f(), GAME_SetMode_f(), GAME_TeamDelete_f(), GAME_ToggleActorForTeam_f(), HUD_DisplayActions_f(), HUD_DisplayFiremodes_f(), HUD_ExecuteAction_f(), HUD_FireWeapon_f(), HUD_RemainingTUs_f(), HUD_SelectReactionFiremode_f(), HUD_ShotReserve_f(), IN_KeyDown(), IN_KeyUp(), INV_UpdateActorLoad_f(), INV_UpdateObject_f(), Irc_Client_Join_f(), Irc_Client_Kick_f(), Irc_Client_Mode_f(), Irc_Client_Part_f(), Irc_Client_PrivMsg_f(), Irc_Client_Topic_f(), Irc_Client_Who_f(), Irc_Client_Whois_f(), Irc_Client_Whowas_f(), Irc_Connect_f(), Irc_UserClick_f(), Irc_UserRightClick_f(), Key_Bind_f(), Key_Unbind_f(), Key_Unbindall_f(), Key_WriteBindings_f(), M_Change_f(), M_Play_f(), R_ScreenShot(), R_ScreenShot_f(), S_Play_f(), SV_ConnectionlessPacket(), SV_ExecuteUserCommand(), SV_GetPlayerClientStructure(), SV_InitGameProgs(), SV_Kick_f(), SV_Map_f(), SV_MapcycleAdd_f(), SV_ServerCommand_f(), SV_UserInfo_f(), SVC_DirectConnect(), SVC_Info(), SVC_RemoteCommand(), TEST_F(), TUT_ListClick_f(), UI_AddCvarListener_f(), UI_AddListener_f(), UI_CloseWindow_f(), UI_DebugTree_f(), UI_EditorNodeExtract_f(), UI_ExecuteLuaConFunc(), UI_GeoscapeNodeScroll_f(), UI_GeoscapeNodeZoom_f(), UI_GetParam(), UI_InitStack_f(), UI_ListMaps_f(), UI_MaterialEditorChangeValue_f(), UI_MaterialEditorNewStage_f(), UI_MaterialEditorRemoveStage_f(), UI_MaterialEditorSelectStage_f(), UI_Popup_f(), UI_PopWindow_f(), UI_PushChildWindow_f(), UI_PushDropDownWindow_f(), UI_PushWindow_f(), UI_RemoveCvarListener_f(), UI_RemoveListener(), UI_RemoveListener_f(), UI_ResetData_f(), UI_SelectMap_f(), UI_TextScrollEnd(), WEB_Auth_f(), WEB_DeleteCGame_f(), WEB_DownloadCGame_f(), WEB_ListCGame_f(), and WEB_UploadCGame_f().
Clears the argv vector and set argc to zero.
Clears the command execution buffer.
Definition at line 543 of file cmd.cpp.
References cmd_argc, cmd_args, cmd_argv, cmd_userdata, i, and Mem_Free.
Referenced by Cmd_ExecuteString(), and Cmd_TokenizeString().
Will no longer add any command to command buffer ...until cmd_close is false again.
Definition at line 79 of file cmd.cpp.
References cmdClosed, Com_DPrintf(), and DEBUG_COMMANDS.
Referenced by Cmd_Init().
| int Cmd_CompleteCommand | ( | const char * | partial, |
| const char ** | match ) |
Unix like tab completion for console commands.
| [in] | partial | The beginning of the command we try to complete |
| [out] | match | The found entry of the list we are searching, in case of more than one entry their common suffix is returned. |
Definition at line 924 of file cmd.cpp.
References cmd_alias, cmd_functions, Cmd_GenericCompleteFunction(), Com_Printf(), and S_COLOR_GREEN.
Referenced by Com_ConsoleCompleteCommand().
| int Cmd_CompleteCommandParameters | ( | const char * | command, |
| const char * | partial, | ||
| const char ** | match ) |
Unix like tab completion for console commands parameters.
attempts to match a partial command for automatic command line completion returns nullptr if nothing fits
| [in] | command | The command we try to complete the parameter for |
| [in] | partial | The beginning of the parameter we try to complete |
| [out] | match | The command we are writing back (if something was found) |
Definition at line 903 of file cmd.cpp.
References cmd_functions_hash, CMD_HASH_SIZE, Com_HashKey(), hash, and Q_strcasecmp.
Referenced by Com_ConsoleCompleteCommand().
|
static |
Autocomplete function for exec command.
Definition at line 1066 of file cmd.cpp.
References Cmd_GenericCompleteFunction(), Com_Printf(), and FS_NextFileFromFileList().
Referenced by Cmd_Init().
Dummy binding if you don't want unknown commands forwarded to the server.
Definition at line 1083 of file cmd.cpp.
Referenced by Cmd_ExecuteString(), S_Init(), and CampaignTest::SetUpTestCase().
Just prints the rest of the line to the console.
Definition at line 383 of file cmd.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), and i.
Referenced by Cmd_Init().
Definition at line 352 of file cmd.cpp.
References Cbuf_InsertText(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), f, FS_FreeFile(), FS_LoadFile(), len, Mem_AllocTypeN, and Mem_Free.
Referenced by Cmd_Init().
| void Cmd_ExecuteString | ( | const char * | text, |
| ... ) |
A complete command line has been parsed, so try to execute it.
Definition at line 1007 of file cmd.cpp.
References Cmd_vExecuteString().
Referenced by cgame_import_t::__attribute__(), _LE_NotFoundError(), Cbuf_Execute(), CL_BattlescapeRadarGenerateAll(), CL_InvAdd(), CL_InvDel(), CL_InvReload(), CL_ViewLoadMedia(), Cmd_vExecuteString(), Com_ReadFromPipe(), GAME_GetImportData(), HUD_ExecuteAction_f(), IN_Frame(), ScopedCommand::ScopedCommand(), ScopedCommand::ScopedCommand(), CampaignTest::SetUpTestCase(), SV_ShutdownGameProgs(), SVC_RemoteCommand(), TEST_F(), TEST_F(), TEST_F(), TUT_ListClick_f(), UFO_ExecuteTestWindow(), and ScopedCommand::~ScopedCommand().
| bool Cmd_Exists | ( | const char * | cmdName | ) |
Checks whether a function exists already.
used by the cvar code to check for cvar / command name overlap
| [in] | cmdName | The script interface function name to search for |
Definition at line 887 of file cmd.cpp.
References Cmd_TableFind().
Referenced by uiConFuncNode::deleteNode(), M_Init(), uiConFuncNode::onLoaded(), and UI_Shutdown().
adds the current command line as a clc_stringcmd to the client message. things like action, turn, etc, are commands directed to the server, so when they are typed in at the console, they will need to be forwarded.
Definition at line 98 of file cl_main.cpp.
Referenced by Cmd_vExecuteString().
| bool Cmd_GenericCompleteFunction | ( | char const * | candidate, |
| char const * | partial, | ||
| char const ** | match ) |
Tests whether candidate has partial as prefix and determines the common prefix of all candidates passed to it.
| [out] | match | The found entry of the list we are searching, in case of more than one entry their common suffix is returned. |
| [in] | candidate | A completion candidate. |
| [in] | partial | The prefix a candidate must have to be considered a match. |
Definition at line 648 of file cmd.cpp.
References MAX_QPATH, Q_strncpyz(), and Q_strstart().
Referenced by cgame_import_t::bool(), Cmd_CompleteCommand(), Cmd_CompleteExecCommand(), Cvar_CompleteVariable(), GAME_GetImportData(), Key_CompleteKeyName(), M_CompleteMusic(), S_CompleteSounds(), SV_CompleteMapCommand(), SV_CompleteServerCommand(), and UI_CompleteWithWindow().
| const char * Cmd_GetCommandDesc | ( | const char * | cmdName | ) |
Returns the command description for a given command.
Searches for the description of a given command.
| [in] | cmdName | Command id in global command array |
Definition at line 629 of file cmd.cpp.
References Cmd_TableFind(), cmd_function_t::description, MAX_VAR, and Q_strncpyz().
Referenced by CLMN_AddBindings(), and Cmd_ExecuteString().
| void * Cmd_GetUserdata | ( | const char * | cmdName | ) |
Fetches the userdata for a console command.
| [in] | cmdName | The name the command we want to add edit |
nullptr if no userdata was set or the command wasn't found, the userdata pointer if it was found and set Definition at line 700 of file cmd.cpp.
References Cmd_TableFind(), Com_Printf(), and cmd_function_t::userdata.
Referenced by uiConFuncNode::deleteNode(), uiConFuncNode::onWindowClosed(), uiConFuncNode::onWindowOpened(), and UI_ConFuncIsVirtual().
Display some help about cmd and cvar usage.
Definition at line 1019 of file cmd.cpp.
References Com_Printf(), and S_COLOR_GREEN.
Referenced by Cmd_Init().
Definition at line 1127 of file cmd.cpp.
References Cmd_AddCommand(), Cmd_AddParamCompleteFunction(), Cmd_Alias_f(), Cmd_Close_f(), Cmd_CompleteExecCommand(), Cmd_Echo_f(), Cmd_Exec_f(), Cmd_Help_f(), Cmd_List_f(), Cmd_Open_f(), and Cmd_Wait_f().
Referenced by Qcommon_Init(), and TEST_Init().
List all available script interface functions.
Definition at line 1028 of file cmd.cpp.
References cmd_alias, Cmd_Argc(), Cmd_Argv(), cmd_functions, Com_Printf(), i, len, and S_COLOR_GREEN.
Referenced by Cmd_Init().
Reopens the command buffer for writing.
Definition at line 68 of file cmd.cpp.
References cmdClosed, Com_DPrintf(), and DEBUG_COMMANDS.
Referenced by Cmd_Init().
| void Cmd_RegisterCmdListener | ( | CmdListenerPtr | listener | ) |
Registers a command listener.
| listener | The listener callback to register |
Definition at line 869 of file cmd.cpp.
References cmdListeners.
Referenced by GAME_InitStartup().
| void Cmd_RemoveCommand | ( | const char * | cmdName | ) |
Removes a command from script interface.
| [in] | cmdName | The script interface function name to remove |
Definition at line 786 of file cmd.cpp.
References cmd_functions, cmd_functions_hash, CMD_HASH_SIZE, cmdListeners, Com_HashKey(), Com_Printf(), cmd_function_t::getName(), hash, cmd_function_t::hash_next, i, Mem_Free, cmd_function_t::next, and Q_streq.
Referenced by CLMN_Shutdown(), Cmd_TableRemoveList(), uiConFuncNode::deleteNode(), GAME_GetImportData(), M_Init(), GAMECmdListener::onGameModeChange(), S_Shutdown(), TEST_F(), UI_Shutdown(), and cgame_import_t::void().
Definition at line 1145 of file cmd.cpp.
References alias_count, cmd_alias, cmd_alias_hash, cmd_argc, cmd_argv, cmd_functions, cmd_functions_hash, cmdClosed, cmdWait, com_cmdSysPool, Mem_FreePool, and OBJZERO.
Referenced by Qcommon_Shutdown(), and TEST_Shutdown().
Definition at line 853 of file cmd.cpp.
References Cmd_AddCommand(), and cmdList_t::name.
Referenced by GAME_GetImportData(), M_Init(), MAP_InitCallbacks(), R_RegisterSystemVars(), and cgame_import_t::void().
Check both the functiontable and the associated hashtable for invalid entries.
Definition at line 826 of file cmd.cpp.
References cmd_functions, cmd_functions_hash, CMD_HASH_SIZE, Com_Printf(), i, and Q_streq.
|
static |
Definition at line 613 of file cmd.cpp.
References cmd_functions_hash, CMD_HASH_SIZE, Com_HashKey(), hash, and Q_streq.
Referenced by Cmd_AddCommand(), Cmd_AddParamCompleteFunction(), Cmd_AddUserdata(), Cmd_Exists(), Cmd_GetCommandDesc(), and Cmd_GetUserdata().
Definition at line 859 of file cmd.cpp.
References Cmd_RemoveCommand(), and cmdList_t::name.
Referenced by GAME_GetImportData(), M_Shutdown(), MAP_ShutdownCallbacks(), R_Shutdown(), and cgame_import_t::void().
| void Cmd_TokenizeString | ( | const char * | text, |
| bool | macroExpand, | ||
| bool | replaceWhitespaces ) |
Parses the given string into command line tokens.
cmd_argv and cmd_argv are filled and set here | [in] | text | The text to parse and tokenize. Must be null terminated. Does not need to be "\n" terminated. |
| [in] | macroExpand | expand cvar string with their values |
| [in] | replaceWhitespaces | Replace "\\t" and "\\n" to "\t" and "\n" |
Definition at line 565 of file cmd.cpp.
References cmd_argc, cmd_args, cmd_argv, Cmd_BufClear(), Com_Chop(), com_cmdSysPool, Com_MacroExpandString(), Com_Parse(), com_token, Cvar_GetString(), MAX_STRING_TOKENS, Mem_PoolStrDup, and Q_strncpyz().
Referenced by CL_ConnectionlessPacket(), Cmd_vExecuteString(), SV_ConnectionlessPacket(), SV_ExecuteUserCommand(), and TEST_F().
| void Cmd_UnRegisterCmdListener | ( | CmdListenerPtr | listener | ) |
Unregisters a command listener.
| listener | The listener callback to unregister |
Definition at line 878 of file cmd.cpp.
References cmdListeners.
Referenced by GAME_Shutdown().
Return the userdata of the called command.
Definition at line 534 of file cmd.cpp.
References cmd_userdata.
Referenced by UI_ConfuncCommand_f().
| void Cmd_vExecuteString | ( | const char * | fmt, |
| va_list | ap ) |
Definition at line 952 of file cmd.cpp.
References alias_count, ALIAS_HASH_SIZE, ALIAS_LOOP_COUNT, Cbuf_InsertText(), cmd_alias_hash, Cmd_Argc(), Cmd_Argv(), Cmd_ExecuteString(), Cmd_ForwardToServer(), cmd_functions_hash, CMD_HASH_SIZE, Cmd_TokenizeString(), cmd_userdata, Com_DPrintf(), Com_HashKey(), Com_Printf(), Cvar_Command(), DEBUG_COMMANDS, hash, Q_strcasecmp, and Q_vsnprintf().
Referenced by Cmd_ExecuteString(), Cmd_ExecuteString(), and UI_ExecuteConfunc().
Causes execution of the remainder of the command buffer to be delayed until next frame. This allows commands like: bind g "impulse 5; +attack; wait; -attack; impulse 2".
Definition at line 90 of file cmd.cpp.
References cmdWait.
Referenced by Cmd_Init().
Write lines containing "aliasa alias value" for all aliases with the archive flag set to true.
Writes the persistent aliases to the given filehandle.
| f | Filehandle to write the aliases to |
Definition at line 454 of file cmd.cpp.
References cmd_alias, f, FS_Printf(), and i.
Referenced by Cmd_ExecuteString(), and Com_WriteConfigToFile().
|
static |
Definition at line 61 of file cmd.cpp.
Referenced by Cbuf_Execute(), Cmd_Shutdown(), and Cmd_vExecuteString().
|
static |
Definition at line 55 of file cmd.cpp.
Referenced by Cmd_Alias_f(), Cmd_CompleteCommand(), Cmd_List_f(), Cmd_Shutdown(), and Cmd_WriteAliases().
|
static |
Definition at line 56 of file cmd.cpp.
Referenced by Cmd_Alias_f(), Cmd_Shutdown(), and Cmd_vExecuteString().
|
static |
Definition at line 491 of file cmd.cpp.
Referenced by Cmd_Argc(), Cmd_Argv(), Cmd_BufClear(), Cmd_Shutdown(), and Cmd_TokenizeString().
|
static |
Definition at line 493 of file cmd.cpp.
Referenced by Cmd_Args(), Cmd_BufClear(), and Cmd_TokenizeString().
|
static |
Definition at line 492 of file cmd.cpp.
Referenced by Cmd_Argv(), Cmd_BufClear(), Cmd_Shutdown(), and Cmd_TokenizeString().
|
static |
Definition at line 496 of file cmd.cpp.
Referenced by Cmd_AddCommand(), Cmd_CompleteCommand(), Cmd_List_f(), Cmd_RemoveCommand(), Cmd_Shutdown(), and Cmd_TableCheck().
|
static |
Definition at line 497 of file cmd.cpp.
Referenced by Cmd_AddCommand(), Cmd_CompleteCommandParameters(), Cmd_RemoveCommand(), Cmd_Shutdown(), Cmd_TableCheck(), Cmd_TableFind(), and Cmd_vExecuteString().
|
static |
Definition at line 102 of file cmd.cpp.
Referenced by Cbuf_AddText(), Cbuf_CopyToDefer(), Cbuf_Execute(), Cbuf_Init(), Cbuf_InsertText(), and Cbuf_Shutdown().
|
static |
Definition at line 103 of file cmd.cpp.
Referenced by Cbuf_AddText(), Cbuf_CopyToDefer(), and Cbuf_Init().
|
static |
Definition at line 494 of file cmd.cpp.
Referenced by Cmd_BufClear(), Cmd_Userdata(), and Cmd_vExecuteString().
|
static |
Definition at line 58 of file cmd.cpp.
Referenced by Cbuf_AddText(), Cmd_Close_f(), Cmd_Open_f(), and Cmd_Shutdown().
|
static |
Definition at line 54 of file cmd.cpp.
Referenced by Cmd_AddCommand(), Cmd_RegisterCmdListener(), Cmd_RemoveCommand(), and Cmd_UnRegisterCmdListener().
|
static |
Definition at line 57 of file cmd.cpp.
Referenced by Cbuf_Execute(), Cmd_Shutdown(), and Cmd_Wait_f().
|
static |
Definition at line 104 of file cmd.cpp.
Referenced by Cbuf_CopyToDefer(), and Cbuf_InsertFromDefer().