From e6bc1a957fdd36f42677e811c08400dcd962a048 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 25 Jun 2023 14:19:16 +0300 Subject: [PATCH 21/21] 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-2.0/diplodlg.c | 8 +++++--- client/gui-gtk-3.0/diplodlg.c | 6 ++++-- client/gui-gtk-3.22/diplodlg.c | 10 +++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/client/gui-gtk-2.0/diplodlg.c b/client/gui-gtk-2.0/diplodlg.c index 838508458d..3f6ef43814 100644 --- a/client/gui-gtk-2.0/diplodlg.c +++ b/client/gui-gtk-2.0/diplodlg.c @@ -259,7 +259,7 @@ static void popup_add_menu(GtkMenuShell *parent, gpointer data) gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); g_object_set_data(G_OBJECT(item), "plr", pgiver); g_signal_connect(item, "activate", - G_CALLBACK(diplomacy_dialog_seamap_callback), pdialog); + G_CALLBACK(diplomacy_dialog_seamap_callback), pdialog); item = gtk_menu_item_new_with_mnemonic(_("_Maps")); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); @@ -272,6 +272,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); @@ -280,8 +281,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)) { diff --git a/client/gui-gtk-3.0/diplodlg.c b/client/gui-gtk-3.0/diplodlg.c index 2bef3ae961..9015ea40f0 100644 --- a/client/gui-gtk-3.0/diplodlg.c +++ b/client/gui-gtk-3.0/diplodlg.c @@ -272,6 +272,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); @@ -280,8 +281,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)) { diff --git a/client/gui-gtk-3.22/diplodlg.c b/client/gui-gtk-3.22/diplodlg.c index 018eb640f1..80313ee451 100644 --- a/client/gui-gtk-3.22/diplodlg.c +++ b/client/gui-gtk-3.22/diplodlg.c @@ -272,6 +272,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); @@ -280,8 +281,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)) { @@ -315,8 +317,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))); @@ -334,7 +335,6 @@ static void popup_add_menu(GtkMenuShell *parent, gpointer data) gtk_widget_show_all(advance_item); } - /* Trading: cities. */ /**************************************************************** -- 2.40.1