Author: cazfi Date: Thu Apr 23 01:19:41 2015 New Revision: 28845 URL: http://svn.gna.org/viewcvs/freeciv?rev=28845&view=rev Log: Worker Task dialog gives only those task options that are possible for the given tile at this time.
See patch #6019 Modified: branches/S2_6/client/gui-gtk-3.0/citydlg.c Modified: branches/S2_6/client/gui-gtk-3.0/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/citydlg.c?rev=28845&r1=28844&r2=28845&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/citydlg.c (original) +++ branches/S2_6/client/gui-gtk-3.0/citydlg.c Thu Apr 23 01:19:41 2015 @@ -2802,6 +2802,9 @@ { if (!is_showing_workertask_dialog) { GtkWidget *shl; + struct terrain *pterr = tile_terrain(ptile); + struct universal for_terr = { .kind = VUT_TERRAIN, + .value = { .terrain = pterr }}; is_showing_workertask_dialog = TRUE; workertask_req.owner = pcity; @@ -2810,21 +2813,39 @@ shl = choice_dialog_start(GTK_WINDOW(toplevel), _("What Action to Request"), _("Select autosettler activity:")); - choice_dialog_add(shl, _("Clear request"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_IDLE), NULL); - choice_dialog_add(shl, _("Mine"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_MINE), NULL); - choice_dialog_add(shl, _("Irrigate"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_IRRIGATE), NULL); - choice_dialog_add(shl, _("Road"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_GEN_ROAD), NULL); - choice_dialog_add(shl, _("Transform"), - G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_TRANSFORM), NULL); + if (pcity->task_req.ptile != NULL) { + choice_dialog_add(shl, _("Clear request"), + G_CALLBACK(set_city_workertask), + GINT_TO_POINTER(ACTIVITY_IDLE), NULL); + } + + if ((pterr->mining_result == pterr + && effect_cumulative_max(EFT_MINING_POSSIBLE, &for_terr) > 0) + || (pterr->mining_result != pterr && pterr->mining_result != NULL + && effect_cumulative_max(EFT_MINING_TF_POSSIBLE, &for_terr) > 0)) { + choice_dialog_add(shl, _("Mine"), + G_CALLBACK(set_city_workertask), + GINT_TO_POINTER(ACTIVITY_MINE), NULL); + } + if ((pterr->irrigation_result == pterr + && effect_cumulative_max(EFT_IRRIG_POSSIBLE, &for_terr) > 0) + || (pterr->irrigation_result != pterr && pterr->irrigation_result != NULL + && effect_cumulative_max(EFT_IRRIG_TF_POSSIBLE, &for_terr) > 0)) { + choice_dialog_add(shl, _("Irrigate"), + G_CALLBACK(set_city_workertask), + GINT_TO_POINTER(ACTIVITY_IRRIGATE), NULL); + } + if (next_extra_for_tile(ptile, EC_ROAD, city_owner(pcity), NULL) != NULL) { + choice_dialog_add(shl, _("Road"), + G_CALLBACK(set_city_workertask), + GINT_TO_POINTER(ACTIVITY_GEN_ROAD), NULL); + } + if (pterr->transform_result != pterr && pterr->transform_result != NULL + && effect_cumulative_max(EFT_TRANSFORM_POSSIBLE, &for_terr) > 0) { + choice_dialog_add(shl, _("Transform"), + G_CALLBACK(set_city_workertask), + GINT_TO_POINTER(ACTIVITY_TRANSFORM), NULL); + } choice_dialog_add(shl, GTK_STOCK_CANCEL, 0, 0, NULL); choice_dialog_end(shl); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits