1
0

Removed the SquirrelVM.

It has been crashing the server. http://forum.mc-server.org/showthread.php?tid=610

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1024 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-11-08 19:09:35 +00:00
parent 99a6252d6a
commit f7ef93611c
15 changed files with 284 additions and 28 deletions

View File

@ -97,10 +97,13 @@ INCLUDE = -I.\
-IiniFile\ -IiniFile\
-Itolua++-1.0.93/include\ -Itolua++-1.0.93/include\
-Ijsoncpp-src-0.5.0/include\ -Ijsoncpp-src-0.5.0/include\
-Ijsoncpp-src-0.5.0/src/lib_json\ -Ijsoncpp-src-0.5.0/src/lib_json
-Isquirrel_3_0_1_stable/include\
-Isquirrel_3_0_1_stable\
-Isquirrel_3_0_1_stable/sqrat # 2012_11_08 _X: Removed, see Globals.h
# -Isquirrel_3_0_1_stable/include\
# -Isquirrel_3_0_1_stable\
# -Isquirrel_3_0_1_stable/sqrat
@ -110,7 +113,9 @@ INCLUDE = -I.\
# Build MCServer # Build MCServer
# #
SOURCES := $(shell find CryptoPP lua-5.1.4 jsoncpp-src-0.5.0 zlib-1.2.7 source squirrel_3_0_1_stable tolua++-1.0.93 iniFile WebServer '(' -name '*.cpp' -o -name '*.c' ')') # 2012_11_08 _X: Removed: squirrel_3_0_1_stable
SOURCES := $(shell find CryptoPP lua-5.1.4 jsoncpp-src-0.5.0 zlib-1.2.7 source tolua++-1.0.93 iniFile WebServer '(' -name '*.cpp' -o -name '*.c' ')')
SOURCES := $(filter-out %minigzip.c %lua.c %tolua.c %toluabind.c %LeakFinder.cpp %StackWalker.cpp %example.c,$(SOURCES)) SOURCES := $(filter-out %minigzip.c %lua.c %tolua.c %toluabind.c %LeakFinder.cpp %StackWalker.cpp %example.c,$(SOURCES))
OBJECTS := $(patsubst %.c,$(BUILDDIR)%.o,$(SOURCES)) OBJECTS := $(patsubst %.c,$(BUILDDIR)%.o,$(SOURCES))
OBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(OBJECTS)) OBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(OBJECTS))

View File

