[Freeciv-Dev] Re: Improved Auto-Explore
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, 2 Dec 2002, Cameron Morland wrote:
> On Thu, Nov 14, 2002 at 02:59:20PM -0500, Cameron Morland wrote:
> > I made the explorer follow coastlines, which is much more useful that
> > the old behaviour. The patch is attached.
>
> I have heard only positive comments with this; I think it should beapplied to
> CVS.
I like the patch in general, but there are lots of style issues. Please
read doc/CodingStyle.
Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.229
diff -u -3 -p -r1.229 aiunit.c
--- ai/aiunit.c 2002/11/14 09:14:50 1.229
+++ ai/aiunit.c 2002/11/14 19:56:02
@@ -256,6 +256,71 @@ static bool tile_is_accessible(struct un
}
/**************************************************************************
+ Determine if a tile is likely to be water, given information that
+ the player actually has. Return the certainty that it's water
+ (0x80 = certain, 0x40 = no idea, 0 = certainly not).
+**************************************************************************/
+int likely_ocean(int x, int y, struct player *pplayer)
+{
+ int sum = 0;
+
+ if(map_get_known(x,y,pplayer))
+ {
Should be
if {
+ /* we've seen the tile already. */
+ if(map_get_terrain(x,y) == T_OCEAN)
+ return 128;
Forgot { }
+ if(((x-1 >= 0) && map_get_known(x-1,y,pplayer) &&
+ map_get_terrain(x-1,y) == T_OCEAN) ||
+ ((x+1 < map.xsize) && map_get_known(x+1,y,pplayer) &&
+ map_get_terrain(x+1,y) == T_OCEAN) ||
+ ((y-1 >= 0) && map_get_known(x,y-1,pplayer) &&
+ map_get_terrain(x,y-1) == T_OCEAN) ||
+ ((y+1 < map.ysize) && map_get_known(x,y+1,pplayer) &&
+ (map_get_terrain(x,y+1) == T_OCEAN)))
+ {
Space between if and brace, put && and || first on next line instead
of last on previous, and spaces between operators.
The same errors appear consistently all over the patch. Please fix them
and send a new patch to RT.
- Per
|
|