From d88f29517693bc5f7624db70f19005a4c939ff24 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.22/helpdlg.c | 6 ++++-- client/gui-gtk-4.0/helpdlg.c | 6 ++++-- client/gui-qt/helpdlg.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/gui-gtk-3.22/helpdlg.c b/client/gui-gtk-3.22/helpdlg.c index b05d70a5a1..ebc936339d 100644 --- a/client/gui-gtk-3.22/helpdlg.c +++ b/client/gui-gtk-3.22/helpdlg.c @@ -1291,10 +1291,12 @@ static void help_update_terrain(const struct help_item *pitem, && 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 0eeeb7dfc7..f0e6dff3cb 100644 --- a/client/gui-gtk-4.0/helpdlg.c +++ b/client/gui-gtk-4.0/helpdlg.c @@ -1298,10 +1298,12 @@ static void help_update_terrain(const struct help_item *pitem, && 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 2a81cd77b3..3fba9a4de7 100644 --- a/client/gui-qt/helpdlg.cpp +++ b/client/gui-qt/helpdlg.cpp @@ -1399,10 +1399,12 @@ void help_widget::set_topic_terrain(const help_item *topic, && 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