Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: [Patch] Make do_unit_goto return a meaningful value (P
Home

[Freeciv-Dev] Re: [Patch] Make do_unit_goto return a meaningful value (P

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Patch] Make do_unit_goto return a meaningful value (PR#985)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 1 Oct 2001 09:17:42 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Mon, Oct 01, 2001 at 12:13:32AM +0100, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > On Sat, Sep 29, 2001 at 02:16:32PM -0700, Gregory Berkolaiko wrote:
> > > 
> > > The testgames are identical with/without the patch.
> > 
> > Looks ok.
> 
> good
> 
> > > @@ -1099,7 +1104,7 @@
> > >        /* this is a special case for air units who do not always want
> > to move. */
> > >        if (same_pos(waypoint_x, waypoint_y, punit->x, punit->y)) {
> > >   advance_unit_focus(punit);
> > > - return;
> > > + return GR_ARRIVED; /* well, somewhere */
> > 
> > Than split GR_ARRIVED into GR_ARRIVED_AT_DEST and GR_ARRIVED_SOMEWHERE
> 
> I have a problem with this: nowhere in the code such differentiation is
> needed yet, but I do not know what will come in the future.  I think the
> best solution is to go for something now, comment it well, explaining
> what case it is really (it's already explained in this particular
> instance) so that it will be easy to change later when needed.  
> 
> Actually, thinking about it, this place should return
> GR_OUT_OF_MOVEPOINTS, which is a lie, but the unit does not want to be
> disturbed so it serves the purpose.
> > >        /* Don't attack more than once per goto */
> > >        if (penemy && !pplayer->ai.control) { /* Should I cancel for
> > ai's too? */
> > >           punit->activity = ACTIVITY_IDLE;
> > >           send_unit_info(0, punit);
> > > -         return;
> > > +         return GR_FAILED; /* well, nothing better comes to mind... */
> > 
> > ????
> 
> Actually I would be surprised if this case is ever encountered but it's
> interpretation is as follows: human-owned unit was on eXplore,
> encountered something and attacked it.  Wants to rest now.  How about
>   return GR_OUT_OF_MOVEPOINTS
> with a comment?  Alternatively, can return something like
> GR_GOT_IN_TROUBLE and let the superior code decide whether to cancel
> eXplore.

What about a class where all such cases go in: GR_REST or
GR_SPECIAL_CASE or GR_WEIRD?

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "I haven't lost my mind - it's backed up on tape somewhere."


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