Navigation Menu

Skip to content

Commit

Permalink
remove old version check code from pre-steam days
Browse files Browse the repository at this point in the history
  • Loading branch information
DexterHaslem committed Feb 4, 2018
1 parent d3b3916 commit 924fa50
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 86 deletions.
5 changes: 1 addition & 4 deletions dlls/gameinterface.cpp
Expand Up @@ -2059,8 +2059,7 @@ char *GetModVersion();
// Output : Returns TRUE if player is allowed to join, FALSE if connection is denied.
//-----------------------------------------------------------------------------
bool CServerGameClients::ClientConnect( edict_t *pEdict, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen )
{
engine->ClientCommand(pEdict, UTIL_VarArgs("sync_version %s\n", GetModVersion()));
{
return g_pGameRules->ClientConnected( pEdict, pszName, pszAddress, reject, maxrejectlen );
}

Expand All @@ -2070,8 +2069,6 @@ bool CServerGameClients::ClientConnect( edict_t *pEdict, const char *pszName, co
//-----------------------------------------------------------------------------
void CServerGameClients::ClientActive( edict_t *pEdict, bool bLoadGame )
{
engine->ClientCommand(pEdict, UTIL_VarArgs("sync_version %s\n", GetModVersion()));

MDLCACHE_CRITICAL_SECTION();

::ClientActive( pEdict, bLoadGame );
Expand Down
82 changes: 0 additions & 82 deletions game_shared/ff/ff_gamerules.cpp
Expand Up @@ -38,88 +38,6 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

// Okay the server and client are versioned separately so that we can do a
// client- or server- only update if required.
// The client version is checked when FF is loaded
// The client + server versions are checked when a server is joined
// It is the discretion of the web-based version check script whether or not
// to tell the client to upgrade or that the server they are joining is out of date.
/*
// Jon: starting with 2.3, the versions are set through resource/version_client.txt and resource/version_server.txt
//const char *MOD_CLIENT_VERSION = "2.3";
//const char *MOD_SERVER_VERSION = "2.3";
// Ignore this for now...!
void VersionCvarChange(ConVar *var, const char *pOldString) {}
ConVar cvar_version("sync_version_cvar", MOD_SERVER_VERSION, FCVAR_REPLICATED, ""
#ifdef CLIENT_DLL
, VersionCvarChange);
#else
);
#endif
*/

#define MAX_MOD_VERSION_LENGTH 16

// this can be different between client and server
char MOD_VERSION[MAX_MOD_VERSION_LENGTH] = { 0 };

#ifdef CLIENT_DLL
#define MOD_VERSION_FILENAME "resource/ff_version_client.txt"
#else
#define MOD_VERSION_FILENAME "resource/ff_version_server.txt"
#endif

char *GetModVersion()
{
if ( MOD_VERSION[0] )
return MOD_VERSION;

FileHandle_t hFile = filesystem->Open( MOD_VERSION_FILENAME, "r", "MOD" );

if (!hFile)
{
Warning("[VERSION] %s either does not exist or could not be opened.\n", MOD_VERSION_FILENAME);
return "0.0";
}

// allocate buffer for the file's first line
char *buffer = (char*)MemAllocScratch(MAX_MOD_VERSION_LENGTH);
Assert(buffer);

// load file's first line into a null-terminated buffer
filesystem->ReadLine(buffer, MAX_MOD_VERSION_LENGTH, hFile);
buffer[MAX_MOD_VERSION_LENGTH] = 0;
filesystem->Close(hFile);

for (int i=0; buffer[i]; i++)
{
if (buffer[i] == '\r' || buffer[i] == '\n')
{
buffer[i] = 0;
break;
}
}

if ( buffer[0] )
{
Q_snprintf( MOD_VERSION, sizeof(MOD_VERSION), "%s", buffer );
if ( MOD_VERSION[0] )
{
Msg(
#ifdef CLIENT_DLL
"[VERSION] Client: %s\n"
#else
"[VERSION] Server: %s\n"
#endif
, MOD_VERSION);

return MOD_VERSION;
}
}

return "0.0";
}

#ifndef CLIENT_DLL
// Let's not use these or allow them.
Expand Down

0 comments on commit 924fa50

Please sign in to comment.