From 412f8429eabe744d9ad4a09c23408c938f58567b Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 1 Jun 2023 00:16:26 +0300 Subject: [PATCH 36/36] Drop client side support for requesting old Clean actions See osdn #48124 Signed-off-by: Marko Lindqvist --- client/control.c | 57 ----------------------------------- client/control.h | 2 -- client/gui-gtk-3.22/citydlg.c | 12 -------- client/gui-gtk-3.22/menu.c | 43 +++----------------------- client/gui-gtk-4.0/citydlg.c | 12 -------- client/gui-gtk-4.0/menu.c | 52 -------------------------------- client/gui-qt/menu.cpp | 12 -------- client/helpdata.c | 55 +-------------------------------- 8 files changed, 6 insertions(+), 239 deletions(-) diff --git a/client/control.c b/client/control.c index bd9df3aec2..dd00b20148 100644 --- a/client/control.c +++ b/client/control.c @@ -124,8 +124,6 @@ static int action_selection_in_progress_for = IDENTITY_NUMBER_ZERO; */ bool non_ai_unit_focus; -static void key_unit_gen_clean(enum unit_activity act, enum extra_rmcause rmcause); - static void do_unit_teleport_to(struct unit *punit, struct tile *ptile); /*************************************************************************/ @@ -3572,14 +3570,6 @@ void key_unit_convert(void) } unit_list_iterate_end; } -/**********************************************************************//** - Handle user 'clean fallout' input -**************************************************************************/ -void key_unit_fallout(void) -{ - key_unit_gen_clean(ACTIVITY_FALLOUT, ERM_CLEANFALLOUT); -} - /**********************************************************************//** Handle user 'fortify' input **************************************************************************/ @@ -3636,25 +3626,6 @@ static void key_unit_extra(enum unit_activity act, enum extra_cause cause) } unit_list_iterate_end; } -/**********************************************************************//** - Handle user extra cleaning input of given class -**************************************************************************/ -static void key_unit_gen_clean(enum unit_activity act, - enum extra_rmcause rmcause) -{ - unit_list_iterate(get_units_in_focus(), punit) { - struct extra_type *tgt = prev_extra_in_tile(unit_tile(punit), - rmcause, - unit_owner(punit), - punit); - - if (tgt != NULL - && can_unit_do_activity_targeted(punit, act, tgt)) { - request_new_unit_activity_targeted(punit, act, tgt); - } - } unit_list_iterate_end; -} - /**********************************************************************//** Handle user 'irrigate' input **************************************************************************/ @@ -3721,38 +3692,10 @@ void key_unit_clean(void) if (tgt != NULL && can_unit_do_activity_targeted(punit, ACTIVITY_CLEAN, tgt)) { request_new_unit_activity_targeted(punit, ACTIVITY_CLEAN, tgt); - } else { - tgt = prev_extra_in_tile(unit_tile(punit), - ERM_CLEANPOLLUTION, - unit_owner(punit), - punit); - - if (tgt != NULL - && can_unit_do_activity_targeted(punit, ACTIVITY_CLEAN, tgt)) { - request_new_unit_activity_targeted(punit, ACTIVITY_CLEAN, tgt); - } else { - tgt = prev_extra_in_tile(unit_tile(punit), - ERM_CLEANFALLOUT, - unit_owner(punit), - punit); - - if (tgt != NULL - && can_unit_do_activity_targeted(punit, ACTIVITY_CLEAN, tgt)) { - request_new_unit_activity_targeted(punit, ACTIVITY_CLEAN, tgt); - } - } } } unit_list_iterate_end; } -/**********************************************************************//** - Handle user 'clean pollution' input -**************************************************************************/ -void key_unit_pollution(void) -{ - key_unit_gen_clean(ACTIVITY_POLLUTION, ERM_CLEANPOLLUTION); -} - /**********************************************************************//** Handle user 'build road or railroad' input **************************************************************************/ diff --git a/client/control.h b/client/control.h index 8d5a347b89..d5260a471c 100644 --- a/client/control.h +++ b/client/control.h @@ -253,7 +253,6 @@ void key_unit_action_select_tgt(void); void key_unit_clean(void); void key_unit_convert(void); void key_unit_done(void); -void key_unit_fallout(void); void key_unit_fortify(void); void key_unit_fortress(void); void key_unit_goto(void); @@ -265,7 +264,6 @@ void key_unit_plant(void); void key_unit_patrol(void); void key_unit_paradrop(void); void key_unit_pillage(void); -void key_unit_pollution(void); void key_unit_road(void); void key_unit_sentry(void); void key_unit_teleport(void); diff --git a/client/gui-gtk-3.22/citydlg.c b/client/gui-gtk-3.22/citydlg.c index f60bda929a..8745b704e5 100644 --- a/client/gui-gtk-3.22/citydlg.c +++ b/client/gui-gtk-3.22/citydlg.c @@ -3006,18 +3006,6 @@ static void popup_workertask_dlg(struct city *pcity, struct tile *ptile) G_CALLBACK(set_city_workertask), GINT_TO_POINTER(ACTIVITY_CLEAN), FALSE, NULL); } - if (prev_extra_in_tile(ptile, ERM_CLEANPOLLUTION, - city_owner(pcity), NULL) != NULL) { - choice_dialog_add(shl, _("Clean Pollution"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_POLLUTION), FALSE, NULL); - } - if (prev_extra_in_tile(ptile, ERM_CLEANFALLOUT, - city_owner(pcity), NULL) != NULL) { - choice_dialog_add(shl, _("Clean Fallout"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_FALLOUT), FALSE, NULL); - } choice_dialog_add(shl, _("_Cancel"), 0, 0, FALSE, NULL); choice_dialog_end(shl); diff --git a/client/gui-gtk-3.22/menu.c b/client/gui-gtk-3.22/menu.c index 816a11c18e..6f192fcefc 100644 --- a/client/gui-gtk-3.22/menu.c +++ b/client/gui-gtk-3.22/menu.c @@ -2020,14 +2020,6 @@ static void clean_callback(GtkMenuItem *item, gpointer data) if (can_unit_do_activity_targeted(punit, ACTIVITY_CLEAN, pextra)) { request_new_unit_activity_targeted(punit, ACTIVITY_CLEAN, pextra); - } else if (can_unit_do_activity_targeted(punit, ACTIVITY_POLLUTION, - pextra)) { - request_new_unit_activity_targeted(punit, ACTIVITY_POLLUTION, - pextra); - } else if (can_unit_do_activity_targeted(punit, ACTIVITY_FALLOUT, - pextra)) { - request_new_unit_activity_targeted(punit, ACTIVITY_FALLOUT, - pextra); } } unit_list_iterate_end; } @@ -2519,13 +2511,7 @@ void real_menus_update(void) gtk_widget_set_sensitive(GTK_WIDGET(iter->data), can_units_do_activity_targeted(punits, ACTIVITY_CLEAN, - pextra) - || can_units_do_activity_targeted(punits, - ACTIVITY_POLLUTION, - pextra) - || can_units_do_activity_targeted(punits, - ACTIVITY_FALLOUT, - pextra)); + pextra)); } } g_list_free(list); @@ -2590,15 +2576,14 @@ void real_menus_update(void) menu_entry_set_sensitive("BUILD_AIRBASE", can_units_do_base_gui(punits, BASE_GUI_AIRBASE)); menu_entry_set_sensitive("CLEAN", - can_units_do_activity(punits, ACTIVITY_CLEAN) - || can_units_do_activity(punits, ACTIVITY_POLLUTION) - || can_units_do_activity(punits, ACTIVITY_FALLOUT)); + can_units_do_activity(punits, ACTIVITY_CLEAN)); menu_entry_set_sensitive("UNIT_SENTRY", can_units_do_activity(punits, ACTIVITY_SENTRY)); menu_entry_set_sensitive("DO_PARADROP", can_units_do(punits, can_unit_paradrop)); - /* FIXME: should conditionally rename "Pillage" to "Pillage..." in cases where - * selecting the command results in a dialog box listing options of what to pillage */ + /* FIXME: should conditionally rename "Pillage" to "Pillage..." in cases + * where selecting the command results in a dialog box listing options of + * what to pillage */ menu_entry_set_sensitive("DO_PILLAGE", can_units_do_activity(punits, ACTIVITY_PILLAGE)); menu_entry_set_sensitive("UNIT_DISBAND", @@ -3041,24 +3026,6 @@ void real_menus_init(void) gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); gtk_widget_show(item); } extra_type_by_rmcause_iterate_end; - extra_type_by_rmcause_iterate(ERM_CLEANPOLLUTION, pextra) { - if (!is_extra_removed_by(pextra, ERM_CLEAN)) { - item = gtk_menu_item_new_with_label(extra_name_translation(pextra)); - g_object_set_data(G_OBJECT(item), "nuisance", pextra); - g_signal_connect(item, "activate", G_CALLBACK(clean_callback), pextra); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show(item); - } - } extra_type_by_rmcause_iterate_end; - extra_type_by_rmcause_iterate(ERM_CLEANFALLOUT, pextra) { - if (!is_extra_removed_by(pextra, ERM_CLEAN)) { - item = gtk_menu_item_new_with_label(extra_name_translation(pextra)); - g_object_set_data(G_OBJECT(item), "nuisance", pextra); - g_signal_connect(item, "activate", G_CALLBACK(clean_callback), pextra); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show(item); - } - } extra_type_by_rmcause_iterate_end; } /* Initialize the Go to and... actions. */ diff --git a/client/gui-gtk-4.0/citydlg.c b/client/gui-gtk-4.0/citydlg.c index 5c3835bc48..e90b8313ce 100644 --- a/client/gui-gtk-4.0/citydlg.c +++ b/client/gui-gtk-4.0/citydlg.c @@ -3111,18 +3111,6 @@ static void popup_workertask_dlg(struct city *pcity, struct tile *ptile) G_CALLBACK(set_city_workertask), GINT_TO_POINTER(ACTIVITY_CLEAN), FALSE, NULL); } - if (prev_extra_in_tile(ptile, ERM_CLEANPOLLUTION, - city_owner(pcity), NULL) != NULL) { - choice_dialog_add(shl, _("Clean Pollution"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_POLLUTION), FALSE, NULL); - } - if (prev_extra_in_tile(ptile, ERM_CLEANFALLOUT, - city_owner(pcity), NULL) != NULL) { - choice_dialog_add(shl, _("Clean Fallout"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_FALLOUT), FALSE, NULL); - } choice_dialog_add(shl, _("_Cancel"), 0, 0, FALSE, NULL); choice_dialog_end(shl); diff --git a/client/gui-gtk-4.0/menu.c b/client/gui-gtk-4.0/menu.c index 4ad898acf2..ed0462a0ea 100644 --- a/client/gui-gtk-4.0/menu.c +++ b/client/gui-gtk-4.0/menu.c @@ -2790,12 +2790,6 @@ static void clean_menu_callback(GSimpleAction *action, if (can_unit_do_activity_targeted(punit, ACTIVITY_CLEAN, pextra)) { request_new_unit_activity_targeted(punit, ACTIVITY_CLEAN, pextra); - } else if (can_unit_do_activity_targeted(punit, ACTIVITY_POLLUTION, pextra)) { - request_new_unit_activity_targeted(punit, ACTIVITY_POLLUTION, - pextra); - } else { - request_new_unit_activity_targeted(punit, ACTIVITY_FALLOUT, - pextra); } } unit_list_iterate_end; } @@ -3682,52 +3676,6 @@ void real_menus_update(void) g_menu_item_new(extra_name_translation(pextra), actname)); } extra_type_by_rmcause_iterate_end; - extra_type_by_rmcause_iterate(ERM_CLEANPOLLUTION, pextra) { - if (!is_extra_removed_by(pextra, ERM_CLEAN)) { - char actname[256]; - GSimpleAction *act; - - fc_snprintf(actname, sizeof(actname), "clean_%d", i); - act = g_simple_action_new(actname, NULL); - g_simple_action_set_enabled(act, - can_units_do_activity_targeted(punits, - ACTIVITY_CLEAN, - pextra) - || can_units_do_activity_targeted(punits, - ACTIVITY_POLLUTION, - pextra)); - g_action_map_add_action(map, G_ACTION(act)); - g_signal_connect(act, "activate", G_CALLBACK(clean_menu_callback), pextra); - - fc_snprintf(actname, sizeof(actname), "app.clean_%d", i++); - menu_item_append_unref(submenu, - g_menu_item_new(extra_name_translation(pextra), actname)); - } - } extra_type_by_rmcause_iterate_end; - - extra_type_by_rmcause_iterate(ERM_CLEANFALLOUT, pextra) { - if (!is_extra_removed_by(pextra, ERM_CLEAN)) { - char actname[256]; - GSimpleAction *act; - - fc_snprintf(actname, sizeof(actname), "clean_%d", i); - act = g_simple_action_new(actname, NULL); - g_simple_action_set_enabled(act, - can_units_do_activity_targeted(punits, - ACTIVITY_CLEAN, - pextra) - || can_units_do_activity_targeted(punits, - ACTIVITY_FALLOUT, - pextra)); - g_action_map_add_action(map, G_ACTION(act)); - g_signal_connect(act, "activate", G_CALLBACK(clean_menu_callback), pextra); - - fc_snprintf(actname, sizeof(actname), "app.clean_%d", i++); - menu_item_append_unref(submenu, - g_menu_item_new(extra_name_translation(pextra), actname)); - } - } extra_type_by_rmcause_iterate_end; - g_menu_remove(work_menu, 5); g_menu_insert_submenu(work_menu, 5, _("_Clean Nuisance"), G_MENU_MODEL(submenu)); diff --git a/client/gui-qt/menu.cpp b/client/gui-qt/menu.cpp index a59937aa40..2200be25ae 100644 --- a/client/gui-qt/menu.cpp +++ b/client/gui-qt/menu.cpp @@ -2593,18 +2593,6 @@ void mr_menu::slot_clean() if (pextra != NULL) { request_new_unit_activity_targeted(punit, ACTIVITY_CLEAN, pextra); - } else { - pextra = prev_extra_in_tile(unit_tile(punit), ERM_CLEANPOLLUTION, - unit_owner(punit), punit); - if (pextra != NULL) { - request_new_unit_activity_targeted(punit, ACTIVITY_POLLUTION, pextra); - } else { - pextra = prev_extra_in_tile(unit_tile(punit), ERM_CLEANFALLOUT, - unit_owner(punit), punit); - if (pextra != NULL) { - request_new_unit_activity_targeted(punit, ACTIVITY_FALLOUT, pextra); - } - } } } unit_list_iterate_end; } diff --git a/client/helpdata.c b/client/helpdata.c index b0e466c274..19b93d87f1 100644 --- a/client/helpdata.c +++ b/client/helpdata.c @@ -273,28 +273,6 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) extra_type_by_rmcause_iterate(ERM_CLEAN, pextra) { int rmtime = pterrain->extra_removal_times[extra_index(pextra)]; - if (rmtime != 0) { - if (clean_time < 0) { - clean_time = rmtime; - } else if (clean_time != rmtime) { - clean_time = 0; /* Give up */ - } - } - } extra_type_by_rmcause_iterate_end; - extra_type_by_rmcause_iterate(ERM_CLEANPOLLUTION, pextra) { - int rmtime = pterrain->extra_removal_times[extra_index(pextra)]; - - if (rmtime != 0) { - if (clean_time < 0) { - clean_time = rmtime; - } else if (clean_time != rmtime) { - clean_time = 0; /* Give up */ - } - } - } extra_type_by_rmcause_iterate_end; - extra_type_by_rmcause_iterate(ERM_CLEANFALLOUT, pextra) { - int rmtime = pterrain->extra_removal_times[extra_index(pextra)]; - if (rmtime != 0) { if (clean_time < 0) { clean_time = rmtime; @@ -339,36 +317,6 @@ static bool insert_generated_text(char *outbuf, size_t outlen, const char *name) } } } extra_type_by_rmcause_iterate_end; - extra_type_by_rmcause_iterate(ERM_CLEANPOLLUTION, pextra) { - if (pextra->removal_time == 0) { - if (factor < 0) { - factor = pextra->removal_time_factor; - } else if (factor != pextra->removal_time_factor) { - factor = 0; /* Give up */ - } - } else { - if (time < 0) { - time = pextra->removal_time; - } else if (time != pextra->removal_time) { - time = 0; /* Give up */ - } - } - } extra_type_by_rmcause_iterate_end; - extra_type_by_rmcause_iterate(ERM_CLEANFALLOUT, pextra) { - if (pextra->removal_time == 0) { - if (factor < 0) { - factor = pextra->removal_time_factor; - } else if (factor != pextra->removal_time_factor) { - factor = 0; /* Give up */ - } - } else { - if (time < 0) { - time = pextra->removal_time; - } else if (time != pextra->removal_time) { - time = 0; /* Give up */ - } - } - } extra_type_by_rmcause_iterate_end; if (factor < 0) { /* No extra has terrain-dependent clean time; use extra's time */ @@ -3852,8 +3800,7 @@ void helptext_extra(char *buf, size_t bufsz, struct player *pplayer, pillage_time), pillage_time); } } - if (is_extra_removed_by(pextra, ERM_CLEANPOLLUTION) - || is_extra_removed_by(pextra, ERM_CLEANFALLOUT)) { + if (is_extra_removed_by(pextra, ERM_CLEAN)) { int clean_time = -1; if (pextra->removal_time != 0) { -- 2.39.2