[Freeciv-Dev] Cleaning up gotohand.c (PR#1068)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Old subject: Safe paths for triremes.
Since there were no signs that the management of the CVS is going to put
my patch in immediately, I decided to update it, in the meantime. The
changes from the previous patch:
* in two places in really_generate_warmap and find_the_shortest_path it
is no longer assumed that RAILROAD cost is zero. The resulting statement
is ugly due to the legacy from long ago: any IGTER move costs SINGLE_MOVE
on the warmap, not MOVE_COST_ROAD as it should. I haven't got the
courage to challenge this legacy yet.
* Extensive variable renaming in find_a_direction. I do really hope that
it makes the code clearer although in some places it is completely over
my head. Added some comments too, where I know what to say.
! Neither of the changes affects the program flow !
The old parts of the patch are described below:
As was requested about a month ago, I am splitting my warmap patch into a
series of smaller patches.
The first part is mostly cleanup.
Below is the list of features (unfortunately there is no way to comment
the patch in the patch itself):
* removed some comments referring to the code which is not there for
* added some comments (editor, feel free to cut my comments short)
* removed "silence compiler warning" line because there is no compiler
* fixed buggy check
if (warmap.warunit == punit && !warmap.cost[punit->x][punit->y])
* removed initializations that do not affect anything
* removed dir_ok (sorry guys)
* as was proposed in the comment, changed the code to take into account
where we _really_ came from, not to guess the direction from dir_ok
* changed the comment accordingly
* the previous handling of trireme was pathetic. changed it to use
is_coast_seen. NB: it does not mean that triremes are safe: if
find_a_direction is given an unsafe destination it is unlikely to help.
AI goto has 3 levels
1. Find a destination -- generate_warmap
takes into account terrain only
2. Find routes to destination -- find_the_shortest_path
takes into account some info about enemy and ZOC
3. Choose between the routes -- find_a_direction
final level of detalisation.
In other places:
* general cleanup of magic numbers
* definition of is_coast_seen
Waiting for your comments,
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and
- [Freeciv-Dev] Cleaning up gotohand.c (PR#1068),
Gregory Berkolaiko <=