<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39363 >

Try this one.  It uses more direct logic and removes the (quite
unnecessary) assertion.

-jason

Index: common/player.c
===================================================================
--- common/player.c	(revision 12929)
+++ common/player.c	(working copy)
@@ -741,14 +741,19 @@
 }
 
 /****************************************************************************
-  Returns TRUE if players can't enter each others' territory.  Undefined if
-  the players are equal.
+  Returns TRUE if players can't enter each others' territory.
 ****************************************************************************/
 bool players_non_invade(const struct player *pplayer1,
 			const struct player *pplayer2)
 {
-  assert(pplayer1 != pplayer2);
-  return pplayers_in_peace(pplayer1, pplayer2);
+  if (pplayer1 == pplayer2 || !pplayer1 || !pplayer2) {
+    return FALSE;
+  }
+  if (is_barbarian(pplayer1) || is_barbarian(pplayer2)) {
+    /* Likely an unnecessary test. */
+    return FALSE;
+  }
+  return pplayer_get_diplstate(pplayer1, pplayer2)->type == DS_PEACE;
 }
 
 /***************************************************************
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to