Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: [Patch] Exploring triremes getting lost (PR#961)
Home

[Freeciv-Dev] Re: [Patch] Exploring triremes getting lost (PR#961)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Patch] Exploring triremes getting lost (PR#961)
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Mon, 17 Sep 2001 11:41:57 +0100 (BST)

Before going into the discussion of code, a general question:
what do you think AI should do if it's exploring trireme ventures into
the open sea and realises that it does not have enough movepoints to
reach the destination?

Possibilities (ascending in code complexity):
1. Panic (go in random direction).
2. Push on to the destination.
3. Come back to shore (danger of infinite loops here).

Right now it does 2.

--- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> On Sun, Sep 16, 2001 at 12:38:21PM -0700, Gregory Berkolaiko wrote:
[..]
> > -- I also did little cleaning up in gotohand.c.  Sorry if it confuses
> > those few who'll be reading the patch.
> 
> It would be nice if you can seperate this.

mmm, I will try :(

> It also looks like you have some knowledge about how the methods
> work. Can you add some comments to the code?

I managed to decipher the sailing part, and yes I roughly know what
unknown variable does.  So I can put in a limited number of comments.

> > +       if (afraid_of_sinking && !is_coast_seen(x1,y1,pplayer))
> > +         unknown = 0;
> > +     } else
> 
> What is unknown? What means 0 here?

> > diff -ur -Xfreeciv/diff_ignore freeciv/server/gotohand.c
> freeciv_mod/server/gotohand.c
> > --- freeciv/server/gotohand.c       Sun Sep 16 20:20:04 2001
> > +++ freeciv_mod/server/gotohand.c   Sun Sep 16 21:09:23 2001
> > @@ -182,6 +182,7 @@
> >        freelog(LOG_DEBUG, "returned before. getting next");
> >        return get_from_mapqueue(x, y);
> >      } else {
> > +      warmap.returned[*x][*y] = 1;
> 
> Why this change?

Sorry, it wasn't meant to be in the patch.
I'll explain it in a separate email.

> > +int is_coast_seen(int x, int y, struct player *pplayer)
> > +{
> > +  square_iterate(x, y, 1, x1, y1) {
> > +    enum tile_terrain_type ter = map_get_terrain(x1, y1);
> > +    if (ter != T_OCEAN) {
> > +      square_iterate(x1, y1, 1, x2, y2) {
> > +        if (map_get_known(x2, y2, pplayer)) {
> > +          return 1;
> > +        }
> > +      } square_iterate_end; /* around x1,y1 */
> > +    }
> > +  } square_iterate_end; /*around x2,y2 */
> > +  return 0;
> > +}
> 
> I don't understand why you use two square_iterate here? If (x,y) is
> known and (x,y) is a coastline ocean tile this method return 1. What
> other cases do you try to handle?

when (x,y) is not known and very few tiles around it are known.
an example: 
nothing within radius 1 of (x,y) is known,
(x+1,y) is a land tile
(x+2,y) is known

then on the left side of the (x+2,y) graphic tile you will see a narrow
strip of land and will be able to conclude that (x+1,y) is land and
therefore (x,y) is either land or near land.

maybe my naming is bad, maybe my programming is...

Best,
G.

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie


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