<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40276 >

 This patch finally switches lua 5.1 and toluaxx in to use.

 Minimally tested, as loading scenarios does not currently work.


 - ML

diff -Nurd -X.diff_ignore freeciv/configure.ac freeciv/configure.ac
--- freeciv/configure.ac        2008-06-09 18:58:57.000000000 +0300
+++ freeciv/configure.ac        2008-06-14 18:25:25.000000000 +0300
@@ -693,23 +693,22 @@
 dnl In the future we probably get rid of our own lua tree and use
 dnl lua from system.
 dnl LUA_AS_DEPENDENCY should be empty when using lua outside own our tree.
-LUA_CFLAGS="-I\$(top_srcdir)/dependencies/lua/include"
-LUA_LIBS="\$(top_builddir)/dependencies/lua/src/liblua.a \
- \$(top_builddir)/dependencies/lua/src/lib/liblualib.a"
+LUA_CFLAGS="-I\$(top_srcdir)/dependencies/lua-5.1/src"
+LUA_LIBS="\$(top_builddir)/dependencies/lua-5.1/src/liblua.a"
 LUA_AS_DEPENDENCY="$LUA_LIBS"
 AC_SUBST([LUA_CFLAGS])
 AC_SUBST([LUA_LIBS])
 AC_SUBST([LUA_AS_DEPENDENCY])
 
 
-TOLUA_CFLAGS="-I\$(top_srcdir)/dependencies/tolua"
-TOLUA_LIBS="\$(top_builddir)/dependencies/tolua/libtolua.a"
+TOLUA_CFLAGS="-I\$(top_srcdir)/dependencies/toluaxx/include"
+TOLUA_LIBS="\$(top_builddir)/dependencies/toluaxx/src/lib/libtolua.a"
 TOLUA_AS_DEPENDENCY="$TOLUA_LIBS"
 AC_SUBST([TOLUA_CFLAGS])
 AC_SUBST([TOLUA_LIBS])
 AC_SUBST([TOLUA_AS_DEPENDENCY])
 
-TOLUA="\$(top_builddir)/dependencies/tolua/tolua$EXEEXT"
+TOLUA="\$(top_builddir)/dependencies/toluaxx/src/bin/tolua$EXEEXT"
 AC_SUBST([TOLUA])
 
 dnl Freeciv uses a non-standard macro, Q_(), to handle cases of qualified
@@ -845,10 +844,12 @@
          utility/Makefile
          utility/ftwl/Makefile
          dependencies/Makefile
-         dependencies/lua/Makefile
-         dependencies/tolua/Makefile
-         dependencies/lua/src/Makefile
-         dependencies/lua/src/lib/Makefile
+         dependencies/lua-5.1/Makefile
+          dependencies/lua-5.1/src/Makefile
+         dependencies/toluaxx/Makefile
+         dependencies/toluaxx/src/Makefile
+         dependencies/toluaxx/src/lib/Makefile
+          dependencies/toluaxx/src/bin/Makefile
          common/Makefile
          common/aicore/Makefile
          ai/Makefile
Binary files src.orig/data/misc/editor.png and src.patched/data/misc/editor.png 
differ
diff -Nurd -X.diff_ignore freeciv/dependencies/Makefile.am 
freeciv/dependencies/Makefile.am
--- freeciv/dependencies/Makefile.am    2007-08-04 18:36:09.000000000 +0300
+++ freeciv/dependencies/Makefile.am    2008-06-14 18:25:25.000000000 +0300
@@ -1,3 +1,3 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS=        lua tolua
+SUBDIRS = lua-5.1 toluaxx
diff -Nurd -X.diff_ignore freeciv/server/scripting/api.pkg 
freeciv/server/scripting/api.pkg
--- freeciv/server/scripting/api.pkg    2008-04-06 15:19:10.000000000 +0300
+++ freeciv/server/scripting/api.pkg    2008-06-14 21:17:32.000000000 +0300
@@ -47,7 +47,9 @@
 struct Unit {
   Unit_Type *utype;
   Player *owner;
-  int homecity @ homecity_id;
+
+  /* This used to be @ homecity_id, but it doesn't work with toluaxx. */
+  int homecity;
   Tile *tile;
 
   const int id;
@@ -173,7 +175,7 @@
 
 -- Unit methods.
 function Unit:homecity()
-  return find.city(self.owner, self.homecity_id)
+  return find.city(self.owner, self.homecity)
 end
 
 function Unit:is_on_possible_city_tile()
diff -Nurd -X.diff_ignore freeciv/server/scripting/script.c 
freeciv/server/scripting/script.c
--- freeciv/server/scripting/script.c   2007-08-04 18:36:19.000000000 +0300
+++ freeciv/server/scripting/script.c   2008-06-14 18:25:25.000000000 +0300
@@ -20,7 +20,7 @@
 
 #include "lua.h"
 #include "lualib.h"
-#include "tolua.h"
+#include "toluaxx.h"
 
 #include "astring.h"
 #include "log.h"
@@ -371,11 +371,7 @@
       return FALSE;
     }
 
-    luaopen_base(state);
-    luaopen_string(state);
-    luaopen_io(state);
-    luaopen_debug(state);
-    luaopen_table(state);
+    luaL_openlibs(state);
 
     tolua_api_open(state);
 
@@ -401,7 +397,7 @@
 
     script_signals_free();
 
-    lua_setgcthreshold(state, 0); /* Collected garbage */
+    lua_gc(state, LUA_GCCOLLECT, 0); /* Collected garbage */
     lua_close(state);
     state = NULL;
   }
@@ -412,7 +408,7 @@
 **************************************************************************/
 bool script_do_file(const char *filename)
 {
-  return (lua_dofile(state, filename) == 0);
+  return (luaL_dofile(state, filename) == 0);
 }
 
 /**************************************************************************
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to