[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/missile ccl_missile.c
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus/src/missile ccl_missile.c |
Date: |
Wed, 12 Nov 2003 15:22:26 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/11/12 15:22:26
Modified files:
src/missile : ccl_missile.c
Log message:
Started lua support
Patches:
Index: stratagus/src/missile/ccl_missile.c
diff -u stratagus/src/missile/ccl_missile.c:1.37
stratagus/src/missile/ccl_missile.c:1.38
--- stratagus/src/missile/ccl_missile.c:1.37 Sat Oct 25 19:10:44 2003
+++ stratagus/src/missile/ccl_missile.c Wed Nov 12 15:22:25 2003
@@ -1,4 +1,4 @@
-// _________ __ __
+/ _________ __ __
// / _____// |_____________ _/ |______ ____ __ __ ______
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_missile.c,v 1.37 2003/10/25 23:10:44 n0body Exp $
+// $Id: ccl_missile.c,v 1.38 2003/11/12 20:22:25 jsalmon3 Exp $
//@{
@@ -62,6 +62,7 @@
**
** @param list List describing missile-type.
*/
+#if defined(USE_GUILE) || defined(USE_SIOD)
local SCM CclDefineMissileType(SCM list)
{
SCM value;
@@ -156,12 +157,15 @@
return SCM_UNSPECIFIED;
}
+#elif defined(USE_LUA)
+#endif
/**
** Define missile type mapping from original number to internal symbol
**
** @param list List of all names.
*/
+#if defined(USE_GUILE) || defined(USE_SIOD)
local SCM CclDefineMissileTypeWcNames(SCM list)
{
int i;
@@ -187,12 +191,49 @@
return SCM_UNSPECIFIED;
}
+#elif defined(USE_LUA)
+local int CclDefineMissileTypeWcNames(lua_State* l)
+{
+ int i;
+ int j;
+ char** cp;
+
+ if ((cp = MissileTypeWcNames)) { // Free all old names
+ while (*cp) {
+ free(*cp++);
+ }
+ free(MissileTypeWcNames);
+ }
+
+ //
+ // Get new table.
+ //
+ i = lua_gettop(l);
+ MissileTypeWcNames = cp = malloc((i + 1) * sizeof(char*));
+ if (!cp) {
+ fprintf(stderr, "out of memory.\n");
+ ExitFatal(-1);
+ }
+
+ for (j = 0; j < i; ++j) {
+ if (!lua_isstring(l, j + 1)) {
+ lua_pushstring(l, "incorrect argument");
+ lua_error(l);
+ }
+ *cp++ = strdup(lua_tostring(l, j + 1));
+ }
+ *cp = NULL;
+
+ return 0;
+}
+#endif
/**
** Create a missile.
**
** @param list List of all names.
*/
+#if defined(USE_GUILE) || defined(USE_SIOD)
local SCM CclMissile(SCM list)
{
SCM value;
@@ -327,12 +368,15 @@
}
return SCM_UNSPECIFIED;
}
+#elif defined(USE_LUA)
+#endif
/**
** Define burning building missiles.
**
** @param list .
*/
+#if defined(USE_GUILE) || defined(USE_SIOD)
local SCM CclDefineBurningBuilding(SCM list)
{
SCM value;
@@ -377,17 +421,27 @@
}
return SCM_UNSPECIFIED;
}
+#elif defined(USE_LUA)
+#endif
/**
** Register CCL features for missile-type.
*/
global void MissileCclRegister(void)
{
+#if defined(USE_GUILE) || defined(USE_SIOD)
gh_new_procedureN("define-missiletype-wc-names",
- CclDefineMissileTypeWcNames);
+ CclDefineMissileTypeWcNames);
gh_new_procedureN("define-missile-type", CclDefineMissileType);
gh_new_procedureN("missile", CclMissile);
gh_new_procedureN("define-burning-building", CclDefineBurningBuilding);
+#elif defined(USE_LUA)
+ lua_register(Lua, "DefineMissileTypeWcNames",
+ CclDefineMissileTypeWcNames);
+// lua_register("DefineMissileType", CclDefineMissileType);
+// lua_register("Missile", CclMissile);
+// lua_register("DefineBurningBuilding", CclDefineBurningBuilding);
+#endif
}
//@}
- [Stratagus-CVS] stratagus/src/missile ccl_missile.c,
Jimmy Salmon <=