Complete.Org: Mailing Lists: Archives: freeciv-dev: September 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: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Patch] Make do_unit_goto return a meaningful value (PR#985)
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Sun, 30 Sep 2001 16:17:24 -0700 (PDT)

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> On Sun, Sep 30, 2001 at 12:28:33PM -0400, Ross W. Wetmore wrote:
> > -enum goto_result {
> > -  GR_FAILED, GR_ARRIVED, GR_OUT_OF_MOVEPOINTS, GR_DIED }
> > +enum goto_result {
> > +  GR_ARRIVED = 0, GR_FAILED, GR_OUT_OF_MOVEPOINTS, GR_DIED }
> > 
> > I would make the above change noting that "ARRIVED" is really
> > "SUCCESS" and the rest are different forms of "FAILED". This
> > makes the return status agree with the "shell" or "strcmp" 
> > concept of true/false, i.e. zero == true and non-zero == false.
> > 
> > This may not be immediately useful here as (ret != GR_ARRIVED)
> > works just as well for the global false case, but in different
> > programming environments such as a shell scripted client AI, it
> > may make things more sensible to follow some standard.
> 
> Yes and no. Yes it would my make this analog to other systems. No we
> want an explicit compare against a value from "enum goto_result" and
> not a "if(!do_unit_goto(...))". Sometimes I explicitly code enums such
> as "enum xyz{a=1,b,c,d}" to catch such bad boolean tests.

Actually I thought of GR_OUT_OF_MOVE_POINTS as a sort of success.
Continuing with the same logic, GR_DIED is a success too (what can be
better than to die for your country (on the GOTO mission to the
supermarket)).  But personally I don't care a wee bit.  So whatever
people think looks best...

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]
  • [Freeciv-Dev] Re: [Patch] Make do_unit_goto return a meaningful value (PR#985), Gregory Berkolaiko <=