diff --git a/rehlds/engine/cl_null.cpp b/rehlds/engine/cl_null.cpp index 29c8e85..227fd86 100644 --- a/rehlds/engine/cl_null.cpp +++ b/rehlds/engine/cl_null.cpp @@ -52,7 +52,7 @@ cvar_t console; #endif //HOOK_ENGINE -void CL_RecordHUDCommand(char *cmdname) { } +void CL_RecordHUDCommand(const char *cmdname) { } void R_DecalRemoveAll(int textureIndex) { } void CL_CheckForResend(void) { } qboolean CL_CheckFile(sizebuf_t *msg, char *filename) { return 1; } diff --git a/rehlds/engine/client.h b/rehlds/engine/client.h index 8e95c4b..2c7ea63 100644 --- a/rehlds/engine/client.h +++ b/rehlds/engine/client.h @@ -289,7 +289,7 @@ extern cvar_t cl_name; extern cvar_t rate_; extern cvar_t console; -void CL_RecordHUDCommand(char *cmdname); +void CL_RecordHUDCommand(const char *cmdname); void R_DecalRemoveAll(int textureIndex); void CL_CheckForResend(void); qboolean CL_CheckFile(sizebuf_t *msg, char *filename); diff --git a/rehlds/engine/cmd.cpp b/rehlds/engine/cmd.cpp index ca65171..c6f6e30 100644 --- a/rehlds/engine/cmd.cpp +++ b/rehlds/engine/cmd.cpp @@ -417,7 +417,7 @@ void Cmd_Echo_f(void) Con_Printf("\n"); } -char *CopyString(char *in) +char *CopyString(const char *in) { char *out = (char *)Z_Malloc(Q_strlen(in) + 1); Q_strcpy(out, in); @@ -652,7 +652,7 @@ void EXT_FUNC Cmd_TokenizeString(char *text) } } -NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name) +NOXREF cmd_function_t *Cmd_FindCmd(const char *cmd_name) { NOXREFCHECK; @@ -669,7 +669,7 @@ NOXREF cmd_function_t *Cmd_FindCmd(char *cmd_name) return NULL; } -cmd_function_t *Cmd_FindCmdPrev(char *cmd_name) +cmd_function_t *Cmd_FindCmdPrev(const char *cmd_name) { cmd_function_t *cmd = NULL; @@ -715,7 +715,7 @@ void Cmd_InsertCommand(cmd_function_t *cmd) } // Use this for engine inside call only, not from user code, because it doesn't alloc string for the name. -void Cmd_AddCommand(char *cmd_name, xcommand_t function) +void Cmd_AddCommand(const char *cmd_name, xcommand_t function) { cmd_function_t *cmd; @@ -748,7 +748,7 @@ void Cmd_AddCommand(char *cmd_name, xcommand_t function) } // Use this for call from user code, because it alloc string for the name. -void Cmd_AddMallocCommand(char *cmd_name, xcommand_t function, int flag) +void Cmd_AddMallocCommand(const char *cmd_name, xcommand_t function, int flag) { cmd_function_t *cmd; @@ -775,26 +775,26 @@ void Cmd_AddMallocCommand(char *cmd_name, xcommand_t function, int flag) Cmd_InsertCommand(cmd); } -NOXREF void Cmd_AddHUDCommand(char *cmd_name, xcommand_t function) +NOXREF void Cmd_AddHUDCommand(const char *cmd_name, xcommand_t function) { NOXREFCHECK; Cmd_AddMallocCommand(cmd_name, function, FCMD_HUD_COMMAND); } -NOXREF void Cmd_AddWrapperCommand(char *cmd_name, xcommand_t function) +NOXREF void Cmd_AddWrapperCommand(const char *cmd_name, xcommand_t function) { NOXREFCHECK; Cmd_AddMallocCommand(cmd_name, function, FCMD_WRAPPER_COMMAND); } -void EXT_FUNC Cmd_AddGameCommand(char *cmd_name, xcommand_t function) +void EXT_FUNC Cmd_AddGameCommand(const char *cmd_name, xcommand_t function) { Cmd_AddMallocCommand(cmd_name, function, FCMD_GAME_COMMAND); } -void EXT_FUNC Cmd_RemoveCmd(char *cmd_name) +void EXT_FUNC Cmd_RemoveCmd(const char *cmd_name) { auto prev = Cmd_FindCmdPrev(cmd_name); @@ -802,7 +802,7 @@ void EXT_FUNC Cmd_RemoveCmd(char *cmd_name) auto cmd = prev->next; prev->next = cmd->next; - Z_Free(cmd->name); + Z_Free((void*)cmd->name); Mem_Free(cmd); } } @@ -818,7 +818,7 @@ void Cmd_RemoveMallocedCmds(int flag) if (c->flags & flag) { *p = c->next; - Z_Free(c->name); + Z_Free((void*)c->name); Mem_Free(c); c = *p; continue; @@ -862,7 +862,7 @@ qboolean Cmd_Exists(const char *cmd_name) return FALSE; } -NOXREF char *Cmd_CompleteCommand(char *search, int forward) +NOXREF const char *Cmd_CompleteCommand(char *search, int forward) { NOXREFCHECK; diff --git a/rehlds/engine/cmd.h b/rehlds/engine/cmd.h index 6d874dd..ececf8f 100644 --- a/rehlds/engine/cmd.h +++ b/rehlds/engine/cmd.h @@ -93,7 +93,7 @@ void Cbuf_Execute(void); void Cmd_StuffCmds_f(void); void Cmd_Exec_f(void); void Cmd_Echo_f(void); -char *CopyString(char *in); +char *CopyString(const char *in); void Cmd_Alias_f(void); struct cmd_function_s *Cmd_GetFirstCmd(void); void Cmd_Init(void); @@ -102,20 +102,20 @@ int Cmd_Argc(void); 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); -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); +NOXREF cmd_function_t *Cmd_FindCmd(const char *cmd_name); +cmd_function_t *Cmd_FindCmdPrev(const char *cmd_name); +void Cmd_AddCommand(const char *cmd_name, xcommand_t function); +void Cmd_AddMallocCommand(const char *cmd_name, xcommand_t function, int flag); +NOXREF void Cmd_AddHUDCommand(const char *cmd_name, xcommand_t function); +NOXREF void Cmd_AddWrapperCommand(const char *cmd_name, xcommand_t function); +void Cmd_AddGameCommand(const char *cmd_name, xcommand_t function); +void Cmd_RemoveCmd(const char *cmd_name); void Cmd_RemoveMallocedCmds(int flag); NOXREF void Cmd_RemoveHudCmds(void); void Cmd_RemoveGameCmds(void); void Cmd_RemoveWrapperCmds(void); qboolean Cmd_Exists(const char *cmd_name); -NOXREF char *Cmd_CompleteCommand(char *search, int forward); +NOXREF const char *Cmd_CompleteCommand(char *search, int forward); void Cmd_ExecuteString(char *text, cmd_source_t src); qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf); void Cmd_ForwardToServer(void); diff --git a/rehlds/public/rehlds/cmd_rehlds.h b/rehlds/public/rehlds/cmd_rehlds.h index 0f5de26..9337575 100644 --- a/rehlds/public/rehlds/cmd_rehlds.h +++ b/rehlds/public/rehlds/cmd_rehlds.h @@ -33,7 +33,7 @@ typedef void(*xcommand_t)(void); typedef struct cmd_function_s { struct cmd_function_s *next; - char *name; + const char *name; xcommand_t function; int flags; } cmd_function_t; diff --git a/rehlds/public/rehlds/eiface.h b/rehlds/public/rehlds/eiface.h index 8081743..b679719 100644 --- a/rehlds/public/rehlds/eiface.h +++ b/rehlds/public/rehlds/eiface.h @@ -258,7 +258,7 @@ typedef struct enginefuncs_s void (*pfnGetPlayerStats) ( const edict_t *pClient, int *ping, int *packet_loss ); - void (*pfnAddServerCommand) ( char *cmd_name, void (*function) (void) ); + void (*pfnAddServerCommand) ( const char *cmd_name, void (*function) (void) ); // For voice communications, set which clients hear eachother. // NOTE: these functions take player entity indices (starting at 1). diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index b0fbc90..748b8b7 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -282,7 +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); + void(*Cmd_RemoveCmd)(const char *cmd_name); }; class IRehldsApi {