summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xSConscript29
-rw-r--r--src/cat/LegacyLuaAPI.cpp3
-rw-r--r--src/cat/LuaBit.cpp3
-rw-r--r--src/cat/LuaButton.cpp4
-rw-r--r--src/cat/LuaCheckbox.cpp4
-rw-r--r--src/cat/LuaComponent.cpp4
-rw-r--r--src/cat/LuaLabel.cpp4
-rw-r--r--src/cat/LuaProgressBar.cpp4
-rw-r--r--src/cat/LuaScriptInterface.cpp2
-rw-r--r--src/cat/LuaSlider.cpp4
-rw-r--r--src/cat/LuaTextbox.cpp4
-rw-r--r--src/cat/LuaWindow.cpp4
-rw-r--r--src/graphics/Renderer.cpp4
-rw-r--r--src/gui/game/GameController.cpp8
-rw-r--r--src/gui/game/GameController.h5
-rw-r--r--src/simulation/Simulation.cpp8
-rw-r--r--src/socket/socket.lua.cpp2
17 files changed, 71 insertions, 25 deletions
diff --git a/SConscript b/SConscript
index da4d53e..96ff876 100755
--- a/SConscript
+++ b/SConscript
@@ -44,6 +44,7 @@ AddOption('--sse2',dest="sse2",action='store_true',default=False,help="Enable SS
AddOption('--sse3',dest="sse3",action='store_true',default=False,help="Enable SSE3 optimisations")
AddOption('--x86',dest="x86",action='store_true',default=True,help="Target Intel x86 platform")
AddOption('--nofft',dest="nofft", action='store_true',default=False,help="Do not use fftw3f for gravity.")
+AddOption('--nolua',dest="nolua", action='store_true',default=False,help="Disable all lua scripting features.")
AddOption('--debugging', dest="debug", action="store_true", default=False, help="Enable debug options")
AddOption('--beta',dest="beta",action='store_true',default=False,help="Beta build.")
@@ -90,15 +91,16 @@ if not GetOption("macosx"):
env.Append(CPPPATH=[GetOption("sdl-dir")])
#Find correct lua include dir
- try:
- env.ParseConfig('pkg-config --cflags lua5.1')
- except:
- if(GetOption("lua-dir")):
- if not conf.CheckCHeader(GetOption("lua-dir") + '/lua.h'):
- print "lua5.1 headers not found or not installed"
- raise SystemExit(1)
- else:
- env.Append(CPPPATH=[GetOption("lua-dir")])
+ if not GetOption("nolua"):
+ try:
+ env.ParseConfig('pkg-config --cflags lua5.1')
+ except:
+ if(GetOption("lua-dir")):
+ if not conf.CheckCHeader(GetOption("lua-dir") + '/lua.h'):
+ print "lua5.1 headers not found or not installed"
+ raise SystemExit(1)
+ else:
+ env.Append(CPPPATH=[GetOption("lua-dir")])
if not GetOption('nofft'):
#Check for FFT lib
@@ -121,7 +123,7 @@ if not GetOption("macosx"):
raise SystemExit(1)
#Check for Lua lib
- if not GetOption("macosx"):
+ if not GetOption("macosx") and not GetOption("nolua"):
if not conf.CheckLib('lua5.1') and not conf.CheckLib('lua-5.1') and not conf.CheckLib('lua51') and not conf.CheckLib('lua'):
print "liblua not found or not installed"
raise SystemExit(1)
@@ -135,9 +137,11 @@ else:
env.Append(CPPPATH=['src/', 'data/', 'generated/'])
env.Append(CCFLAGS=['-w', '-std=c++98', '-fkeep-inline-functions'])
env.Append(LIBS=['pthread', 'm'])
-env.Append(CPPDEFINES=["LUACONSOLE", "_GNU_SOURCE", "USE_STDINT", "_POSIX_C_SOURCE=200112L"])
+env.Append(CPPDEFINES=["_GNU_SOURCE", "USE_STDINT", "_POSIX_C_SOURCE=200112L"])
if not GetOption('nofft'):
env.Append(CPPDEFINES=["GRAVFFT"])
+if not GetOption('nolua'):
+ env.Append(CPPDEFINED=["LUACONSOLE"])
if GetOption("ptw32-static"):
env.Append(CPPDEFINES=['PTW32_STATIC_LIB']);
@@ -267,7 +271,8 @@ sources+=Glob("src/gui/*/*.cpp")
sources+=Glob("src/simulation/elements/*.cpp")
sources+=Glob("src/simulation/tools/*.cpp")
sources+=Glob("src/client/requestbroker/*.cpp")
-sources+=Glob("src/socket/*.c")
+if not GetOption('nolua'):
+ sources+=Glob("src/socket/*.c")
#for source in sources:
# print str(source)
diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp
index 9c73936..82ae6a0 100644
--- a/src/cat/LegacyLuaAPI.cpp
+++ b/src/cat/LegacyLuaAPI.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
#include <string>
#include <iomanip>
#include <vector>
@@ -1983,4 +1984,4 @@ int luatpt_screenshot(lua_State* l)
Client::Ref().WriteFile(data, filename.str());
return 0;
}
-
+#endif \ No newline at end of file
diff --git a/src/cat/LuaBit.cpp b/src/cat/LuaBit.cpp
index c55f45a..9807441 100644
--- a/src/cat/LuaBit.cpp
+++ b/src/cat/LuaBit.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
/*
** Lua BitOp -- a bit operations library for Lua 5.1/5.2.
** http://bitop.luajit.org/
@@ -189,4 +190,4 @@ int luaopen_bit(lua_State *L)
#endif
return 1;
}
-
+#endif \ No newline at end of file
diff --git a/src/cat/LuaButton.cpp b/src/cat/LuaButton.cpp
index 013adac..3f7ba26 100644
--- a/src/cat/LuaButton.cpp
+++ b/src/cat/LuaButton.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
@@ -111,4 +112,5 @@ void LuaButton::triggerAction()
LuaButton::~LuaButton()
{
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/cat/LuaCheckbox.cpp b/src/cat/LuaCheckbox.cpp
index bac5c4e..d844cf5 100644
--- a/src/cat/LuaCheckbox.cpp
+++ b/src/cat/LuaCheckbox.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
@@ -109,4 +110,5 @@ void LuaCheckbox::triggerAction()
LuaCheckbox::~LuaCheckbox()
{
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/cat/LuaComponent.cpp b/src/cat/LuaComponent.cpp
index 75e7a21..c32db6d 100644
--- a/src/cat/LuaComponent.cpp
+++ b/src/cat/LuaComponent.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
@@ -79,4 +80,5 @@ LuaComponent::~LuaComponent()
if(component->GetParentWindow())
component->GetParentWindow()->RemoveComponent(component);
delete component;
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/cat/LuaLabel.cpp b/src/cat/LuaLabel.cpp
index b08e687..15a7720 100644
--- a/src/cat/LuaLabel.cpp
+++ b/src/cat/LuaLabel.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
@@ -52,4 +53,5 @@ int LuaLabel::text(lua_State * l)
LuaLabel::~LuaLabel()
{
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/cat/LuaProgressBar.cpp b/src/cat/LuaProgressBar.cpp
index 08c88ca..670d88a 100644
--- a/src/cat/LuaProgressBar.cpp
+++ b/src/cat/LuaProgressBar.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
@@ -68,4 +69,5 @@ int LuaProgressBar::status(lua_State * l)
LuaProgressBar::~LuaProgressBar()
{
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp
index 4b2e749..d299c2c 100644
--- a/src/cat/LuaScriptInterface.cpp
+++ b/src/cat/LuaScriptInterface.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
#include <string>
#include <iomanip>
#include <vector>
@@ -2201,3 +2202,4 @@ std::string LuaScriptInterface::FormatCommand(std::string command)
LuaScriptInterface::~LuaScriptInterface() {
delete legacy;
}
+#endif \ No newline at end of file
diff --git a/src/cat/LuaSlider.cpp b/src/cat/LuaSlider.cpp
index ce07ebb..e022ba0 100644
--- a/src/cat/LuaSlider.cpp
+++ b/src/cat/LuaSlider.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
@@ -109,4 +110,5 @@ void LuaSlider::triggerOnValueChanged()
LuaSlider::~LuaSlider()
{
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/cat/LuaTextbox.cpp b/src/cat/LuaTextbox.cpp
index 5721525..be4add9 100644
--- a/src/cat/LuaTextbox.cpp
+++ b/src/cat/LuaTextbox.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
@@ -112,4 +113,5 @@ int LuaTextbox::text(lua_State * l)
LuaTextbox::~LuaTextbox()
{
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/cat/LuaWindow.cpp b/src/cat/LuaWindow.cpp
index d765d68..80fc014 100644
--- a/src/cat/LuaWindow.cpp
+++ b/src/cat/LuaWindow.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
@@ -590,4 +591,5 @@ LuaWindow::~LuaWindow()
if(ui::Engine::Ref().GetWindow() == window)
ui::Engine::Ref().CloseWindow();
delete window;
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp
index a3ea66d..dfdd307 100644
--- a/src/graphics/Renderer.cpp
+++ b/src/graphics/Renderer.cpp
@@ -9,8 +9,10 @@
#include "simulation/Elements.h"
#include "simulation/ElementGraphics.h"
#include "simulation/Air.h"
+#ifdef LUACONSOLE
#include "cat/LuaScriptInterface.h"
#include "cat/LuaScriptHelper.h"
+#endif
extern "C"
{
#include "hmap.h"
@@ -1212,7 +1214,7 @@ void Renderer::render_parts()
{
if (elements[t].Graphics)
{
-#ifndef RENDERER
+#if !defined(RENDERER) && defined(LUACONSOLE)
if (lua_gr_func[t])
{
luacon_graphicsReplacement(this, &(sim->parts[i]), nx, ny, &pixel_mode, &cola, &colr, &colg, &colb, &firea, &firer, &fireg, &fireb, i);
diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp
index ed1a866..d7b808b 100644
--- a/src/gui/game/GameController.cpp
+++ b/src/gui/game/GameController.cpp
@@ -145,8 +145,12 @@ GameController::GameController():
gameView->AttachController(this);
gameModel->AddObserver(gameView);
- commandInterface = new LuaScriptInterface(this, gameModel);//new TPTScriptInterface();
+#ifdef LUACONSOLE
+ commandInterface = new LuaScriptInterface(this, gameModel);
((LuaScriptInterface*)commandInterface)->SetWindow(gameView);
+#else
+ commandInterface = new TPTScriptInterface(this, gameModel);
+#endif
commandInterface->OnBrushChanged(gameModel->GetBrushID(), gameModel->GetBrush()->GetRadius().X, gameModel->GetBrush()->GetRadius().X);
ActiveToolChanged(0, gameModel->GetActiveTool(0));
@@ -706,7 +710,9 @@ void GameController::Tick()
{
if(firstTick)
{
+#ifdef LUACONSOLE
((LuaScriptInterface*)commandInterface)->Init();
+#endif
if(!Client::Ref().GetPrefBool("InstallCheck", false))
{
Client::Ref().SetPref("InstallCheck", true);
diff --git a/src/gui/game/GameController.h b/src/gui/game/GameController.h
index c34d44a..f2cf26b 100644
--- a/src/gui/game/GameController.h
+++ b/src/gui/game/GameController.h
@@ -14,8 +14,11 @@
#include "gui/console/ConsoleController.h"
#include "gui/localbrowser/LocalBrowserController.h"
#include "gui/options/OptionsController.h"
-//#include "cat/TPTScriptInterface.h"
+#ifdef LUACONSOLE
#include "cat/LuaScriptInterface.h"
+#else
+#include "cat/TPTScriptInterface.h"
+#endif
#include "client/ClientListener.h"
#include "RenderPreset.h"
#include "Menu.h"
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index c1f56f7..50239b1 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -24,8 +24,10 @@
#include "Snapshot.h"
//#include "StorageClasses.h"
+#ifdef LUACONSOLE
#include "cat/LuaScriptInterface.h"
#include "cat/LuaScriptHelper.h"
+#endif
int Simulation::Load(GameSave * save)
{
@@ -4196,7 +4198,11 @@ void Simulation::update_particles_i(int start, int inc)
}
//call the particle update function, if there is one
+#if !defined(RENDERER) && defined(LUACONSOLE)
if (elements[t].Update && lua_el_mode[t] != 2)
+#else
+ if (elements[t].Update)
+#endif
{
if ((*(elements[t].Update))(this, i, x, y, surround_space, nt, parts, pmap))
continue;
@@ -4207,6 +4213,7 @@ void Simulation::update_particles_i(int start, int inc)
y = (int)(parts[i].y+0.5f);
}
}
+#if !defined(RENDERER) && defined(LUACONSOLE)
if(lua_el_mode[t])
{
if(luacon_elementReplacement(this, i, x, y, surround_space, nt, parts, pmap))
@@ -4215,6 +4222,7 @@ void Simulation::update_particles_i(int start, int inc)
x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f);
}
+#endif
if(legacy_enable)//if heat sim is off
Element::legacyUpdate(this, i,x,y,surround_space,nt, parts, pmap);
diff --git a/src/socket/socket.lua.cpp b/src/socket/socket.lua.cpp
index 80b32f7..0032e2c 100644
--- a/src/socket/socket.lua.cpp
+++ b/src/socket/socket.lua.cpp
@@ -1,3 +1,4 @@
+#ifdef LUACONSOLE
// socket.lua from luasocket compiled into a cpp file
extern "C" {
#include "lua.h"
@@ -10,3 +11,4 @@ void luaopen_socket(lua_State *l){
luaL_loadbuffer(l, socket_luac, socket_luac_sz, "@builtin socket.lua");
lua_call(l, 0, 0);
}
+#endif \ No newline at end of file