diff -u -r freecivold2/client/gui-gtk/citydlg.c freecivold/client/gui-gtk/citydlg.c --- freecivold2/client/gui-gtk/citydlg.c Wed Feb 23 15:51:29 2000 +++ freecivold/client/gui-gtk/citydlg.c Wed Feb 23 19:16:44 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;