Author: jtn Date: Tue Sep 27 23:24:34 2016 New Revision: 33920 URL: http://svn.gna.org/viewcvs/freeciv?rev=33920&view=rev Log: In transport selection dialog, select what we think is the best transport by default.
See patch #7728. Modified: branches/S2_6/client/gui-gtk-3.0/action_dialog.c branches/S2_6/client/gui-gtk-3.0/transportdlg.c branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.c branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.h Modified: branches/S2_6/client/gui-gtk-3.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/action_dialog.c?rev=33920&r1=33919&r2=33920&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/action_dialog.c (original) +++ branches/S2_6/client/gui-gtk-3.0/action_dialog.c Tue Sep 27 23:24:34 2016 @@ -992,7 +992,7 @@ if ((punit = game_unit_by_number(args->actor_unit_id)) && (ptile = index_to_tile(args->target_tile_id))) { - select_tgt_unit(punit, ptile, ptile->units, + select_tgt_unit(punit, ptile, ptile->units, NULL, _("Target unit selection"), _("Looking for target unit:"), _("Units at tile:"), Modified: branches/S2_6/client/gui-gtk-3.0/transportdlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/transportdlg.c?rev=33920&r1=33919&r2=33920&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/transportdlg.c (original) +++ branches/S2_6/client/gui-gtk-3.0/transportdlg.c Tue Sep 27 23:24:34 2016 @@ -83,6 +83,7 @@ { int tcount; struct unit_list *potential_transports = unit_list_new(); + struct unit *best_transport = transporter_for_unit(cargo); unit_list_iterate(ptile->units, ptransport) { if (can_unit_transport(ptransport, cargo) @@ -94,11 +95,13 @@ tcount = unit_list_size(potential_transports); if (tcount == 0) { + fc_assert(best_transport == NULL); unit_list_destroy(potential_transports); return FALSE; /* Unit was not handled here. */ } else if (tcount == 1) { /* There's exactly one potential transport - use it automatically */ + fc_assert(unit_list_get(potential_transports, 0) == best_transport); request_unit_load(cargo, unit_list_get(potential_transports, 0), ptile); unit_list_destroy(potential_transports); @@ -106,7 +109,7 @@ return TRUE; } - return select_tgt_unit(cargo, ptile, potential_transports, + return select_tgt_unit(cargo, ptile, potential_transports, best_transport, _("Transport selection"), _("Looking for transport:"), _("Transports available:"), Modified: branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.c?rev=33920&r1=33919&r2=33920&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.c (original) +++ branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.c Tue Sep 27 23:24:34 2016 @@ -69,6 +69,7 @@ ****************************************************************************/ bool select_tgt_unit(struct unit *actor, struct tile *ptile, struct unit_list *potential_tgt_units, + struct unit *suggested_tgt_unit, const gchar *dlg_title, const gchar *actor_label, const gchar *tgt_label, @@ -146,6 +147,9 @@ G_CALLBACK(unit_sel_unit_toggled), cbdata); g_signal_connect(radio, "destroy", G_CALLBACK(unit_sel_unit_destroyed), cbdata); + if (ptgt == suggested_tgt_unit) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE); + } gtk_grid_attach(GTK_GRID(box), radio, 0, tcount, 1, 1); tubuf = usdlg_get_unit_image(ptgt); Modified: branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.h?rev=33920&r1=33919&r2=33920&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.h (original) +++ branches/S2_6/client/gui-gtk-3.0/unitselunitdlg.h Tue Sep 27 23:24:34 2016 @@ -15,6 +15,7 @@ bool select_tgt_unit(struct unit *actor, struct tile *ptile, struct unit_list *potential_tgt_units, + struct unit *suggested_tgt_unit, const gchar *dlg_title, const gchar *actor_label, const gchar *tgt_label, _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits