From 5b13c84f935b868f8940d86fc0f03a283545d868 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 25 Jun 2023 14:07:45 +0300 Subject: [PATCH 33/33] gtk: Make it possible to offer techs even without embassy Tech trading was not possible unless there was an embassy, as the player didn't know if the other can receive offered tech. It should be possible to offer tech unless one is sure that the other cannot receive it. See osdn #45552 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.22/diplodlg.c | 10 +++++----- client/gui-gtk-4.0/diplodlg.c | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/client/gui-gtk-3.22/diplodlg.c b/client/gui-gtk-3.22/diplodlg.c index 57adbb94bd..f7cf306075 100644 --- a/client/gui-gtk-3.22/diplodlg.c +++ b/client/gui-gtk-3.22/diplodlg.c @@ -300,6 +300,7 @@ static void popup_add_menu(GtkMenuShell *parent, gpointer data) const struct research *oresearch = research_get(pother); GtkWidget *advance_item; GList *sorting_list = NULL; + bool team_embassy = team_has_embassy(pgiver->team, pother); advance_item = gtk_menu_item_new_with_mnemonic(_("_Advances")); gtk_menu_shell_append(GTK_MENU_SHELL(parent), advance_item); @@ -308,8 +309,9 @@ static void popup_add_menu(GtkMenuShell *parent, gpointer data) Tech_type_id i = advance_number(padvance); if (research_invention_state(gresearch, i) == TECH_KNOWN - && research_invention_gettable(oresearch, i, - game.info.tech_trade_allow_holes) + && (!team_embassy /* We don't know what the other could actually receive */ + || research_invention_gettable(oresearch, i, + game.info.tech_trade_allow_holes)) && (research_invention_state(oresearch, i) == TECH_UNKNOWN || research_invention_state(oresearch, i) == TECH_PREREQS_KNOWN)) { @@ -343,8 +345,7 @@ static void popup_add_menu(GtkMenuShell *parent, gpointer data) for (list_item = sorting_list; NULL != list_item; list_item = g_list_next(list_item)) { padvance = (const struct advance *) list_item->data; - item = - gtk_menu_item_new_with_label(advance_name_translation(padvance)); + item = gtk_menu_item_new_with_label(advance_name_translation(padvance)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); g_object_set_data(G_OBJECT(item), "player_from", GINT_TO_POINTER(player_number(pgiver))); @@ -362,7 +363,6 @@ static void popup_add_menu(GtkMenuShell *parent, gpointer data) gtk_widget_show_all(advance_item); } - /* Trading: cities. */ /**************************************************************** diff --git a/client/gui-gtk-4.0/diplodlg.c b/client/gui-gtk-4.0/diplodlg.c index bdfd824f98..3864d47443 100644 --- a/client/gui-gtk-4.0/diplodlg.c +++ b/client/gui-gtk-4.0/diplodlg.c @@ -331,6 +331,7 @@ static GMenu *create_clause_menu(GActionGroup *group, const struct research *gresearch = research_get(pgiver); const struct research *oresearch = research_get(pother); GList *sorting_list = NULL; + bool team_embassy = team_has_embassy(pgiver->team, pother); int i; submenu = g_menu_new(); @@ -339,8 +340,9 @@ static GMenu *create_clause_menu(GActionGroup *group, Tech_type_id tech = advance_number(padvance); if (research_invention_state(gresearch, tech) == TECH_KNOWN - && research_invention_gettable(oresearch, tech, - game.info.tech_trade_allow_holes) + && (!team_embassy /* We don't know what the other could actually receive */ + || research_invention_gettable(oresearch, tech, + game.info.tech_trade_allow_holes)) && (research_invention_state(oresearch, tech) == TECH_UNKNOWN || research_invention_state(oresearch, tech) == TECH_PREREQS_KNOWN)) { -- 2.40.1