diff -u -r freeciv/client/gui-gtk/citydlg.c gtk-menu/client/gui-gtk/citydlg.c --- freeciv/client/gui-gtk/citydlg.c Thu Feb 24 23:28:09 2000 +++ gtk-menu/client/gui-gtk/citydlg.c Sun Feb 27 21:09:48 2000 @@ -660,6 +660,26 @@ /**************************************************************** ... *****************************************************************/ +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); +} + +/**************************************************************** +... +*****************************************************************/ static void present_units_activate_callback(GtkWidget *w, gpointer data) { struct unit *punit; @@ -691,6 +711,30 @@ /**************************************************************** ... *****************************************************************/ +static void present_units_sentry_callback(GtkWidget *w, gpointer data) +{ + struct unit *punit; + + if((punit=unit_list_find(&game.player_ptr->units, (size_t)data))) + sentry_unit(punit); + destroy_message_dialog(w); +} + +/**************************************************************** +... +*****************************************************************/ +static void present_units_fortify_callback(GtkWidget *w, gpointer data) +{ + struct unit *punit; + + if((punit=unit_list_find(&game.player_ptr->units, (size_t)data))) + fortify_unit(punit); + destroy_message_dialog(w); +} + +/**************************************************************** +... +*****************************************************************/ static void supported_units_activate_close_callback(GtkWidget *w, gpointer data) { struct unit *punit; @@ -780,7 +824,7 @@ } /**************************************************************** -... +The little pop-up menu to change attributes of units, fx change their homecity. *****************************************************************/ gint present_units_callback(GtkWidget *w, GdkEventButton *ev, gpointer data) { @@ -803,6 +847,10 @@ present_units_activate_callback, punit->id, _("Activate unit, close dialog"), present_units_activate_close_callback, punit->id, + _("Sentry unit"), + present_units_sentry_callback, punit->id, + _("Fortify unit"), + present_units_fortify_callback, punit->id, _("Disband unit"), present_units_disband_callback, punit->id, _("Make new homecity"), @@ -813,7 +861,20 @@ present_units_cancel_callback, 0, NULL); if (can_upgrade_unittype(game.player_ptr,punit->type) == -1) { - message_dialog_button_set_sensitive(wd, "button4", FALSE); + message_dialog_button_set_sensitive(wd, "button6", FALSE); + } + if (punit->activity == ACTIVITY_SENTRY || !can_unit_do_activity(punit,ACTIVITY_SENTRY)) { + message_dialog_button_set_sensitive(wd, "button2", FALSE); + }else{ + message_dialog_button_set_sensitive(wd, "button2", TRUE); + } + printf("KILROY WAS HERE: "); + if (punit->activity == ACTIVITY_FORTIFY || !can_unit_do_activity(punit,ACTIVITY_FORTIFY)) { + message_dialog_button_set_sensitive(wd, "button3", FALSE); + printf("FALSE\n"); + }else{ + message_dialog_button_set_sensitive(wd, "button3", TRUE); + printf("TRUE\n"); } } return TRUE; diff -u -r freeciv/common/unit.c gtk-menu/common/unit.c --- freeciv/common/unit.c Thu Feb 24 23:28:10 2000 +++ gtk-menu/common/unit.c Sun Feb 27 21:12:39 2000 @@ -927,9 +927,6 @@ if (activity == ACTIVITY_EXPLORE) /* added 980803 by Syela */ return (is_ground_unit(punit) || is_sailing_unit(punit)); - /* can't go directly from non-idle to non-idle activity */ - if(punit->activity!=ACTIVITY_IDLE && punit->activity != activity) return 0; - switch(activity) { case ACTIVITY_POLLUTION: return unit_flag(punit->type, F_SETTLERS) && punit->moves_left &&