summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile15
-rw-r--r--VC2008/MCServer.sln6
-rw-r--r--source/Globals.h4
-rw-r--r--source/PluginManager.h24
-rw-r--r--source/Plugin_Squirrel.cpp21
-rw-r--r--source/Plugin_Squirrel.h16
-rw-r--r--source/SquirrelCommandBinder.cpp20
-rw-r--r--source/SquirrelCommandBinder.h18
-rw-r--r--source/squirrelbindings/SquirrelArray.h24
-rw-r--r--source/squirrelbindings/SquirrelBaseClass.h29
-rw-r--r--source/squirrelbindings/SquirrelBindings.cpp30
-rw-r--r--source/squirrelbindings/SquirrelBindings.h23
-rw-r--r--source/squirrelbindings/SquirrelFunctions.cpp28
-rw-r--r--source/squirrelbindings/SquirrelFunctions.h24
-rw-r--r--source/squirrelbindings/SquirrelObject.h28
15 files changed, 283 insertions, 27 deletions
diff --git a/GNUmakefile b/GNUmakefile
index fa7169ace..335b5a6fd 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -97,10 +97,13 @@ INCLUDE = -I.\
-IiniFile\
-Itolua++-1.0.93/include\
-Ijsoncpp-src-0.5.0/include\
- -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
+ -Ijsoncpp-src-0.5.0/src/lib_json
+
+
+# 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
#
-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))
OBJECTS := $(patsubst %.c,$(BUILDDIR)%.o,$(SOURCES))
OBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(OBJECTS))
diff --git a/VC2008/MCServer.sln b/VC2008/MCServer.sln
index 11ea5ea47..eec989003 100644
--- a/VC2008/MCServer.sln
+++ b/VC2008/MCServer.sln
@@ -5,10 +5,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MCServer", "MCServer.vcproj
ProjectSection(ProjectDependencies) = postProject
{9A476537-42C0-4848-AB40-15CFE83D17A8} = {9A476537-42C0-4848-AB40-15CFE83D17A8}
{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}
{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}
EndProjectSection
EndProject
@@ -70,11 +69,8 @@ Global
{9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.ActiveCfg = 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.Build.0 = Debug|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.Build.0 = Release|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}.Release profiled|Win32.ActiveCfg = Release|Win32
diff --git a/source/Globals.h b/source/Globals.h
index 40e80bd79..e536559dd 100644
--- a/source/Globals.h
+++ b/source/Globals.h
@@ -128,7 +128,9 @@ typedef unsigned short UInt16;
#endif
#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
#if defined(ANDROID_NDK)
diff --git a/source/PluginManager.h b/source/PluginManager.h
index 8fc74c90c..ebbd0ca89 100644
--- a/source/PluginManager.h
+++ b/source/PluginManager.h
@@ -5,7 +5,11 @@
struct lua_State;
class cLuaCommandBinder;
-class cSquirrelCommandBinder;
+
+#ifdef USE_SQUIRREL
+ class cSquirrelCommandBinder;
+#endif // USE_SQUIRREL
+
class cPlugin;
// fwd: cWorld.h
@@ -124,11 +128,16 @@ public: //tolua_export
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;
+
private:
+
friend class cRoot;
+
cPluginManager();
~cPluginManager();
@@ -142,8 +151,15 @@ private:
void ReloadPluginsNow();
void UnloadPluginsNow();
- cLuaCommandBinder* m_LuaCommandBinder;
- cSquirrelCommandBinder* m_SquirrelCommandBinder;
+ cLuaCommandBinder * m_LuaCommandBinder;
+
+ #ifdef USE_SQUIRREL
+ cSquirrelCommandBinder * m_SquirrelCommandBinder;
+ #endif // USE_SQUIRREL
bool m_bReloadPlugins;
}; //tolua_export
+
+
+
+
diff --git a/source/Plugin_Squirrel.cpp b/source/Plugin_Squirrel.cpp
index e11dbc07b..eac4d6a9e 100644
--- a/source/Plugin_Squirrel.cpp
+++ b/source/Plugin_Squirrel.cpp
@@ -1,4 +1,15 @@
+
#include "Globals.h"
+
+
+
+
+#ifdef USE_SUIRREL
+
+
+
+
+
#include "Plugin_Squirrel.h"
#include "squirrelbindings/SquirrelFunctions.h"
#include "squirrelbindings/SquirrelBindings.h"
@@ -386,3 +397,13 @@ bool cPlugin_Squirrel::OnUpdatedSign(
a_Player
);
}
+
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/Plugin_Squirrel.h b/source/Plugin_Squirrel.h
index 9d27261d0..9980d3a4d 100644
--- a/source/Plugin_Squirrel.h
+++ b/source/Plugin_Squirrel.h
@@ -1,6 +1,16 @@
#pragma once
+
+
+
+
+#ifdef USE_SQUIRREL
+
+
+
+
+
#include "Plugin.h"
#include <sqrat.h>
#include "squirrelbindings/SquirrelObject.h"
@@ -51,3 +61,9 @@ protected:
+
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/SquirrelCommandBinder.cpp b/source/SquirrelCommandBinder.cpp
index 50eae9333..9ff8a43f9 100644
--- a/source/SquirrelCommandBinder.cpp
+++ b/source/SquirrelCommandBinder.cpp
@@ -1,6 +1,16 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+
+
+
+#ifdef USE_SQUIRREL
+
+
+
+
+
#include "SquirrelCommandBinder.h"
#include "Player.h"
#include "Plugin.h"
@@ -96,3 +106,13 @@ bool cSquirrelCommandBinder::HandleCommand( const std::string & a_Command, cPlay
}
return false;
}
+
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/SquirrelCommandBinder.h b/source/SquirrelCommandBinder.h
index 50e026d06..c2bc4bafe 100644
--- a/source/SquirrelCommandBinder.h
+++ b/source/SquirrelCommandBinder.h
@@ -1,5 +1,16 @@
+
#pragma once
-#include <string>
+
+
+
+
+
+#ifdef USE_SQUIRREL
+
+
+
+
+
#include <sqrat.h>
class cPlugin;
@@ -33,3 +44,8 @@ private:
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/squirrelbindings/SquirrelArray.h b/source/squirrelbindings/SquirrelArray.h
index 0c2e34f7f..c54315aae 100644
--- a/source/squirrelbindings/SquirrelArray.h
+++ b/source/squirrelbindings/SquirrelArray.h
@@ -1,5 +1,15 @@
+
#pragma once
-#include <string>
+
+
+
+
+
+#ifdef USE_SQUIRREL
+
+
+
+
template <typename T>
class SquirrelArray
@@ -33,4 +43,14 @@ protected:
};
-class SquirrelStringArray : public SquirrelArray<std::string> { }; \ No newline at end of file
+class SquirrelStringArray : public SquirrelArray<std::string> { };
+
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/squirrelbindings/SquirrelBaseClass.h b/source/squirrelbindings/SquirrelBaseClass.h
index ef03c1a55..36f532611 100644
--- a/source/squirrelbindings/SquirrelBaseClass.h
+++ b/source/squirrelbindings/SquirrelBaseClass.h
@@ -1,11 +1,26 @@
+
#pragma once
+
+
+
+
+#ifdef USE_SQUIRREL
+
+
+
+
+
#include "SquirrelBindings.h"
#include "../Plugin_Squirrel.h"
#include "../PluginManager.h"
#include "../Root.h"
#include "../SquirrelCommandBinder.h"
-//The baseclass for squirrel plugins
+
+
+
+
+// The baseclass for squirrel plugins
class cSquirrelBaseClass
{
public:
@@ -38,4 +53,14 @@ public:
protected:
cPlugin_Squirrel *m_Instance;
-}; \ No newline at end of file
+};
+
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/squirrelbindings/SquirrelBindings.cpp b/source/squirrelbindings/SquirrelBindings.cpp
index 5c6b585f4..a463e55d1 100644
--- a/source/squirrelbindings/SquirrelBindings.cpp
+++ b/source/squirrelbindings/SquirrelBindings.cpp
@@ -1,4 +1,15 @@
+
#include "Globals.h"
+
+
+
+
+
+#ifdef USE_SQUIRREL
+
+
+
+
#include "SquirrelBindings.h"
#include "SquirrelFunctions.h"
@@ -7,9 +18,16 @@
#include "../Player.h"
+
+
+
+
using namespace Sqrat;
-#ifdef USE_SQUIRREL
+
+
+
+
void BindSquirrel(HSQUIRRELVM vm)
{
RootTable()
@@ -166,4 +184,12 @@ void BindSquirrel(HSQUIRRELVM vm)
.Const("UpdatedSign", cPluginManager::HOOK_UPDATED_SIGN));
}
-#endif \ No newline at end of file
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/squirrelbindings/SquirrelBindings.h b/source/squirrelbindings/SquirrelBindings.h
index e16311d6a..fef563f4a 100644
--- a/source/squirrelbindings/SquirrelBindings.h
+++ b/source/squirrelbindings/SquirrelBindings.h
@@ -1,11 +1,32 @@
+
#pragma once
+
+
+
#ifdef USE_SQUIRREL
+
+
+
+
#include <squirrel.h>
#include <sqrat.h>
+
+
+
+
void BindSquirrel(HSQUIRRELVM vm);
-#endif
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+
+
diff --git a/source/squirrelbindings/SquirrelFunctions.cpp b/source/squirrelbindings/SquirrelFunctions.cpp
index b6410ad2e..0e35f7361 100644
--- a/source/squirrelbindings/SquirrelFunctions.cpp
+++ b/source/squirrelbindings/SquirrelFunctions.cpp
@@ -1,13 +1,29 @@
#include "Globals.h"
+
+
+
+
+
+#ifdef USE_SQUIRREL
+
+
+
+
+
#include "SquirrelFunctions.h"
#include "SquirrelBindings.h"
-#ifdef USE_SQUIRREL
+
+
static HSQUIRRELVM squirrelvm = NULL;
+
+
+
+
SQInteger runtimeErrorHandler(HSQUIRRELVM a_VM)
{
const SQChar *sErr = 0;
@@ -67,4 +83,12 @@ void sqPrint(SQChar * text)
LOGINFO("%s", text);
}
-#endif \ No newline at end of file
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/squirrelbindings/SquirrelFunctions.h b/source/squirrelbindings/SquirrelFunctions.h
index 0d08a726c..2b74fb52d 100644
--- a/source/squirrelbindings/SquirrelFunctions.h
+++ b/source/squirrelbindings/SquirrelFunctions.h
@@ -1,6 +1,28 @@
+
#pragma once
+
+#ifdef USE_SQUIRREL
+
+
+
+
#include <sqrat.h>
+
+
+
+
+
HSQUIRRELVM OpenSquirrelVM();
void CloseSquirrelVM();
-void sqPrint(SQChar * text); \ No newline at end of file
+void sqPrint(SQChar * text);
+
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+
diff --git a/source/squirrelbindings/SquirrelObject.h b/source/squirrelbindings/SquirrelObject.h
index 547dd4e02..a7a44d531 100644
--- a/source/squirrelbindings/SquirrelObject.h
+++ b/source/squirrelbindings/SquirrelObject.h
@@ -1,6 +1,22 @@
+
#pragma once
+
+
+
+
+
+#ifdef USE_SQUIRREL
+
+
+
+
+
#include <sqrat.h>
+
+
+
+
class SquirrelObject
{
public:
@@ -26,4 +42,14 @@ public:
protected:
Sqrat::Object m_SquirrelObject;
-}; \ No newline at end of file
+};
+
+
+
+
+
+#endif // USE_SQUIRREL
+
+
+
+