diff options
Diffstat (limited to 'mp/src/game/server/gameinterface.cpp')
| -rw-r--r-- | mp/src/game/server/gameinterface.cpp | 71 |
1 files changed, 62 insertions, 9 deletions
diff --git a/mp/src/game/server/gameinterface.cpp b/mp/src/game/server/gameinterface.cpp index b20daf08..f6bbebb4 100644 --- a/mp/src/game/server/gameinterface.cpp +++ b/mp/src/game/server/gameinterface.cpp @@ -99,6 +99,7 @@ #include "tf_gamerules.h" #include "tf_lobby.h" #include "player_vs_environment/tf_population_manager.h" +#include "workshop/maps_workshop.h" extern ConVar tf_mm_trusted; extern ConVar tf_mm_servermode; @@ -559,11 +560,11 @@ void DrawAllDebugOverlays( void ) CServerGameDLL g_ServerGameDLL; // INTERFACEVERSION_SERVERGAMEDLL_VERSION_8 is compatible with the latest since we're only adding things to the end, so expose that as well. -EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameDLL, IServerGameDLL008, INTERFACEVERSION_SERVERGAMEDLL_VERSION_8, g_ServerGameDLL ); +//EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameDLL, IServerGameDLL008, INTERFACEVERSION_SERVERGAMEDLL_VERSION_8, g_ServerGameDLL ); EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CServerGameDLL, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL, g_ServerGameDLL); // When bumping the version to this interface, check that our assumption is still valid and expose the older version in the same way -COMPILE_TIME_ASSERT( INTERFACEVERSION_SERVERGAMEDLL_INT == 9 ); +COMPILE_TIME_ASSERT( INTERFACEVERSION_SERVERGAMEDLL_INT == 10 ); bool CServerGameDLL::DLLInit( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physicsFactory, CreateInterfaceFn fileSystemFactory, @@ -1081,9 +1082,7 @@ bool g_bCheckForChainedActivate; { \ if ( bCheck ) \ { \ - char msg[ 1024 ]; \ - Q_snprintf( msg, sizeof( msg ), "Entity (%i/%s/%s) failed to call base class Activate()\n", pClass->entindex(), pClass->GetClassname(), STRING( pClass->GetEntityName() ) ); \ - AssertMsg( g_bReceivedChainedActivate == true, msg ); \ + AssertMsg( g_bReceivedChainedActivate, "Entity (%i/%s/%s) failed to call base class Activate()\n", pClass->entindex(), pClass->GetClassname(), STRING( pClass->GetEntityName() ) ); \ } \ g_bCheckForChainedActivate = false; \ } @@ -1100,7 +1099,7 @@ void CServerGameDLL::ServerActivate( edict_t *pEdictList, int edictCount, int cl if ( gEntList.ResetDeleteList() != 0 ) { - Msg( "ERROR: Entity delete queue not empty on level start!\n" ); + Msg( "%s", "ERROR: Entity delete queue not empty on level start!\n" ); } for ( CBaseEntity *pClass = gEntList.FirstEnt(); pClass != NULL; pClass = gEntList.NextEnt(pClass) ) @@ -1150,6 +1149,7 @@ void CServerGameDLL::ServerActivate( edict_t *pEdictList, int edictCount, int cl void CServerGameDLL::GameServerSteamAPIActivated( void ) { #ifndef NO_STEAM + steamgameserverapicontext->Clear(); steamgameserverapicontext->Init(); if ( steamgameserverapicontext->SteamGameServer() && engine->IsDedicatedServer() ) { @@ -1160,6 +1160,7 @@ void CServerGameDLL::GameServerSteamAPIActivated( void ) #ifdef TF_DLL GCClientSystem()->GameServerActivate(); InventoryManager()->GameServerSteamAPIActivated(); + TFMapsWorkshop()->GameServerSteamAPIActivated(); #endif } @@ -1937,6 +1938,52 @@ void CServerGameDLL::Status( void (*print) (const char *fmt, ...) ) } //----------------------------------------------------------------------------- +void CServerGameDLL::PrepareLevelResources( /* in/out */ char *pszMapName, size_t nMapNameSize, + /* in/out */ char *pszMapFile, size_t nMapFileSize ) +{ +#ifdef TF_DLL + TFMapsWorkshop()->PrepareLevelResources( pszMapName, nMapNameSize, pszMapFile, nMapFileSize ); +#endif // TF_DLL +} + +//----------------------------------------------------------------------------- +IServerGameDLL::ePrepareLevelResourcesResult +CServerGameDLL::AsyncPrepareLevelResources( /* in/out */ char *pszMapName, size_t nMapNameSize, + /* in/out */ char *pszMapFile, size_t nMapFileSize, + float *flProgress /* = NULL */ ) +{ +#ifdef TF_DLL + return TFMapsWorkshop()->AsyncPrepareLevelResources( pszMapName, nMapNameSize, pszMapFile, nMapFileSize, flProgress ); +#endif // TF_DLL + + if ( flProgress ) + { + *flProgress = 1.f; + } + return IServerGameDLL::ePrepareLevelResources_Prepared; +} + +//----------------------------------------------------------------------------- +IServerGameDLL::eCanProvideLevelResult CServerGameDLL::CanProvideLevel( /* in/out */ char *pMapName, int nMapNameMax ) +{ +#ifdef TF_DLL + return TFMapsWorkshop()->OnCanProvideLevel( pMapName, nMapNameMax ); +#endif // TF_DLL + return IServerGameDLL::eCanProvideLevel_CannotProvide; +} + +//----------------------------------------------------------------------------- +bool CServerGameDLL::IsManualMapChangeOkay( const char **pszReason ) +{ + if ( GameRules() ) + { + return GameRules()->IsManualMapChangeOkay( pszReason ); + } + + return true; +} + +//----------------------------------------------------------------------------- // Purpose: Called during a transition, to build a map adjacency list //----------------------------------------------------------------------------- void CServerGameDLL::BuildAdjacentMapList( void ) @@ -2648,7 +2695,7 @@ void CServerGameClients::ClientActive( edict_t *pEdict, bool bLoadGame ) #if defined( TF_DLL ) Assert( pPlayer ); - if ( pPlayer && !pPlayer->IsFakeClient() ) + if ( pPlayer && !pPlayer->IsFakeClient() && !pPlayer->IsHLTV() && !pPlayer->IsReplay() ) { CSteamID steamID; if ( pPlayer->GetSteamID( &steamID ) ) @@ -2657,7 +2704,10 @@ void CServerGameClients::ClientActive( edict_t *pEdict, bool bLoadGame ) } else { - Log("WARNING: ClientActive, but we don't know his SteamID?\n"); + if ( !pPlayer->IsReplay() && !pPlayer->IsHLTV() ) + { + Log("WARNING: ClientActive, but we don't know his SteamID?\n"); + } } } #endif @@ -2731,7 +2781,10 @@ void CServerGameClients::ClientDisconnect( edict_t *pEdict ) } else { - Log("WARNING: ClientDisconnected, but we don't know his SteamID?\n"); + if ( !player->IsReplay() && !player->IsHLTV() ) + { + Log("WARNING: ClientDisconnected, but we don't know his SteamID?\n"); + } } } #endif |