[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-wiki-changes] WritingYourOwnAI
From: |
wiki |
Subject: |
[Wesnoth-wiki-changes] WritingYourOwnAI |
Date: |
Sun, 24 Oct 2004 21:02 +0200 |
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20040913
Firefox/0.10.1 StumbleUpon/1.998
IP: 67.38.248.41
URI: http://wesnoth.slack.it/?WritingYourOwnAI
- - - - -
Index: WritingYourOwnAI
===================================================================
RCS file: /home/wesnoth/cvsroot/wikiroot/WritingYourOwnAI,v
retrieving revision 1.7
diff -u -r1.7 WritingYourOwnAI
--- WritingYourOwnAI 3 Oct 2004 03:45:49 -0000 1.7
+++ WritingYourOwnAI 24 Oct 2004 19:02:36 -0000
@@ -115,9 +115,8 @@
Note that the 'possible_moves' thing is of little direct interest. It contains
details of exactly which tiles the unit
moves along to get from one tile to another. This is useful for the display to
know about when it draws the unit
-moving,
-but as an AI programmer, it's likely you'll ever care about what it contains.
Just pass it along to the move_unit()
-function so it can draw the unit moving along the correct path.
+moving, but as an AI programmer, it's not likely you'll ever care about what
it contains. Just pass it along to the
+move_unit() function so it can draw the unit moving along the correct path.
The things we're interested in are srcdst and dstsrc. Especially dstsrc. It
will tell us all the hexes our units can
reach. We want to check if any of these hexes are next to an enemy unit. Let's
walk over the units and see if we can
@@ -134,9 +133,8 @@
get_adjacent_tiles(i->first,adjacent_tiles);
This kind of call is very common in the game's code -- make an array of 6
locations, and fill them up with the
-locations
-adjacent to a certain location. We actually want to find the position to
attack from which gives our unit the best
-possible defense. So, we initialize some variables to find the best possible
defense:
+locations adjacent to a certain location. We actually want to find the
position to attack from which gives our unit the
+bestpossible defense. So, we initialize some variables to find the best
possible defense:
int best_defense = -1;
std::pair<location,location> best_movement;