Beispiel #1
0
/**************************************************************************
  User requested closing of pillage dialog.
**************************************************************************/
static void pillage_callback(Widget w, XtPointer client_data, 
			     XtPointer call_data)
{
  if (!is_showing_pillage_dialog) {
    destroy_message_dialog (w);
    return;
  }

  if (client_data) {
    struct unit *punit = game_unit_by_number(unit_to_use_to_pillage);
    if (punit) {
      struct act_tgt target;
      int what = XTPOINTER_TO_INT(client_data);

      if (what >= S_LAST + game.control.num_base_types) {
        target.type = ATT_ROAD;
        target.obj.road = what - S_LAST - game.control.num_base_types;
      } else if (what >= S_LAST) {
        target.type = ATT_BASE;
        target.obj.base = what - S_LAST;
      } else {
        target.type = ATT_SPECIAL;
        target.obj.spe = what;
      }

      request_new_unit_activity_targeted(punit, ACTIVITY_PILLAGE,
                                         &target);
    }
  }

  destroy_message_dialog (w);
  is_showing_pillage_dialog = FALSE;
}
Beispiel #2
0
/****************************************************************
...
*****************************************************************/
static void diplomat_incite_no_callback(Widget w, XtPointer client_data, 
					XtPointer call_data)
{
  destroy_message_dialog(w);

  process_diplomat_arrival(NULL, 0);
}
Beispiel #3
0
/****************************************************************
...
*****************************************************************/
static void diplomat_cancel_callback(Widget w, XtPointer a, XtPointer b)
{
  destroy_message_dialog(w);
  diplomat_dialog = NULL;

  process_diplomat_arrival(NULL, 0);
}
Beispiel #4
0
/****************************************************************
 Remove the preset selected in the preset list.
*****************************************************************/
static void remove_preset_yes(Widget w, XtPointer row,
                              XtPointer call_data)
{
  cmafec_preset_remove(XTPOINTER_TO_INT(row));
  update_cma_preset_list();
  destroy_message_dialog(w);
}
Beispiel #5
0
/****************************************************************
...
*****************************************************************/
static void caravan_keep_moving_callback(Widget w, XtPointer client_data, 
					 XtPointer call_data)
{
  destroy_message_dialog(w);
  caravan_dialog = 0;
  process_caravan_arrival(NULL);
}
Beispiel #6
0
/****************************************************************
...
*****************************************************************/
static void spy_steal_popup(Widget w, XtPointer client_data,
                            XtPointer call_data)
{
  struct city *pvcity = game_city_by_number(diplomat_target_id);
  struct player *pvictim = NULL;

  if(pvcity)
    pvictim = city_owner(pvcity);

/* it is concievable that pvcity will not be found, because something
has happened to the city during latency.  Therefore we must initialize
pvictim to NULL and account for !pvictim in create_advances_list. -- Syela */
  
  destroy_message_dialog(w);
  diplomat_dialog = NULL;

  if(!spy_tech_shell){
    Position x, y;
    Dimension width, height;
    spy_tech_shell_is_modal=1;

    create_advances_list(client.conn.playing, pvictim, spy_tech_shell_is_modal);
    
    XtVaGetValues(toplevel, XtNwidth, &width, XtNheight, &height, NULL);
    
    XtTranslateCoords(toplevel, (Position) width/10, (Position) height/10,
		      &x, &y);
    XtVaSetValues(spy_tech_shell, XtNx, x, XtNy, y, NULL);
    
    XtPopup(spy_tech_shell, XtGrabNone);
  }
}
Beispiel #7
0
/****************************************************************
...
*****************************************************************/
static void caravan_establish_trade_callback(Widget w, XtPointer client_data,
					     XtPointer call_data)
{
  dsend_packet_unit_establish_trade(&client.conn, caravan_unit_id);
  destroy_message_dialog(w);
  caravan_dialog = 0;
  process_caravan_arrival(NULL);
}
Beispiel #8
0
/****************************************************************
...
*****************************************************************/
static void diplomat_bribe_yes_callback(Widget w, XtPointer client_data, 
					XtPointer call_data)
{
  request_diplomat_action(DIPLOMAT_BRIBE, diplomat_id,
			  diplomat_target_id, 0);

  destroy_message_dialog(w);
}
Beispiel #9
0
/****************************************************************
...
*****************************************************************/
static void spy_sabotage_unit_callback(Widget w, XtPointer client_data, 
				       XtPointer call_data)
{
  request_diplomat_action(SPY_SABOTAGE_UNIT, diplomat_id,
			  diplomat_target_id, 0);

  destroy_message_dialog(w);
}
Beispiel #10
0
/****************************************************************
...
*****************************************************************/
void sell_callback_no(Widget w, XtPointer client_data, XtPointer call_data)
{
  struct city_dialog *pdialog;
  
  pdialog=(struct city_dialog *)client_data;

  destroy_message_dialog(w);
}
Beispiel #11
0
/****************************************************************
...
*****************************************************************/
void present_units_homecity_callback(Widget w, XtPointer client_data, 
				     XtPointer call_data)
{
  struct unit *punit;
  
  if((punit=unit_list_find(&game.player_ptr->units, (int)client_data)))
    request_unit_change_homecity(punit);

  destroy_message_dialog(w);
}
Beispiel #12
0
/****************************************************************
...
*****************************************************************/
static void caravan_help_build_wonder_callback(Widget w,
					       XtPointer client_data,
					       XtPointer call_data)
{
  dsend_packet_unit_help_build_wonder(&client.conn, caravan_unit_id);

  destroy_message_dialog(w);
  caravan_dialog = 0;
  process_caravan_arrival(NULL);
}
Beispiel #13
0
/****************************************************************
...
*****************************************************************/
static void diplomat_incite_yes_callback(Widget w, XtPointer client_data, 
					 XtPointer call_data)
{
  request_diplomat_action(DIPLOMAT_INCITE, diplomat_id,
			  diplomat_target_id, 0);

  destroy_message_dialog(w);

  process_diplomat_arrival(NULL, 0);
}
Beispiel #14
0
/**************************************************************************
  Asks the server how much the bribe is
**************************************************************************/
static void diplomat_bribe_callback(Widget w, XtPointer client_data, 
				    XtPointer call_data)
{
  destroy_message_dialog(w);

  if (NULL != game_unit_by_number(diplomat_id)
      && NULL != game_unit_by_number(diplomat_target_id)) {
    request_diplomat_answer(DIPLOMAT_BRIBE, diplomat_id,
                            diplomat_target_id, 0);
  }
}
Beispiel #15
0
/**************************************************************************
  Requests up-to-date list of improvements, the return of
  which will trigger the popup_sabotage_dialog() function.
**************************************************************************/
static void spy_request_sabotage_list(Widget w, XtPointer client_data,
				      XtPointer call_data)
{
  destroy_message_dialog(w);
  diplomat_dialog = NULL;

  if (NULL != game_unit_by_number(diplomat_id)
      && NULL != game_city_by_number(diplomat_target_id)) {
    request_diplomat_answer(DIPLOMAT_SABOTAGE, diplomat_id,
			    diplomat_target_id, 0);
  }
}
Beispiel #16
0
/****************************************************************
...
*****************************************************************/
static void spy_poison_callback(Widget w, XtPointer client_data, 
				XtPointer call_data)
{
  destroy_message_dialog(w);
  diplomat_dialog = NULL;

  if (NULL != game_unit_by_number(diplomat_id)
      && NULL != game_city_by_number(diplomat_target_id)) {
    request_diplomat_action(SPY_POISON, diplomat_id, diplomat_target_id, 0);
  }

  process_diplomat_arrival(NULL, 0);
}
Beispiel #17
0
/****************************************************************
...
*****************************************************************/
void buy_callback_yes(Widget w, XtPointer client_data, XtPointer call_data)
{
  struct city_dialog *pdialog;
  struct packet_city_request packet;

  pdialog=(struct city_dialog *)client_data;

  packet.city_id=pdialog->pcity->id;
  packet.name[0]='\0';
  send_packet_city_request(&aconnection, &packet, PACKET_CITY_BUY);

  destroy_message_dialog(w);
}
Beispiel #18
0
/****************************************************************
...
*****************************************************************/
static void revolution_callback_yes(Widget w, XtPointer client_data, 
				    XtPointer call_data)
{
  struct government *pgovernment = client_data;

  if (!pgovernment) {
    start_revolution();
  } else {
    /* Player have choosed government */
    set_government_choice(pgovernment);
  }
  destroy_message_dialog(w);
}
Beispiel #19
0
/****************************************************************
...
*****************************************************************/
static void diplomat_steal_callback(Widget w, XtPointer client_data, 
				    XtPointer call_data)
{
  destroy_message_dialog(w);
  diplomat_dialog = NULL;

  if (NULL != game_unit_by_number(diplomat_id)
      && NULL != game_city_by_number(diplomat_target_id)) {
    request_diplomat_action(DIPLOMAT_STEAL, diplomat_id,
			    diplomat_target_id, A_UNSET);
  }

  process_diplomat_arrival(NULL, 0);
}
Beispiel #20
0
/****************************************************************
...
*****************************************************************/
void present_units_activate_close_callback(Widget w, XtPointer client_data, 
					   XtPointer call_data)
{
  struct unit *punit;
  struct city *pcity;
  struct city_dialog *pdialog;

  activate_unit((int)client_data);

  destroy_message_dialog(w);

  if((punit=unit_list_find(&game.player_ptr->units, (int)client_data)))
    if((pcity=game_find_city_by_coor(punit->x, punit->y)))
      if((pdialog=get_city_dialog(pcity)))
	close_city_dialog(pdialog);
}
/**************************************************************************
  Callback from diplomat/spy dialog for "keep moving".
  (This should only occur when entering allied city.)
**************************************************************************/
static void diplomat_keep_moving_callback(Widget w, XtPointer client_data, 
					  XtPointer call_data)
{
  struct unit *punit;
  struct city *pcity;
  
  destroy_message_dialog(w);
  diplomat_dialog = NULL;

  if ((punit = game_unit_by_number(diplomat_id))
      && (pcity = game_city_by_number(diplomat_target_id))
      && !same_pos(unit_tile(punit), city_tile(pcity))) {
    request_diplomat_action(DIPLOMAT_MOVE, diplomat_id,
                            diplomat_target_id, 0);
  }
  process_diplomat_arrival(NULL, 0);
}
Beispiel #22
0
/****************************************************************
...
*****************************************************************/
static void unitdisband_callback_yes(Widget w, XtPointer client_data, XtPointer call_data)
{
  struct unit_list *punits = client_data;

  /* Is it right place for breaking? -ev */
  if (!can_client_issue_orders()) {
    unit_list_destroy(punits);
    return;
  }

  unit_list_iterate(punits, punit) {
    if (!unit_has_type_flag(punit, UTYF_UNDISBANDABLE)) {
      request_unit_disband(punit);
    }
  } unit_list_iterate_end;

  unit_list_destroy(punits);
  destroy_message_dialog(w);
}
Beispiel #23
0
/****************************************************************
 Close the remove preset dialog, without removing a preset. 
*****************************************************************/
static void remove_preset_no(Widget w, XtPointer client_data,
                             XtPointer call_data)
{
  destroy_message_dialog(w);
}
Beispiel #24
0
/****************************************************************
...
*****************************************************************/
void present_units_activate_callback(Widget w, XtPointer client_data, 
				     XtPointer call_data)
{
  activate_unit((int)client_data);
  destroy_message_dialog(w);
}
Beispiel #25
0
/****************************************************************
...
*****************************************************************/
void buy_callback_no(Widget w, XtPointer client_data, XtPointer call_data)
{
  destroy_message_dialog(w);
}
Beispiel #26
0
/****************************************************************
...
*****************************************************************/
static void diplomat_bribe_no_callback(Widget w, XtPointer client_data, 
				       XtPointer call_data)
{
  destroy_message_dialog(w);
}
Beispiel #27
0
/****************************************************************
...
*****************************************************************/
void present_units_cancel_callback(Widget w, XtPointer client_data, 
				XtPointer call_data)
{
  destroy_message_dialog(w);
}
Beispiel #28
0
/****************************************************************
...
*****************************************************************/
void trade_message_dialog_callback(Widget w, XtPointer client_data, 
				   XtPointer call_data)
{
  destroy_message_dialog(w);
}
Beispiel #29
0
/****************************************************************
...
*****************************************************************/
static void revolution_callback_no(Widget w, XtPointer client_data, 
				   XtPointer call_data)
{
  destroy_message_dialog(w);
}
Beispiel #30
0
/****************************************************************
...
*****************************************************************/
static void unitdisband_callback_no(Widget w, XtPointer client_data, XtPointer call_data)
{
  destroy_message_dialog(w);
}