diff --git a/rehlds/engine/APIProxy.h b/rehlds/engine/APIProxy.h index 0ac2dcb..15c4c26 100644 --- a/rehlds/engine/APIProxy.h +++ b/rehlds/engine/APIProxy.h @@ -576,7 +576,7 @@ typedef void(*pfnEngDst_pfnGetScreenFade_t) (struct screenfade_s **); typedef void(*pfnEngDst_pfnSetScreenFade_t) (struct screenfade_s **); typedef void(*pfnEngDst_VGui_GetPanel_t) (); typedef void(*pfnEngDst_VGui_ViewportPaintBackground_t) (int **); -typedef void(*pfnEngDst_COM_LoadFile_t) (char **, int *, int **); +typedef void(*pfnEngDst_COM_LoadFile_t) (const char **, int *, int **); typedef void(*pfnEngDst_COM_ParseFile_t) (char **, char **); typedef void(*pfnEngDst_COM_FreeFile_t) (void **); typedef void(*pfnEngDst_IsSpectateOnly_t) (void); diff --git a/rehlds/engine/cmd.cpp b/rehlds/engine/cmd.cpp index 38eaa08..1a8680e 100644 --- a/rehlds/engine/cmd.cpp +++ b/rehlds/engine/cmd.cpp @@ -57,7 +57,7 @@ void Cbuf_Init(void) // As new commands are generated from the console or keybindings, // the text is added to the end of the command buffer. -void Cbuf_AddText(char *text) +void Cbuf_AddText(const char *text) { int len = Q_strlen(text); @@ -73,7 +73,7 @@ void Cbuf_AddText(char *text) // When a command wants to issue other commands immediately, the text is // inserted at the beginning of the buffer, before any remaining unexecuted // commands. -void Cbuf_InsertText(char *text) +void Cbuf_InsertText(const char *text) { int addLen = Q_strlen(text); @@ -112,7 +112,7 @@ void Cbuf_InsertText(char *text) #endif // REHLDS_FIXES } -void Cbuf_InsertTextLines(char *text) +void Cbuf_InsertTextLines(const char *text) { int addLen = Q_strlen(text); int currLen = cmd_text.cursize; @@ -862,7 +862,7 @@ qboolean Cmd_Exists(const char *cmd_name) return FALSE; } -NOXREF const char *Cmd_CompleteCommand(char *search, int forward) +NOXREF const char *Cmd_CompleteCommand(const char *search, int forward) { NOXREFCHECK; @@ -1057,7 +1057,7 @@ qboolean Cmd_ForwardToServerUnreliable(void) // Returns the position (1 to argc-1) in the command's argument list // where the given parameter apears, or 0 if not present. -NOXREF int Cmd_CheckParm(char *parm) +NOXREF int Cmd_CheckParm(const char *parm) { NOXREFCHECK; diff --git a/rehlds/engine/cmd.h b/rehlds/engine/cmd.h index ececf8f..c685544 100644 --- a/rehlds/engine/cmd.h +++ b/rehlds/engine/cmd.h @@ -86,9 +86,9 @@ extern cmdalias_t *cmd_alias; void Cmd_Wait_f(void); void Cbuf_Init(void); -void Cbuf_AddText(char *text); -void Cbuf_InsertText(char *text); -void Cbuf_InsertTextLines(char *text); +void Cbuf_AddText(const char *text); +void Cbuf_InsertText(const char *text); +void Cbuf_InsertTextLines(const char *text); void Cbuf_Execute(void); void Cmd_StuffCmds_f(void); void Cmd_Exec_f(void); @@ -115,10 +115,10 @@ NOXREF void Cmd_RemoveHudCmds(void); void Cmd_RemoveGameCmds(void); void Cmd_RemoveWrapperCmds(void); qboolean Cmd_Exists(const char *cmd_name); -NOXREF const char *Cmd_CompleteCommand(char *search, int forward); +NOXREF const char *Cmd_CompleteCommand(const char *search, int forward); void Cmd_ExecuteString(char *text, cmd_source_t src); qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf); void Cmd_ForwardToServer(void); qboolean Cmd_ForwardToServerUnreliable(void); -NOXREF int Cmd_CheckParm(char *parm); +NOXREF int Cmd_CheckParm(const char *parm); void Cmd_CmdList_f(void); diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index 4b36514..169b688 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -1973,7 +1973,7 @@ NOXREF int COM_ExpandFilename(char *filename) return *filename != 0; } -int EXT_FUNC COM_FileSize(char *filename) +int EXT_FUNC COM_FileSize(const char *filename) { FileHandle_t fp; int iSize; @@ -2385,7 +2385,7 @@ void COM_Log(char *pszFile, char *fmt, ...) } } -unsigned char* EXT_FUNC COM_LoadFileForMe(char *filename, int *pLength) +unsigned char* EXT_FUNC COM_LoadFileForMe(const char *filename, int *pLength) { return COM_LoadFile(filename, 5, pLength); } diff --git a/rehlds/engine/common.h b/rehlds/engine/common.h index 3ea8174..6c30045 100644 --- a/rehlds/engine/common.h +++ b/rehlds/engine/common.h @@ -317,7 +317,7 @@ void COM_FixSlashes(char *pname); void COM_CreatePath(char *path); NOXREF void COM_CopyFile(char *netpath, char *cachepath); NOXREF int COM_ExpandFilename(char *filename); -int COM_FileSize(char *filename); +int COM_FileSize(const char *filename); unsigned char *COM_LoadFile(const char *path, int usehunk, int *pLength); void COM_FreeFile(void *buffer); void COM_CopyFileChunk(FileHandle_t dst, FileHandle_t src, int nSize); @@ -335,7 +335,7 @@ qboolean COM_SetupDirectories(void); void COM_CheckPrintMap(dheader_t *header, const char *mapname, qboolean bShowOutdated); void COM_ListMaps(char *pszSubString); void COM_Log(char *pszFile, char *fmt, ...); -unsigned char *COM_LoadFileForMe(char *filename, int *pLength); +unsigned char *COM_LoadFileForMe(const char *filename, int *pLength); int COM_CompareFileTime(char *filename1, char *filename2, int *iCompare); void COM_GetGameDir(char *szGameDir); int COM_EntsForPlayerSlots(int nPlayers); diff --git a/rehlds/engine/delta.cpp b/rehlds/engine/delta.cpp index d6f029d..6b242e6 100644 --- a/rehlds/engine/delta.cpp +++ b/rehlds/engine/delta.cpp @@ -993,7 +993,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) return MSG_CurrentBit() - startbit; } -void EXT_FUNC DELTA_AddEncoder(char *name, void(*conditionalencode)(struct delta_s *, const unsigned char *, const unsigned char *)) +void EXT_FUNC DELTA_AddEncoder(const char *name, void(*conditionalencode)(struct delta_s *, const unsigned char *, const unsigned char *)) { delta_encoder_t *p = (delta_encoder_t *)Mem_ZeroMalloc(sizeof(delta_encoder_t)); p->name = Mem_Strdup(name); diff --git a/rehlds/engine/delta.h b/rehlds/engine/delta.h index 92b439e..953530e 100644 --- a/rehlds/engine/delta.h +++ b/rehlds/engine/delta.h @@ -136,7 +136,7 @@ qboolean DELTA_WriteDeltaForceMask(unsigned char *from, unsigned char *to, qbool qboolean DELTA_WriteDelta(unsigned char *from, unsigned char *to, qboolean force, delta_t *pFields, void(*callback)(void)); qboolean _DELTA_WriteDelta(unsigned char *from, unsigned char *to, qboolean force, delta_t *pFields, void(*callback)(void), qboolean sendfields); int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields); -void DELTA_AddEncoder(char *name, void(*conditionalencode)(struct delta_s *, const unsigned char *, const unsigned char *)); +void DELTA_AddEncoder(const char *name, void(*conditionalencode)(struct delta_s *, const unsigned char *, const unsigned char *)); void DELTA_ClearEncoders(void); encoder_t DELTA_LookupEncoder(char *name); int DELTA_CountLinks(delta_link_t *plinks); diff --git a/rehlds/engine/host_cmd.cpp b/rehlds/engine/host_cmd.cpp index c79c33f..8bfb1e3 100644 --- a/rehlds/engine/host_cmd.cpp +++ b/rehlds/engine/host_cmd.cpp @@ -1839,9 +1839,10 @@ void ParseSaveTables(SAVERESTOREDATA *pSaveData, SAVE_HEADER *pHeader, int updat gEntityInterface.pfnSaveReadFields(pSaveData, "LIGHTSTYLE", &light, gLightstyleDescription, ARRAYSIZE(gLightstyleDescription)); if (updateGlobals) { - g_psv.lightstyles[light.index] = (char *)Hunk_Alloc(Q_strlen(light.style) + 1); - Q_strncpy(g_psv.lightstyles[light.index], light.style, 3); - g_psv.lightstyles[light.index][3] = 0; + char *val = (char *)Hunk_Alloc(Q_strlen(light.style) + 1); + Q_strncpy(val, light.style, 3); + val[3] = 0; + g_psv.lightstyles[light.index] = val; } } } diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index ba88336..8ff8e5f 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -816,7 +816,7 @@ qboolean EXT_FUNC ValidCmd(const char *pCmd) return len && (pCmd[len - 1] == '\n' || pCmd[len - 1] == ';'); } -void EXT_FUNC PF_stuffcmd_I(edict_t *pEdict, char *szFmt, ...) +void EXT_FUNC PF_stuffcmd_I(edict_t *pEdict, const char *szFmt, ...) { int entnum; client_t *old; @@ -850,7 +850,7 @@ void EXT_FUNC PF_stuffcmd_I(edict_t *pEdict, char *szFmt, ...) } } -void EXT_FUNC PF_localcmd_I(char *str) +void EXT_FUNC PF_localcmd_I(const char *str) { if (ValidCmd(str)) Cbuf_AddText(str); @@ -1457,7 +1457,7 @@ int EXT_FUNC PF_precache_model_I(const char *s) } #ifdef REHLDS_FIXES -int EXT_FUNC PF_precache_generic_I(char *s) +int EXT_FUNC PF_precache_generic_I(const char *s) { if (!s) Host_Error("%s: NULL pointer", __func__); @@ -1504,7 +1504,7 @@ int EXT_FUNC PF_precache_generic_I(char *s) return g_rehlds_sv.precachedGenericResourceCount++; } #else // REHLDS_FIXES -int EXT_FUNC PF_precache_generic_I(char *s) +int EXT_FUNC PF_precache_generic_I(const char *s) { if (!s) Host_Error("%s: NULL pointer", __func__); @@ -1544,7 +1544,7 @@ int EXT_FUNC PF_precache_generic_I(char *s) } #endif // REHLDS_FIXES -int EXT_FUNC PF_IsMapValid_I(char *mapname) +int EXT_FUNC PF_IsMapValid_I(const char *mapname) { char cBuf[260]; if (!mapname || Q_strlen(mapname) == 0) @@ -1710,7 +1710,7 @@ int EXT_FUNC PF_DecalIndex(const char *name) return -1; } -void EXT_FUNC PF_lightstyle_I(int style, char *val) +void EXT_FUNC PF_lightstyle_I(int style, const char *val) { g_psv.lightstyles[style] = val; if (g_psv.state != ss_active) diff --git a/rehlds/engine/pr_cmds.h b/rehlds/engine/pr_cmds.h index 553615f..620561f 100644 --- a/rehlds/engine/pr_cmds.h +++ b/rehlds/engine/pr_cmds.h @@ -129,8 +129,8 @@ mnode_t *PVSNode(mnode_t *node, vec_t *emins, vec_t *emaxs); void PVSMark(model_t *pmodel, unsigned char *ppvs); edict_t *PVSFindEntities(edict_t *pplayer); qboolean ValidCmd(const char *pCmd); -void PF_stuffcmd_I(edict_t *pEdict, char *szFmt, ...); -void PF_localcmd_I(char *str); +void PF_stuffcmd_I(edict_t *pEdict, const char *szFmt, ...); +void PF_localcmd_I(const char *str); void PF_localexec_I(void); edict_t *FindEntityInSphere(edict_t *pEdictStartSearchAfter, const float *org, float rad); edict_t *PF_Spawn_I(void); @@ -150,8 +150,8 @@ void EV_PlayReliableEvent_internal(client_t *cl, int entindex, unsigned short ev void EV_Playback(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2); void EV_SV_Playback(int flags, int clientindex, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2); int PF_precache_model_I(const char *s); -int PF_precache_generic_I(char *s); -int PF_IsMapValid_I(char *mapname); +int PF_precache_generic_I(const char *s); +int PF_IsMapValid_I(const char *mapname); int PF_NumberOfEntities_I(void); char *PF_GetInfoKeyBuffer_I(edict_t *e); char *PF_InfoKeyValue_I(char *infobuffer, const char *key); @@ -161,7 +161,7 @@ void PF_SetClientKeyValue_I(int clientIndex, char *infobuffer, const char *key, int PF_walkmove_I(edict_t *ent, float yaw, float dist, int iMode); int PF_droptofloor_I(edict_t *ent); int PF_DecalIndex(const char *name); -void PF_lightstyle_I(int style, char *val); +void PF_lightstyle_I(int style, const char *val); int PF_checkbottom_I(edict_t *pEdict); int PF_pointcontents_I(const float *rgflVector); void PF_aim_I(edict_t *ent, float speed, float *rgflReturn); diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index 93fbaf3..1d57c19 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -129,7 +129,7 @@ typedef struct server_s const char *generic_precache[MAX_GENERIC]; char generic_precache_names[MAX_GENERIC][64]; int num_generic_names; - char *lightstyles[MAX_LIGHTSTYLES]; + const char *lightstyles[MAX_LIGHTSTYLES]; int num_edicts; int max_edicts; edict_t *edicts; diff --git a/rehlds/pm_shared/pm_defs.h b/rehlds/pm_shared/pm_defs.h index 1a5f01d..7350c1a 100644 --- a/rehlds/pm_shared/pm_defs.h +++ b/rehlds/pm_shared/pm_defs.h @@ -208,7 +208,7 @@ typedef struct playermove_s void (*PM_GetModelBounds)( struct model_s *mod, float *mins, float *maxs ); void *(*PM_HullForBsp)( physent_t *pe, float *offset ); float (*PM_TraceModel)( physent_t *pEnt, float *start, float *end, trace_t *trace ); - int (*COM_FileSize)(char *filename); + int (*COM_FileSize)(const char *filename); byte *(*COM_LoadFile) (const char *path, int usehunk, int *pLength); void (*COM_FreeFile) ( void *buffer ); char *(*memfgets)( byte *pMemFile, int fileSize, int *pFilePos, char *pBuffer, int bufferSize ); diff --git a/rehlds/public/rehlds/eiface.h b/rehlds/public/rehlds/eiface.h index b679719..b9aceee 100644 --- a/rehlds/public/rehlds/eiface.h +++ b/rehlds/public/rehlds/eiface.h @@ -144,11 +144,11 @@ typedef struct enginefuncs_s const char *(*pfnTraceTexture) (edict_t *pTextureEntity, const float *v1, const float *v2 ); void (*pfnTraceSphere) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr); void (*pfnGetAimVector) (edict_t* ent, float speed, float *rgflReturn); - void (*pfnServerCommand) (char* str); + void (*pfnServerCommand) (const char* str); void (*pfnServerExecute) (void); - void (*pfnClientCommand) (edict_t* pEdict, char* szFmt, ...); + void (*pfnClientCommand) (edict_t* pEdict, const char* szFmt, ...); void (*pfnParticleEffect) (const float *org, const float *dir, float color, float count); - void (*pfnLightStyle) (int style, char* val); + void (*pfnLightStyle) (int style, const char* val); int (*pfnDecalIndex) (const char *name); int (*pfnPointContents) (const float *rgflVector); void (*pfnMessageBegin) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); @@ -200,7 +200,7 @@ typedef struct enginefuncs_s void (*pfnSetView) (const edict_t *pClient, const edict_t *pViewent ); float (*pfnTime) ( void ); void (*pfnCrosshairAngle) (const edict_t *pClient, float pitch, float yaw); - byte * (*pfnLoadFileForMe) (char *filename, int *pLength); + byte * (*pfnLoadFileForMe) (const char *filename, int *pLength); void (*pfnFreeFile) (void *buffer); void (*pfnEndSection) (const char *pszSectionName); // trigger_endsection int (*pfnCompareFileTime) (char *filename1, char *filename2, int *iCompare); @@ -215,9 +215,9 @@ typedef struct enginefuncs_s char* (*pfnInfoKeyValue) (char *infobuffer, const char *key); void (*pfnSetKeyValue) (char *infobuffer, const char *key, const char *value); void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, const char *key, const char *value); - int (*pfnIsMapValid) (char *filename); + int (*pfnIsMapValid) (const char *filename); void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); - int (*pfnPrecacheGeneric) (char* s); + int (*pfnPrecacheGeneric) (const char* s); int (*pfnGetPlayerUserId) (edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients void (*pfnBuildSoundMsg) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); int (*pfnIsDedicatedServer) (void);// is this a dedicated server? @@ -239,7 +239,7 @@ typedef struct enginefuncs_s void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname ); void (*pfnDeltaUnsetField) ( struct delta_s *pFields, const char *fieldname ); - void (*pfnDeltaAddEncoder) ( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); + void (*pfnDeltaAddEncoder) ( const char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) ); int (*pfnGetCurrentPlayer) ( void ); int (*pfnCanSkipPlayer) ( const edict_t *player ); int (*pfnDeltaFindField) ( struct delta_s *pFields, const char *fieldname ); @@ -274,7 +274,7 @@ typedef struct enginefuncs_s sentenceEntry_s* (*pfnSequencePickSentence) ( const char* groupName, int pickMethod, int *picked ); // LH: Give access to filesize via filesystem - int (*pfnGetFileSize) ( char *filename ); + int (*pfnGetFileSize) ( const char *filename ); unsigned int (*pfnGetApproxWavePlayLen) (const char *filepath); // MDC: Added for CZ career-mode