stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src include/script.h stratagus/script...


From: address@hidden
Subject: [Stratagus-CVS] stratagus/src include/script.h stratagus/script...
Date: 21 Jan 2004 04:40:09 +1100

CVSROOT:        /home/strat
Module name:    stratagus
Changes by:      <address@hidden>       04/01/21 04:40:08

Modified files:
        src/include    : script.h 
        src/stratagus  : script.c script_player.c 

Log message:
        More Stratagus.Players.* META_LUA. basic stuff should work, complete 
after 2.0

Patches:
Index: stratagus/src/include/script.h
diff -u stratagus/src/include/script.h:1.55 stratagus/src/include/script.h:1.56
--- stratagus/src/include/script.h:1.55 Wed Jan 21 03:44:56 2004
+++ stratagus/src/include/script.h      Wed Jan 21 04:40:05 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: script.h,v 1.55 2004/01/20 16:44:56 nobody_ Exp $
+//      $Id: script.h,v 1.56 2004/01/20 17:40:05 nobody_ Exp $
 
 #ifndef __SCRIPT_H__
 #define __SCRIPT_H__
@@ -210,6 +210,14 @@
                return 0; \
        } \
 }*/
+
+#define META_GET_USERDATA(keyval, obj, type) \
+{ \
+       if (!strcmp(key, keyval)) { \
+               ScriptCreateUserdata(l, obj, type); \
+               return 1; \
+       } \
+}
 
 #endif // META_LUA
 
Index: stratagus/src/stratagus/script.c
diff -u stratagus/src/stratagus/script.c:1.162 
stratagus/src/stratagus/script.c:1.163
--- stratagus/src/stratagus/script.c:1.162      Wed Jan 21 03:44:56 2004
+++ stratagus/src/stratagus/script.c    Wed Jan 21 04:40:07 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: script.c,v 1.162 2004/01/20 16:44:56 nobody_ Exp $
+//      $Id: script.c,v 1.163 2004/01/20 17:40:07 nobody_ Exp $
 
 //@{
 
@@ -1193,6 +1193,8 @@
        /* Add all our namesspaces and stuff.*/
        ScriptSpellInit();
        ScriptMissileTypesInit();
+       ScriptPlayerInit();
+
        lua_settable(Lua, LUA_GLOBALSINDEX);
 }
 
@@ -1356,7 +1358,7 @@
        }
 
        fprintf(fd, "--- -----------------------------------------\n");
-       fprintf(fd, "--- $Id: script.c,v 1.162 2004/01/20 16:44:56 nobody_ Exp 
$\n");
+       fprintf(fd, "--- $Id: script.c,v 1.163 2004/01/20 17:40:07 nobody_ Exp 
$\n");
 
        fprintf(fd, "SetVideoResolution(%d, %d)\n", VideoWidth, VideoHeight);
        fprintf(fd, "SetGroupKeys(\"");
@@ -1392,7 +1394,7 @@
        }
 
        fprintf(fd, "--- -----------------------------------------\n");
-       fprintf(fd, "--- $Id: script.c,v 1.162 2004/01/20 16:44:56 nobody_ Exp 
$\n");
+       fprintf(fd, "--- $Id: script.c,v 1.163 2004/01/20 17:40:07 nobody_ Exp 
$\n");
 
        // Global options
        if (OriginalFogOfWar) {
@@ -1495,7 +1497,7 @@
        extern SCM oblistvar;
 
        CLprintf(file, "\n;;; -----------------------------------------\n");
-       CLprintf(file, ";;; MODULE: CCL $Id: script.c,v 1.162 2004/01/20 
16:44:56 nobody_ Exp $\n\n");
+       CLprintf(file, ";;; MODULE: CCL $Id: script.c,v 1.163 2004/01/20 
17:40:07 nobody_ Exp $\n\n");
 
        for (list = oblistvar; gh_list_p(list); list = gh_cdr(list)) {
                SCM sym;
Index: stratagus/src/stratagus/script_player.c
diff -u stratagus/src/stratagus/script_player.c:1.56 
stratagus/src/stratagus/script_player.c:1.57
--- stratagus/src/stratagus/script_player.c:1.56        Wed Jan 21 03:44:57 2004
+++ stratagus/src/stratagus/script_player.c     Wed Jan 21 04:40:07 2004
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: script_player.c,v 1.56 2004/01/20 16:44:57 nobody_ Exp $
+//      $Id: script_player.c,v 1.57 2004/01/20 17:40:07 nobody_ Exp $
 
 //@{
 
@@ -814,7 +814,7 @@
        /// Proxy type for Player->SharedVision
 local ScriptProxyType ScriptProxyPlayerSharedVision;
        /// Proxy type for Player->UnitTypesCount
-local ScriptProxyType ScriptProxtPlayerUnitTypesCount;
+local ScriptProxyType ScriptProxyPlayerUnitTypesCount;
 
 /**
 **     Get function for the big Players namespace, with int index
@@ -853,6 +853,12 @@
        META_GET_INT("TotalRazings", player->TotalRazings);
        META_GET_INT("TotalKills", player->TotalKills);
 
+       META_GET_USERDATA("Allied", player, &ScriptProxyPlayerAllied);
+       META_GET_USERDATA("Enemy", player, &ScriptProxyPlayerEnemy);
+       META_GET_USERDATA("SharedVision", player, 
&ScriptProxyPlayerSharedVision);
+       META_GET_USERDATA("UnitTypesCount", player, 
&ScriptProxyPlayerUnitTypesCount);
+       META_GET_USERDATA("Research", player, &ScriptProxyPlayer);
+
        LuaError(l, "Field \"%s\" is innexistent or write-only (yes, we have 
those).\n" _C_ key);
 }
 
@@ -995,6 +1001,10 @@
        ScriptProxyTypeInitBlock(&ScriptProxyPlayerSharedVision);
        ScriptProxyPlayerSharedVision.GetInt = (ScriptGetSetIntFunction 
*)ScriptPlayerSharedVisionGet;
        ScriptProxyPlayerSharedVision.SetInt = (ScriptGetSetIntFunction 
*)ScriptPlayerSharedVisionSet;
+
+       ScriptProxyTypeInitBlock(&ScriptProxyPlayerUnitTypesCount);
+       ScriptProxyPlayerUnitTypesCount.GetStr = (ScriptGetSetStrFunction 
*)ScriptPlayerUnitTypesCountGetStr;
+       ScriptProxyPlayerUnitTypesCount.GetInt = (ScriptGetSetIntFunction 
*)ScriptPlayerUnitTypesCountGetInt;
 
        // Create Stratagus.Players namespace.
        lua_pushstring(Lua, "Players");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]