Author: pepeto
Date: Sat Dec 13 10:47:04 2014
New Revision: 27282

URL: http://svn.gna.org/viewcvs/freeciv?rev=27282&view=rev
Log:
Sanity check: ensure team mates have an embassy and shared vision each others.
Do diplomatic checking only once per player couple.

See gna patch #5472

Modified:
    branches/S2_5/server/sanitycheck.c

Modified: branches/S2_5/server/sanitycheck.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/sanitycheck.c?rev=27282&r1=27281&r2=27282&view=diff
==============================================================================
--- branches/S2_5/server/sanitycheck.c  (original)
+++ branches/S2_5/server/sanitycheck.c  Sat Dec 13 10:47:04 2014
@@ -465,15 +465,24 @@
     } city_list_iterate_end;
 
     players_iterate(pplayer2) {
-      struct player_diplstate *state1 = player_diplstate_get(pplayer, 
pplayer2);
-      struct player_diplstate *state2 = player_diplstate_get(pplayer2, 
pplayer);
-
+      struct player_diplstate *state1, *state2;
+
+      if (pplayer2 == pplayer) {
+        break; /* Do diplomatic sanity check only once per player couple. */
+      }
+
+      state1 = player_diplstate_get(pplayer, pplayer2);
+      state2 = player_diplstate_get(pplayer2, pplayer);
       SANITY_CHECK(state1->type == state2->type);
       if (state1->type == DS_CEASEFIRE) {
         SANITY_CHECK(state1->turns_left == state2->turns_left);
       }
       if (state1->type == DS_TEAM) {
         SANITY_CHECK(players_on_same_team(pplayer, pplayer2));
+        SANITY_CHECK(player_has_real_embassy(pplayer, pplayer2));
+        SANITY_CHECK(player_has_real_embassy(pplayer2, pplayer));
+        SANITY_CHECK(really_gives_vision(pplayer, pplayer2));
+        SANITY_CHECK(really_gives_vision(pplayer2, pplayer));
       }
       if (pplayer->is_alive
           && pplayer2->is_alive


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to