stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus src/ai/ccl_ai.c doc/ccl/ai.html doc/c...


From: ludovic pollet
Subject: [Stratagus-CVS] stratagus src/ai/ccl_ai.c doc/ccl/ai.html doc/c...
Date: Sat, 01 Nov 2003 06:37:35 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     ludovic pollet <address@hidden> 03/11/01 06:37:34

Modified files:
        src/ai         : ccl_ai.c 
        doc/ccl        : ai.html ccl-index.html 

Log message:
        Added ai:debug-player command to control debugging of the AI

Patches:
Index: stratagus/doc/ccl/ai.html
diff -u stratagus/doc/ccl/ai.html:1.17 stratagus/doc/ccl/ai.html:1.18
--- stratagus/doc/ccl/ai.html:1.17      Wed Oct 29 13:51:07 2003
+++ stratagus/doc/ccl/ai.html   Sat Nov  1 06:37:34 2003
@@ -60,6 +60,7 @@
 <a href="#ai:compute-gauges">ai:compute-gauges</a>
 <a href="#ai:debug">ai:debug</a>
 <a href="#ai:debug-gauges">ai:debug-gauges</a>
+<a href="#ai:debug-player">ai:debug-player</a>
 <a href="#ai:dump">ai:dump</a>
 <a href="#ai:evaluate-force-cost">ai:evaluate-force-cost</a>
 <a href="#ai:force">ai:force</a>
@@ -557,6 +558,23 @@
 
 <a href="../../data/ccl/ai.ccl"> $LIBARYPATH/ccl/ai.ccl </a>
 
+<a name="ai:debug-player"></a>
+<h3>(ai:debug-player 1 2 3 ...)</h3>
+
+Activate dump of AI forces and strategy on stdout.<br>
+Parameters are player number, or 'self, for thisplayer.<br>
+'none will stop all AI debug output.
+
+<h4>Example</h4>
+
+<pre>
+    (ai:debug-player 'self)
+</pre>
+
+<h4>Used</h4>
+
+During the game...
+
 <a name="ai:dump"></a>
 <h3>(ai:dump)</h3>
 
@@ -1468,7 +1486,7 @@
 FIXME: need some complex examples.
 
 <hr>
-Last changed: $Id: ai.html,v 1.17 2003/10/29 18:51:07 pludov Exp $<br>
+Last changed: $Id: ai.html,v 1.18 2003/11/01 11:37:34 pludov Exp $<br>
 All trademarks and copyrights on this page are owned by their respective 
owners.
 <address>(c) 2002-2003 by <a href="http://stratagus.org";>
 The Stratagus Project</a></address></body></html>
Index: stratagus/doc/ccl/ccl-index.html
diff -u stratagus/doc/ccl/ccl-index.html:1.50 
stratagus/doc/ccl/ccl-index.html:1.51
--- stratagus/doc/ccl/ccl-index.html:1.50       Fri Oct 31 17:31:20 2003
+++ stratagus/doc/ccl/ccl-index.html    Sat Nov  1 06:37:34 2003
@@ -102,6 +102,8 @@
 <dd></dd>
 <dt><a href="ai.html#ai:debug-gauges">ai:debug-gauges</a></dt>
 <dd></dd>
+<dt><a href="ai.html#ai:debug-player">ai:debug-player</a></dt>
+<dd></dd>
 <dt><a href="ai.html#ai:dump">ai:dump</a></dt>
 <dd></dd>
 <dt><a href="ai.html#ai:evaluate-force-cost">ai:evaluate-force-cost</a></dt>
@@ -577,7 +579,7 @@
 <!-- SCRIPT END -->
 </dl>
 
-Last changed: $Id: ccl-index.html,v 1.50 2003/10/31 22:31:20 jsalmon3 Exp $<br>
+Last changed: $Id: ccl-index.html,v 1.51 2003/11/01 11:37:34 pludov Exp $<br>
 All trademarks and copyrights on this page are owned by their respective 
owners.
 <address>(c) 2002-2003 by <a href="http://stratagus.org";>
 The Stratagus Project</a></address></body></html>
Index: stratagus/src/ai/ccl_ai.c
diff -u stratagus/src/ai/ccl_ai.c:1.75 stratagus/src/ai/ccl_ai.c:1.76
--- stratagus/src/ai/ccl_ai.c:1.75      Fri Oct 31 04:14:46 2003
+++ stratagus/src/ai/ccl_ai.c   Sat Nov  1 06:37:34 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: ccl_ai.c,v 1.75 2003/10/31 09:14:46 pludov Exp $
+//      $Id: ccl_ai.c,v 1.76 2003/11/01 11:37:34 pludov Exp $
 
 //@{
 
@@ -948,6 +948,49 @@
 }
 
 /**
+**     Activate AI debugging for the given player(s)
+**     Player can be
+**             a number for a specific player 
+**             "self" for current human player (ai me)
+**             "none" to disable
+**
+**     @param list the list of player to activate
+*/
+local SCM CclAiDebugPlayer(SCM list)
+{
+    SCM item;
+    int playerid;
+    while (!gh_null_p(list)) {
+       item = gh_car(list);
+       list = gh_cdr(list);
+
+       if (gh_eq_p(item, gh_symbol2scm("none"))) {
+           for (playerid = 0; playerid < NumPlayers; playerid++) {
+               if (!Players[playerid].AiEnabled || !Players[playerid].Ai) {
+                   continue;
+               }
+               ((PlayerAi*)Players[playerid].Ai)->ScriptDebug = 0;
+           }
+       } else {
+           if (gh_eq_p(item, gh_symbol2scm("self"))) {
+               if (!ThisPlayer) {
+                   continue;
+               }
+               playerid = ThisPlayer->Player;
+           } else {
+               playerid = gh_scm2int(item);
+           }
+
+           if (!Players[playerid].AiEnabled || !Players[playerid].Ai) {
+               continue;
+           }
+           ((PlayerAi*)Players[playerid].Ai)->ScriptDebug = 1;
+       }
+    }
+    return SCM_UNSPECIFIED;
+}
+
+/**
 **     Need an unit.
 **
 **     @param value    Unit-type as string/symbol/object.
@@ -1005,6 +1048,7 @@
        if (unit_types_count[type->Type]) {
            return SCM_BOOL_F;
        }
+
        //
        //      Look if we have equivalent unit-types.
        //
@@ -2314,6 +2358,7 @@
     gh_new_procedure0_0("ai:get-sleep-cycles", CclAiGetSleepCycles);
 
     gh_new_procedure1_0("ai:debug", CclAiDebug);
+    gh_new_procedureN("ai:debug-player", CclAiDebugPlayer);
     gh_new_procedure1_0("ai:need", CclAiNeed);
     gh_new_procedure2_0("ai:set", CclAiSet);
     gh_new_procedure1_0("ai:wait", CclAiWait);




reply via email to

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