More binary-compatible const char fixes to support newer compilers.
authorScott Ehlert <ds@alliedmods.net>
Tue Feb 12 00:45:53 2013 -0600 (2013-02-12)
changeset 8646c28acea3a
parent 7 4c74b35a811b
child 9 71f739086823
More binary-compatible const char fixes to support newer compilers.
multiplayer/common/cvardef.h
multiplayer/dlls/extdll.h
multiplayer/dlls/util.cpp
multiplayer/dlls/util.h
multiplayer/engine/eiface.h
     1.1 --- a/multiplayer/common/cvardef.h	Thu Feb 07 22:54:07 2013 -0800
     1.2 +++ b/multiplayer/common/cvardef.h	Tue Feb 12 00:45:53 2013 -0600
     1.3 @@ -27,10 +27,10 @@
     1.4  
     1.5  typedef struct cvar_s
     1.6  {
     1.7 -	char	*name;
     1.8 -	char	*string;
     1.9 -	int		flags;
    1.10 -	float	value;
    1.11 +	const char *name;
    1.12 +	const char *string;
    1.13 +	int flags;
    1.14 +	float value;
    1.15  	struct cvar_s *next;
    1.16  } cvar_t;
    1.17  #endif
     2.1 --- a/multiplayer/dlls/extdll.h	Thu Feb 07 22:54:07 2013 -0800
     2.2 +++ b/multiplayer/dlls/extdll.h	Tue Feb 12 00:45:53 2013 -0600
     2.3 @@ -51,8 +51,12 @@
     2.4  #define NOIME
     2.5  #include "windows.h"
     2.6  #else // _WIN32
     2.7 +#ifndef FALSE
     2.8  #define FALSE 0
     2.9 +#endif
    2.10 +#ifndef TRUE
    2.11  #define TRUE (!FALSE)
    2.12 +#endif
    2.13  typedef unsigned long ULONG;
    2.14  typedef unsigned char BYTE;
    2.15  typedef int BOOL;
     3.1 --- a/multiplayer/dlls/util.cpp	Thu Feb 07 22:54:07 2013 -0800
     3.2 +++ b/multiplayer/dlls/util.cpp	Tue Feb 12 00:45:53 2013 -0600
     3.3 @@ -1593,7 +1593,7 @@
     3.4  // UTIL_LogPrintf - Prints a logged message to console.
     3.5  // Preceded by LOG: ( timestamp ) < message >
     3.6  //=========================================================
     3.7 -void UTIL_LogPrintf( char *fmt, ... )
     3.8 +void UTIL_LogPrintf( const char *fmt, ... )
     3.9  {
    3.10  	va_list			argptr;
    3.11  	static char		string[1024];
     4.1 --- a/multiplayer/dlls/util.h	Thu Feb 07 22:54:07 2013 -0800
     4.2 +++ b/multiplayer/dlls/util.h	Tue Feb 12 00:45:53 2013 -0600
     4.3 @@ -76,7 +76,9 @@
     4.4  typedef int BOOL;
     4.5  
     4.6  // In case this ever changes
     4.7 +#ifndef M_PI
     4.8  #define M_PI			3.14159265358979323846
     4.9 +#endif
    4.10  
    4.11  // Keeps clutter down a bit, when declaring external entity/global method prototypes
    4.12  #define DECLARE_GLOBAL_METHOD(MethodName)  extern void DLLEXPORT MethodName( void )
    4.13 @@ -246,7 +248,7 @@
    4.14  typedef enum { ignore_glass=1, dont_ignore_glass=0 } IGNORE_GLASS;
    4.15  extern void			UTIL_TraceLine			(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr);
    4.16  extern void			UTIL_TraceLine			(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr);
    4.17 -enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 };
    4.18 +typedef enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 } HULL_TYPE;
    4.19  extern void			UTIL_TraceHull			(const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr);
    4.20  extern TraceResult	UTIL_GetGlobalTrace		(void);
    4.21  extern void			UTIL_TraceModel			(const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr);
    4.22 @@ -331,7 +333,7 @@
    4.23  extern char *UTIL_dtos4( int d );
    4.24  
    4.25  // Writes message to console with timestamp and FragLog header.
    4.26 -extern void			UTIL_LogPrintf( char *fmt, ... );
    4.27 +extern void			UTIL_LogPrintf( const char *fmt, ... );
    4.28  
    4.29  // Sorta like FInViewCone, but for nonmonsters. 
    4.30  extern float UTIL_DotPoints ( const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir );
     5.1 --- a/multiplayer/engine/eiface.h	Thu Feb 07 22:54:07 2013 -0800
     5.2 +++ b/multiplayer/engine/eiface.h	Tue Feb 12 00:45:53 2013 -0600
     5.3 @@ -104,13 +104,13 @@
     5.4  // Engine hands this to DLLs for functionality callbacks
     5.5  typedef struct enginefuncs_s
     5.6  {
     5.7 -	int			(*pfnPrecacheModel)			(char* s);
     5.8 -	int			(*pfnPrecacheSound)			(char* s);
     5.9 +	int			(*pfnPrecacheModel)			(const char* s);
    5.10 +	int			(*pfnPrecacheSound)			(const char* s);
    5.11  	void		(*pfnSetModel)				(edict_t *e, const char *m);
    5.12  	int			(*pfnModelIndex)			(const char *m);
    5.13  	int			(*pfnModelFrames)			(int modelIndex);
    5.14  	void		(*pfnSetSize)				(edict_t *e, const float *rgflMin, const float *rgflMax);
    5.15 -	void		(*pfnChangeLevel)			(char* s1, char* s2);
    5.16 +	void		(*pfnChangeLevel)			(const char* s1, const char* s2);
    5.17  	void		(*pfnGetSpawnParms)			(edict_t *ent);
    5.18  	void		(*pfnSaveSpawnParms)		(edict_t *ent);
    5.19  	float		(*pfnVecToYaw)				(const float *rgflVector);
    5.20 @@ -143,7 +143,7 @@
    5.21  	const char *(*pfnTraceTexture)			(edict_t *pTextureEntity, const float *v1, const float *v2 );
    5.22  	void		(*pfnTraceSphere)			(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
    5.23  	void		(*pfnGetAimVector)			(edict_t* ent, float speed, float *rgflReturn);
    5.24 -	void		(*pfnServerCommand)			(char* str);
    5.25 +	void		(*pfnServerCommand)			(const char* str);
    5.26  	void		(*pfnServerExecute)			(void);
    5.27  	void		(*pfnClientCommand)			(edict_t* pEdict, const char* szFmt, ...);
    5.28  	void		(*pfnParticleEffect)		(const float *org, const float *dir, float color, float count);
    5.29 @@ -166,7 +166,7 @@
    5.30  	void		(*pfnCVarSetFloat)			(const char *szVarName, float flValue);
    5.31  	void		(*pfnCVarSetString)			(const char *szVarName, const char *szValue);
    5.32  	void		(*pfnAlertMessage)			(ALERT_TYPE atype, const char *szFmt, ...);
    5.33 -	void		(*pfnEngineFprintf)			(void *pfile, char *szFmt, ...);
    5.34 +	void		(*pfnEngineFprintf)			(void *pfile, const char *szFmt, ...);
    5.35  	void*		(*pfnPvAllocEntPrivateData)	(edict_t *pEdict, int32 cb);
    5.36  	void*		(*pfnPvEntPrivateData)		(edict_t *pEdict);
    5.37  	void		(*pfnFreeEntPrivateData)	(edict_t *pEdict);
    5.38 @@ -211,12 +211,12 @@
    5.39  	void		(*pfnRunPlayerMove)			(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
    5.40  	int			(*pfnNumberOfEntities)		(void);
    5.41  	char*		(*pfnGetInfoKeyBuffer)		(edict_t *e);	// passing in NULL gets the serverinfo
    5.42 -	char*		(*pfnInfoKeyValue)			(char *infobuffer, char *key);
    5.43 -	void		(*pfnSetKeyValue)			(char *infobuffer, char *key, char *value);
    5.44 -	void		(*pfnSetClientKeyValue)		(int clientIndex, char *infobuffer, char *key, char *value);
    5.45 -	int			(*pfnIsMapValid)			(char *filename);
    5.46 +	char*		(*pfnInfoKeyValue)			(char *infobuffer, const char *key);
    5.47 +	void		(*pfnSetKeyValue)			(char *infobuffer, const char *key, const char *value);
    5.48 +	void		(*pfnSetClientKeyValue)		(int clientIndex, char *infobuffer, const char *key, const char *value);
    5.49 +	int			(*pfnIsMapValid)			(const char *filename);
    5.50  	void		(*pfnStaticDecal)			( const float *origin, int decalIndex, int entityIndex, int modelIndex );
    5.51 -	int			(*pfnPrecacheGeneric)		(char* s);
    5.52 +	int			(*pfnPrecacheGeneric)		(const char* s);
    5.53  	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
    5.54  	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);
    5.55  	int			(*pfnIsDedicatedServer)		(void);// is this a dedicated server?
    5.56 @@ -228,7 +228,7 @@
    5.57  	const char *(*pfnGetPhysicsKeyValue)	( const edict_t *pClient, const char *key );
    5.58  	void		(*pfnSetPhysicsKeyValue)	( const edict_t *pClient, const char *key, const char *value );
    5.59  	const char *(*pfnGetPhysicsInfoString)	( const edict_t *pClient );
    5.60 -	unsigned short (*pfnPrecacheEvent)		( int type, const char*psz );
    5.61 +	unsigned short (*pfnPrecacheEvent)		( int type, const char* psz );
    5.62  	void		(*pfnPlaybackEvent)			( 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 );
    5.63  
    5.64  	unsigned char *(*pfnSetFatPVS)			( float *org );
    5.65 @@ -257,7 +257,7 @@
    5.66  
    5.67  	void		(*pfnGetPlayerStats)		( const edict_t *pClient, int *ping, int *packet_loss );
    5.68  
    5.69 -	void		(*pfnAddServerCommand)		( char *cmd_name, void (*function) (void) );
    5.70 +	void		(*pfnAddServerCommand)		( const char *cmd_name, void (*function) (void) );
    5.71  
    5.72  	// For voice communications, set which clients hear eachother.
    5.73  	// NOTE: these functions take player entity indices (starting at 1).
    5.74 @@ -273,7 +273,7 @@
    5.75  	sentenceEntry_s*	(*pfnSequencePickSentence)		( const char* groupName, int pickMethod, int *picked );
    5.76  
    5.77  	// LH: Give access to filesize via filesystem
    5.78 -	int			(*pfnGetFileSize)						( char *filename );
    5.79 +	int			(*pfnGetFileSize)						( const char *filename );
    5.80  
    5.81  	unsigned int (*pfnGetApproxWavePlayLen)				(const char *filepath);
    5.82  	// MDC: Added for CZ career-mode
    5.83 @@ -300,9 +300,9 @@
    5.84  // Passed to pfnKeyValue
    5.85  typedef struct KeyValueData_s
    5.86  {
    5.87 -	char	*szClassName;	// in: entity classname
    5.88 -	char	*szKeyName;		// in: name of key
    5.89 -	char	*szValue;		// in: value of key
    5.90 +	const char *szClassName;	// in: entity classname
    5.91 +	const char *szKeyName;		// in: name of key
    5.92 +	const char *szValue;		// in: value of key
    5.93  	int32	fHandled;		// out: DLL sets to true if key-value pair was understood
    5.94  } KeyValueData;
    5.95  
    5.96 @@ -472,7 +472,7 @@
    5.97  
    5.98  	void			(*pfnPM_Move) ( struct playermove_s *ppmove, qboolean server );
    5.99  	void			(*pfnPM_Init) ( struct playermove_s *ppmove );
   5.100 -	char			(*pfnPM_FindTextureType)( char *name );
   5.101 +	char			(*pfnPM_FindTextureType)( const char *name );
   5.102  	void			(*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas );
   5.103  	void			(*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd );
   5.104  	int				(*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet );