Engine:
authorsmxx
Wed, 03 Mar 2010 15:04:39 +0000
changeset 2924 908851e59958
parent 2923 e33ecd95aa1a
child 2925 d088b5f813c9
Engine: * Renamed proto.inc to config.inc to receive other config values from cmake as well * Moved Lua library lookup back to CMake - hope this finally fixes all issues * Fixed training once again
cmake_modules/FindLua.cmake
hedgewars/CMakeLists.txt
hedgewars/LuaPas.pas
hedgewars/PascalExports.pas
hedgewars/config.inc.in
hedgewars/proto.inc.in
hedgewars/uConsts.pas
hedgewars/uRandom.pas
hedgewars/uScript.pas
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/FindLua.cmake	Wed Mar 03 15:04:39 2010 +0000
@@ -0,0 +1,11 @@
+# Find the Lua library
+#
+
+IF(UNIX)
+  FIND_LIBRARY(LUA_LIBRARY NAMES lua5.1 lua)
+ELSE(UNIX)
+  IF(WIN32)
+    SET(LUA_LIBRARY lua.dll CACHE FILEPATH "Path to the lua library to be used. This should be set to 'lua.dll' or 'lua' under Win32/Apple to use the bundled copy.")
+  else(WIN32)
+  ENDIF(WIN32)
+ENDIF(UNIX)
\ No newline at end of file
--- a/hedgewars/CMakeLists.txt	Wed Mar 03 14:49:10 2010 +0000
+++ b/hedgewars/CMakeLists.txt	Wed Mar 03 15:04:39 2010 +0000
@@ -1,10 +1,11 @@
-configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in ${CMAKE_CURRENT_BINARY_DIR}/proto.inc)
+configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
 
 find_package(SDL)
 find_package(SDL_image)
 find_package(SDL_net)
 find_package(SDL_ttf)
 find_package(SDL_mixer)
+find_package(Lua)
 
 #find which version of SDL_image and SDL_mixer we have (for IMG_Init and Mix_Init)
 #if the headers are not installed, the newer apis won't be activated
@@ -73,7 +74,7 @@
 	HHHandlers.inc
 	SinTable.inc
 	options.inc
-	${CMAKE_CURRENT_BINARY_DIR}/proto.inc
+	${CMAKE_CURRENT_BINARY_DIR}/config.inc
 	)
 
 find_program(fpc_executable ${fpc_tryexe})
--- a/hedgewars/LuaPas.pas	Wed Mar 03 14:49:10 2010 +0000
+++ b/hedgewars/LuaPas.pas	Wed Mar 03 15:04:39 2010 +0000
@@ -10,6 +10,7 @@
 interface
 
 {.$DEFINE LUA_GETHOOK}
+{$INCLUDE "config.inc"}
 
 type
   size_t   = type Cardinal;
@@ -20,15 +21,7 @@
   Plua_State = ^lua_State;
 
 const
-{$IFDEF UNIX}
-  {$IFDEF DARWIN}
-    LuaLibName = 'lua';
-  {$ELSE}
-    LuaLibName = 'lua5.1.so';
-  {$ENDIF}
-{$ELSE}
-  LuaLibName = 'lua.dll';
-{$ENDIF}
+    LuaLibName = cLuaLibrary;
 
 
 (*****************************************************************************)
--- a/hedgewars/PascalExports.pas	Wed Mar 03 14:49:10 2010 +0000
+++ b/hedgewars/PascalExports.pas	Wed Mar 03 15:04:39 2010 +0000
@@ -15,7 +15,7 @@
 interface
 uses uKeys, uConsole;
 
-{$INCLUDE "proto.inc"}
+{$INCLUDE "config.inc"}
 
 {$IFDEF IPHONEOS}
 // called by pascal code, they deal with the objc code
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/config.inc.in	Wed Mar 03 15:04:39 2010 +0000
@@ -0,0 +1,21 @@
+(*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *)
+
+const cNetProtoVersion = ${HEDGEWARS_PROTO_VER};
+      cVersionString = '${HEDGEWARS_VERSION}';
+      cLuaLibrary = '${LUA_LIBRARY}';
--- a/hedgewars/proto.inc.in	Wed Mar 03 14:49:10 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-(*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *)
-
-const cNetProtoVersion = ${HEDGEWARS_PROTO_VER};
-      cVersionString = '${HEDGEWARS_VERSION}';
--- a/hedgewars/uConsts.pas	Wed Mar 03 14:49:10 2010 +0000
+++ b/hedgewars/uConsts.pas	Wed Mar 03 15:04:39 2010 +0000
@@ -29,7 +29,7 @@
 {$ENDIF}
 
 
-{$INCLUDE "proto.inc"}
+{$INCLUDE "config.inc"}
 
 // typed const is a variable despite const qualifier
 // in freepascal you may actually use var for the same purpose
--- a/hedgewars/uRandom.pas	Wed Mar 03 14:49:10 2010 +0000
+++ b/hedgewars/uRandom.pas	Wed Mar 03 15:04:39 2010 +0000
@@ -21,7 +21,7 @@
 unit uRandom;
 interface
 uses uFloat;
-{$INCLUDE "proto.inc"}
+{$INCLUDE "config.inc"}
 
 procedure init_uRandom;
 procedure free_uRandom;
--- a/hedgewars/uScript.pas	Wed Mar 03 14:49:10 2010 +0000
+++ b/hedgewars/uScript.pas	Wed Mar 03 15:04:39 2010 +0000
@@ -207,7 +207,7 @@
 		end
 	else
 		begin
-		ParseCommand('addteam ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 1), true);
+		ParseCommand('addteam x ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 1), true);
 		ParseCommand('grave ' + lua_tostring(L, 3), true);
 		ParseCommand('fort ' + lua_tostring(L, 4), true);
 		ParseCommand('voicepack ' + lua_tostring(L, 5), true);