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

@@ -599,7 +599,7 @@ void SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word eventindex,
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void SV_PlaybackReliableEvent( sizebuf_t *msg, word eventindex, float delay, event_args_t *args );
int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample, int vol, float attn, int flags, int pitch, const vec3_t pos );
qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax );
int SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax );
void SV_WriteEntityPatch( const char *filename );
float SV_AngleMod( float ideal, float current, float speed );
void SV_SpawnEntities( const char *mapname );

View File

@@ -241,7 +241,7 @@ void SV_ConnectClient( netadr_t from )
int qport, version;
int i, count = 0;
int challenge;
char *s;
const char *s;
if( Cmd_Argc() < 5 )
{
@@ -1562,7 +1562,7 @@ void SV_UserinfoChanged( sv_client_t *cl )
edict_t *ent = cl->edict;
string name1, name2;
sv_client_t *current;
char *val;
const char *val;
if( !COM_CheckString( cl->userinfo ))
return;
@@ -1810,7 +1810,7 @@ SV_DownloadFile_f
*/
static qboolean SV_DownloadFile_f( sv_client_t *cl )
{
char *name;
const char *name;
if( Cmd_Argc() < 2 )
return true;
@@ -2077,7 +2077,8 @@ connectionless packets.
void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
{
char *args;
char *pcmd, buf[MAX_SYSPATH];
const char *pcmd;
char buf[MAX_SYSPATH];
int len = sizeof( buf );
MSG_Clear( msg );

View File

@@ -73,7 +73,7 @@ void SV_BroadcastPrintf( sv_client_t *ignore, char *fmt, ... )
}
// echo to console
Con_DPrintf( string );
Con_DPrintf( "%s", string );
}
/*
@@ -108,7 +108,7 @@ Sets sv_client and sv_player to the player with idnum Cmd_Argv(1)
*/
static sv_client_t *SV_SetPlayer( void )
{
char *s;
const char *s;
sv_client_t *cl;
int i, idnum;
@@ -550,7 +550,8 @@ SV_ConSay_f
*/
void SV_ConSay_f( void )
{
char *p, text[MAX_SYSPATH];
const char *p;
char text[MAX_SYSPATH];
if( Cmd_Argc() < 2 ) return;
@@ -560,18 +561,17 @@ void SV_ConSay_f( void )
return;
}
Q_snprintf( text, sizeof( text ), "%s: ", Cvar_VariableString( "hostname" ));
p = Cmd_Args();
Q_strncpy( text, *p == '"' ? p + 1 : p, MAX_SYSPATH );
if( *p == '"' )
{
p++;
p[Q_strlen(p) - 1] = 0;
text[Q_strlen(text) - 1] = 0;
}
Q_strncat( text, p, MAX_SYSPATH );
Log_Printf( "Server say: \"%s\"\n", text );
Q_snprintf( text, sizeof( text ), "%s: %s", Cvar_VariableString( "hostname" ), p );
SV_BroadcastPrintf( NULL, "%s\n", text );
Log_Printf( "Server say: \"%s\"\n", p );
}
/*
@@ -866,4 +866,4 @@ void SV_KillOperatorCommands( void )
{
Cmd_RemoveCommand( "say" );
}
}
}

View File

@@ -181,7 +181,7 @@ void SV_ParseConsistencyResponse( sv_client_t *cl, sizebuf_t *msg )
if( svgame.dllFuncs.pfnInconsistentFile( cl->edict, sv.resources[badresindex - 1].szFileName, dropmessage ))
{
if( COM_CheckString( dropmessage ))
SV_ClientPrintf( cl, dropmessage );
SV_ClientPrintf( cl, "%s", dropmessage );
SV_DropClient( cl, false );
}
}
@@ -575,4 +575,4 @@ void SV_SendResources( sv_client_t *cl, sizebuf_t *msg )
}
SV_SendConsistencyList( cl, msg );
}
}

View File

@@ -649,7 +649,7 @@ SV_BoxInPVS
check brush boxes in fat pvs
==============
*/
qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax )
int SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax )
{
if( !Mod_BoxVisible( absmin, absmax, Mod_GetPVSForPoint( org )))
return false;
@@ -4379,12 +4379,12 @@ static enginefuncs_t gEngfuncs =
pfnAnimationAutomove,
pfnGetBonePosition,
(void*)pfnFunctionFromName,
pfnNameForFunction,
(void*)pfnNameForFunction,
pfnClientPrintf,
pfnServerPrint,
Cmd_Args,
Cmd_Argv,
Cmd_Argc,
(void*)Cmd_Argc,
pfnGetAttachment,
CRC32_Init,
CRC32_ProcessBuffer,
@@ -4418,7 +4418,7 @@ static enginefuncs_t gEngfuncs =
pfnIsDedicatedServer,
pfnCVarGetPointer,
pfnGetPlayerWONId,
Info_RemoveKey,
(void*)Info_RemoveKey,
pfnGetPhysicsKeyValue,
pfnSetPhysicsKeyValue,
pfnGetPhysicsInfoString,

View File

@@ -565,7 +565,7 @@ void SV_ActivateServer( int runPhysics )
Con_Printf( "%i player server started\n", svs.maxclients );
else Con_Printf( "Game started\n" );
Log_Printf( "Started map \"%s\" (CRC \"%lu\")\n", sv.name, sv.worldmapCRC );
Log_Printf( "Started map \"%s\" (CRC \"%u\")\n", sv.name, sv.worldmapCRC );
// dedicated server purge unused resources here
if( host.type == HOST_DEDICATED )

View File

@@ -23,7 +23,7 @@ void Log_Open( void )
char szFileBase[ MAX_OSPATH ];
char szTestFile[ MAX_OSPATH ];
file_t *fp = NULL;
char *temp;
const char *temp;
int i;
if( !svs.log.active )

View File

@@ -345,7 +345,8 @@ void SV_ReadPackets( void )
{
if( !svs.initialized )
{
char *args, *c;
char *args;
const char *c;
MSG_Clear( &net_message );
MSG_ReadLong( &net_message );// skip the -1 marker

View File

@@ -2002,7 +2002,7 @@ static server_physics_api_t gPhysicsAPI =
SV_LinkEdict,
SV_GetServerTime,
SV_GetFrameTime,
SV_ModelHandle,
(void*)SV_ModelHandle,
SV_GetHeadNode,
SV_ServerState,
Host_Error,
@@ -2074,4 +2074,4 @@ qboolean SV_InitPhysicsAPI( void )
// physic interface is missed
return true;
}
}

View File

@@ -336,7 +336,7 @@ void SV_AddLaddersToPmove( areanode_t *node, const vec3_t pmove_mins, const vec3
SV_AddLaddersToPmove( node->children[1], pmove_mins, pmove_maxs );
}
static void pfnParticle( float *origin, int color, float life, int zpos, int zvel )
static void pfnParticle( const float *origin, int color, float life, int zpos, int zvel )
{
int v;
@@ -614,7 +614,7 @@ void SV_InitClientMove( void )
svgame.pmove->RandomFloat = COM_RandomFloat;
svgame.pmove->PM_GetModelType = pfnGetModelType;
svgame.pmove->PM_GetModelBounds = pfnGetModelBounds;
svgame.pmove->PM_HullForBsp = pfnHullForBsp;
svgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp;
svgame.pmove->PM_TraceModel = pfnTraceModel;
svgame.pmove->COM_FileSize = COM_FileSize;
svgame.pmove->COM_LoadFile = COM_LoadFile;
@@ -1140,4 +1140,4 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed )
{
SV_RestoreMoveInterpolant( cl );
}
}
}

View File

@@ -2154,7 +2154,7 @@ SV_GetSaveComment
check savegame for valid
==================
*/
qboolean SV_GetSaveComment( const char *savename, char *comment )
int SV_GetSaveComment( const char *savename, char *comment )
{
int i, tag, size, nNumberOfFields, nFieldSize, tokenSize, tokenCount;
char *pData, *pSaveData, *pFieldName, **pTokenList;
@@ -2341,4 +2341,4 @@ qboolean SV_GetSaveComment( const char *savename, char *comment )
void SV_InitSaveRestore( void )
{
pfnSaveGameComment = COM_GetProcAddress( svgame.hInstance, "SV_SaveGameComment" );
}
}