Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#14385) Treaty window update problem
Home

[Freeciv-Dev] (PR#14385) Treaty window update problem

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#14385) Treaty window update problem
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Fri, 28 Oct 2005 23:34:35 -0700
Reply-to: bugs@xxxxxxxxxxx

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

With this patch all treaties currently being negotiated are
automatically rejected when you declare war.
--
mateusz
Index: server/diplhand.c
===================================================================
--- server/diplhand.c   (wersja 11198)
+++ server/diplhand.c   (kopia robocza)
@@ -726,3 +726,28 @@
     }
   } players_iterate_end;
 }
+
+/**************************************************************************
+  Reject all treaties currently being negotiated
+**************************************************************************/
+void reject_all_treaties(struct player *pplayer)
+{
+  struct Treaty* treaty;
+  players_iterate(pplayer2) {
+    treaty = find_treaty(pplayer, pplayer2);
+    if (!treaty) {
+      continue;
+    }
+    treaty->accept0 = FALSE;
+    treaty->accept1 = FALSE;
+    dlsend_packet_diplomacy_accept_treaty(pplayer->connections,
+                                         pplayer2->player_no,
+                                         FALSE,
+                                         FALSE);
+    dlsend_packet_diplomacy_accept_treaty(pplayer2->connections,
+                                          pplayer->player_no,
+                                         FALSE,
+                                         FALSE);
+  } players_iterate_end;
+}
+
Index: server/diplhand.h
===================================================================
--- server/diplhand.h   (wersja 11198)
+++ server/diplhand.h   (kopia robocza)
@@ -30,5 +30,5 @@
 
 void send_diplomatic_meetings(struct connection *dest);
 void cancel_all_meetings(struct player *pplayer);
-
+void reject_all_treties(struct player *pplayer);
 #endif  /* FC__DIPLHAND_H */
Index: server/plrhand.c
===================================================================
--- server/plrhand.c    (wersja 11198)
+++ server/plrhand.c    (kopia robocza)
@@ -532,7 +532,8 @@
     return; /* Duh */
   }
 
-
+  reject_all_treaties(pplayer);
+  reject_all_treaties(pplayer2);
   /* else, breaking a treaty */
 repeat_break_treaty:
 

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