Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [Patch] ai_handicap should return bool
Home

[Freeciv-Dev] Re: [Patch] ai_handicap should return bool

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] ai_handicap should return bool
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Sun, 10 Feb 2002 18:43:29 +0000 (GMT)

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> 
> The attached patch makes the return value of ai_handicap a bool. Note
> that ai_handicap is only used in bool context so the -1 is "useless".
> 
>       Raimar

Makes sense.
I hope one day we will be able to remove 
if (!pplayer->ai.control) {    
  return TRUE;
}
clause as well.

G.

> 
> -- 
>  email: rf13@xxxxxxxxxxxxxxxxx
>  "Last year, out in California, at a PC users group, there was a demo
> of
>   smart speech recognition software. Before the demonstrator could
> begin
>   his demo, a voice called out from the audience: "Format c, return.
> Yes,
>   return." Damned short demo, it was.
> > Index: common/player.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
> retrieving revision 1.75
> diff -u -r1.75 player.c
> --- common/player.c   2002/02/09 14:46:22     1.75
> +++ common/player.c   2002/02/10 17:28:17
> @@ -442,8 +442,10 @@
> 
>
**************************************************************************/
>  int ai_handicap(struct player *pplayer, enum handicap_type htype)
>  {
> -  if (!pplayer->ai.control) return -1;
> -  return(pplayer->ai.handicap&htype);
> +  if (!pplayer->ai.control) {
> +    return TRUE;
> +  }
> +  return BOOL_VAL(pplayer->ai.handicap & htype);
>  }
>  
> 
>
/**************************************************************************
>  

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


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