Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2006:
[Freeciv-Dev] (PR#15710) SDL-client: can't establish embassies through a
Home

[Freeciv-Dev] (PR#15710) SDL-client: can't establish embassies through a

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Martin.Gerdes@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#15710) SDL-client: can't establish embassies through a pact
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Mon, 27 Feb 2006 22:06:32 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [Martin.Gerdes@xxxxxxxxxxxxx - Di 28. Feb 2006, 00:38:21]:
> 
> cproc wrote:
> > I have the patch for exchanging embassies in a treaty agreement
> ready,
> > too, but it would be nice if you send a bug report first, so I can
> add a
> > reference to the ticket in the SVN log.
> 
> Well, I happily oblige :-)
> 
> When doing diplomacy with an AI-player, there is no option to offer or
> demand the opening of an embassy, the way it can be done with the GTK
> client.
> 

And here's the patch ;-)
Index: client/gui-sdl/diplodlg.c
===================================================================
--- client/gui-sdl/diplodlg.c   (Revision 11619)
+++ client/gui-sdl/diplodlg.c   (Arbeitskopie)
@@ -257,6 +257,21 @@
   return -1;
 }
 
+static int embassy_callback(struct GUI *pWidget)
+{
+  struct diplomacy_dialog *pdialog;
+    
+  if (!(pdialog = get_diplomacy_dialog(pWidget->data.cont->id1))) {
+    pdialog = get_diplomacy_dialog(pWidget->data.cont->id0);
+  }
+
+  dsend_packet_diplomacy_create_clause_req(&aconnection,
+                                          pdialog->treaty.plr1->player_no,
+                                          pWidget->data.cont->id0,
+                                          CLAUSE_EMBASSY, 0);
+  return -1;
+}
+
 static int maps_callback(struct GUI *pWidget)
 {
   int clause_type;
@@ -515,6 +530,21 @@
     add_to_gui_list(MAX_ID, pBuf);
     count++;
   }
+  
+  if (!player_has_embassy(pPlayer1, pPlayer0)) {  
+    pBuf = create_iconlabel_from_chars(NULL, pWindow->dst,
+        _("Give embassy"), adj_font(12),
+                (WF_DRAW_THEME_TRANSPARENT|WF_DRAW_TEXT_LABEL_WITH_SPACE));
+    pBuf->string16->fgcol = color;
+    width = MAX(width, pBuf->size.w);
+    height = MAX(height, pBuf->size.h);
+    pBuf->action = embassy_callback;
+    pBuf->data.cont = pCont;
+    set_wstate(pBuf, FC_WS_NORMAL);
+    add_to_gui_list(ID_LABEL, pBuf);
+    count++;
+  }
+    
   /* ---------------------------- */
   if(pPlayer0->economic.gold > 0) {
     pCont->value = pPlayer0->economic.gold;

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