@ -5,10 +5,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MCServer", "MCServer.vcproj
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{9A476537-42C0-4848-AB40-15CFE83D17A8} = {9A476537-42C0-4848-AB40-15CFE83D17A8} {9A476537-42C0-4848-AB40-15CFE83D17A8} = {9A476537-42C0-4848-AB40-15CFE83D17A8}
{082E8185-7B3A-4945-8C82-9132341A329D} = {082E8185-7B3A-4945-8C82-9132341A329D} {082E8185-7B3A-4945-8C82-9132341A329D} = {082E8185-7B3A-4945-8C82-9132341A329D}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{EEAB54AD-114C-4AB8-8482-0A52D502BD35} = {EEAB54AD-114C-4AB8-8482-0A52D502BD35} {EEAB54AD-114C-4AB8-8482-0A52D502BD35} = {EEAB54AD-114C-4AB8-8482-0A52D502BD35}
{5AAA90B9-946D-4034-83F3-676B06A6E326} = {5AAA90B9-946D-4034-83F3-676B06A6E326} {5AAA90B9-946D-4034-83F3-676B06A6E326} = {5AAA90B9-946D-4034-83F3-676B06A6E326}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C} = {54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}
{EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA} = {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA} {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA} = {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}
EndProjectSection EndProjectSection
EndProject EndProject
@ -70,11 +69,8 @@ Global
{9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.ActiveCfg = Release|Win32 {9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.ActiveCfg = Release|Win32
{9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.Build.0 = Release|Win32 {9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.Build.0 = Release|Win32
{54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Debug|Win32.ActiveCfg = Debug|Win32 {54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Debug|Win32.ActiveCfg = Debug|Win32
{54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Debug|Win32.Build.0 = Debug|Win32
{54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Release profiled|Win32.ActiveCfg = Release profiled|Win32 {54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Release profiled|Win32.ActiveCfg = Release profiled|Win32
{54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Release profiled|Win32.Build.0 = Release profiled|Win32
{54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Release|Win32.ActiveCfg = Release|Win32 {54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Release|Win32.ActiveCfg = Release|Win32
{54DBF6CE-D1A8-4CCB-A249-4BF1CA9B7E4C}.Release|Win32.Build.0 = Release|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.ActiveCfg = Debug|Win32 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.ActiveCfg = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.Build.0 = Debug|Win32 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.Build.0 = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release profiled|Win32.ActiveCfg = Release|Win32 {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release profiled|Win32.ActiveCfg = Release|Win32

View File

@ -128,7 +128,9 @@ typedef unsigned short UInt16;
#endif #endif
#if !defined(ANDROID_NDK) #if !defined(ANDROID_NDK)
#define USE_SQUIRREL // 2012_11_08 _X: Disabled SquirrelVM, because it would crash the server from time to time.
// For details see: http://forum.mc-server.org/showthread.php?tid=610
// #define USE_SQUIRREL
#endif #endif
#if defined(ANDROID_NDK) #if defined(ANDROID_NDK)

View File

@ -5,7 +5,11 @@
struct lua_State; struct lua_State;
class cLuaCommandBinder; class cLuaCommandBinder;
class cSquirrelCommandBinder;
#ifdef USE_SQUIRREL
class cSquirrelCommandBinder;
#endif // USE_SQUIRREL
class cPlugin; class cPlugin;
// fwd: cWorld.h // fwd: cWorld.h
@ -124,11 +128,16 @@ public: //tolua_export
cLuaCommandBinder* GetLuaCommandBinder() const { return m_LuaCommandBinder; } cLuaCommandBinder* GetLuaCommandBinder() const { return m_LuaCommandBinder; }
cSquirrelCommandBinder* GetSquirrelCommandBinder() { return m_SquirrelCommandBinder; } #ifdef USE_SQUIRREL
cSquirrelCommandBinder * GetSquirrelCommandBinder() { return m_SquirrelCommandBinder; }
#endif // USE_SQUIRREL
bool HasPlugin( cPlugin* a_Plugin ) const; bool HasPlugin( cPlugin* a_Plugin ) const;
private: private:
friend class cRoot; friend class cRoot;
cPluginManager(); cPluginManager();
~cPluginManager(); ~cPluginManager();
@ -142,8 +151,15 @@ private:
void ReloadPluginsNow(); void ReloadPluginsNow();
void UnloadPluginsNow(); void UnloadPluginsNow();
cLuaCommandBinder* m_LuaCommandBinder; cLuaCommandBinder * m_LuaCommandBinder;
cSquirrelCommandBinder* m_SquirrelCommandBinder;
#ifdef USE_SQUIRREL
cSquirrelCommandBinder * m_SquirrelCommandBinder;
#endif // USE_SQUIRREL
bool m_bReloadPlugins; bool m_bReloadPlugins;
}; //tolua_export }; //tolua_export

View File

@ -1,4 +1,15 @@
#include "Globals.h" #include "Globals.h"
#ifdef USE_SUIRREL
#include "Plugin_Squirrel.h" #include "Plugin_Squirrel.h"
#include "squirrelbindings/SquirrelFunctions.h" #include "squirrelbindings/SquirrelFunctions.h"
#include "squirrelbindings/SquirrelBindings.h" #include "squirrelbindings/SquirrelBindings.h"
@ -386,3 +397,13 @@ bool cPlugin_Squirrel::OnUpdatedSign(
a_Player a_Player
); );
} }
#endif // USE_SQUIRREL

View File

@ -1,6 +1,16 @@
#pragma once #pragma once
#ifdef USE_SQUIRREL
#include "Plugin.h" #include "Plugin.h"
#include <sqrat.h> #include <sqrat.h>
#include "squirrelbindings/SquirrelObject.h" #include "squirrelbindings/SquirrelObject.h"
@ -51,3 +61,9 @@ protected:
#endif // USE_SQUIRREL

View File

@ -1,6 +1,16 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#ifdef USE_SQUIRREL
#include "SquirrelCommandBinder.h" #include "SquirrelCommandBinder.h"
#include "Player.h" #include "Player.h"
#include "Plugin.h" #include "Plugin.h"
@ -96,3 +106,13 @@ bool cSquirrelCommandBinder::HandleCommand( const std::string & a_Command, cPlay
} }
return false; return false;
} }
#endif // USE_SQUIRREL

View File

@ -1,5 +1,16 @@
#pragma once #pragma once
#include <string>
#ifdef USE_SQUIRREL
#include <sqrat.h> #include <sqrat.h>
class cPlugin; class cPlugin;
@ -33,3 +44,8 @@ private:
#endif // USE_SQUIRREL

View File

@ -1,5 +1,15 @@
#pragma once #pragma once
#include <string>
#ifdef USE_SQUIRREL
template <typename T> template <typename T>
class SquirrelArray class SquirrelArray
@ -34,3 +44,13 @@ protected:
}; };
class SquirrelStringArray : public SquirrelArray<std::string> { }; class SquirrelStringArray : public SquirrelArray<std::string> { };
#endif // USE_SQUIRREL

View File

@ -1,11 +1,26 @@
#pragma once #pragma once
#ifdef USE_SQUIRREL
#include "SquirrelBindings.h" #include "SquirrelBindings.h"
#include "../Plugin_Squirrel.h" #include "../Plugin_Squirrel.h"
#include "../PluginManager.h" #include "../PluginManager.h"
#include "../Root.h" #include "../Root.h"
#include "../SquirrelCommandBinder.h" #include "../SquirrelCommandBinder.h"
//The baseclass for squirrel plugins
// The baseclass for squirrel plugins
class cSquirrelBaseClass class cSquirrelBaseClass
{ {
public: public:
@ -39,3 +54,13 @@ public:
protected: protected:
cPlugin_Squirrel *m_Instance; cPlugin_Squirrel *m_Instance;
}; };
#endif // USE_SQUIRREL

View File

@ -1,4 +1,15 @@
#include "Globals.h" #include "Globals.h"
#ifdef USE_SQUIRREL
#include "SquirrelBindings.h" #include "SquirrelBindings.h"
#include "SquirrelFunctions.h" #include "SquirrelFunctions.h"
@ -7,9 +18,16 @@
#include "../Player.h" #include "../Player.h"
using namespace Sqrat; using namespace Sqrat;
#ifdef USE_SQUIRREL
void BindSquirrel(HSQUIRRELVM vm) void BindSquirrel(HSQUIRRELVM vm)
{ {
RootTable() RootTable()
@ -166,4 +184,12 @@ void BindSquirrel(HSQUIRRELVM vm)
.Const("UpdatedSign", cPluginManager::HOOK_UPDATED_SIGN)); .Const("UpdatedSign", cPluginManager::HOOK_UPDATED_SIGN));
} }
#endif
#endif // USE_SQUIRREL

View File

@ -1,11 +1,32 @@
#pragma once #pragma once
#ifdef USE_SQUIRREL #ifdef USE_SQUIRREL
#include <squirrel.h> #include <squirrel.h>
#include <sqrat.h> #include <sqrat.h>
void BindSquirrel(HSQUIRRELVM vm); void BindSquirrel(HSQUIRRELVM vm);
#endif
#endif // USE_SQUIRREL

View File

@ -1,13 +1,29 @@
#include "Globals.h" #include "Globals.h"
#include "SquirrelFunctions.h"
#include "SquirrelBindings.h"
#ifdef USE_SQUIRREL #ifdef USE_SQUIRREL
#include "SquirrelFunctions.h"
#include "SquirrelBindings.h"
static HSQUIRRELVM squirrelvm = NULL; static HSQUIRRELVM squirrelvm = NULL;
SQInteger runtimeErrorHandler(HSQUIRRELVM a_VM) SQInteger runtimeErrorHandler(HSQUIRRELVM a_VM)
{ {
const SQChar *sErr = 0; const SQChar *sErr = 0;
@ -67,4 +83,12 @@ void sqPrint(SQChar * text)
LOGINFO("%s", text); LOGINFO("%s", text);
} }
#endif
#endif // USE_SQUIRREL

View File

@ -1,6 +1,28 @@
#pragma once #pragma once
#ifdef USE_SQUIRREL
#include <sqrat.h> #include <sqrat.h>
HSQUIRRELVM OpenSquirrelVM(); HSQUIRRELVM OpenSquirrelVM();
void CloseSquirrelVM(); void CloseSquirrelVM();
void sqPrint(SQChar * text); void sqPrint(SQChar * text);
#endif // USE_SQUIRREL

View File

@ -1,6 +1,22 @@
#pragma once #pragma once
#ifdef USE_SQUIRREL
#include <sqrat.h> #include <sqrat.h>
class SquirrelObject class SquirrelObject
{ {
public: public:
@ -27,3 +43,13 @@ protected:
Sqrat::Object m_SquirrelObject; Sqrat::Object m_SquirrelObject;
}; };
#endif // USE_SQUIRREL