diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index dd9f0122..af0307ec 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -1249,7 +1249,7 @@ static const ui_enginefuncs_t gEngfuncs = pfnSetCursor, pfnIsMapValid, GL_ProcessTexture, - COM_CompareFileTime, + pfnCompareFileTime, VID_GetModeString, (void*)COM_SaveFile, pfnDelete diff --git a/engine/client/cl_render.c b/engine/client/cl_render.c index 6a40baec..400ed0fb 100644 --- a/engine/client/cl_render.c +++ b/engine/client/cl_render.c @@ -296,7 +296,7 @@ static render_api_t gRenderAPI = R_Mem_Free, pfnGetFilesList, pfnFileBufferCRC32, - COM_CompareFileTime, + pfnCompareFileTime, Host_Error, (void*)CL_ModelHandle, pfnTime, diff --git a/engine/common/common.c b/engine/common/common.c index e0f8fa7e..afc784b5 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -840,30 +840,30 @@ cvar_t *GAME_EXPORT pfnCVarGetPointer( const char *szVarName ) /* ============= -COM_CompareFileTime +pfnCompareFileTime ============= */ -int GAME_EXPORT COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare ) +int GAME_EXPORT pfnCompareFileTime( const char *path1, const char *path2, int *retval ) { - int bRet = 0; + int t1, t2; + *retval = 0; - *iCompare = 0; + if( !path1 || !path2 ) + return 0; - if( filename1 && filename2 ) - { - int ft1 = FS_FileTime( filename1, false ); - int ft2 = FS_FileTime( filename2, false ); + if(( t1 = g_fsapi.FileTime( path1, false )) == -1 ) + return 0; - // one of files is missing - if( ft1 == -1 || ft2 == -1 ) - return bRet; + if(( t2 = g_fsapi.FileTime( path2, false )) == -1 ) + return 0; - *iCompare = ft1 < ft2 ? -1 : ( ft1 > ft2 ? 1 : 0 ); - bRet = 1; - } + if( t1 < t2 ) + *retval = -1; + else if( t1 > t2 ) + *retval = 1; - return bRet; + return 1; } /* diff --git a/engine/common/common.h b/engine/common/common.h index 065284e7..4bf40ef4 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -773,7 +773,7 @@ void Rcon_Print( host_redirect_t *rd, const char *pMsg ); qboolean COM_ParseVector( char **pfile, float *v, size_t size ); int COM_FileSize( const char *filename ); void COM_FreeFile( void *buffer ); -int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare ); +int pfnCompareFileTime( const char *path1, const char *path2, int *retval ); char *va( const char *format, ... ) FORMAT_CHECK( 1 ) RETURNS_NONNULL; qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multiplayer ); diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index 1f67aa09..ef24e942 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -1699,7 +1699,7 @@ static qboolean Mod_LoadColoredLighting( model_t *mod, dbspmodel_t *bmod ) Q_snprintf( path, sizeof( path ), "maps/%s.lit", modelname ); // make sure what deluxemap is actual - if( !COM_CompareFileTime( path, mod->name, &iCompare )) + if( !pfnCompareFileTime( path, mod->name, &iCompare )) return false; if( iCompare < 0 ) // this may happens if level-designer used -onlyents key for hlcsg @@ -1754,7 +1754,7 @@ static void Mod_LoadDeluxemap( model_t *mod, dbspmodel_t *bmod ) Q_snprintf( path, sizeof( path ), "maps/%s.dlit", modelname ); // make sure what deluxemap is actual - if( !COM_CompareFileTime( path, mod->name, &iCompare )) + if( !pfnCompareFileTime( path, mod->name, &iCompare )) return; if( iCompare < 0 ) // this may happens if level-designer used -onlyents key for hlcsg diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index 34a9dac1..7f498b14 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -4732,7 +4732,7 @@ static enginefuncs_t gEngfuncs = COM_LoadFileForMe, COM_FreeFile, pfnEndSection, - COM_CompareFileTime, + pfnCompareFileTime, pfnGetGameDir, pfnCvar_RegisterEngineVariable, pfnFadeClientVolume,