From 9497e70ad3182524318abbe71e6ea9d86e883f41 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Thu, 29 Apr 2021 00:20:40 +0200 Subject: [PATCH] Check if road or base action can target terrain. The help dialog should only claim that a terrain type can have bases or roads built on it if a base or road building action is possible. See osdn #42131 --- client/gui-gtk-3.0/helpdlg.c | 6 ++++-- client/gui-gtk-3.22/helpdlg.c | 6 ++++-- client/gui-gtk-4.0/helpdlg.c | 6 ++++-- client/gui-qt/helpdlg.cpp | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/client/gui-gtk-3.0/helpdlg.c b/client/gui-gtk-3.0/helpdlg.c index 55e7701974..4528c8c210 100644 --- a/client/gui-gtk-3.0/helpdlg.c +++ b/client/gui-gtk-3.0/helpdlg.c @@ -1287,10 +1287,12 @@ static void help_update_terrain(const struct help_item *pitem, if (action_id_univs_not_blocking(ACTION_MINE, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_MINE, _("Build as mine")); } - if (pterrain->road_time != 0) { + if (pterrain->road_time != 0 + && action_id_univs_not_blocking(ACTION_ROAD, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_GEN_ROAD, _("Build as road")); } - if (pterrain->base_time != 0) { + if (pterrain->base_time != 0 + && action_id_univs_not_blocking(ACTION_BASE, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_BASE, _("Build as base")); } gtk_widget_show(help_vbox); diff --git a/client/gui-gtk-3.22/helpdlg.c b/client/gui-gtk-3.22/helpdlg.c index 5822db79b0..38332d5374 100644 --- a/client/gui-gtk-3.22/helpdlg.c +++ b/client/gui-gtk-3.22/helpdlg.c @@ -1287,10 +1287,12 @@ static void help_update_terrain(const struct help_item *pitem, if (action_id_univs_not_blocking(ACTION_MINE, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_MINE, _("Build as mine")); } - if (pterrain->road_time != 0) { + if (pterrain->road_time != 0 + && action_id_univs_not_blocking(ACTION_ROAD, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_GEN_ROAD, _("Build as road")); } - if (pterrain->base_time != 0) { + if (pterrain->base_time != 0 + && action_id_univs_not_blocking(ACTION_BASE, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_BASE, _("Build as base")); } gtk_widget_show(help_vbox); diff --git a/client/gui-gtk-4.0/helpdlg.c b/client/gui-gtk-4.0/helpdlg.c index bd882b8e9c..8d469c7ce2 100644 --- a/client/gui-gtk-4.0/helpdlg.c +++ b/client/gui-gtk-4.0/helpdlg.c @@ -1294,10 +1294,12 @@ static void help_update_terrain(const struct help_item *pitem, if (action_id_univs_not_blocking(ACTION_MINE, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_MINE, _("Build as mine")); } - if (pterrain->road_time != 0) { + if (pterrain->road_time != 0 + && action_id_univs_not_blocking(ACTION_ROAD, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_GEN_ROAD, _("Build as road")); } - if (pterrain->base_time != 0) { + if (pterrain->base_time != 0 + && action_id_univs_not_blocking(ACTION_BASE, NULL, &for_terr)) { help_extras_of_act_for_terrain(pterrain, ACTIVITY_BASE, _("Build as base")); } gtk_widget_show(help_vbox); diff --git a/client/gui-qt/helpdlg.cpp b/client/gui-qt/helpdlg.cpp index 97a2c0403f..0208050fef 100644 --- a/client/gui-qt/helpdlg.cpp +++ b/client/gui-qt/helpdlg.cpp @@ -1395,10 +1395,12 @@ void help_widget::set_topic_terrain(const help_item *topic, if (action_id_univs_not_blocking(ACTION_MINE, NULL, &for_terr)) { add_extras_of_act_for_terrain(pterrain, ACTIVITY_MINE, _("Build as mine")); } - if (pterrain->road_time != 0) { + if (pterrain->road_time != 0 + && action_id_univs_not_blocking(ACTION_ROAD, NULL, &for_terr)) { add_extras_of_act_for_terrain(pterrain, ACTIVITY_GEN_ROAD, _("Build as road")); } - if (pterrain->base_time != 0) { + if (pterrain->base_time != 0 + && action_id_univs_not_blocking(ACTION_BASE, NULL, &for_terr)) { add_extras_of_act_for_terrain(pterrain, ACTIVITY_BASE, _("Build as base")); } -- 2.30.2