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 10:41:02 -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 >
> 
> On Mon, 18 Oct 2004, Jason Short wrote:
> 
>>This seems wrong.If !pplayer->is_alive then player_can_ally should be
>>false.Then sanity checking should just skip dead players.
> 
> 
> That depends. If pplayer_can_ally() should accurately reflect who can be
> allied, then it must be the way suggested in my patch. Since players who
> are dead do not count towards the love-love-hate limitations. However, if
> pplayer_can_ally() is just who can make new alliances, then your
> suggestion is better.

Hmm.  Perhaps this is complicated.  What kinds of situations would we 
actually be checking the diplomatic states of dead players, and care 
what result we got?

What about this patch?  It causes pplayers_allied, pplayers_at_war, 
pplayers_at_peace to all return false for dead players.

jason

Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.157.2.1
diff -u -r1.157.2.1 player.c
--- common/player.c     8 Oct 2004 05:11:53 -0000       1.157.2.1
+++ common/player.c     18 Oct 2004 17:33:47 -0000
@@ -641,9 +641,13 @@
                      const struct player *pplayer2)
 {
   enum diplstate_type ds = pplayer_get_diplstate(pplayer, pplayer2)->type;
+
   if (pplayer == pplayer2) {
     return FALSE;
   }
+  if (pplayer->is_dead || pplayer2->is_dead) {
+    return FALSE;
+  }
   if (is_barbarian(pplayer) || is_barbarian(pplayer2)) {
     return TRUE;
   }
@@ -657,9 +661,13 @@
                      const struct player *pplayer2)
 {
   enum diplstate_type ds = pplayer_get_diplstate(pplayer, pplayer2)->type;
+
   if (pplayer == pplayer2) {
     return TRUE;
   }
+  if (pplayer->is_dead || pplayer2->is_dead) {
+    return FALSE;
+  }
   if (is_barbarian(pplayer) || is_barbarian(pplayer2)) {
     return FALSE;
   }
@@ -677,6 +685,9 @@
   if (pplayer == pplayer2) {
     return TRUE;
   }
+  if (pplayer->is_dead || pplayer2->is_dead) {
+    return FALSE;
+  }
   if (is_barbarian(pplayer) || is_barbarian(pplayer2)) {
     return FALSE;
   }
@@ -690,9 +701,13 @@
                          const struct player *pplayer2)
 {
   enum diplstate_type ds = pplayer_get_diplstate(pplayer, pplayer2)->type;
+
   if (pplayer == pplayer2) {
     return FALSE;
   }
+  if (pplayer->is_dead || pplayer2->is_dead) {
+    return FALSE;
+  }
   if (is_barbarian(pplayer) || is_barbarian(pplayer2)) {
     return FALSE;
   }

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