Skip to content

Commit 4b21839

Browse files
committed
Fixed CSteamGameServerAPIContext interface retrieval code
1 parent 5b8745a commit 4b21839

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

source/server/gametags.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <steam/steam_gameserver.h>
1111

1212
class CBaseServer;
13+
class CSteam3Server : public CSteamGameServerAPIContext { };
1314

1415
namespace GameTags
1516
{
@@ -22,9 +23,13 @@ namespace GameTags
2223
if( RecalculateTags_original == nullptr )
2324
LUA->ThrowError( "unable to find CBaseServer::RecalculateTags" );
2425

25-
gameserver_context = InterfacePointers::SteamGameServerAPIContext( );
26+
FunctionPointers::Steam3Server_t Steam3Server = FunctionPointers::Steam3Server( );
27+
if( Steam3Server == nullptr )
28+
LUA->ThrowError( "unable to find Steam3Server" );
29+
30+
gameserver_context = Steam3Server( );
2631
if( gameserver_context == nullptr )
27-
LUA->ThrowError( "Failed to load required CSteamGameServerAPIContext interface." );
32+
LUA->ThrowError( "unable to load CSteamGameServerAPIContext interface" );
2833
}
2934

3035
void RecalculateTags( )
@@ -63,13 +68,13 @@ namespace GameTags
6368

6469
private:
6570
static FunctionPointers::CBaseServer_RecalculateTags_t RecalculateTags_original;
66-
static CSteamGameServerAPIContext *gameserver_context;
71+
static CSteam3Server *gameserver_context;
6772
static std::string gametags_substitute;
6873
};
6974

7075
FunctionPointers::CBaseServer_RecalculateTags_t
7176
CBaseServerProxy::RecalculateTags_original = nullptr;
72-
CSteamGameServerAPIContext *CBaseServerProxy::gameserver_context = nullptr;
77+
CSteam3Server *CBaseServerProxy::gameserver_context = nullptr;
7378
std::string CBaseServerProxy::gametags_substitute;
7479

7580
void PreInitialize( GarrysMod::Lua::ILuaBase *LUA )

0 commit comments

Comments
 (0)