Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail
Home

[Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bagpipe@xxxxxxxxx, bh@xxxxxxxxxxxxxxxxxxx, marko.lindqvist@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Oct 2004 08:25:43 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10459 >

Per I. Mathisen wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10459 >
> 
> Found it. We did not properly check that the players we sanity checked
> were alive. So there was no actual bug, since pplayers_can_ally() would
> not be called by dead players, except by sanity_check().
> 
> I changed a few other things, too, that could be bug prone.

Yay.

> Index: common/player.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
> retrieving revision 1.158
> diff -u -r1.158 player.c
> --- common/player.c   8 Oct 2004 05:11:51 -0000       1.158
> +++ common/player.c   18 Oct 2004 14:26:28 -0000
> @@ -44,6 +44,9 @@
>  ***************************************************************/
>  bool pplayer_can_ally(struct player *p1, struct player *p2)
>  {
> +  if (!p1->is_alive || !p2->is_alive) {
> +    return TRUE;
> +  }

This seems wrong.  If !pplayer->is_alive then player_can_ally should be 
false.  Then sanity checking should just skip dead players.

jason




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