Skip to content

Commit

Permalink
Fix crash on map change (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielga authored Oct 17, 2021
1 parent 19c6938 commit 2e074b9
Show file tree
Hide file tree
Showing 8 changed files with 747 additions and 645 deletions.
12 changes: 0 additions & 12 deletions source/main.hpp → source/debug.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#pragma once

#include <GarrysMod/FactoryLoader.hpp>

#include <string>
#include <vector>

#if defined DEBUG

#include <dbg.h>
Expand All @@ -19,10 +14,3 @@
#define _DebugWarning( ... )

#endif

class IServer;

namespace global
{
extern IServer *server;
}
4 changes: 2 additions & 2 deletions source/filecheck.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "filecheck.hpp"
#include "main.hpp"
#include "debug.hpp"

#include <GarrysMod/Lua/Interface.h>
#include <GarrysMod/Lua/Helpers.hpp>
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace filecheck
LUA->SetField( -2, "EnableFileValidation" );
}

void Deinitialize( GarrysMod::Lua::ILuaBase * )
void Deinitialize( )
{
hook.Destroy( );
}
Expand Down
2 changes: 1 addition & 1 deletion source/filecheck.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ namespace GarrysMod
namespace filecheck
{
void Initialize( GarrysMod::Lua::ILuaBase *LUA );
void Deinitialize( GarrysMod::Lua::ILuaBase *LUA );
void Deinitialize( );
}
12 changes: 5 additions & 7 deletions source/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "main.hpp"
#include "netfilter/core.hpp"
#include "filecheck.hpp"

Expand All @@ -10,8 +9,7 @@

namespace global
{
SourceSDK::FactoryLoader engine_loader( "engine" );
IServer *server = nullptr;
static IServer *server = nullptr;

LUA_FUNCTION_STATIC( GetClientCount )
{
Expand All @@ -27,11 +25,11 @@ namespace global

LUA->CreateTable( );

LUA->PushString( "serversecure 1.5.37" );
LUA->PushString( "serversecure 1.5.38" );
LUA->SetField( -2, "Version" );

// version num follows LuaJIT style, xxyyzz
LUA->PushNumber( 10537 );
LUA->PushNumber( 10538 );
LUA->SetField( -2, "VersionNum" );

LUA->PushCFunction( GetClientCount );
Expand Down Expand Up @@ -61,8 +59,8 @@ GMOD_MODULE_OPEN( )

GMOD_MODULE_CLOSE( )
{
filecheck::Deinitialize( LUA );
netfilter::Deinitialize( LUA );
filecheck::Deinitialize( );
netfilter::Deinitialize( );
global::Deinitialize( LUA );
return 0;
}
2 changes: 1 addition & 1 deletion source/netfilter/client.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "client.hpp"
#include "clientmanager.hpp"
#include "main.hpp"
#include "debug.hpp"

namespace netfilter
{
Expand Down
2 changes: 1 addition & 1 deletion source/netfilter/clientmanager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "clientmanager.hpp"
#include "main.hpp"
#include "debug.hpp"

namespace netfilter
{
Expand Down
Loading

0 comments on commit 2e074b9

Please sign in to comment.