Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: Improved Auto-Explore
Home

[Freeciv-Dev] Re: Improved Auto-Explore

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Cameron Morland <cjmorlan_freeciv@xxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Improved Auto-Explore
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 2 Dec 2002 23:24:08 +0000 (GMT)

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



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