Fix missing const-qualifiers in engine code. Fix qboolean/int mixing in interface implementations(int is preferred). Replace long by int in COM_RandomLong.

This commit is contained in:
Alibek Omarov
2018-04-23 23:07:54 +03:00
parent e1f80fba3d
commit efe8ddf151
44 changed files with 143 additions and 138 deletions

View File

@@ -1014,7 +1014,7 @@ void CL_StopPlayback( void )
CL_GetDemoComment
==================
*/
qboolean CL_GetDemoComment( const char *demoname, char *comment )
int CL_GetDemoComment( const char *demoname, char *comment )
{
file_t *demfile;
demoheader_t demohdr;
@@ -1461,4 +1461,4 @@ void CL_Stop_f( void )
{
S_StopBackgroundTrack();
}
}
}

View File

@@ -3243,7 +3243,7 @@ TriCullFace
=============
*/
void TriCullFace( int mode )
void TriCullFace( TRICULLSTYLE mode )
{
switch( mode )
{

View File

@@ -83,7 +83,7 @@ client_static_t cls;
clgame_static_t clgame;
//======================================================================
qboolean CL_Active( void )
int CL_Active( void )
{
return ( cls.state == ca_active );
}
@@ -878,7 +878,7 @@ CL_BeginUpload_f
*/
void CL_BeginUpload_f( void )
{
char *name;
const char *name;
resource_t custResource;
byte *buf = NULL;
int size = 0;
@@ -986,7 +986,7 @@ connect.
void CL_SendConnectPacket( void )
{
char protinfo[MAX_INFO_STRING];
char *qport;
const char *qport;
const char *key;
netadr_t adr;
@@ -1583,7 +1583,7 @@ void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg, const char *s )
static char infostring[MAX_INFO_STRING+8];
int i, context, type;
int errorBits = 0;
char *val;
const char *val;
context = Q_atoi( Cmd_Argv( 1 ));
type = Q_atoi( Cmd_Argv( 2 ));
@@ -1704,7 +1704,8 @@ Responses to broadcasts, etc
void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
{
char *args;
char *c, buf[MAX_SYSPATH];
const char *c;
char buf[MAX_SYSPATH];
int len = sizeof( buf );
int dataoffset = 0;
netadr_t servadr;
@@ -1870,7 +1871,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
nr->pfnFunc( &nr->resp );
// throw the list, now it will be stored in user area
prev = &nr->resp.response;
prev = (net_adrlist_t**)&nr->resp.response;
while( 1 )
{

View File

@@ -992,7 +992,7 @@ void CL_InitClientMove( void )
clgame.pmove->RandomFloat = COM_RandomFloat;
clgame.pmove->PM_GetModelType = pfnGetModelType;
clgame.pmove->PM_GetModelBounds = pfnGetModelBounds;
clgame.pmove->PM_HullForBsp = pfnHullForBsp;
clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp;
clgame.pmove->PM_TraceModel = pfnTraceModel;
clgame.pmove->COM_FileSize = COM_FileSize;
clgame.pmove->COM_LoadFile = COM_LoadFile;
@@ -1407,4 +1407,4 @@ void CL_PredictMovement( qboolean repredicting )
VectorCopy( cl.simorg, cl.local.lastorigin );
cl.local.repredicting = false;
}
}

View File

@@ -16,6 +16,8 @@ GNU General Public License for more details.
#ifndef CL_TENT_H
#define CL_TENT_H
#include "triangleapi.h"
// EfxAPI
struct particle_s *R_AllocParticle( void (*callback)( struct particle_s*, float ));
void R_Explosion( vec3_t pos, int model, float scale, float framerate, int flags );
@@ -111,10 +113,10 @@ int TriWorldToScreen( float *world, float *screen );
void TriColor4ub( byte r, byte g, byte b, byte a );
void TriBrightness( float brightness );
void TriRenderMode( int mode );
void TriCullFace( int mode );
void TriCullFace( TRICULLSTYLE mode );
void TriEnd( void );
extern model_t *cl_sprite_dot;
extern model_t *cl_sprite_shell;
#endif//CL_TENT_H
#endif//CL_TENT_H

View File

@@ -988,7 +988,7 @@ void CL_RunLightStyles( void );
// console.c
//
extern convar_t *con_fontsize;
qboolean Con_Visible( void );
int Con_Visible( void );
qboolean Con_FixedFont( void );
void Con_VidInit( void );
void Con_Shutdown( void );

View File

@@ -130,8 +130,8 @@ typedef struct
// console auto-complete
string shortestMatch;
field_t *completionField; // con.input or dedicated server fake field-line
char *completionString;
char *completionBuffer;
const char *completionString;
const char *completionBuffer;
char *cmds[CON_MAXCMDS];
int matchCount;
} console_t;
@@ -537,7 +537,7 @@ void Con_Bottom( void )
Con_Visible
================
*/
qboolean Con_Visible( void )
int Con_Visible( void )
{
return (con.vislines > 0);
}
@@ -1245,7 +1245,7 @@ Con_NPrint
Draw a single debug line with specified height
================
*/
void Con_NPrintf( int idx, char *fmt, ... )
void Con_NPrintf( int idx, const char *fmt, ... )
{
va_list args;
@@ -1272,7 +1272,7 @@ Con_NXPrint
Draw a single debug line with specified height, color and time to live
================
*/
void Con_NXPrintf( con_nprint_t *info, char *fmt, ... )
void Con_NXPrintf( con_nprint_t *info, const char *fmt, ... )
{
va_list args;
@@ -1301,7 +1301,7 @@ UI_NPrint
Draw a single debug line with specified height (menu version)
================
*/
void UI_NPrintf( int idx, char *fmt, ... )
void UI_NPrintf( int idx, const char *fmt, ... )
{
va_list args;
@@ -1328,7 +1328,7 @@ UI_NXPrint
Draw a single debug line with specified height, color and time to live (menu version)
================
*/
void UI_NXPrintf( con_nprint_t *info, char *fmt, ... )
void UI_NXPrintf( con_nprint_t *info, const char *fmt, ... )
{
va_list args;
@@ -1419,7 +1419,7 @@ Con_ConcatRemaining
*/
static void Con_ConcatRemaining( const char *src, const char *start )
{
char *arg;
const char *arg;
int i;
arg = Q_strstr( src, start );

View File

@@ -198,7 +198,7 @@ void GL_FrustumInitProjFromMatrix( gl_frustum_t *out, const matrix4x4 projection
void GL_FrustumComputeCorners( gl_frustum_t *out, vec3_t corners[8] )
{
memset( corners, 0, sizeof( corners ));
memset( corners, 0, sizeof( vec3_t ) * 8 );
PlanesGetIntersectionPoint( &out->planes[FRUSTUM_LEFT], &out->planes[FRUSTUM_TOP], &out->planes[FRUSTUM_FAR], corners[0] );
PlanesGetIntersectionPoint( &out->planes[FRUSTUM_RIGHT], &out->planes[FRUSTUM_TOP], &out->planes[FRUSTUM_FAR], corners[1] );
@@ -352,4 +352,4 @@ qboolean GL_FrustumCullSphere( gl_frustum_t *out, const vec3_t center, float rad
}
return false;
}
}

View File

@@ -459,7 +459,7 @@ void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, f
qboolean R_SpeedsMessage( char *out, size_t size );
void R_SetupSky( const char *skyboxname );
qboolean R_CullBox( const vec3_t mins, const vec3_t maxs );
qboolean R_WorldToScreen( const vec3_t point, vec3_t screen );
int R_WorldToScreen( const vec3_t point, vec3_t screen );
void R_ScreenToWorld( const vec3_t screen, vec3_t point );
qboolean R_AddEntity( struct cl_entity_s *pRefEntity, int entityType );
void Mod_LoadMapSprite( struct model_s *mod, const void *buffer, size_t size, qboolean *loaded );

View File

@@ -136,7 +136,7 @@ Convert a given point from world into screen space
Returns true if we behind to screen
===============
*/
qboolean R_WorldToScreen( const vec3_t point, vec3_t screen )
int R_WorldToScreen( const vec3_t point, vec3_t screen )
{
matrix4x4 worldToScreen;
qboolean behind;
@@ -1275,7 +1275,7 @@ R_EnvShot
=================
*/
static void R_EnvShot( const float *vieworg, const char *name, int skyshot, int shotsize )
static void R_EnvShot( const float *vieworg, const char *name, qboolean skyshot, int shotsize )
{
static vec3_t viewPoint;
@@ -1469,13 +1469,13 @@ static render_api_t gRenderAPI =
DrawSingleDecal,
R_DecalSetupVerts,
R_EntityRemoveDecals,
AVI_LoadVideoNoSound,
AVI_GetVideoInfo,
AVI_GetVideoFrameNumber,
AVI_GetVideoFrame,
(void*)AVI_LoadVideoNoSound,
(void*)AVI_GetVideoInfo,
(void*)AVI_GetVideoFrameNumber,
(void*)AVI_GetVideoFrame,
R_UploadStretchRaw,
AVI_FreeVideo,
AVI_IsActive,
(void*)AVI_FreeVideo,
(void*)AVI_IsActive,
NULL,
NULL,
NULL,
@@ -1506,7 +1506,7 @@ static render_api_t gRenderAPI =
pfnFileBufferCRC32,
COM_CompareFileTime,
Host_Error,
CL_ModelHandle,
(void*)CL_ModelHandle,
pfnTime,
Cvar_Set,
S_FadeMusicVolume,

View File

@@ -3631,13 +3631,13 @@ static engine_studio_api_t gStudioAPI =
R_StudioDrawHulls,
R_StudioDrawAbsBBox,
R_StudioDrawBones,
R_StudioSetupSkin,
(void*)R_StudioSetupSkin,
R_StudioSetRemapColors,
R_StudioSetupPlayerModel,
R_StudioClientEvents,
R_StudioGetForceFaceFlags,
R_StudioSetForceFaceFlags,
R_StudioSetHeader,
(void*)R_StudioSetHeader,
R_StudioSetRenderModel,
R_StudioSetupRenderer,
R_StudioRestoreRenderer,

View File

@@ -246,7 +246,7 @@ void IN_TouchWriteConfig( void )
void IN_TouchExportConfig_f( void )
{
file_t *f;
char *name;
const char *name;
if( Cmd_Argc() != 2 )
{

View File

@@ -108,7 +108,7 @@ keyname_t keynames[] =
Key_IsDown
===================
*/
qboolean Key_IsDown( int keynum )
int Key_IsDown( int keynum )
{
if( keynum == -1 )
return false;
@@ -516,7 +516,7 @@ Key_Event
Called by the system for both key up and key down events
===================
*/
void Key_Event( int key, qboolean down )
void Key_Event( int key, int down )
{
const char *kb;
char cmd[1024];