diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/Globals.h | 4 | ||||
-rw-r--r-- | source/PluginManager.h | 24 | ||||
-rw-r--r-- | source/Plugin_Squirrel.cpp | 21 | ||||
-rw-r--r-- | source/Plugin_Squirrel.h | 16 | ||||
-rw-r--r-- | source/SquirrelCommandBinder.cpp | 20 | ||||
-rw-r--r-- | source/SquirrelCommandBinder.h | 18 | ||||
-rw-r--r-- | source/squirrelbindings/SquirrelArray.h | 24 | ||||
-rw-r--r-- | source/squirrelbindings/SquirrelBaseClass.h | 29 | ||||
-rw-r--r-- | source/squirrelbindings/SquirrelBindings.cpp | 30 | ||||
-rw-r--r-- | source/squirrelbindings/SquirrelBindings.h | 23 | ||||
-rw-r--r-- | source/squirrelbindings/SquirrelFunctions.cpp | 28 | ||||
-rw-r--r-- | source/squirrelbindings/SquirrelFunctions.h | 24 | ||||
-rw-r--r-- | source/squirrelbindings/SquirrelObject.h | 28 |
13 files changed, 272 insertions, 17 deletions
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
+
+
+
+
|