[Freeciv-Dev] Re: [Patch] ai_handicap should return bool
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- 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
|
|