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: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src ai.cpp
Date: Mon, 04 Oct 2004 18:58:36 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    04/10/04 22:45:38

Modified files:
        src            : ai.cpp 

Log message:
        make the AI more inclined to make risk-free attacks

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

Patches:
Index: wesnoth/src/ai.cpp
diff -u wesnoth/src/ai.cpp:1.119 wesnoth/src/ai.cpp:1.120
--- wesnoth/src/ai.cpp:1.119    Mon Oct  4 22:41:05 2004
+++ wesnoth/src/ai.cpp  Mon Oct  4 22:45:37 2004
@@ -1,4 +1,4 @@
-/* $Id: ai.cpp,v 1.119 2004/10/04 22:41:05 Sirp Exp $ */
+/* $Id: ai.cpp,v 1.120 2004/10/04 22:45:37 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1282,16 +1282,13 @@
                LOG_AI << "move: " << move.first.x << ", " << move.first.y << " 
- " << move.second.x << ", " << move.second.y << "\n";
 
                //search to see if there are any enemy units next
-               //to the tile which really should be attacked once the move is 
done
+               //to the tile which really should be attacked once the move is 
done.
                gamemap::location adj[6];
                get_adjacent_tiles(move.second,adj);
                battle_stats bat_stats;
                gamemap::location target;
                int weapon = -1;
 
-               //the behavior of attacking anyone the AI ends up next to
-               //is disabled for the moment, to see how it works out
-               /*
                for(int n = 0; n != 6; ++n) {
                        const unit_map::iterator enemy = 
find_visible_unit(units_,adj[n],
                                        map_,
@@ -1300,13 +1297,18 @@
 
                        if(enemy != units_.end() &&
                           current_team().is_enemy(enemy->second.side()) && 
enemy->second.stone() == false) {
-                               target = adj[n];
-                               weapon = 
choose_weapon(move.first,target,bat_stats,
+                               const int res = 
choose_weapon(move.first,adj[n],bat_stats,
                                                       
map_[move.second.x][move.second.y]);
-                               break;
+
+                               //current behavior is to only make risk-free 
attacks
+                               if(bat_stats.damage_attacker_takes == 0) {
+                                       weapon = res;
+                                       target = adj[n];
+                                       break;
+                               }
                        }
                }
-               */
+               
 
                const location arrived_at = 
move_unit(move.first,move.second,possible_moves);
 




reply via email to

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