[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]
<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;
}
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail, Per I. Mathisen, 2004/10/15
- [Freeciv-Dev] (PR#10459) bug: pplayer_can_ally assert fail, Jason Short, 2004/10/17
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail, Per I. Mathisen, 2004/10/18
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail, Jason Short, 2004/10/18
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail, Per I. Mathisen, 2004/10/18
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail,
Jason Short <=
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail, Jason Short, 2004/10/18
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail, Per I. Mathisen, 2004/10/18
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail, Jason Short, 2004/10/18
- [Freeciv-Dev] Re: (PR#10459) bug: pplayer_can_ally assert fail, Marko Lindqvist, 2004/10/19
|
|