stratagus-cvs
[Top][All Lists]
Advanced

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

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


From: Martin Renold
Subject: [Stratagus-CVS] stratagus doc/ccl/ai.html src/ai/new_ai.c
Date: Wed, 08 Oct 2003 04:47:42 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Martin Renold <address@hidden>  03/10/08 04:47:42

Modified files:
        doc/ccl        : ai.html 
        src/ai         : new_ai.c 

Log message:
        ai prints useful error if missing

Patches:
Index: stratagus/doc/ccl/ai.html
diff -u stratagus/doc/ccl/ai.html:1.14 stratagus/doc/ccl/ai.html:1.15
--- stratagus/doc/ccl/ai.html:1.14      Wed Sep 10 11:33:43 2003
+++ stratagus/doc/ccl/ai.html   Wed Oct  8 04:47:41 2003
@@ -111,7 +111,7 @@
 
 <pre>
     ;; Defines the passive computer AI, which does nothing.
-(define-ai "wc2-passive" "*" "passive"
+(define-ai "passive-ai" "*" "passive"
   '((ai:sleep  10000)
   (ai:restart) ))
 </pre>
@@ -876,7 +876,7 @@
 FIXME: need some complex examples.
 
 <hr>
-Last changed: $Id: ai.html,v 1.14 2003/09/10 15:33:43 martinxyz Exp $<br>
+Last changed: $Id: ai.html,v 1.15 2003/10/08 08:47:41 martinxyz 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/new_ai.c
diff -u stratagus/src/ai/new_ai.c:1.73 stratagus/src/ai/new_ai.c:1.74
--- stratagus/src/ai/new_ai.c:1.73      Thu Sep 25 02:58:36 2003
+++ stratagus/src/ai/new_ai.c   Wed Oct  8 04:47:42 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//      $Id: new_ai.c,v 1.73 2003/09/25 06:58:36 mr-russ Exp $
+//      $Id: new_ai.c,v 1.74 2003/10/08 08:47:42 martinxyz Exp $
 
 
 //@{
@@ -803,7 +803,7 @@
 global void SaveAi(CLFile* file)
 {
     CLprintf(file,"\n;;; -----------------------------------------\n");
-    CLprintf(file,";;; MODULE: AI $Id: new_ai.c,v 1.73 2003/09/25 06:58:36 
mr-russ Exp $\n\n");
+    CLprintf(file,";;; MODULE: AI $Id: new_ai.c,v 1.74 2003/10/08 08:47:42 
martinxyz Exp $\n\n");
 
     SaveAiTypesWcName(file);
     SaveAiHelper(file);
@@ -835,11 +835,16 @@
     ait=AiTypes;
 
     ainame=AiTypeWcNames[player->AiNum];
-    DebugLevel0(" %s\n" _C_ ainame);
+    DebugLevel0(" looking for class %s\n" _C_ ainame);
 
     //
     // Search correct AI type.
     //
+    if( !ait ) {
+       DebugLevel0Fn("AI: Got no scripts at all! You need at least one dummy 
fallback script.\n");
+       DebugLevel0Fn("AI: Look at the (define-ai) documentation.\n");
+       exit(0);
+    }
     for( ;; ) {
        if( ait->Race && strcmp(ait->Race,player->RaceName) ) {
            ait=ait->Next;
@@ -847,7 +852,7 @@
                ainame=NULL;
                ait=AiTypes;
            }
-           DebugCheck( !ait );
+           if( !ait ) break;
            continue;
        }
        if( ainame && strcmp(ainame,ait->Class) ) {
@@ -856,13 +861,18 @@
                ainame=NULL;
                ait=AiTypes;
            }
-           DebugCheck( !ait );
+           if( !ait ) break;
            continue;
        }
        break;
     }
+    if( !ait ) {
+       DebugLevel0Fn("AI: Found no matching ai scripts at all!\n");
+       exit(0);
+    }
     if( !ainame ) {
        DebugLevel0Fn("AI: not found!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+       DebugLevel0Fn("AI: Using fallback:\n");
     }
     DebugLevel0Fn("AI: %s:%s with %s:%s\n" _C_ player->RaceName _C_ ait->Race
            _C_ ainame _C_ ait->Class );




reply via email to

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