diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/control.c freeciv/client/control.c --- FreecivCVS/client/control.c Sun Mar 12 23:32:57 2000 +++ freeciv/client/control.c Mon Mar 13 15:00:02 2000 @@ -356,6 +356,26 @@ send_unit_info(&req_unit); } +/**************************************************************** +... +*****************************************************************/ +void request_unit_sentry(struct unit *punit) +{ + if(punit->activity!=ACTIVITY_SENTRY && + can_unit_do_activity(punit, ACTIVITY_SENTRY)) + request_new_unit_activity(punit, ACTIVITY_SENTRY); +} + +/**************************************************************** +... +*****************************************************************/ +void request_unit_fortify(struct unit *punit) +{ + if(punit->activity!=ACTIVITY_FORTIFY && + can_unit_do_activity(punit, ACTIVITY_FORTIFY)) + request_new_unit_activity(punit, ACTIVITY_FORTIFY); +} + /************************************************************************** ... **************************************************************************/ diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/control.h freeciv/client/control.h --- FreecivCVS/client/control.h Sat Jan 1 13:55:31 2000 +++ freeciv/client/control.h Mon Mar 13 15:00:35 2000 @@ -28,6 +28,8 @@ void request_new_unit_activity_targeted(struct unit *punit, enum unit_activity act, int tgt); void request_unit_pillage(struct unit *punit); +void request_unit_sentry(struct unit *punit); +void request_unit_fortify(struct unit *punit); void request_unit_auto(struct unit *punit); void request_unit_build_city(struct unit *punit); void request_unit_caravan_action(struct unit *punit, enum packet_type action); diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/gui-gtk/citydlg.c freeciv/client/gui-gtk/citydlg.c --- FreecivCVS/client/gui-gtk/citydlg.c Fri Mar 10 09:48:02 2000 +++ freeciv/client/gui-gtk/citydlg.c Mon Mar 13 15:03:58 2000 @@ -658,23 +658,6 @@ set_unit_focus(punit); } -static void sentry_unit(struct unit *punit) -{ - if(punit->activity!=ACTIVITY_SENTRY && - can_unit_do_activity(punit, ACTIVITY_SENTRY)) - request_new_unit_activity(punit, ACTIVITY_SENTRY); -} - -/**************************************************************** -... -*****************************************************************/ -static void fortify_unit(struct unit *punit) -{ - if(punit->activity!=ACTIVITY_FORTIFY && - can_unit_do_activity(punit, ACTIVITY_FORTIFY)) - request_new_unit_activity(punit, ACTIVITY_FORTIFY); -} - /**************************************************************** ... *****************************************************************/ @@ -714,7 +697,7 @@ struct unit *punit; if((punit=unit_list_find(&game.player_ptr->units, (size_t)data))) - sentry_unit(punit); + request_unit_sentry(punit); destroy_message_dialog(w); } @@ -726,7 +709,7 @@ struct unit *punit; if((punit=unit_list_find(&game.player_ptr->units, (size_t)data))) - fortify_unit(punit); + request_unit_fortify(punit); destroy_message_dialog(w); } diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/gui-xaw/Freeciv.h freeciv/client/gui-xaw/Freeciv.h --- FreecivCVS/client/gui-xaw/Freeciv.h Mon Feb 21 18:32:28 2000 +++ freeciv/client/gui-xaw/Freeciv.h Mon Mar 13 15:11:23 2000 @@ -890,17 +890,23 @@ "Freeciv*presentunitsdialog.*.button1.label: _(\"Activate unit, close dialog\")", "Freeciv*presentunitsdialog.*.button1.fromVert: button0", "Freeciv*presentunitsdialog.*.button1.width: 200", -"Freeciv*presentunitsdialog.*.button2.label: _(\"Disband unit\")", +"Freeciv*presentunitsdialog.*.button2.label: _(\"Sentry unit\")", "Freeciv*presentunitsdialog.*.button2.fromVert: button1", "Freeciv*presentunitsdialog.*.button2.width: 200", -"Freeciv*presentunitsdialog.*.button3.label: _(\"Make new homecity\")", +"Freeciv*presentunitsdialog.*.button3.label: _(\"Fortify unit\")", "Freeciv*presentunitsdialog.*.button3.fromVert: button2", "Freeciv*presentunitsdialog.*.button3.width: 200", -"Freeciv*presentunitsdialog.*.button4.label: _(\"Upgrade unit\")", -"Freeciv*presentunitsdialog.*.button4.fromVert: button3", -"Freeciv*presentunitsdialog.*.button4.width: 200", -"Freeciv*presentunitsdialog.*.button5.label: _(\"Cancel\")", +"Freeciv*presentunitsdialog.*.button4.label: _(\"Disband unit\")", +"Freeciv*presentunitsdialog.*.button4.fromVert: button3", +"Freeciv*presentunitsdialog.*.button4.width: 200", +"Freeciv*presentunitsdialog.*.button5.label: _(\"Make new homecity\")", "Freeciv*presentunitsdialog.*.button5.fromVert: button4", +"Freeciv*presentunitsdialog.*.button5.width: 200", +"Freeciv*presentunitsdialog.*.button6.label: _(\"Upgrade unit\")", +"Freeciv*presentunitsdialog.*.button6.fromVert: button5", +"Freeciv*presentunitsdialog.*.button6.width: 200", +"Freeciv*presentunitsdialog.*.button7.label: _(\"Cancel\")", +"Freeciv*presentunitsdialog.*.button7.fromVert: button6", "Freeciv*supportunitsdialog.title: _(\"Unit Commands\")", "Freeciv*supportunitsdialog.*.dlabel.borderWidth: 0", "Freeciv*supportunitsdialog.*.button0.label: _(\"Activate unit\")", diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/gui-xaw/citydlg.c freeciv/client/gui-xaw/citydlg.c --- FreecivCVS/client/gui-xaw/citydlg.c Thu Feb 10 09:43:33 2000 +++ freeciv/client/gui-xaw/citydlg.c Mon Mar 13 15:07:22 2000 @@ -1256,6 +1256,35 @@ } +/**************************************************************** +... +*****************************************************************/ +static void present_units_sentry_callback(Widget w, XtPointer client_data, + XtPointer call_data) +{ + struct unit *punit; + + if((punit=unit_list_find(&game.player_ptr->units, (size_t)client_data))) + request_unit_sentry(punit); + + destroy_message_dialog(w); +} + + +/**************************************************************** +... +*****************************************************************/ +static void present_units_fortify_callback(Widget w, XtPointer client_data, + XtPointer call_data) +{ + struct unit *punit; + + if((punit=unit_list_find(&game.player_ptr->units, (size_t)client_data))) + request_unit_fortify(punit); + + destroy_message_dialog(w); +} + /**************************************************************** ... @@ -1324,13 +1353,24 @@ unit_description(punit), present_units_activate_callback, punit->id, 1, present_units_activate_close_callback, punit->id, 1, + present_units_sentry_callback, punit->id, 1, + present_units_fortify_callback, punit->id, 1, present_units_disband_callback, punit->id, 1, present_units_homecity_callback, punit->id, 1, upgrade_callback, punit->id, 1, present_units_cancel_callback, 0, 0, NULL); + + if (punit->activity == ACTIVITY_SENTRY + || !can_unit_do_activity(punit, ACTIVITY_SENTRY)) { + XtSetSensitive(XtNameToWidget(wd, "*button2"), FALSE); + } + if (punit->activity == ACTIVITY_FORTIFY + || !can_unit_do_activity(punit, ACTIVITY_FORTIFY)) { + XtSetSensitive(XtNameToWidget(wd, "*button3"), FALSE); + } if (can_upgrade_unittype(game.player_ptr,punit->type) == -1) { - XtSetSensitive(XtNameToWidget(wd, "*button4"), FALSE); + XtSetSensitive(XtNameToWidget(wd, "*button6"), FALSE); } } } diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/data/Freeciv freeciv/data/Freeciv --- FreecivCVS/data/Freeciv Mon Feb 21 18:32:28 2000 +++ freeciv/data/Freeciv Mon Mar 13 15:09:28 2000 @@ -1134,20 +1134,28 @@ Freeciv*presentunitsdialog.*.button1.fromVert: button0 Freeciv*presentunitsdialog.*.button1.width: 200 -Freeciv*presentunitsdialog.*.button2.label: _("Disband unit") +Freeciv*presentunitsdialog.*.button2.label: _("Sentry unit") Freeciv*presentunitsdialog.*.button2.fromVert: button1 Freeciv*presentunitsdialog.*.button2.width: 200 -Freeciv*presentunitsdialog.*.button3.label: _("Make new homecity") +Freeciv*presentunitsdialog.*.button3.label: _("Fortify unit") Freeciv*presentunitsdialog.*.button3.fromVert: button2 Freeciv*presentunitsdialog.*.button3.width: 200 -Freeciv*presentunitsdialog.*.button4.label: _("Upgrade unit") -Freeciv*presentunitsdialog.*.button4.fromVert: button3 -Freeciv*presentunitsdialog.*.button4.width: 200 +Freeciv*presentunitsdialog.*.button4.label: _("Disband unit") +Freeciv*presentunitsdialog.*.button4.fromVert: button3 +Freeciv*presentunitsdialog.*.button4.width: 200 -Freeciv*presentunitsdialog.*.button5.label: _("Cancel") +Freeciv*presentunitsdialog.*.button5.label: _("Make new homecity") Freeciv*presentunitsdialog.*.button5.fromVert: button4 +Freeciv*presentunitsdialog.*.button5.width: 200 + +Freeciv*presentunitsdialog.*.button6.label: _("Upgrade unit") +Freeciv*presentunitsdialog.*.button6.fromVert: button5 +Freeciv*presentunitsdialog.*.button6.width: 200 + +Freeciv*presentunitsdialog.*.button7.label: _("Cancel") +Freeciv*presentunitsdialog.*.button7.fromVert: button6 ! ! Supported units dialog in city dialog