wesnoth-cvs-commits
[Top][All Lists]
Advanced

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

[Wesnoth-cvs-commits] wesnoth/src ai.cpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src ai.cpp
Date: Sat, 30 Apr 2005 03:15:05 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/04/30 07:15:05

Modified files:
        src            : ai.cpp 

Log message:
        Fix bug #12909: don't crash when scenarios are faulty.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai.cpp.diff?tr1=1.146&tr2=1.147&r1=text&r2=text

Patches:
Index: wesnoth/src/ai.cpp
diff -u wesnoth/src/ai.cpp:1.146 wesnoth/src/ai.cpp:1.147
--- wesnoth/src/ai.cpp:1.146    Mon Mar 28 19:08:58 2005
+++ wesnoth/src/ai.cpp  Sat Apr 30 07:15:05 2005
@@ -1,4 +1,4 @@
-/* $Id: ai.cpp,v 1.146 2005/03/28 19:08:58 gruikya Exp $ */
+/* $Id: ai.cpp,v 1.147 2005/04/30 07:15:05 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -35,6 +35,8 @@
 #include <iostream>
 
 #define LOG_AI LOG_STREAM(info, ai)
+#define WRN_AI LOG_STREAM(warn, ai)
+#define ERR_AI LOG_STREAM(err, ai)
 
 ///a trivial ai that sits around doing absolutely nothing
 class idle_ai : public ai_interface {
@@ -1670,10 +1672,14 @@
        }
 
        const gamemap::location dst(*goal);
+       if (!dst.valid()) {
+               ERR_AI << "Invalid goal\n";
+               return;
+       }
 
        const unit_map::iterator leader = find_leader(units_,team_num_);
        if(leader == units_.end() || leader->second.incapacitated()) {
-               LOG_AI << "leader not found\n";
+               WRN_AI << "Leader not found\n";
                return;
        }
 




reply via email to

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