mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
Merge pull request #311 from dreamstalker/cmd_remove_cmd
Added Cmd_RemoveCmd to ReHlds API
This commit is contained in:
commit
b6fe0ac31f
@ -669,10 +669,8 @@ NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NOXREF cmd_function_t *Cmd_FindCmdPrev(char *cmd_name)
|
||||
cmd_function_t *Cmd_FindCmdPrev(char *cmd_name)
|
||||
{
|
||||
NOXREFCHECK;
|
||||
|
||||
cmd_function_t *cmd = NULL;
|
||||
|
||||
if (cmd_functions == NULL)
|
||||
@ -796,6 +794,19 @@ void EXT_FUNC Cmd_AddGameCommand(char *cmd_name, xcommand_t function)
|
||||
Cmd_AddMallocCommand(cmd_name, function, FCMD_GAME_COMMAND);
|
||||
}
|
||||
|
||||
void EXT_FUNC Cmd_RemoveCmd(char *cmd_name)
|
||||
{
|
||||
auto prev = Cmd_FindCmdPrev(cmd_name);
|
||||
|
||||
if (prev) {
|
||||
auto cmd = prev->next;
|
||||
prev->next = cmd->next;
|
||||
|
||||
Z_Free(cmd->name);
|
||||
Mem_Free(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void Cmd_RemoveMallocedCmds(int flag)
|
||||
{
|
||||
cmd_function_t *c, **p;
|
||||
|
@ -103,12 +103,13 @@ const char *Cmd_Argv(int arg);
|
||||
const char *Cmd_Args(void);
|
||||
void Cmd_TokenizeString(char *text);
|
||||
NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name);
|
||||
NOXREF cmd_function_t *Cmd_FindCmdPrev(char *cmd_name);
|
||||
cmd_function_t *Cmd_FindCmdPrev(char *cmd_name);
|
||||
void Cmd_AddCommand(char *cmd_name, xcommand_t function);
|
||||
void Cmd_AddMallocCommand(char *cmd_name, xcommand_t function, int flag);
|
||||
NOXREF void Cmd_AddHUDCommand(char *cmd_name, xcommand_t function);
|
||||
NOXREF void Cmd_AddWrapperCommand(char *cmd_name, xcommand_t function);
|
||||
void Cmd_AddGameCommand(char *cmd_name, xcommand_t function);
|
||||
void Cmd_RemoveCmd(char *cmd_name);
|
||||
void Cmd_RemoveMallocedCmds(int flag);
|
||||
NOXREF void Cmd_RemoveHudCmds(void);
|
||||
void Cmd_RemoveGameCmds(void);
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "model.h"
|
||||
|
||||
#define REHLDS_API_VERSION_MAJOR 3
|
||||
#define REHLDS_API_VERSION_MINOR 0
|
||||
#define REHLDS_API_VERSION_MINOR 1
|
||||
|
||||
//Steam_NotifyClientConnect hook
|
||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||
@ -282,6 +282,7 @@ struct RehldsFuncs_t {
|
||||
bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin);
|
||||
void(*SV_UpdateUserInfo)(IGameClient *pGameClient);
|
||||
bool(*StripUnprintableAndSpace)(char *pch);
|
||||
void(*Cmd_RemoveCmd)(char *cmd_name);
|
||||
};
|
||||
|
||||
class IRehldsApi {
|
||||
|
@ -210,7 +210,8 @@ RehldsFuncs_t g_RehldsApiFuncs =
|
||||
&SV_StartSound_api,
|
||||
&SV_EmitSound2_api,
|
||||
&SV_UpdateUserInfo_api,
|
||||
&StripUnprintableAndSpace_api
|
||||
&StripUnprintableAndSpace_api,
|
||||
&Cmd_RemoveCmd
|
||||
};
|
||||
|
||||
bool EXT_FUNC SV_EmitSound2_internal(edict_t *entity, IGameClient *pReceiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin)
|
||||
|
Loading…
Reference in New Issue
Block a user