From 1c3d6a69b551461d9211614077722305c6b33f9c Mon Sep 17 00:00:00 2001
From: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Date: Sat, 28 Nov 2026 13:33:50 -0800
Subject: [PATCH 1/2] Add update_diplomacy_gold() client GUI hook

A diplomacy meeting's dialog shows limits taken from each player's
gold, and nothing told it when that gold changed.

Add update_diplomacy_gold() to the GUI interface and call it from
handle_player_info() beside update_intel_dialog(). Every client gets
an empty stub; each is filled in separately.

See RM #2506

Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
---
 client/gui-gtk-3.22/diplodlg.c | 8 ++++++++
 client/gui-gtk-4.0/diplodlg.c  | 8 ++++++++
 client/gui-gtk-5.0/diplodlg.c  | 8 ++++++++
 client/gui-qt/diplodlg.cpp     | 8 ++++++++
 client/gui-sdl2/diplodlg.c     | 8 ++++++++
 client/gui-sdl3/diplodlg.c     | 8 ++++++++
 client/gui-stub/diplodlg.c     | 8 ++++++++
 client/include/diplodlg_g.h    | 1 +
 client/packhand.c              | 2 ++
 9 files changed, 59 insertions(+)

diff --git a/client/gui-gtk-3.22/diplodlg.c b/client/gui-gtk-3.22/diplodlg.c
index f837f3fba3..befb514e3f 100644
--- a/client/gui-gtk-3.22/diplodlg.c
+++ b/client/gui-gtk-3.22/diplodlg.c
@@ -1254,6 +1254,14 @@ static void diplo_dialog_returnkey(GtkWidget *w, gpointer data)
   }
 }
 
+/************************************************************************//**
+  Player's gold may have changed
+****************************************************************************/
+void update_diplomacy_gold(struct player *pplayer)
+{
+  /* PORTME */
+}
+
 /************************************************************************//**
   Close all dialogs, for when client disconnects from game.
 ****************************************************************************/
diff --git a/client/gui-gtk-4.0/diplodlg.c b/client/gui-gtk-4.0/diplodlg.c
index dbc365dd38..a431dfdffb 100644
--- a/client/gui-gtk-4.0/diplodlg.c
+++ b/client/gui-gtk-4.0/diplodlg.c
@@ -1338,6 +1338,14 @@ static void diplo_dialog_returnkey(GtkWidget *w, gpointer data)
   }
 }
 
+/************************************************************************//**
+  Player's gold may have changed
+****************************************************************************/
+void update_diplomacy_gold(struct player *pplayer)
+{
+  /* PORTME */
+}
+
 /************************************************************************//**
   Close all dialogs, for when client disconnects from game.
 ****************************************************************************/
diff --git a/client/gui-gtk-5.0/diplodlg.c b/client/gui-gtk-5.0/diplodlg.c
index 168d1c0b35..42138c73cd 100644
--- a/client/gui-gtk-5.0/diplodlg.c
+++ b/client/gui-gtk-5.0/diplodlg.c
@@ -1387,6 +1387,14 @@ static void diplo_dialog_returnkey(GtkWidget *w, gpointer data)
   }
 }
 
+/************************************************************************//**
+  Player's gold may have changed
+****************************************************************************/
+void update_diplomacy_gold(struct player *pplayer)
+{
+  /* PORTME */
+}
+
 /************************************************************************//**
   Close all dialogs, for when client disconnects from game.
 ****************************************************************************/
diff --git a/client/gui-qt/diplodlg.cpp b/client/gui-qt/diplodlg.cpp
index 632715577e..3174914a5e 100644
--- a/client/gui-qt/diplodlg.cpp
+++ b/client/gui-qt/diplodlg.cpp
@@ -1121,3 +1121,11 @@ void close_all_diplomacy_dialogs(void)
   dd->close();
   delete dd;
 }
+
+/************************************************************************//**
+  Player's gold may have changed.
+****************************************************************************/
+void update_diplomacy_gold(struct player *pplayer)
+{
+  /* PORTME */
+}
diff --git a/client/gui-sdl2/diplodlg.c b/client/gui-sdl2/diplodlg.c
index 0f00278574..19efce913d 100644
--- a/client/gui-sdl2/diplodlg.c
+++ b/client/gui-sdl2/diplodlg.c
@@ -1787,3 +1787,11 @@ void popup_diplomacy_dialog(struct player *pplayer)
     flush_dirty();
   }
 }
+
+/**********************************************************************//**
+  Player's gold may have changed.
+**************************************************************************/
+void update_diplomacy_gold(struct player *pplayer)
+{
+  /* PORTME */
+}
diff --git a/client/gui-sdl3/diplodlg.c b/client/gui-sdl3/diplodlg.c
index 45cfc0d4e0..ce1d744fc2 100644
--- a/client/gui-sdl3/diplodlg.c
+++ b/client/gui-sdl3/diplodlg.c
@@ -1783,3 +1783,11 @@ void popup_diplomacy_dialog(struct player *pplayer)
     flush_dirty();
   }
 }
+
+/**********************************************************************//**
+  Player's gold may have changed.
+**************************************************************************/
+void update_diplomacy_gold(struct player *pplayer)
+{
+  /* PORTME */
+}
diff --git a/client/gui-stub/diplodlg.c b/client/gui-stub/diplodlg.c
index a8fda253f9..73edf49f7a 100644
--- a/client/gui-stub/diplodlg.c
+++ b/client/gui-stub/diplodlg.c
@@ -82,3 +82,11 @@ void close_all_diplomacy_dialogs(void)
 {
   /* PORTME */
 }
+
+/**********************************************************************//**
+  Player's gold may have changed.
+**************************************************************************/
+void update_diplomacy_gold(struct player *pplayer)
+{
+  /* PORTME */
+}
diff --git a/client/include/diplodlg_g.h b/client/include/diplodlg_g.h
index 03fc229ccc..f3d43c2f05 100644
--- a/client/include/diplodlg_g.h
+++ b/client/include/diplodlg_g.h
@@ -37,5 +37,6 @@ GUI_FUNC_PROTO(void, gui_recv_accept_treaty, struct treaty *ptreaty,
                struct player *they)
 
 GUI_FUNC_PROTO(void, close_all_diplomacy_dialogs, void)
+GUI_FUNC_PROTO(void, update_diplomacy_gold, struct player *pplayer)
 
 #endif /* FC__DIPLODLG_G_H */
diff --git a/client/packhand.c b/client/packhand.c
index 0bbc6eff0c..a4bf9e43a2 100644
--- a/client/packhand.c
+++ b/client/packhand.c
@@ -64,6 +64,7 @@
 #include "cityrep_g.h"
 #include "connectdlg_g.h"
 #include "dialogs_g.h"
+#include "diplodlg_g.h"
 #include "editgui_g.h"
 #include "gui_main_g.h"
 #include "inteldlg_g.h"
@@ -2695,6 +2696,7 @@ void handle_player_info(const struct packet_player_info *pinfo)
     /* Just about any changes above require an update to the intelligence
      * dialog. */
     update_intel_dialog(pplayer);
+    update_diplomacy_gold(pplayer);
   }
 
   editgui_refresh();
-- 
2.55.0

