diff options
author | Aaron Marks <nymacro@gmail.com> | 2005-05-21 10:48:09 +0000 |
---|---|---|
committer | Aaron Marks <nymacro@gmail.com> | 2005-05-21 10:48:09 +0000 |
commit | fff37ac56a093ca1659d03d7fca339d96f6a931f (patch) | |
tree | 0f215b010e83650289150e4930b46f8188003f21 | |
parent | debc30dc9ea83ee6b7693f7258f38f52c0b15c45 (diff) | |
download | manaserv-fff37ac56a093ca1659d03d7fca339d96f6a931f.tar.gz manaserv-fff37ac56a093ca1659d03d7fca339d96f6a931f.tar.bz2 manaserv-fff37ac56a093ca1659d03d7fca339d96f6a931f.tar.xz manaserv-fff37ac56a093ca1659d03d7fca339d96f6a931f.zip |
Disabled scripting by default (enabled using --with-scripting at configure)
-rw-r--r-- | configure.ac | 18 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/object.h | 4 | ||||
-rw-r--r-- | src/script-squirrel.cpp | 3 | ||||
-rw-r--r-- | src/script-squirrel.h | 4 | ||||
-rw-r--r-- | src/script.cpp | 3 | ||||
-rw-r--r-- | src/script.h | 4 |
7 files changed, 37 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 2545fdf2..a3b7e671 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,20 @@ AC_PROG_RANLIB # Checks for libraries. AC_CHECK_LIB([physfs], [PHYSFS_init]) AC_CHECK_LIB([SDL_net], [SDLNet_Init]) -AC_CHECK_LIB([squirrel], [sq_open]) + +AC_ARG_WITH(scripting,[ --with-scripting Build with scripting]) +if test "x$with_scripting" == "xyes"; then + AC_CHECK_LIB([squirrel], [sq_open]) + + with_scripting=yes + SCRIPT_CFLAGS=' -DSCRIPT_SUPPORT' + SCRIPT_LIBS=' -lsquirrel -lsqstdlib' + AC_SUBST(SCRIPT_CFLAGS) + AC_SUBST(SCRIPT_LIBS) +else + with_scripting=no +fi + # Checks for header files. AC_HEADER_STDC @@ -36,3 +49,6 @@ AC_CHECK_FUNCS([atexit]) AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT + +echo +echo "Building with scripting support: $with_scripting" diff --git a/src/Makefile.am b/src/Makefile.am index 31da9d86..d9862799 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ LIBS = $(SQLITE_LIBS) # the library search path. tmwserv_LDFLAGS = $(all_libraries) -lSDL_net `sdl-config --libs` `pkg-config --libs libxml-2.0` -lphysfs -tmwserv_CXXFLAGS = -g -Wall `sdl-config --cflags` `pkg-config --cflags libxml-2.0` -fno-inline -DSCRIPT_SUPPORT +tmwserv_CXXFLAGS = -g -Wall `sdl-config --cflags` `pkg-config --cflags libxml-2.0` -fno-inline $(SCRIPT_CFLAGS) #tmwserv_LDADD = $(LIBSDL_LIBS) -lphysfs -tmwserv_LDADD = -lsquirrel -lsqstdlib +tmwserv_LDADD = $(SCRIPT_LIBS) tmwserv_TARGET = ../tmwserv diff --git a/src/object.h b/src/object.h index 50b854da..a3031598 100644 --- a/src/object.h +++ b/src/object.h @@ -86,7 +86,9 @@ class Being : public Object //Inventory inventory; //Equipment equipment; +#ifdef SCRIPT_SUPPORT Script *script; +#endif public: ~Being() { } //empty definition @@ -102,7 +104,9 @@ class Being : public Object stats.speed = dexterity; //Update scipt +#ifdef SCRIPT_SUPPORT script->update(); +#endif } //accessors diff --git a/src/script-squirrel.cpp b/src/script-squirrel.cpp index 901ad9a9..749d5b28 100644 --- a/src/script-squirrel.cpp +++ b/src/script-squirrel.cpp @@ -1,6 +1,8 @@ #include "script-squirrel.h" #include <cstring> +#ifdef SCRIPT_SUPPORT + void registerStdLib(HSQUIRRELVM); /* @@ -271,3 +273,4 @@ void registerStdLib(HSQUIRRELVM v) functionRegister(v, getVitality, "getVitality"); } +#endif diff --git a/src/script-squirrel.h b/src/script-squirrel.h index c17608ff..ed16e158 100644 --- a/src/script-squirrel.h +++ b/src/script-squirrel.h @@ -24,6 +24,8 @@ #ifndef SCRIPT_SQUIRREL_H #define SCRIPT_SQUIRREL_H +#ifdef SCRIPT_SUPPORT + #include "script.h" #include <cstdio> #include <cstdlib> @@ -45,3 +47,5 @@ class ScriptSquirrel : public Script }; #endif + +#endif diff --git a/src/script.cpp b/src/script.cpp index a614e030..9d761eb8 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1,4 +1,7 @@ #include "script.h" +#ifdef SCRIPT_SUPPORT + Script *script; +#endif diff --git a/src/script.h b/src/script.h index 4a003611..d58ea9a1 100644 --- a/src/script.h +++ b/src/script.h @@ -24,6 +24,8 @@ #ifndef SCRIPT_H #define SCRIPT_H +#ifdef SCRIPT_SUPPORT + #include <iostream> /* @@ -65,3 +67,5 @@ class Script extern Script *script; // Global script (temporary? #endif + +#endif |