summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-15 23:24:11 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-15 23:24:11 +0200
commitd21e4dacf7341b924fa534523ba31348ff6789ad (patch)
tree95a8b355c471cd2ab39e58f3d80b63d64ab8510a /source
parentAdded temporary debug statistics of the RelEntMoveLook packet removal efficiency (diff)
downloadcuberite-d21e4dacf7341b924fa534523ba31348ff6789ad.tar
cuberite-d21e4dacf7341b924fa534523ba31348ff6789ad.tar.gz
cuberite-d21e4dacf7341b924fa534523ba31348ff6789ad.tar.bz2
cuberite-d21e4dacf7341b924fa534523ba31348ff6789ad.tar.lz
cuberite-d21e4dacf7341b924fa534523ba31348ff6789ad.tar.xz
cuberite-d21e4dacf7341b924fa534523ba31348ff6789ad.tar.zst
cuberite-d21e4dacf7341b924fa534523ba31348ff6789ad.zip
Diffstat (limited to 'source')
-rw-r--r--source/Globals.h6
-rw-r--r--source/StringUtils.cpp3
-rw-r--r--source/cLog.cpp7
-rw-r--r--source/cPluginManager.cpp19
-rw-r--r--source/cRoot.cpp2
-rw-r--r--source/cSocket.cpp4
-rw-r--r--source/main.cpp9
7 files changed, 42 insertions, 8 deletions
diff --git a/source/Globals.h b/source/Globals.h
index 12cdd8c94..4816e2769 100644
--- a/source/Globals.h
+++ b/source/Globals.h
@@ -114,8 +114,14 @@ typedef short Int16;
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
+#if !defined(ANDROID_NDK)
#include <tr1/memory>
#endif
+#endif
+
+#if !defined(ANDROID_NDK)
+ #define USE_SQUIRREL
+#endif
diff --git a/source/StringUtils.cpp b/source/StringUtils.cpp
index 652c680c7..fa61a61e7 100644
--- a/source/StringUtils.cpp
+++ b/source/StringUtils.cpp
@@ -5,6 +5,9 @@
#include "Globals.h"
+#if defined(ANDROID_NDK)
+#include <ctype.h>
+#endif
diff --git a/source/cLog.cpp b/source/cLog.cpp
index 5e79b48bf..372616be8 100644
--- a/source/cLog.cpp
+++ b/source/cLog.cpp
@@ -9,6 +9,9 @@
#include "cIsThread.h"
+#if defined(ANDROID_NDK)
+#include <android/log.h>
+#endif
@@ -97,6 +100,10 @@ void cLog::ClearLog()
void cLog::Log(const char * a_Format, va_list argList)
{
+#if defined(ANDROID_NDK)
+ __android_log_vprint(ANDROID_LOG_ERROR,"MCServer", a_Format, argList);
+ return; // This is as far as android goes
+#endif
AString Message;
AppendVPrintf(Message, a_Format, argList);
diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp
index 64f6442ca..a722520bf 100644
--- a/source/cPluginManager.cpp
+++ b/source/cPluginManager.cpp
@@ -4,20 +4,21 @@
#include "cPlugin.h"
#include "cPlugin_Lua.h"
#include "cPlugin_NewLua.h"
-#include "cPlugin_Squirrel.h"
#include "cWebAdmin.h"
#include "cItem.h"
#include "cRoot.h"
#include "cLuaCommandBinder.h"
-#include "cSquirrelCommandBinder.h"
+#if USE_SQUIRREL
+# include "cPlugin_Squirrel.h"
+# include "cSquirrelCommandBinder.h"
+#endif
#include "../iniFile/iniFile.h"
#include "tolua++.h"
#include "cPlayer.h"
-#include "squirrelbindings/SquirrelBindings.h"
-#include "squirrelbindings/SquirrelFunctions.h"
-
#if USE_SQUIRREL
+ #include "squirrelbindings/SquirrelBindings.h"
+ #include "squirrelbindings/SquirrelFunctions.h"
#pragma warning(disable:4100;disable:4127;disable:4510;disable:4610;disable:4244;disable:4512) // Getting A LOT of these warnings from SqPlus
#pragma warning(default:4100;default:4127;default:4510;default:4610;default:4244;default:4512)
@@ -39,7 +40,9 @@ cPluginManager* cPluginManager::GetPluginManager()
cPluginManager::cPluginManager()
: m_LuaCommandBinder( new cLuaCommandBinder() )
+#if USE_SQUIRREL
, m_SquirrelCommandBinder( new cSquirrelCommandBinder() )
+#endif
, m_bReloadPlugins(false)
{
}
@@ -53,7 +56,9 @@ cPluginManager::~cPluginManager()
UnloadPluginsNow();
delete m_LuaCommandBinder;
+#if USE_SQUIRREL
delete m_SquirrelCommandBinder;
+#endif
}
@@ -197,10 +202,12 @@ bool cPluginManager::CallHook(PluginHook a_Hook, unsigned int a_NumArgs, ...)
cPlayer * Player = va_arg(argptr, cPlayer * );
va_end (argptr);
+#if USE_SQUIRREL
if (m_SquirrelCommandBinder->HandleCommand( std::string( Message ), Player))
{
return true;
}
+#endif
if (m_LuaCommandBinder->HandleCommand( std::string( Message ), Player))
{
@@ -682,7 +689,9 @@ void cPluginManager::RemovePlugin( cPlugin* a_Plugin, bool a_bDelete /* = false
if( a_bDelete )
{
m_LuaCommandBinder->RemoveBindingsForPlugin( a_Plugin );
+#if USE_SQUIRREL
m_SquirrelCommandBinder->RemoveBindingsForPlugin( a_Plugin );
+#endif
m_Plugins.remove( a_Plugin );
RemoveHooks( a_Plugin );
a_Plugin->OnDisable();
diff --git a/source/cRoot.cpp b/source/cRoot.cpp
index df89eb966..4d69635e2 100644
--- a/source/cRoot.cpp
+++ b/source/cRoot.cpp
@@ -16,8 +16,10 @@
#include "cRedstone.h"
#include "blocks/Block.h"
#include "items/Item.h"
+#if USE_SQUIRREL
#include "squirrelbindings/SquirrelFunctions.h"
#include "squirrelbindings/SquirrelBindings.h"
+#endif
#include "cChunk.h"
#include "../iniFile/iniFile.h"
diff --git a/source/cSocket.cpp b/source/cSocket.cpp
index 57ecfcbdc..edce83981 100644
--- a/source/cSocket.cpp
+++ b/source/cSocket.cpp
@@ -111,7 +111,7 @@ AString cSocket::GetErrorString( int a_ErrNo )
// According to http://linux.die.net/man/3/strerror_r there are two versions of strerror_r():
- #if ( _GNU_SOURCE ) // GNU version of strerror_r()
+ #if ( _GNU_SOURCE ) && !defined(ANDROID_NDK) // GNU version of strerror_r()
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
if( res != NULL )
@@ -158,7 +158,7 @@ int cSocket::GetLastError()
int cSocket::SetReuseAddress()
{
-#ifdef _WIN32
+#if defined(_WIN32) || defined(ANDROID_NDK)
char yes = 1;
#else
int yes = 1;
diff --git a/source/main.cpp b/source/main.cpp
index 4b498ae0a..0fdaf2d50 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -6,13 +6,16 @@
#include <exception> //std::exception
#include <csignal> //std::signal
#include <stdlib.h> //exit()
+#ifdef USE_SQUIRREL
#include "squirrelbindings/SquirrelFunctions.h"
+#include "squirrelbindings/SquirrelBindings.h"
+#endif
#ifdef _WIN32
#include <dbghelp.h>
#endif // _WIN32
-#include "squirrelbindings/SquirrelBindings.h"
+
@@ -168,11 +171,14 @@ int main( int argc, char **argv )
// DEBUG: test the dumpfile creation:
// *((int *)0) = 0;
+ #if !defined(ANDROID_NDK)
try
+ #endif
{
cRoot Root;
Root.Start();
}
+ #if !defined(ANDROID_NDK)
catch( std::exception& e )
{
LOGERROR("Standard exception: %s", e.what() );
@@ -181,6 +187,7 @@ int main( int argc, char **argv )
{
LOGERROR("Unknown exception!");
}
+ #endif
#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)