DELTA 12611 0 4044
SVN  Ú6Øx1— †7  ˆ†3³ <Žf˜ …61… ƒ –€ ‚
š,€/ _Y€l ƒ Ÿ j£4• ‚'¤€  ‚§n€, G—@» „-¬h¦ l±.” a³+€e ‚´w° p·¸ P¸=€O q¼• H¾± =¿v€D ‚ÁM€‰: IÍ-€t G  	®; Ñ~ ƒÓ.¯ uÓ0 ‚U×a#include "logplayer_index(player_by_number(MAX_ID - pWidget->ID)game_find_city_by_numbern = 0players_iterate(pPlayer) {
    
    if (!TEST_BIT(all_players, player_index(pPlayer))) {
      continue;
    }

    city_list_iterate(pPlayer->adj_font(12));
      pStr->style |= TTF_STYLE_BOLD;
   
      if(!player_owns_city(owner, pCity)) {
        pLogo = get_nation_flag_surface(nation_of_player(city_owner(pCity))!player_owns_city(owner, pCity)) {
        set_wflag(pBuf, WF_FREE_THEME);
        owner = city_owner(pCity)(pGotoDlg->pScroll->active - 1) players_iterate_end;pGotoDlg->pScroll->active)
    {
      show_scrollbar(pGotoDlg->pScroll);
      pGotoDlg->pScroll->pScrollBar->size.y = pGotoDlg->pEndWidgetList->area.y +
     area.x,
        pGotoDlg->pEndWidgetList->area.y,
        pGotoDlg->pScroll->pUp_Left_Button->size.x -
          pGotoDlg->pEndWidgetList->area.x - adj_size(2),
        0,     
  } else {
    hide_scrollbar(pGotoDlg->pScroll);
  }
i, col, block_x, x, y;
  SDL_Rect area_skeleton(NULL, pStr
  add_to_gui_list(ID_WINDOW, pWindow);
  pGotoDlg->pEndWidgetList = pWindow;

  area = pWindow->areaarea.w = MAX(area.w, pBuf->size.w) + adj_size(10players_iterate(pPlayer) {
    if(player_number(pPlayer)pPlayer)->type == DS_NO_CONTACT) {
      continue;
    }
    
    pFlag = ResizeSurfaceBox(get_nation_flag_surface(pPlayer->nation),
                             adj_size(30), adj_size(30), 1, TRUE, FALSE);
player_index(pPlayer)nation_name_translation(pPlayer->nation),
    			player_number(pPlayer), pBuf);
    col++;  
  } players_iterate_end;6, TRUE, TRUE);
  hide_scrollbar(pGotoDlg->pScroll);
  
  area.w = MAX(area.w, adj_size(300));
  area.h = adj_size(320);

  resize_window(pWindow, NULL, NULL,
                (pWindow->size.w - pWindow->area.w) + area.w,
                (pWindow->size.h - pWindow->area.h) + area.h);

  /* background */
  col = (col + 15) / 16; /* number of flag columns */
  
  pFlag = ResizeSurface(pTheme->Block,
    (col * pBuf->size.w + (col - 1) * adj_size(5) + adj_size(10)), area.h, 1);
  
  block_x = dst.x = area.x + area.w - pFlag->w;
  dst.y = area.y;
  alphablit(pFlag, NULL, pWindow->theme, &dst);
  FREESURFACE(pFlag);

  widget_set_position(pWindow,
                      (Main.screen->w - pWindow->size.w) / 2,
                      (Main.screen->h - pWindow->size.h) / 2);

  /* exit button */
  pBuf = pWindow->prev;
  pBuf->size.x = area.x + area.w - pBuf->size.w - 1;
  pBuf->size.y = pWindow->size.y + 1;

  /* nations buttons */
  pBuf = pBuf->prev;
  i = 0;
  x = block_x + adj_size(5);
  y = area.y + adj_size(1);
  while(pBuf) {
    pBuf->size.x = x;
    pBuf->size.y = y;
       
    if(!((i + 1) % col)) {
      x = block_x + adj_size(5);
      y += pBuf->size.h + adj_size(1);
    } else {
      x                        block_x, area.y,
  	                        area.h, TRUE);
    
  update_goto_dialog();
}


player_index(game.player_ptr)player_index(game.player_ptr)));
  GOTO = FALSEENDREP
DELTA 12351 12196 11992
SVN  ƒÖPƒØY…dµ> ˆ ± 	ˆI |¥U ƒ¦M€g fƒ4™ ‡¬%œ ‚U³M€ x·(š #‘@ X¹C ]”o€ g¼g …—n” ‚ Ã>€O +Æ|‹ 'È'² E±> ‚ Ù3£ Lº< „Ü. ƒÌ\€^ R¿0€< fƒÏ/€ 4ç>œ pÈ€E ‚"ì= „îq ‹Hó€. ¦zƒ ;¨€k fƒ4Ÿ '¬& …†<„ a‹@¡ ‚^Œ,€l „%	 m»8€ W¼g …—e” tÃ>€9 _Ç:   T€i H¨8€( U¤7€w C¨=€n C¨=€^ O¨1¶ ©.€‚ ‚^¬6« g¯7² I±>€M ‚Z²L„ Lµ&„ W¶r  
·P„ 6¸Z† sº" ƒf»" ƒÌ\€^ R¿0€< fƒÏ/€ 4ç>œ pÈ® dÉc qÊY îq ‚gÌj …wÏc† ŒAÕ] ‰ âœ ƒ'ëT€N ‚Uï ” ˆñ~€@ …]ú(€c Gƒ¸¿ ƒ/‚‚$š kþd€‚x „9‚ˆ€‚W z‚,€. †@‚‘6€\ 	‚š kœc F‚ªX Z‚¬4€n ‚Û ´\‚°'¼ „w‚å9— ƒR‚ê<¨ † ‚î+¬ †‚ôl” ‡[‚ú|› †ƒ‚gŽ ‚*ƒ‰©  ƒŒ³ „ƒ¬4” mƒ°dŸ ƒ¬& i¯7 ƒ¶A™ C‚ú b‚û@ ~ƒ¹ m»8€ W¼g …*ƒ¾;” lÃ> …XƒÅF ƒÌ\€^ R¿0€< fƒÏ/€ 4ç>œ ‚&ƒÔ*mapview.h"
#include "repodlgs.h"
#include "spriteSDL_Rect areas"), adj_font(12));
    pStr->style |= TTF_STYLE_BOLD;

    pWindow = create_window_skeleton(NULL, pStr
    area = pWindow->areaimprovement_name_translationget_building_surface(type);
      pText = zoomSurface(pText, DEFAULT_ZOOM * ((float)36 / pText->w), DEFAULT_ZOOM * ((float)36 / pText->w), 1FREESURFACE(pText);
      pHelpDlg->pBeginActiveWidgetList = pHelpDlg->pBeginWidgetList;
    
    if (h > 10) {
      pHelpDlg->pActiveWidgetList = pHelpDlg->pEndActiveWidgetListarea = pWindow->areaimprovement_by_number(impr);
  
  pSurf = get_building_surface(impr);
  pBuf= create_iconlabel_from_chars(
	  zoomSurface(pSurf, DEFAULT_ZOOM * ((float)108 / pSurf->w), DEFAULT_ZOOM * ((float)108 / pSurf->w)ovement_has_name_translation(pImpr_type->obsolete_by),
	     area.x + 1 + width + pHelpDlg->pEndadj_size(640), adj_size(480)))
    {
      FREESURFACE(pSurf);
    }

    area = pWindow->areapWindow->size.w) / 2,
                        (Main.screen->h - pWindow->size.h) / 2);
    
    /* exit button */
    pBuf = pWindow->prev;
    pBuf->size.x = area.x + area.w - pBuf->size.area.x;
    pStore->pDock->size.y = area.y;
    
    h = setup_vertical_widgets_position(1, area.x + width,
		  area.y + adj_size(13area.x,	area.y + adj_size(13start_x;
  pBuf->size.y = area.y + adj_size(16);
  start_y = pBuf->size.y + pBuf->size.h + adj_size(10);
  
  if (!improvement_has_flag(impr, IF_GOLD))
  {
    pBuf = pBuf->prev;
    pBuf->size.x =h, start_x, start_y;
  bool created, text = FALSE;
  int width = 0;
  struct unit_type *pUnitType;
  char buffer[bufsz];
  SDL_Rect area;
  
  if(current_help_dlg != HELP_UNIUNIUnits"), adj_font(12));
    pStr->style |= TTF_STYLE_BOLD;

    pWindow = create_window_skeleton(NULL, pStr
    area = pWindow->area;
    Typeutype_name_translation(pUnitType)DEFAULT_ZOOM * (25.0 / get_unittype_surface(type)->h);
        pText = zoomSurface(get_unittype_surface(typepHelpDlg->pBeginActiveWidgetList = pHelpDlg->pBeginWidgetList;
    
    if (h > 10) {
      pHelpDlg->pActiveWidgetList = pHelpDlg->pEndActiveWidgetListarea = pWindow->areaUnitType = utype_by_number(type_id);
  pBuf= create_iconlabel_from_chars(
          adj_surf(get_unittype_surface(pUnitType)),
          pWindow->dst, utype_name_translation(pUnitType),pUnitType),
	      PL_("shield", "shields", unit_build_shield_cost(pUnitType)));
  
    if(pUnitType->popType->pop_cost, PL_("citizen", "citizens", pUnitType->pop_cost));
    }
  
    cat_snprintf(local, sizeof(local), "      %s",  N_("Upkeep:"));
        
    if(pUnitTypeType->upkeep[O_SHIELD], PL_("shield", "shields", pUnitType->upkeep[O_SHIELD]));
     }
    if(pUnitType->upkeep[O_FOOD]Type->upkeep[O_FOOD], PL_("food", "foods", pUnitType->upkeep[O_FOOD]));
    }
    if(pUnitType->upkeep[O_GOLD]Type->upkeep[O_GOLD], PL_("gold", "golds", pUnitType->upkeep[O_GOLD]));
    }
    if(pUnitTypeType->happy_cost, PL_("citizen", "citizens", pUnitTypeType->attack_strength,
	      N_("Defense:"), pUnitType->defense_strength,
              N_("Move:"), pUnitType->move_rate / SINGLE_MOVE,
              N_("Vision:"), pUnitType->vision_radius_sq,
	      N_("FirePower:"), pUnitType->firepower,
              N_("Hitpoints:"), pUnitTypeType->tech_requirement==A_LAST || pUnitType_name_translation(pUnitType->tech_requirement),
	 Type->tech_requirement;
    pBuf->string16->fgcol = *get_tech_color(pUnitTypeTypeType_name_translation(utype),
	     Typearea.xutype_by_numberadj_size(640), adj_size(480)))
    {
      FREESURFACE(pSurf);
    }

    area = pWindow->areapWindow->size.w) / 2,
                        (Main.screen->h - pWindow->size.h) / 2);
    
    /* exit button */
    pBuf = pWindow->prev;
    pBuf->size.x = area.x + area.w - pBuf->size.area.x;
    pStore->pDock->size.y = area.y;
    
    h = setup_vertical_widgets_position(1, area.x + width,
		  area.y + adj_size(13area.x,	area.y + adj_size(13start_x;
  pBuf->size.y = area.y + adj_size(16theme2Window->area.x + adj_size(1)
		    advance_name_translation(tech),
		    adj_font(24),
		    WF_FREE_THEME_name_translation(i)_name_translation(sub_tech),
           adj_font(12),
          adj_surf(get_government_surface(gov)),
                pWindow->dst,
                government_name_translation(gov),
                adj_font(14),
                WF_RESTORE_BACKGROUND|WF_SELLECT_WITHOUT_BAR | WF_FREE_THEME);gov_callback;
        pBuf->ID = MAX_ID - government_index(gov)improvement_by_number(imp)pSurf = get_building_surface(imp);
        pBuf = create_iconlabel_from_chars(
                zoomSurface(pSurf,
                            DEFAULT_ZOOM * ((float)36 / pSurf->w),
                            DEFAULT_ZOOM * ((float)36 / pSurf->w),
                            1),
                pWindow->dst,
                improvement_name_translation(imp),
               Type = un;
    if (pUnitType->tech_requirement == tech) {
      if (get_unittype_surface(un)->w > 64)
      {
	float zoom = DEFAULT_ZOOM * (64.0 / get_unittype_surface(un)->w);
        pBuf = create_iconlabel_from_chars(zoomSurface(get_unittype_surface(un), zoom, zoom, 1),
	      pWindow->dst, utype_name_translation(pUnitType), adj_font(14),adj_surf(get_unittype_surface(un)),
	      pWindow->dst, utype_name_translation(pUnitType), adj_font(14),
	      (WF_RESTORE_BACKGROUND|WF_SELLECT_WITHOUT_BAR | WF_FREE_THEMEarea.x + pWindow->area.w - pBuf->size.w - adj_size(17);
  pBuf->size.y = pWindow->area.y + adj_size(16);
  
  /* Tech label */
  pBuf = pBuf->prev;
  pBuf->size.x = start_x;
  pBuf->size.y = pWindow->area.y + adj_size(16
  dst.x = pWindow->area.x + pWindow->area.w - adj_size(459) - adj_size(7);
  dst.y = pWindow->area.y + adj_size(6);
  dst.w = pWindow->area.w - (dst.x - pWindow->area.x) - adj_size(10); 
  dst.h = pWindow->area.h - (dst.y - pWindow->area theme2 = pTheme->UP_Icon;
    } else {
      pWidget->theme2_name_translation(tech)_name_translation(advances[tech].req[i])_name_translation(advances[sub_tech].req[i])_name_translation(i)_name_translation(sub_tech)Window->area.xarea.y + (pWindow->area.h - pTech->size.hh;
  bool created;
  int width = 0;
  SDL_Rect area_skeleton(NULL, pStr
    area = pWindow->area;
    _name_translation(i));
  pHelpDlg->pBeginActiveWidgetList = pHelpDlg->pBeginWidgetList;
    
    if (h > 10) {
      pHelpDlg->pActiveWidgetList = pHelpDlg->pEndActiveWidgetListarea = pWindow->areaadj_size(640), adj_size(480)))
    {
      FREESURFACE(pSurf);
    }

    area = pWindow->areapWindow->size.w) / 2,
                        (Main.screen->h - pWindow->size.h) / 2);
    
    /* exit button */
    pBuf = pWindow->prev;
    pBuf->size.x = area.x + area.w - pBuf->size.area.x;
    pStore->pDock->size.y = area.y;
    
    h = setup_vertical_widgets_position(1, area.x + width,
		  area.y + adj_size(13area.x, area.y + adj_size(13ENDREP
DELTA 5500 56960 15637
SVN  ƒÞ^…ûc†}…† ‡A « ‡j€ŒU I¯  N‚é~€ˆ I¯ €  I°€‡H ‚Ê9€% N°€ƒU \¤@ v1€‚ V¤>‚ N°€9 ]‚ =‚ N°€‚s _‚ = "’`€— K¤>ƒ C°€A R‚ =ƒ C°€h R‚ =ƒ C°€‚V R‚ =ƒ C°€ C¯ ƒ C°€ƒv V¤>‚ N°€= ]‚ =‚ N°€= ]‚ =‚ N°€ƒ _‚ =‡ •<€‚< _¯ « ^°€¥ S¯ ” YƒÕy€C _‚ =— YƒÕy€p S¯ ” YƒÕy€" Q‚ =· @± €ƒJ Sâ@• YƒÕy€“g X¤>€h V°€‚8 P¯ ‚ N°€D /‚ =€3 :‚ =€‚  :‚ =€b :‚ =€w :‚ =€z :‚ =€U ]‚ =‚ N°€‚= ]‚ =‚ N°€‚ ]‚ =‚ N°€„Q :‚ =€‚L :‚ =€ƒp :‚ =€‚v :‚ =€r X¯ €^ Y°€€ _‚ =‡ ­*€y f¯  -­;€˜X X¤>‡ &°'€f P¯  x¢^³ G  b‚Ë@€; gÖ ‚ N°€1 gÖ ‚ N°€< _‚ = YƒÕy€~ ®C 
Í-“ X¤>” UƒÕ}€ P¯ ‚ N°€d gÖ ‚ N°€6 _‚ = EÖg‡ oØ,€Q XÛ6€‚ mÞj€Š0 jç€‚8 Yƒ»} 4¯P€‹ EÇ<€4 Sâ@ ë+€‡X P¯ ‚ N°€k :‚ =€‡  :‚ =€„F :‚ =€Ž :‚ =€w :‚ =€ :‚ =€… :‚ =« :‚ =€‚E _‚ = X‚ê €ŸO _‚ = X‚ê €ƒ5 ‚Ê5 ]‚ê €…k P¯  X‚Ð.€ V¯  ƒÕi€ÝC Yƒ»} ^ƒØ€w P¯  xƒÜ0€‹Å‚ Bursig
    email                : RafaÅ‚#include <SDL/SDL.h>

/* utility */
#include "fcintl.h"
#include "log.h"
#include "rand.h"

/* common */
#include "combat.h"
#include "government.h"
#include "movement.h"
#include "unitlist.h"

/* client */
#include "civclient.h"
#include "climap.h" /* for client_tile_get_known() */
#include "clinet.h"
#include "goto.h"
#include "packhand.h"
#include "text.h"

/* gui-sdl */
#include "chatline.h"
#include "citydlg.h"
#include "cityrep.h"
#include "cma_fe.h"
#include "colors.h"
#include "finddlg.h"
#include "gotodlg.h"
#include "graphics.h"
#include "gui_iconv.h"
#include "gui_id.h"
#include "gui_main.h"
#include "gui_tilespec.h"
#include "helpdlg.h"
#include "inteldlg.h"
#include "mapctrl.h"
#include "mapview.h"
#include "messagewin.h"
#include "optiondlg.h"
#include "plrdlg.h"
#include "repodlgs.h"
#include "sprite.h"
#include "themespec.h"
#include "widget.h"
#include "wldlg.h"

#include "dialogs.h"

struct player *races_player;

extern bool is_unit_move_blocked;
extern void popdown_diplomat_dialog(void);
extern void popdown_incite_dialog(void);
extern void popdown_bribe_dialog(void);

extern void popdown_caravan_dialog(void);

void popdown_advanced_terrain_dialog(void);
int advanced_terrain_window_dlg_callback(struct widget *pWindow);
int exit_advanced_terrain_dlg_callback(struct widget *pWidget);

static char *pLeaderName = NULL;

static void popdown_unit_select_dialog(void);
static void popdown_terrain_info_dialog(void);
static void popdown_pillage_dialog(void);
static void popdown_connect_dialog(void);
static void popdown_revolution_dialog(void);
static void popdown_unit_upgrade_dlg(void); /
void put_window_near_map_tile(struct widget *pWindow,
  		int window_width, int window_height, struct tile *ptile)
{
  int canvas_x, canvas_y;
  int window_x = 0, window_y = 0;
  
  if (tile_to_canvas_pos(&canvas_x, &canvas_y, ptile)) {
    if (canvas_x + tileset_tile_width(tileset) + window_width >= Main.screen->w)
    {
      if (canvas_x - window_width < 0) {
	window_x = (Main.screen->w - window_width) / 2;
      } else {
	window_x = canvas_x - window_width;
      }
    } else {
      window_x = canvas_x + tileset_tile_width(tileset);
    }
    
    canvas_y += (tileset_tile_height(tileset) - window_height) / 2;
    if (canvas_y + window_height >= Main.screen->h)
    {
      window_y = Main.screen->h - window_height - 1;
    } else {
      if (canvas_y < 0)
      {
	window_y = 0;
      } else {
        window_y = canvas_y;
      }
    }
  } else {
    window_x = (Main.screen->w - window_width) / 2;
    window_y = (Main.screen->h - window_height) / 2;
  }
  
  widget_set_position(pWindow, window_x, window_y);
}
 
  This function is called when the client disconnects or the game is
  over.  It should close all dialog windows for that game/
void popdown_all_game_dialogs(void)
{
  popdown_caravan_dialog();  
  popdown_unit_select_dialog();
  popdown_advanced_terrain_dialog();
  popdown_terrain_info_dialog();
  popdown_newcity_dialog();
  popdown_optiondlg();
  popdown_diplomat_dialog();
  popdown_pillage_dialog();
  popdown_incite_dialog();
  popdown_connect_dialog();
  popdown_bribe_dialog();
  popdown_find_dialog();
  popdown_revolution_dialog();
  popdown_all_science_dialogs();
  popdown_meswin_dialog();
  popdown_worklist_editor();
  popdown_all_city_dialogs();
  popdown_city_report_dialog();
  popdown_economy_report_dialog();
  popdown_activeunits_report_dialog();
  popdown_intel_dialogs();
  popdown_players_nations_dialog();
  popdown_players_dialog();
  popdown_goto_airlift_dialog();
  popdown_unit_upgrade_dlg();
  popdown_help_dialog();
  
  /* clear gui buffer */
  if (get_client_state() == CLIENT_PRE_GAME_STATE) {
    clear_surface(Main.gui->surface, NULL);
  }
}

/* ============Find the my unit's (focus) chance of success at attacking/defending the
  given enemy unit.  Return FALSE if the values cannot be determined (e.g., no
  units given)static bool sdl_get_chance_to_win(int *att_chance, int *def_chance,
		       		struct unit *enemy_unit, struct unit *my_unit)
{
  
  if (!my_unit || !enemy_unit) {
    return FALSE;
  }

  /* chance to win when active unit is attacking the selected unit */
  *att_chance = unit_win_chance(my_unit, enemy_unit) * 100;

  /* chance to win when selected unit is attacking the active unit */
  *def_chance = (1.0 - unit_win_chance(enemy_unit, my_unit)) * 100;

  return TRUonst char *headline, const char *lines,
			      struct tile *ptile)
{
  freelog(LOG_NORMAL, "popup_notify_goto_dialog : PORT ME\n \
  			a: %s\nb: %s",headline, lines );
}

/* ----------------------------------------------------------------------- */
struct ADVANCED_DLG *pNotifyDlg..static int notify_dialog_window_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    move_window_group(pNotifyDlg->pBeginWidgetList, pWindow);
  }..static int exit_notify_dialog_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    if(pNotifyDlg) {
      popdown_window_group_dialog(pNotifyDlg->pBeginWidgetList,
                                              pNotifyDlg->pEndWidgetList);
      FC_FREE(pNotifyDlg->pScroll);
      FC_FREE(pNotifyDlg);
      flush_dirty();
    }
  }onst char *caption, const char *headline,
			 const char *lines)
{
  struct widget *pBuf, *pWindow;
  SDL_String16 *pStr;
  SDL_Surface *pHeadline, *pLines;
  SDL_Rect dst;
  SDL_Rect area;
  
  if (pNotifyDlg) {
    return;
  }
  
  pNotifyDlg = fc_calloc(1, sizeof(struct ADVANCED_DLG));
   
  pStr = create_str16_from_char(caption, adj_font(12));
  pStr->style |= TTF_STYLE_BOLD;
  
  pWindow = create_window_skeleton(NULL, pStr, 0);
  
  pWindow->action = notify_dialog_window_callback;
  set_wstate(pWindow, FC_WS_NORMAL);
  
  add_to_gui_list(ID_WINDOW, pWindow);
  pNotifyDlg->pEndWidgetList = pWindow;

  area = pWindow->area;
  
  /* ---------- */
  /* create exit button */
  pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
  			  			WF_RESTORE_BACKGROUND);
  pBuf->action = exit_notify_dialog_callback;
  set_wstate(pBuf, FC_WS_NORMAL);
  pBuf->key = SDLK_ESCAPE;
  area.w += (pBuf->size.w + adj_size(10));
  
  add_to_gui_list(ID_BUTTON, pBuf);
  pNotifyDlg->pBeginWidgetList = pBuf;
    
  pStr = create_str16_from_char(headline, adj_font(16));
  pStr->style |= TTF_STYLE_BOLD;
  
  pHeadline = create_text_surf_from_str16(pStr);
    
  if(lines && *lines != '\0') {
    change_ptsize16(pStr, adj_font(12));
    pStr->style &= ~TTF_STYLE_BOLD;
    copy_chars_to_string16(pStr, lines);
    pLines = create_text_surf_from_str16(pStr);
  } else {
    pLines = NULL;
  }
  
  FREESTRING16(pStr);
  
  area.w = MAX(area.w, pHeadline->w);
  if(pLines) {
    area.w = MAX(area.w, pLines->w);
  }
  area.w += adj_size(60);
  area.h = MAX(area.h, adj_size(10) + pHeadline->h + adj_size(10));
  if(pLines) {
    area.h += pLines->h + adj_size(10);
  }
  
  resize_window(pWindow, NULL, get_game_colorRGB(COLOR_THEME_BACKGROUND),
                (pWindow->size.w - pWindow->area.w) + area.w,
                (pWindow->size.h - pWindow->area.h) + area.h);

  area = pWindow->area;
  
  widget_set_position(pWindow,
                      (Main.screen->w - pWindow->size.w) / 2,
                      (Main.screen->h - pWindow->size.h) / 2);
  
  dst.x = area.x + (area.w - pHeadline->w) / 2;
  dst.y = area.y + adj_size(10);
  
  alphablit(pHeadline, NULL, pWindow->theme, &dst);
  if(pLines) {
    dst.y += pHeadline->h + adj_size(10);
    if(pHeadline->w < pLines->w) {
      dst.x = area.x + (area.w - pLines->w) / 2;
    }
     
    alphablit(pLines, NULL, pWindow->theme, &dst);
  }
  
  FREESURFACE(pHeadline);
  FREESURFACE(pLines);
  
  /* exit button */
  pBuf = pWindow->prev; 
  pBuf->size.x = area.x + area.w - pBuf->size.w - 1;
  pBuf->size.y = pWindow->size.y + 1;
    
  /* redraw */
  redraw_group(pNotifyDlg->pBeginWidgetList, pWindow, 0);
  widget_flush(pWindow);
}

/* =======================================================================*/
/* ======================== UNIT UPGRADE DIALOG ========================*/
/* =======================================================================*/
static struct SMALL_DLG *pUnit_Upgrade_Dlg
../
static int upgrade_unit_window_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    move_window_group(pUnit_Upgrade_Dlg->pBeginWidgetList, pWindow);
  }
../
static int cancel_upgrade_unit_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    popdown_unit_upgrade_dlg();
    /* enable city dlg */
    enable_city_dlg_widgets();
    flush_dirty();
  }
../
static int ok_upgrade_unit_window_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct unit *pUnit = pWidget->data.unit;
    popdown_unit_upgrade_dlg();
    /* enable city dlg */
    enable_city_dlg_widgets();
    free_city_units_lists();
    request_unit_upgrade(pUnit);
    flush_dirty();
  }
../
void popup_unit_upgrade_dlg(struct unit *pUnit, bool city)
{
  char cBuf[128];
  struct widget *pBuf = NULL, *pWindow;
  SDL_String16 *pStr;
  SDL_Surface *pText;
  SDL_Rect dst;
  int window_x = 0, window_y = 0;
  enum unit_upgrade_result unit_upgrade_result;
  SDL_Rect area;
  
  if (pUnit_Upgrade_Dlg) {
    /* just in case */
    flush_dirty();
    return;
  }
  CHECK_UNIT_TYPE(unit_type(pUnit));
    
  pUnit_Upgrade_Dlg = fc_calloc(1, sizeof(struct SMALL_DLG));

  unit_upgrade_result = get_unit_upgrade_info(cBuf, sizeof(cBuf), pUnit);
 
  pStr = create_str16_from_char(_("Upgrade Obsolete Units"), adj_font(12));
  pStr->style |= TTF_STYLE_BOLD;

  pWindow = create_window_skeleton(NULL, pStr, 0);

  pWindow->action = upgrade_unit_window_callback;
  set_wstate(pWindow, FC_WS_NORMAL);

  pUnit_Upgrade_Dlg->pEndWidgetList = pWindow;

  add_to_gui_list(ID_WINDOW, pWindow);

  area = pWindow->area;
  
  /* ============================================================= */
  
  /* create text label */
  pStr = create_str16_from_char(cBuf, adj_font(10));
  pStr->style |= (TTF_STYLE_BOLD|SF_CENTER);
  pStr->fgcol = *get_game_colorRGB(COLOR_THEME_UNITUPGRADE_TEXT);
  
  pText = create_text_surf_from_str16(pStr);
  FREESTRING16(pStr);
  
  area.w = MAX(area.w, pText->w + adj_size(20));
  area.h += (pText->h + adj_size(10));
  
  /* cancel button */
  pBuf = create_themeicon_button_from_chars(pTheme->CANCEL_Icon,
			    pWindow->dst, _("Cancel"), adj_font(12), 0);

  pBuf->action = cancel_upgrade_unit_callback;
  set_wstate(pBuf, FC_WS_NORMAL);

  area.h += (pBuf->size.h + adj_size(20));
  
  add_to_gui_list(ID_BUTTON, pBuf);
  
  if (unit_upgrade_result == UR_OK) {
    pBuf = create_themeicon_button_from_chars(pTheme->OK_Icon, pWindow->dst,
					      _("Upgrade"), adj_font(12), 0);
        
    pBuf->action = ok_upgrade_unit_window_callback;
    set_wstate(pBuf, FC_WS_NORMAL);
    pBuf->data.unit = pUnit;    
    add_to_gui_list(ID_BUTTON, pBuf);
    pBuf->size.w = MAX(pBuf->size.w, pBuf->next->size.w);
    pBuf->next->size.w = pBuf->size.w;
    area.w = MAX(area.w, adj_size(30) + pBuf->size.w * 2);
  } else {
    area.w = MAX(area.w, pBuf->size.w + adj_size(20));
  }
  /* ============================================ */
  
  pUnit_Upgrade_Dlg->pBeginWidgetList = pBuf;
  
  resize_window(pWindow, NULL, get_game_colorRGB(COLOR_THEME_BACKGROUND),
                (pWindow->size.w - pWindow->area.w) + area.w,
                (pWindow->size.h - pWindow->area.h) + area.h);
  
  area = pWindow->area;
  
  if(city) {
    window_x = Main.event.motion.x;
    window_y = Main.event.motion.y;
  } else {
    put_window_near_map_tile(pWindow, pWindow->size.w, pWindow->size.h,
                             pUnit->tile);
  }
  
  widget_set_position(pWindow, window_x, window_y);
  
  /* setup rest of widgets */
  /* label */
  dst.x = area.x + (area.w - pText->w) / 2;
  dst.y = area.y + adj_size(10);
  alphablit(pText, NULL, pWindow->theme, &dst);
  FREESURFACE(pText);
   
  /* cancel button */
  pBuf = pWindow->prev;
  pBuf->size.y = area.y + area.h - pBuf->size.h - adj_size(7);
  
  if (unit_upgrade_result == UR_OK) {
    /* sell button */
    pBuf = pBuf->prev;
    pBuf->size.x = area.x + (area.w - (2 * pBuf->size.w + adj_size(10))) / 2;
    pBuf->size.y = pBuf->next->size.y;
    
    /* cancel button */
    pBuf->next->size.x = pBuf->size.x + pBuf->size.w + adj_size(10);
  } else {
    /* x position of cancel button */
    pBuf->size.x = area.x + area.w - pBuf->size.w - adj_size(10);
  }
  
  
  /* ================================================== */
  /* redraw */
  redraw_group(pUnit_Upgrade_Dlg->pBeginWidgetList, pWindow, 0);
    
  widget_mark_dirty(pWindow);
  flush_dirty();
  
}
../
static void popdown_unit_upgrade_dlg(void)
{
  if (pUnit_Upgrade_Dlg) {
    popdown_window_group_dialog(pUnit_Upgrade_Dlg->pBeginWidgetList,
			      pUnit_Upgrade_Dlg->pEndWidgetList);
    FC_FREE(pUnit_Upgrade_Dlg);
  }
}

/* =======================================================================*/
/* ======================== UNIT SELECTION DIALOG ========================*/
/* =======================================================================*/
static struct ADVANCED_DLG *pUnit_Select_Dlg..static int unit_select_window_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    move_window_group(pUnit_Select_Dlg->pBeginWidgetList, pWindow);
  }..static int exit_unit_select_callback( struct widget *pWidget )
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    popdown_unit_select_dialog();
    is_unit_move_blocked = FALSE;
  }..static int unit_select_callback( struct widget *pWidget )
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct unit *pUnit = player_find_unit_by_id(game.player_ptr,
                                     MAX_ID - pWidget->ID);
  
    popdown_unit_select_dialog();
    if (pUnit) {
      request_new_unit_activity(pUnit, ACTIVITY_IDLE);
      set_unit_focus(pUnit);
    }
  }Popdownstatic void popdown_unit_select_dialog(void)
{
  if (pUnit_Select_Dlg) {
    is_unit_move_blocked = FALSE;
    popdown_window_group_dialog(pUnit_Select_Dlg->pBeginWidgetList,
			pUnit_Select_Dlg->pEndWidgetList);
				   
    FC_FREE(pUnit_Select_Dlg->pScroll);
    FC_FREE(pUnit_Select_Dlg);
    flush_dirty();
  }
}window to select units on a particular tileselect_dialog(struct tile *ptile)
{
  struct widget *pBuf = NULL, *pWindow;
  SDL_String16 *pStr;
  struct unit *pUnit = NULL, *pFocus = unit_list_get(get_units_in_focus(), 0);
  struct unit_type *pUnitType;
  char cBuf[255];  
  int i, w = 0, n;
  SDL_Rect area;
  
  #define NUM_SEEN	20
  
  n = unit_list_size(ptile->units);
  
  if (!n || pUnit_Select_Dlg) {
    return;
  }
  
  is_unit_move_blocked = TRUE;  
  pUnit_Select_Dlg = fc_calloc(1, sizeof(struct ADVANCED_DLG));
    
  my_snprintf(cBuf , sizeof(cBuf),"%s (%d)", _("Unit selection") , n);
  pStr = create_str16_from_char(cBuf , adj_font(12));
  pStr->style |= TTF_STYLE_BOLD;
  
  pWindow = create_window_skeleton(NULL, pStr, 0);
  
  pWindow->action = unit_select_window_callback;
  set_wstate(pWindow, FC_WS_NORMAL);
  
  add_to_gui_list(ID_UNIT_SELLECT_DLG_WINDOW, pWindow);
  pUnit_Select_Dlg->pEndWidgetList = pWindow;
  
  area = pWindow->area;
  
  /* ---------- */
  /* create exit button */
  pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
  			  			WF_RESTORE_BACKGROUND);
  pBuf->action = exit_unit_select_callback;
  set_wstate(pBuf, FC_WS_NORMAL);
  pBuf->key = SDLK_ESCAPE;
  area.w += (pBuf->size.w + adj_size(10));
  
  add_to_gui_list(ID_UNIT_SELLECT_DLG_EXIT_BUTTON, pBuf);
    
  /* ---------- */
 
  for(i = 0; i < n; i++) {
    pUnit = unit_list_get(ptile->units, i);
    pUnitType = unit_type(pUnit);
        
    if(pUnit->owner == game.player_ptr) {
      my_snprintf(cBuf , sizeof(cBuf), _("Contact %s (%d / %d) %s(%d,%d,%d) %s"),
            pUnit->veteran ? _("Veteran") : "" ,
            pUnit->hp, pUnitType->hp,
            utype_name_translation(pUnitType),
            pUnitType->attack_strength,
            pUnitType->defense_strength,
            (pUnitType->move_rate / SINGLE_MOVE),
	    unit_activity_text(pUnit));
    } else {
      int att_chance, def_chance;
      
      my_snprintf(cBuf , sizeof(cBuf), _("%s %s %s(A:%d D:%d M:%d FP:%d) HP:%d%%"),
            nation_name_translation(nation_of_unit(pUnit)),
            (pUnit->veteran ? _("Veteran") : ""),
            utype_name_translation(pUnitType),
            pUnitType->attack_strength,
            pUnitType->defense_strength,
            (pUnitType->move_rate / SINGLE_MOVE),
      	    pUnitType->firepower,
	    (pUnit->hp * 100 / pUnitType->hp + 9) / 10);
      
      /* calculate chance to win */
      if (sdl_get_chance_to_win(&att_chance, &def_chance, pUnit, pFocus)) {
          cat_snprintf(cBuf, sizeof(cBuf), _(" CtW: Att:%d%% Def:%d%%"),
               att_chance, def_chance);
      }
    }
    
    create_active_iconlabel(pBuf, pWindow->dst,
    		pStr, cBuf, unit_select_callback);
            
    add_to_gui_list(MAX_ID - pUnit->id , pBuf);
    
    area.w = MAX(area.w, pBuf->size.w);
    area.h += pBuf->size.h;
    if(pUnit->owner == game.player_ptr) {
      set_wstate(pBuf, FC_WS_NORMAL);
    }
    
    if (i > NUM_SEEN - 1)
    {
      set_wflag(pBuf , WF_HIDDEN);
    }
    
  }
  pUnit_Select_Dlg->pBeginWidgetList = pBuf;
  pUnit_Select_Dlg->pBeginActiveWidgetList = pUnit_Select_Dlg->pBeginWidgetList;
  pUnit_Select_Dlg->pEndActiveWidgetList = pWindow->prev->prev;
  pUnit_Select_Dlg->pActiveWidgetList = pUnit_Select_Dlg->pEndActiveWidgetList;
  
  area.w += adj_size(2);
  if (n > NUM_SEEN)
  {
    n = create_vertical_scrollbar(pUnit_Select_Dlg, 1, NUM_SEEN, TRUE, TRUE);
    area.w += n;
    
    /* ------- window ------- */
    area.h = NUM_SEEN * pWindow->prev->prev->size.h;
  }

  resize_window(pWindow, NULL, NULL, 
                (pWindow->size.w - pWindow->area.w) + area.w,
                (pWindow->size.h - pWindow->area.h) + area.h);

  area = pWindow->area;
  
  put_window_near_map_tile(pWindow, pWindow->size.w, pWindow->size.h,
                           pUnit->tile);
  
  w = area.w;
  
  if(pUnit_Select_Dlg->pScroll) {
    w -= n;
  }
  
  /* exit button */
  pBuf = pWindow->prev; 
  pBuf->size.x = area.x + area.w - pBuf->size.w - 1;
  pBuf->size.y = pWindow->size.y + 1;
  pBuf = pBuf->prev;
  
  setup_vertical_widgets_position(1, area.x + 1, area.y, w, 0,
		  pUnit_Select_Dlg->pBeginActiveWidgetList, pBuf);
    
  if(pUnit_Select_Dlg->pScroll) {
    setup_vertical_scrollbar_area(pUnit_Select_Dlg->pScroll,
	area.x + area.w, area.y,
    	area.h, TRUE);
  }
  
  /* ==================================================== */
  /* redraw */
  redraw_group(pUnit_Select_Dlg->pBeginWidgetList, pWindow, 0);

  widget_flush(pWindow);
}

/* ====================================================================== */
/* ============================ TERRAIN INFO ============================ */
/* ====================================================================== */
static struct SMALL_DLG *pTerrain_Info_Dlg = NULL;
down terrain informastatic int terrain_info_window_dlg_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    move_window_group(pTerrain_Info_Dlg->pBeginWidgetList, pWindow);
  }Popdown terrain informastatic void popdown_terrain_info_dialog(void)
{
  if (pTerrain_Info_Dlg) {
    popdown_window_group_dialog(pTerrain_Info_Dlg->pBeginWidgetList,
				pTerrain_Info_Dlg->pEndWidgetList);
    FC_FREE(pTerrain_Info_Dlg);
    flush_dirty();
  }
}down terrain informastatic int exit_terrain_info_dialog_callback(struct widget *pButton)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    popdown_terrain_info_dialog();
  }
  Return a (static) string with terrain defense bonus;/
const char *sdl_get_tile_defense_info_text(struct tile *ptile)
{
  static char buffer[64];
  int bonus = (ptile->terrain->defense_bonus - 10) * 10;    
  
  if(tile_has_special(ptile, S_RIVER)) {
    bonus += terrain_control.river_defense_bonus;
  }
  if(tile_has_base_flag(ptile, BF_DEFENSE_BONUS)) {
    bonus += terrain_control.fortress_defense_bonus;
  }
  my_snprintf(buffer, sizeof(buffer), "Terrain Defense Bonus: +%d%% ", bonus);
  
  return bufferPopup terrain informastatic void popup_terrain_info_dialog(SDL_Surface *pDest, struct tile *ptile)
{
  SDL_Surface *pSurf;
  struct widget *pBuf, *pWindow;
  SDL_String16 *pStr;  
  char cBuf[256];  
  SDL_Rect area;

  if (pTerrain_Info_Dlg) {
    flush_dirty();
    return;
  }
      
  pSurf = get_terrain_surface(ptile);
  pTerrain_Info_Dlg = fc_calloc(1, sizeof(struct SMALL_DLG));
    
  /* ----------- */  
  my_snprintf(cBuf, sizeof(cBuf), "%s [%d,%d]", _("Terrain Info"), ptile->x , ptile->y);
  
  pWindow = create_window_skeleton(NULL, create_str16_from_char(cBuf , adj_font(12)), 0);
  pWindow->string16->style |= TTF_STYLE_BOLD;
  
  pWindow->action = terrain_info_window_dlg_callback;
  set_wstate(pWindow, FC_WS_NORMAL);
  
  add_to_gui_list(ID_TERRAIN_INFO_DLG_WINDOW, pWindow);
  pTerrain_Info_Dlg->pEndWidgetList = pWindow;

  area = pWindow->area;
  
  /* ---------- */
  pStr = create_str16_from_char(popup_info_text(ptile), adj_font(12));
  pStr->style |= SF_CENTER;
  pBuf = create_iconlabel(pSurf, pWindow->dst, pStr, 0);
  
  pBuf->size.h += tileset_tile_height(tileset) / 2;
  
  add_to_gui_list(ID_LABEL, pBuf);
  
  /* ------ window ---------- */
  area.w = MAX(area.w, pBuf->size.w + adj_size(20));
  area.h = MAX(area.h, pBuf->size.h);

  resize_window(pWindow, NULL, get_game_colorRGB(COLOR_THEME_BACKGROUND),
                (pWindow->size.w - pWindow->area.w) + area.w,
                (pWindow->size.h - pWindow->area.h) + area.h);

  area = pWindow->area;

  put_window_near_map_tile(pWindow, pWindow->size.w, pWindow->size.h, ptile);
  
  /* ------------------------ */
  
  pBuf->size.x = area.x + adj_size(10);
  pBuf->size.y = area.y;
  
  /* exit icon */
  pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
  			  			WF_RESTORE_BACKGROUND);
  pBuf->size.x = area.x + area.w - pBuf->size.w - 1;
  pBuf->size.y = pWindow->size.y + 1;
  pBuf->action = exit_terrain_info_dialog_callback;
  set_wstate(pBuf, FC_WS_NORMAL);
  pBuf->key = SDLK_ESCAPE;
  
  add_to_gui_list(ID_TERRAIN_INFO_DLG_EXIT_BUTTON, pBuf);
    
  pTerrain_Info_Dlg->pBeginWidgetList = pBuf;
  /* --------------------------------- */
  /* redraw */
  redraw_group(pTerrain_Info_Dlg->pBeginWidgetList, pWindow, 0);
  widget_mark_dirty(pWindow);
  flush_dirty();
}
/* ====================================================================== */
/* ========================= ADVANCED_TERRAIN_MENU ====================== */
/* ====================================================================== */
struct ADVANCED_DLG  *pAdvanced_Terrain_DlgPopdown a generic dialog to display some generic information about
  terrain : tile, units , cities, etcdown_advanced_terrain_dialog(void)
{
  if (pAdvanced_Terrain_Dlg) {
    is_unit_move_blocked = FALSE;
    popdown_window_group_dialog(pAdvanced_Terrain_Dlg->pBeginWidgetList,
			pAdvanced_Terrain_Dlg->pEndWidgetList);
				   
    FC_FREE(pAdvanced_Terrain_Dlg->pScroll);
    FC_FREE(pAdvanced_Terrain_Dlg);
  }
}..int advanced_terrain_window_dlg_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    move_window_group(pAdvanced_Terrain_Dlg->pBeginWidgetList, pWindow);
  }int exit_advanced_terrain_dlg_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    popdown_advanced_terrain_dialog();
    flush_dirty();
  }terrain_info_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    int x = pWidget->data.cont->id0;
    int y = pWidget->data.cont->id1;
      
    popdown_advanced_terrain_dialog();
  
    popup_terrain_info_dialog(NULL, map_pos_to_tile(x , y));
  }zoom_to_city_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct city *pCity = pWidget->data.city;
    
    popdown_advanced_terrain_dialog();
  
    popup_city_dialog(pCity);
  }change_production_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct city *pCity = pWidget->data.city;
    popdown_advanced_terrain_dialog();
    popup_worklist_editor(pCity, &(pCity->worklist));
  }hurry_production_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct city *pCity = pWidget->data.city;
    
    popdown_advanced_terrain_dialog();
  
    popup_hurry_production_dialog(pCity, NULL);
  }  cma_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct city *pCity = pWidget->data.city;
    popdown_advanced_terrain_dialog();
    popup_city_cma_dialog(pCity);
  }..static int adv_unit_select_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct unit *pUnit = pWidget->data.unit;
  
    popdown_advanced_terrain_dialog();
    
    if (pUnit) {
      request_new_unit_activity(pUnit, ACTIVITY_IDLE);
      set_unit_focus(pUnit);
    }
  }..static int adv_unit_select_all_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct unit *pUnit = pWidget->data.unit;
  
    popdown_advanced_terrain_dialog();
    
    if (pUnit) {
      activate_all_units(pUnit->tile);
    }
  }..static int adv_unit_sentry_idle_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct unit *pUnit = pWidget->data.unit;
  
    popdown_advanced_terrain_dialog();
    
    if (pUnit) {
      struct tile *ptile = pUnit->tile;
      unit_list_iterate(ptile->units, punit) {
        if (game.player_ptr == punit->owner && (punit->activity == ACTIVITY_IDLE)
           && !punit->ai.control && can_unit_do_activity(punit, ACTIVITY_SENTRY)) {
          request_new_unit_activity(punit, ACTIVITY_SENTRY);
        }
      } unit_list_iterate_end;
    }
  }goto_here_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    int x = pWidget->data.cont->id0;
    int y = pWidget->data.cont->id1;
      
    popdown_advanced_terrain_dialog();
    
    /* may not work */
    send_goto_tile(unit_list_get(get_units_in_focus(), 0), map_pos_to_tile(x, y));
  }patrol_here_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    
/* FIXME */
#if 0    
    int x = pWidget->data.cont->id0;
    int y = pWidget->data.cont->id1;
    struct unit *pUnit = unit_list_get(get_units_in_focus(), 0);
#endif

    popdown_advanced_terrain_dialog();
    
#if 0  
    if(pUnit) {
      enter_goto_state(pUnit);
      /* may not work */
      do_unit_patrol_to(pUnit, map_pos_to_tile(x, y));
      exit_goto_state();
    }
#endif  
  }paradrop_here_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
/* FIXME */    
#if 0    
    int x = pWidget->data.cont->id0;
    int y = pWidget->data.cont->id1;
#endif    
    
    popdown_advanced_terrain_dialog();

#if 0    
    /* may not work */
    do_unit_paradrop_to(get_unit_in_focus(), map_pos_to_tile(x, y));
#endif    
  }unit_help_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    Unit_type_id unit_id = MAX_ID - pWidget->ID;
      
    popdown_advanced_terrain_dialog();
    popup_unit_info(unit_id);
  }
  return -1;
}
generic dialog to display some generic information about
  terrain : tile, units , cities, etcadvanced_terrain_dialog(struct tile *ptile, Uint16 pos_x, Uint16 pos_y)
{
  struct widget *pWindow = NULL, *pBuf = NULL;
  struct city *pCity;
  struct unit *pFocus_Unit;
  SDL_String16 *pStr;
  SDL_Rect area2;
  struct CONTAINER *pCont;
  char cBuf[255]; 
  int n, w = 0, h, units_h = 0;
  SDL_Rect area;
    
  if (pAdvanced_Terrain_Dlg) {
    return;
  }
  
  pCity = ptile->city;
  n = unit_list_size(ptile->units);
  pFocus_Unit = unit_list_get(get_units_in_focus(), 0);
  
  if (!n && !pCity && !pFocus_Unit)
  {
    popup_terrain_info_dialog(NULL, ptile);
    return;
  }
    
  area.h = adj_size(2);
  is_unit_move_blocked = TRUE;
    
  pAdvanced_Terrain_Dlg = fc_calloc(1, sizeof(struct ADVANCED_DLG));
  
  pCont = fc_calloc(1, sizeof(struct CONTAINER));
  pCont->id0 = ptile->x;
  pCont->id1 = ptile->y;
  
  pStr = create_str16_from_char(_("Advanced Menu") , adj_font(12));
  pStr->style |= TTF_STYLE_BOLD;
  
  pWindow = create_window_skeleton(NULL, pStr, 0);
    
  pWindow->action = advanced_terrain_window_dlg_callback;
  set_wstate(pWindow , FC_WS_NORMAL);
  
  add_to_gui_list(ID_TERRAIN_ADV_DLG_WINDOW, pWindow);
  pAdvanced_Terrain_Dlg->pEndWidgetList = pWindow;
  
  area = pWindow->area;
  
  /* ---------- */
  /* exit button */
  pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
  			  			WF_RESTORE_BACKGROUND);
  
  area.w += pBuf->size.w + adj_size(10);
  pBuf->action = exit_advanced_terrain_dlg_callback;
  set_wstate(pBuf, FC_WS_NORMAL);
  pBuf->key = SDLK_ESCAPE;
  
  add_to_gui_list(ID_TERRAIN_ADV_DLG_EXIT_BUTTON, pBuf);
  /* ---------- */
  
  pStr = create_str16_from_char(_("Terrain Info") , adj_font(10));
  pStr->style |= TTF_STYLE_BOLD;
   
  pBuf = create_iconlabel(NULL, pWindow->dst, pStr , 
    (WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE|WF_FREE_DATA));

  pBuf->string16->bgcol = (SDL_Color) {0, 0, 0, 0};
    
  pBuf->data.cont = pCont;
  
  pBuf->action = terrain_info_callback;
  set_wstate(pBuf, FC_WS_NORMAL);
  
  add_to_gui_list(ID_LABEL, pBuf);
    
  area.w = MAX(area.w, pBuf->size.w);
  area.h += pBuf->size.h;

  /* ---------- */  
  if (pCity && pCity->owner == game.player_ptr)
  {
    /* separator */
    pBuf = create_iconlabel(NULL, pWindow->dst, NULL, WF_FREE_THEME);
    
    add_to_gui_list(ID_SEPARATOR, pBuf);
    area.h += pBuf->next->size.h;
    /* ------------------ */
    
    my_snprintf(cBuf, sizeof(cBuf), _("Zoom to : %s"), pCity->name );
    
    create_active_iconlabel(pBuf, pWindow->dst,
		    pStr, cBuf, zoom_to_city_callback);
    pBuf->data.city = pCity;
    set_wstate(pBuf, FC_WS_NORMAL);
  
    add_to_gui_list(ID_LABEL, pBuf);
    
    area.w = MAX(area.w, pBuf->size.w);
    area.h += pBuf->size.h;
    /* ----------- */
    
    create_active_iconlabel(pBuf, pWindow->dst, pStr,
	    _("Change Production"), change_production_callback);
	    
    pBuf->data.city = pCity;
    set_wstate(pBuf, FC_WS_NORMAL);
  
    add_to_gui_list(ID_LABEL, pBuf);
    
    area.w = MAX(area.w, pBuf->size.w);
    area.h += pBuf->size.h;
    /* -------------- */
    
    create_active_iconlabel(pBuf, pWindow->dst, pStr,
	    _("Hurry production"), hurry_production_callback);
	    
    pBuf->data.city = pCity;
    set_wstate(pBuf, FC_WS_NORMAL);
  
    add_to_gui_list(ID_LABEL, pBuf);
    
    area.w = MAX(area.w, pBuf->size.w);
    area.h += pBuf->size.h;
    /* ----------- */
  
    create_active_iconlabel(pBuf, pWindow->dst, pStr,
	    _("Change City Governor settings"), cma_callback);
	    
    pBuf->data.city = pCity;
    set_wstate(pBuf, FC_WS_NORMAL);
  
    add_to_gui_list(ID_LABEL, pBuf);
    
    area.w = MAX(area.w, pBuf->size.w);
    area.h += pBuf->size.h;
    
  }
  /* ---------- */
  
  if(pFocus_Unit && (pFocus_Unit->tile->x != ptile->x || pFocus_Unit->tile->y != ptile->y)) {
    /* separator */
    pBuf = create_iconlabel(NULL, pWindow->dst, NULL, WF_FREE_THEME);
    
    add_to_gui_list(ID_SEPARATOR, pBuf);
    area.h += pBuf->next->size.h;
    /* ------------------ */
        
    create_active_iconlabel(pBuf, pWindow->dst, pStr, _("Goto here"),
						    goto_here_callback);
    pBuf->data.cont = pCont;
    set_wstate(pBuf, FC_WS_NORMAL);
        
    add_to_gui_list(MAX_ID - 1000 - pFocus_Unit->id, pBuf);
    
    area.w = MAX(area.w, pBuf->size.w);
    area.h += pBuf->size.h;
    /* ----------- */
    
    create_active_iconlabel(pBuf, pWindow->dst, pStr, _("Patrol here"),
						    patrol_here_callback);
    pBuf->data.cont = pCont;
    set_wstate(pBuf, FC_WS_NORMAL);
        
    add_to_gui_list(MAX_ID - 1000 - pFocus_Unit->id, pBuf);
    
    area.w = MAX(area.w, pBuf->size.w);
    area.h += pBuf->size.h;
    /* ----------- */

#if 0 /* FIXME: specific connect buttons */
    if(unit_has_type_flag(pFocus_Unit, F_SETTLERS)) {
      create_active_iconlabel(pBuf, pWindow->dst->surface, pStr, _("Connect here"),
						    connect_here_callback);
      pBuf->data.cont = pCont;
      set_wstate(pBuf, FC_WS_NORMAL);
  
      add_to_gui_list(ID_LABEL, pBuf);
    
      area.w = MAX(area.w, pBuf->size.w);
      area.h += pBuf->size.h;
      
    }
#endif

    if(can_unit_paradrop(pFocus_Unit) && client_tile_get_known(ptile) &&
      !(is_ocean(ptile->terrain) && is_ground_unit(pFocus_Unit)) &&
      !(is_sailing_unit(pFocus_Unit) && (!is_ocean(ptile->terrain) || !pCity)) &&
      !(((pCity && pplayers_non_attack(game.player_ptr, city_owner(pCity))) 
      || is_non_attack_unit_tile(ptile, game.player_ptr))) &&
      (unit_type(pFocus_Unit)->paratroopers_range >=
	    real_map_distance(pFocus_Unit->tile, ptile))) {
	      
      create_active_iconlabel(pBuf, pWindow->dst, pStr, _("Paradrop here"),
						    paradrop_here_callback);
      pBuf->data.cont = pCont;
      set_wstate(pBuf, FC_WS_NORMAL);
  
      add_to_gui_list(ID_LABEL, pBuf);
    
      area.w = MAX(area.w, pBuf->size.w);
      area.h += pBuf->size.h;
      
    }

  }
  pAdvanced_Terrain_Dlg->pBeginWidgetList = pBuf;
  
  /* ---------- */
  if (n)
  {
    int i;
    struct unit *pUnit;
    struct unit_type *pUnitType = NULL;
    units_h = 0;  
    /* separator */
    pBuf = create_iconlabel(NULL, pWindow->dst, NULL, WF_FREE_THEME);
    
    add_to_gui_list(ID_SEPARATOR, pBuf);
    area.h += pBuf->next->size.h;
    /* ---------- */
    if (n > 1)
    {
      struct unit *pDefender, *pAttacker;
      struct widget *pLast = pBuf;
      bool reset = FALSE;
      int my_units = 0;
      
      #define ADV_NUM_SEEN  15
      
      pDefender = (pFocus_Unit ? get_defender(pFocus_Unit, ptile) : NULL);
      pAttacker = (pFocus_Unit ? get_attacker(pFocus_Unit, ptile) : NULL);
      for(i=0; i<n; i++) {
        pUnit = unit_list_get(ptile->units, i);
	if (pUnit == pFocus_Unit) {
	  continue;
	}
        pUnitType = unit_type(pUnit);
        if(pUnit->owner == game.player_ptr) {
          my_snprintf(cBuf, sizeof(cBuf),
            _("Activate %s (%d / %d) %s (%d,%d,%d) %s"),
            pUnit->veteran ? _("Veteran") : "" ,
            pUnit->hp, pUnitType->hp,
            utype_name_translation(pUnitType),
            pUnitType->attack_strength,
            pUnitType->defense_strength,
            (pUnitType->move_rate / SINGLE_MOVE),
	    unit_activity_text(pUnit));
    
	  create_active_iconlabel(pBuf, pWindow->dst, pStr,
	       cBuf, adv_unit_select_callback);
          pBuf->data.unit = pUnit;
          set_wstate(pBuf, FC_WS_NORMAL);
	  add_to_gui_list(ID_LABEL, pBuf);
	  my_units++;
	} else {
	  int att_chance, def_chance;
	  
          my_snprintf(cBuf, sizeof(cBuf), _("%s %s %s (A:%d D:%d M:%d FP:%d) HP:%d%%"),
            nation_name_translation(nation_of_unit(pUnit)),
            (pUnit->veteran ? _("Veteran") : ""),
            utype_name_translation(pUnitType),
            pUnitType->attack_strength,
            pUnitType->defense_strength,
            (pUnitType->move_rate / SINGLE_MOVE),
      	    pUnitType->firepower,
	    ((pUnit->hp * 100) / pUnitType->hp));
    
          /* calculate chance to win */
          if (sdl_get_chance_to_win(&att_chance, &def_chance, pUnit, pFocus_Unit)) {
            cat_snprintf(cBuf, sizeof(cBuf), _(" CtW: Att:%d%% Def:%d%%"),
               att_chance, def_chance);
	  }
	  
	  if (pAttacker && pAttacker == pUnit) {
	    pStr->fgcol = *(get_game_colorRGB(COLOR_OVERVIEW_ENEMY_UNIT));		  
	    reset = TRUE;
	  } else {
	    if (pDefender && pDefender == pUnit) {
	      pStr->fgcol = *(get_game_colorRGB(COLOR_OVERVIEW_MY_UNIT));			
	      reset = TRUE;
	    }
	  }
	  
	  create_active_iconlabel(pBuf, pWindow->dst, pStr, cBuf, NULL);
          
	  if (reset) {
	    pStr->fgcol = *get_game_colorRGB(COLOR_THEME_ADVANCEDTERRAINDLG_TEXT);
	    reset = FALSE;
	  }
	  
	  add_to_gui_list(ID_LABEL, pBuf);
	}
	    
        area.w = MAX(area.w, pBuf->size.w);
        units_h += pBuf->size.h;
	
        if (i > ADV_NUM_SEEN - 1)
        {
          set_wflag(pBuf, WF_HIDDEN);
        }
        
      }
      
      pAdvanced_Terrain_Dlg->pEndActiveWidgetList = pLast->prev;
      pAdvanced_Terrain_Dlg->pActiveWidgetList = pAdvanced_Terrain_Dlg->pEndActiveWidgetList;
      pAdvanced_Terrain_Dlg->pBeginWidgetList = pBuf;
      pAdvanced_Terrain_Dlg->pBeginActiveWidgetList = pAdvanced_Terrain_Dlg->pBeginWidgetList;
            
      if(n > ADV_NUM_SEEN)
      {
        units_h = ADV_NUM_SEEN * pBuf->size.h;
	n = create_vertical_scrollbar(pAdvanced_Terrain_Dlg,
					1, ADV_NUM_SEEN, TRUE, TRUE);
	area.w += n;
      }

      if (my_units > 1) {
	
	my_snprintf(cBuf, sizeof(cBuf), "%s (%d)", _("Ready all"), my_units);
	create_active_iconlabel(pBuf, pWindow->dst, pStr,
	       cBuf, adv_unit_select_all_callback);
        pBuf->data.unit = pAdvanced_Terrain_Dlg->pEndActiveWidgetList->data.unit;
        set_wstate(pBuf, FC_WS_NORMAL);
	pBuf->ID = ID_LABEL;
	DownAdd(pBuf, pLast);
	area.h += pBuf->size.h;
	
	my_snprintf(cBuf, sizeof(cBuf), "%s (%d)", _("Sentry idle"), my_units);
	create_active_iconlabel(pBuf, pWindow->dst, pStr,
	       cBuf, adv_unit_sentry_idle_callback);
        pBuf->data.unit = pAdvanced_Terrain_Dlg->pEndActiveWidgetList->data.unit;
        set_wstate(pBuf, FC_WS_NORMAL);
	pBuf->ID = ID_LABEL;
	DownAdd(pBuf, pLast->prev);
	area.h += pBuf->size.h;
	
	/* separator */
        pBuf = create_iconlabel(NULL, pWindow->dst, NULL, WF_FREE_THEME);
        pBuf->ID = ID_SEPARATOR;
	DownAdd(pBuf, pLast->prev->prev);
        area.h += pBuf->next->size.h;
	  
      }
      #undef ADV_NUM_SEEN
    }
    else
    { /* n == 1 */
      /* one unit - give orders */
      pUnit = unit_list_get(ptile->units, 0);
      pUnitType = unit_type(pUnit);
      if (pUnit != pFocus_Unit) {
        if ((pCity && pCity->owner == game.player_ptr) ||
	   (pUnit->owner == game.player_ptr))
        {
          my_snprintf(cBuf, sizeof(cBuf),
            _("Activate %s (%d / %d) %s (%d,%d,%d) %s"),
            pUnit->veteran ? _("Veteran") : "" ,
            pUnit->hp, pUnitType->hp,
            utype_name_translation(pUnitType),
            pUnitType->attack_strength,
            pUnitType->defense_strength,
            (pUnitType->move_rate / SINGLE_MOVE),
	    unit_activity_text(pUnit));
    
	  create_active_iconlabel(pBuf, pWindow->dst, pStr,
	    		cBuf, adv_unit_select_callback);
	  pBuf->data.unit = pUnit;
          set_wstate(pBuf, FC_WS_NORMAL);
	
          add_to_gui_list(ID_LABEL, pBuf);
    
          area.w = MAX(area.w, pBuf->size.w);
          units_h += pBuf->size.h;
	  /* ---------------- */
	  /* separator */
          pBuf = create_iconlabel(NULL, pWindow->dst, NULL, WF_FREE_THEME);
    
          add_to_gui_list(ID_SEPARATOR, pBuf);
          area.h += pBuf->next->size.h;
        } else {
	  int att_chance, def_chance;
	
          my_snprintf(cBuf, sizeof(cBuf), _("%s %s %s (A:%d D:%d M:%d FP:%d) HP:%d%%"),
            nation_name_translation(nation_of_unit(pUnit)),
            (pUnit->veteran ? _("Veteran") : ""),
            utype_name_translation(pUnitType),
            pUnitType->attack_strength,
            pUnitType->defense_strength,
            (pUnitType->move_rate / SINGLE_MOVE),
      	    pUnitType->firepower,
	    ((pUnit->hp * 100) / pUnitType->hp));
    
	    /* calculate chance to win */
            if (sdl_get_chance_to_win(&att_chance, &def_chance, pUnit, pFocus_Unit)) {
              cat_snprintf(cBuf, sizeof(cBuf), _(" CtW: Att:%d%% Def:%d%%"),
                 att_chance, def_chance);
	    }
	    create_active_iconlabel(pBuf, pWindow->dst, pStr, cBuf, NULL);          
	    add_to_gui_list(ID_LABEL, pBuf);
            area.w = MAX(area.w, pBuf->size.w);
            units_h += pBuf->size.h;
	    /* ---------------- */
	    
	    /* separator */
            pBuf = create_iconlabel(NULL, pWindow->dst, NULL, WF_FREE_THEME);
    
            add_to_gui_list(ID_SEPARATOR, pBuf);
            area.h += pBuf->next->size.h;
	
        }
      }
      /* ---------------- */
      my_snprintf(cBuf, sizeof(cBuf),
            _("View Civiliopedia entry for %s"),
            utype_name_translation(pUnitType));
      create_active_iconlabel(pBuf, pWindow->dst, pStr,
	    cBuf, unit_help_callback);
      set_wstate(pBuf , FC_WS_NORMAL);
      add_to_gui_list(MAX_ID - pUnitType->index, pBuf);
    
      area.w = MAX(area.w, pBuf->size.w);
      units_h += pBuf->size.h;
      /* ---------------- */  
      pAdvanced_Terrain_Dlg->pBeginWidgetList = pBuf;
    }
    
  }
  /* ---------- */
  
  area.w += adj_size(2);
  area.h += units_h;

  resize_window(pWindow, NULL, NULL, 
                (pWindow->size.w - pWindow->area.w) + area.w,
                (pWindow->size.h - pWindow->area.h) + area.h);

  area = pWindow->area;
  
  widget_set_position(pWindow, pos_x, pos_y);

  w = area.w - adj_size(2);
  
  if (pAdvanced_Terrain_Dlg->pScroll) {
    units_h = n;
  } else {
    units_h = 0;
  }
  
  /* exit button */
  pBuf = pWindow->prev;
  
  pBuf->size.x = area.x + area.w - pBuf->size.w - 1;
  pBuf->size.y = pWindow->size.y + 1;
  
  /* terrain info */
  pBuf = pBuf->prev;
  
  pBuf->size.x = area.x + 1;
  pBuf->size.y = area.y + 1;
  pBuf->size.w = w;
  h = pBuf->size.h;
  
  area2.x = adj_size(10);
  area2.h = adj_size(2);
  
  pBuf = pBuf->prev;
  while(pBuf)
  {
    
    if (pBuf == pAdvanced_Terrain_Dlg->pEndActiveWidgetList)
    {
      w -= units_h;
    }
    
    pBuf->size.w = w;
    pBuf->size.x = pBuf->next->size.x;
    pBuf->size.y = pBuf->next->size.y + pBuf->next->size.h;
    
    if (pBuf->ID == ID_SEPARATOR)
    {
      FREESURFACE(pBuf->theme);
      pBuf->size.h = h;
      pBuf->theme = create_surf_alpha(w , h , SDL_SWSURFACE);
    
      area2.y = pBuf->size.h / 2 - 1;
      area2.w = pBuf->size.w - adj_size(20);
      
      SDL_FillRect(pBuf->theme, &area2, map_rgba(pBuf->theme->format,
                    *get_game_colorRGB(COLOR_THEME_ADVANCEDTERRAINDLG_TEXT)));
    }
    
    if(pBuf == pAdvanced_Terrain_Dlg->pBeginWidgetList || 
      pBuf == pAdvanced_Terrain_Dlg->pBeginActiveWidgetList) {
      break;
    }
    pBuf = pBuf->prev;
  }
  
  if (pAdvanced_Terrain_Dlg->pScroll)
  {
    setup_vertical_scrollbar_area(pAdvanced_Terrain_Dlg->pScroll,
	area.x + area.w,
    	pAdvanced_Terrain_Dlg->pEndActiveWidgetList->size.y,
    	area.y - pAdvanced_Terrain_Dlg->pEndActiveWidgetList->size.y + area.h,
        TRUE);
  }
  
  /* -------------------- */
  /* redraw */
  redraw_group(pAdvanced_Terrain_Dlg->pBeginWidgetList, pWindow, 0);

  widget_flush(pWindow);
}

/* ====================================================================== */
/* ============================ PILLAGE DIALOG ========================== */
/* ====================================================================== */
static struct SMALL_DLG *pPillage_Dlg = NULL;

static int pillage_window_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    move_window_group(pPillage_Dlg->pBeginWidgetList, pWindow);
  }
  return -1;
}

static int pillage_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct unit *pUnit = pWidget->data.unit;
    enum tile_special_type what = MAX_ID - pWidget->ID;
    
    popdown_pillage_dialog();
    
    if (pUnit) 
    {
      request_new_unit_activity_targeted(pUnit, ACTIVITY_PILLAGE, what);
    }
  }  
  return -1;
}

static int exit_pillage_dlg_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    popdown_pillage_dialog();
  }Popdownstatic void popdown_pillage_dialog(void)
{
  if (pPillage_Dlg) {
    is_unit_move_blocked = FALSE;
    popdown_window_group_dialog(pPillage_Dlg->pBeginWidgetList,
				pPillage_Dlg->pEndWidgetList);
    FC_FREE(pPillage_Dlg);
    flush_dirty();
  }
}Unit,
			  bv_special may_pillage,
                          struct base_type *pbase)
{
  struct widget *pWindow = NULL, *pBuf = NULL;
  SDL_String16 *pStr;
  enum tile_special_type what, prereq;
  SDL_Rect area;
  
  if (pPillage_Dlg) {
    return;
  }
  
  is_unit_move_blocked = TRUE;
  pPillage_Dlg = fc_calloc(1, sizeof(struct SMALL_DLG));
  
  /* window */
  pStr = create_str16_from_char(_("What To Pillage") , adj_font(12));
  pStr->style |= TTF_STYLE_BOLD;
  
  pWindow = create_window_skeleton(NULL, pStr, 0);
    
  pWindow->action = pillage_window_callback;
  set_wstate(pWindow, FC_WS_NORMAL);
  
  add_to_gui_list(ID_PILLAGE_DLG_WINDOW, pWindow);
  pPillage_Dlg->pEndWidgetList = pWindow;

  area = pWindow->area;
  
  area.h = MAX(area.h, adj_size(2));
  
  /* ---------- */
  /* exit button */
  pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
  			  			WF_RESTORE_BACKGROUND);
  area.w += pBuf->size.w + adj_size(10);
  pBuf->action = exit_pillage_dlg_callback;
  set_wstate(pBuf, FC_WS_NORMAL);
  pBuf->key = SDLK_ESCAPE;
  
  add_to_gui_list(ID_PILLAGE_DLG_EXIT_BUTTON, pBuf);
  /* ---------- */
  
  while ((what = get_preferred_pillage(may_pillage, pbase)) != S_LAST) {
      
    bv_special what_bv;

    if (what != S_PILLAGE_BASE) {
      BV_CLR_ALL(what_bv);
      BV_SET(what_bv, what);
    
      create_active_iconlabel(pBuf, pWindow->dst, pStr,
                              (char *) special_name_translation(what), pillage_callback);
      clear_special(&may_pillage, what);
      prereq = get_infrastructure_prereq(what);
      if (prereq != S_LAST) {
        clear_special(&may_pillage, prereq);  
      }
    } else {
      create_active_iconlabel(pBuf, pWindow->dst, pStr,
                              (char *) base_name(pbase), pillage_callback);
      pbase = NULL;
    }

    pBuf->data.unit = pUnit;
    set_wstate(pBuf, FC_WS_NORMAL);
  
    add_to_gui_list(MAX_ID - what, pBuf);
    
    area.w = MAX(area.w, pBuf->size.w);
    area.h += pBuf->size.h;
  }
  pPillage_Dlg->pBeginWidgetList = pBuf;

  /* setup window size and start position */

  resize_window(pWindow, NULL, NULL, 
                (pWindow->size.w - pWindow->area.w) + area.w,
                (pWindow->size.h - pWindow->area.h) + area.h);

  area = pWindow->area;
  
  put_window_near_map_tile(pWindow, pWindow->size.w, pWindow->size.h,
                           pUnit->tile);
  
  /* setup widget size and start position */

  /* exit button */  
  pBuf = pWindow->prev;
  pBuf->size.x = area.x + area.w - pBuf->size.w - 1;
  pBuf->size.y = pWindow->size.y + 1;

  /* first special to pillage */
  pBuf = pBuf->prev;
  setup_vertical_widgets_position(1,
	area.x,	area.y + 1, area.w, 0,
	pPillage_Dlg->pBeginWidgetList, pBuf);

  /* --------------------- */
  /* redraw */
  redraw_group(pPillage_Dlg->pBeginWidgetList, pWindow, 0);

  widget_flush(pWindow);
}

/* ======================================================================= */
/* =========================== CONNECT DIALOG ============================ */
/* ======================================================================= */
static struct SMALL_DLG *pConnect_DlgPopdownstatic void popdown_connect_dialog(void)
{
  if (pConnect_Dlg) {
    is_unit_move_blocked = FALSE;
    popdown_window_group_dialog(pConnect_Dlg->pBeginWidgetList,
				pConnect_Dlg->pEndWidgetList);
    FC_FREE(pConnect_Dlg);
  }
}static struct SMALL_DLG *pRevolutionDlg = NULL;
  
revolution_dlg_ok_callback(struct widget *pButton)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    start_revolution();
  
    popdown_revolution_dialog();
    
    flush_dirty(..static int revolution_dlg_cancel_callback(struct widget *pCancel_Button)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    popdown_revolution_dialog();
    flush_dirty(..static int move_revolution_dlg_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    move_window_group(pRevolutionDlg->pBeginWidgetList, pWindow);
  }Close the revolustatic void popdown_revolution_dialog(void)
{
  if(pRevolutionDlg) {
    popdown_window_group_dialog(pRevolutionDlg->pBeginWidgetList,
			      pRevolutionDlg->pEndWidgetList);
    FC_FREE(pRevolutionDlg);
    enable_and_redraw_revolution_button();
  }
}SMALL_DLG *pGov_DlgClose the governmentstatic void popdown_government_dialog(void)
{
  if(pGov_Dlg) {
    popdown_window_group_dialog(pGov_Dlg->pBeginWidgetList,
                                pGov_Dlg->pEndWidgetList);
    FC_FREE(pGov_Dlg);
    enable_and_redraw_revolution_button();  
  }
}..static int government_dlg_callback(struct widget *pGov_Button)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    set_government_choice(government_by_number(MAX_ID - pGov_Button->ID));
    
    popdown_government_dialog(..static int move_government_dlg_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    move_window_group(pGov_Dlg->pBeginWidgetList, pWindow);
  }static widget *pGov_Button = NULL;
  struct widget *pWindow = NULL;
  int j;
  Uint16 max_w = 0, max_h = 0;
  SDL_Rect area;

  if (pGov_Dlg) {
    return;
  }

  pGov_Dlg = fc_calloc(1, sizeof(struct SMALL_DLG));
  adj_font(12));
  pStr->style |= TTF_STYLE_BOLD;
  /* this win. size is temp. */
  pWindow = create_window_skeleton(NULL, pStr, 0);
  pWindow->action = move_government_dlg_callback;
  add_to_gui_list(ID_GOVERNMENT_DLG_WINDOW, pWindow);

  pGov_Dlg->pEndWidgetList = pWindow;
  
  area = pWindow->area;
  
  /* create gov. buttons */
  j = 0;
  government_iterate(pGov) {

    if (pGovpGov)) {

      pStr = create_str16_from_char(government_name_translation(pGov), adj_font(12));
      pGov_Button =
          create_icon_button(get_government_surface(pGov), pWindow->dst, pStr, 0);
      pGov_Button->action = government_dlg_callback;

      max_w = MAX(max_w, pGov_Button->size.w);
      max_h = MAX(max_h, pGov_Button->size.h);
      
      /* ugly hack */
      add_to_gui_list((MAX_ID - government_number(pGov)), pGov_Button);
      j++;

    }
  } government_iterate_end;

  pGov_Dlg->pBeginWidgetList = pGov_Button;

  max_w += adj_size(10);
  max_h += adj_size(4);

  area.w = MAX(area.w, max_w + adj_size(20));
  area.h = MAX(area.h, j * (max_h + adj_size(10)) + adj_size(5));
  
  /* create window background */
  pLogo = theme_get_background(theme, BACKGROUND_CHOOSEGOVERNMENTDLG);
  if (resize_window(pWindow, pLogo, NULL,
                    (pWindow->size.w - pWindow->area.w) + area.w,
                    (pWindow->size.h - pWindow->area.h) + area.h)) {
    FREESURFACE(pLogo);
  }

  area = pWindow->area;
  
  /* set window start positions */
  widget_set_position(pWindow,
                      (Main.screen->w - pWindow->size.w) / 2,
                      (Main.screen->h - pWindow->size.h) / 2);
  
  /* set buttons start positions and size */
  j = 1;
  while (pGov_Button != pGov_Dlg->pEndarea.x + adj_size(10);
    pGov_Button->size.y = area.y + area.h - (j++) * (max_h + adj_size(10));
    set_wstate(pGov_Button, FC_WS_NORMAL);

    pGov_Button = pGov_Button->next;
  }

  set_wstate(pWindow, FC_WS_NORMAL);

  /* redraw */
  redraw_group(pGov_Dlg->pBeginWidgetList, pWindow, 0);

  widget_flush(pWSDL_Surface *pLogo;
  struct SDL_String16 *pStr = NULL;
  struct widget *pLabel = NULL;
  struct widget *pWindow = NULL;
  struct widget *pCancel_Button = NULL;
  struct widget *pOK_Button = NULL;
  SDL_Rect area;

  if(pRevolutionDlg) {
    return;
  }
  
  if (game.player_ptr->revolution_finishes >= 0) {
    popup_government_dialog();
    return;
  }
  
  pRevolutionDlg = fc_calloc(1, sizeof(struct SMALL_DLG));

  pStr = create_str16_from_char(_("REVOLUTION!"), adj_font(12));
  pStr->style |= TTF_STYLE_BOLD;

  pWindow = create_window_skeleton(NULL, pStr, 0);
  pWindow->action = move_revolution_dlg_callback;
  set_wstate(pWindow, FC_WS_NORMAL);
  add_to_gui_list(ID_REVOLUTION_DLG_WINDOW, pWindow);
  pRevolutionDlg->pEndWidgetList = pWindow;
 
  area = pWindow->area;
  
  /* create text label */
  pStr = create_str16_from_char(_("You say you wanna revolution?"), adj_font(10));
  pStr->style |= (TTF_STYLE_BOLD|SF_CENTER);
  pStr->fgcol = *get_game_colorRGB(COLOR_THEME_REVOLUTIONDLG_TEXT);
  pLabel = create_iconlabel(NULL, pWindow->dst, pStr, 0);
  add_to_gui_list(ID_REVOLUTION_DLG_LABEL, pLabel);

  
  /* create cancel button */
  pCancel_Button =
      create_themeicon_button_from_chars(pTheme->Small_CANCEL_Icon,
  					pWindow->dst, _("Cancel"), adj_font(10), 0);
  pCancel_Button->action = revolution_dlg_cancel_callback;  
  pCancel_Button->size.w += adj_size(6);
  set_wstate(pCancel_Button, FC_WS_NORMAL);  
  /* create ok button */
  pOK_Button =
      create_themeicon_button_from_chars(pTheme->Small_OK_Icon,
			  pWindow->dst, _("Revolution!"), adj_font(10), 0);
  pOK_Button->action = revolution_dlg_ok_callback;
  pOK_Button->key = SDLK_RETURN;
  set_wstate(pOK_Button, FC_WS_NORMAL);  
  add_to_gui_list(ID_REVOLUTION_DLG_OK_BUTTON, pOK_Button);

  pRevolutionDlg->pBeginWidgetList = pOK_Button;

  if ((pOK_Button->size.w + pCancel_Button->size.w + adj_size(30)) >
      pLabel->size.w + adj_size(20)) {
    area.w = MAX(area.w, pOK_Button->size.w + pCancel_Button->size.w + adj_size(30));
  } else {
    area.w = MAX(area.w, pLabel->size.w + adj_size(20));
  }

  area.h = MAX(area.h, pOK_Button->size.h + pLabel->size.h + adj_size(24));
  
  /* create window background */
  pLogo = theme_get_background(theme, BACKGROUND_REVOLUTIONDLG);
  if (resize_window(pWindow, pLogo, NULL,
                    (pWindow->size.w - pWindow->area.w) + area.w,
                    (pWindow->size.h - pWindow->area.h) + area.h)) {
    FREESURFACE(pLogo);
  }

  area = pWindow->area;
  
  /* set start positions */
  widget_set_position(pWindow,
                      (Main.screen->w - pWindow->size.w) / 2,
                      (Main.screen->h - pWindow->size.h) / 2);
  
  pOK_Button->size.x = area.x + adj_size(10);
  pOK_Button->size.y = area.y + area.h - pOK_Button->size.h - adj_size(10);

  pCancel_Button->size.y = pOK_Button->size.y;
  pCancel_Button->size.x = area.x + area.w - pCancel_Button->size.w - adj_size(10);
  
  pLabel->size.x = area.x;
  pLabel->size.y = area.y + adj_size(4);
  pLabel->size.w = area.w;
  
  /* redraw */
  redraw_group(pOK_Button, pWindow, 0);
  widget_mark_dirty(pWindow);
  flush_dirty()ADVANCED_DLG *pNationDlg = NULL;
static struct SMALL_DLG *pHelpDlg = NULL;
  
struct NAT {
  unsigned char nation_city_style; /* selected city style */
  unsigned char selected_leader;   /* if not unique -> selected leader */
  unsigned char nation;            /* selected nation */
  bool leader_sex;                 /* selected leader sex */
  struct widget *pChange_Sex;
  struct widget *pName_Edit;
  struct widget *pName_Next;
  struct widget *pName_Prev;
};

static int nations_dialog_callback(struct widget *pWindow);
static int nation_button_callback(struct widget *pNation);
static int races_dialog_ok_callback(struct widget *pStart_Button);
static int races_dialog_cancel_callback(struct widget *pButton);
static int next_name_callback(struct widget *pNext_Button);
static int prev_name_callback(struct widget *pPrev_Button);
static int change_sex_callback(struct widget *pSex);
static void select_random_leader(Nation_type_id nation);
static void change_nation_label(void);..static int nations_dialog_callback(struct widget *pWindow)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    if(sellect_window_group_dialog(pNationDlg->pBeginWidgetList, pWindow)) {
      widget_flush(pWindow);
    }      
  }races_dialog_ok_callback(struct widget *pStart_Button)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct NAT *pSetup = (struct NAT *)(pNationDlg->pEndWidgetList->data.ptr);
    char *pStr = convert_to_chars(pSetup->pName_Edit->string16->text);
  
    /* perform a minimum of sanity test on the name */
    if (strlen(pStr) == 0) {
      append_output_window(_("You must type a legal name."));
      pSellected_Widget = pStart_Button;
      set_wstate(pStart_Button, FC_WS_SELLECTED);
      widget_redraw(pStart_Button);
      widget_flush(pStart_Button);
      return (-1);
    }
  
    dsend_packet_nation_select_req(&aconnection, player_number(races_player),
                                   pSetup->nation,
                                   pSetup->leader_sex, pStr,
                                   pSetup->nation_city_style);
    FC_FREE(pStr);
  
    popdown_races_dialog();  
    flush_dirty();
  }  change_sex_callback(struct widget *pSex)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct NAT *pSetup = (struct NAT *)(pNationDlg->pEndWidgetList->data.ptr);
      
    if (pSetup->leader_sex) {
      copy_chars_to_string16(pSetup->pChange_Sex->string16, _("Female"));
    } else {
      copy_chars_to_string16(pSetup->pChange_Sex->string16, _("Male"));
    }
    pSetup->leader_sex = !pSetup->leader_sex;
    
    if (pSex) {
      pSellected_Widget = pSex;
      set_wstate(pSex, FC_WS_SELLECTED);
  
      widget_redraw(pSex);
      widget_flush(pSex);
    }
  }next_name_callback(struct widget *pNext)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    int dim;
    struct NAT *pSetup = (struct NAT *)(pNationDlg->pEndWidgetList->data.ptr);
    struct leader *leaders = get_nation_leaders(nation_by_number(pSetup->nation), &dim);
      
    pSetup->selected_leader++;
    
    /* change leadaer sex */
    if (pSetup->leader_sex != leaders[pSetup->selected_leader].is_male) {
      change_sex_callback(NULL);
    }
      
    /* change leadaer name */
    copy_chars_to_string16(pSetup->pName_Edit->string16,
                                  leaders[pSetup->selected_leader].name);
    
    FC_FREE(pLeaderName);
    pLeaderName = fc_calloc(1, strlen(leaders[pSetup->selected_leader].name) + 1);
    mystrlcpy(pLeaderName, leaders[pSetup->selected_leader].name,
                         strlen(leaders[pSetup->selected_leader].name) + 1);
    
    if ((dim - 1) == pSetup->selected_leader) {
      set_wstate(pSetup->pName_Next, FC_WS_DISABLED);
    }
  
    if (get_wstate(pSetup->pName_Prev) == FC_WS_DISABLED) {
      set_wstate(pSetup->pName_Prev, FC_WS_NORMAL);
    }
  
    if (!(get_wstate(pSetup->pName_Next) == FC_WS_DISABLED)) {
      pSellected_Widget = pSetup->pName_Next;
      set_wstate(pSetup->pName_Next, FC_WS_SELLECTED);
    }
  
    widget_redraw(pSetup->pName_Edit);
    widget_redraw(pSetup->pName_Prev);
    widget_redraw(pSetup->pName_Next);
    dirty_rect(pSetup->pName_Edit->size.x - pSetup->pName_Prev->size.w,
                  pSetup->pName_Edit->size.y,
                  pSetup->pName_Edit->size.w + pSetup->pName_Prev->size.w +
                  pSetup->pName_Next->size.w, pSetup->pName_Edit->size.h);
    
    widget_redraw(pSetup->pChange_Sex);
    widget_mark_dirty(pSetup->pChange_Sex);
    
    flush_dirty();
  }prev_name_callback(struct widget *pPrev)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    int dim;
    struct NAT *pSetup = (struct NAT *)(pNationDlg->pEndWidgetList->data.ptr);
    struct leader *leaders = get_nation_leaders(nation_by_number(pSetup->nation), &dim);
      
    pSetup->selected_leader--;
  
    /* change leadaer sex */
    if (pSetup->leader_sex != leaders[pSetup->selected_leader].is_male) {
      change_sex_callback(NULL);
    }
    
    /* change leadaer name */
    copy_chars_to_string16(pSetup->pName_Edit->string16,
                                  leaders[pSetup->selected_leader].name);
    
    FC_FREE(pLeaderName);
    pLeaderName = fc_calloc(1, strlen(leaders[pSetup->selected_leader].name) + 1);
    mystrlcpy(pLeaderName, leaders[pSetup->selected_leader].name,
                         strlen(leaders[pSetup->selected_leader].name) + 1);
    
    if (!pSetup->selected_leader) {
      set_wstate(pSetup->pName_Prev, FC_WS_DISABLED);
    }
  
    if (get_wstate(pSetup->pName_Next) == FC_WS_DISABLED) {
      set_wstate(pSetup->pName_Next, FC_WS_NORMAL);
    }
  
    if (!(get_wstate(pSetup->pName_Prev) == FC_WS_DISABLED)) {
      pSellected_Widget = pSetup->pName_Prev;
      set_wstate(pSetup->pName_Prev, FC_WS_SELLECTED);
    }
  
    widget_redraw(pSetup->pName_Edit);
    widget_redraw(pSetup->pName_Prev);
    widget_redraw(pSetup->pName_Next);
    dirty_rect(pSetup->pName_Edit->size.x - pSetup->pName_Prev->size.w,
                  pSetup->pName_Edit->size.y, pSetup->pName_Edit->size.w +
                  pSetup->pName_Prev->size.w + pSetup->pName_Next->size.w,
                  pSetup->pName_Edit->size.h);
    
    widget_redraw(pSetup->pChange_Sex);
    widget_mark_dirty(pSetup->pChange_Sex);
    
    flush_dirty();
  }races_dialog_cancel_callback(struct widget *pButton)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    popdown_races_dialog();
    flush_dirty();
  }city_style_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct NAT *pSetup = (struct NAT *)(pNationDlg->pEndWidgetList->data.ptr);
    struct widget *pGUI = get_widget_pointer_form_main_list(MAX_ID - 1000 -
                                              pSetup->nation_city_style);
    set_wstate(pGUI, FC_WS_NORMAL);
    widget_redraw(pGUI);
    widget_mark_dirty(pGUI);
    
    set_wstate(pWidget, FC_WS_DISABLED);
    widget_redraw(pWidget);
    widget_mark_dirty(pWidget);
    
    pSetup->nation_city_style = MAX_ID - 1000 - pWidget->ID;
    
    flush_dirty();
    pSellected_Widget = NULL;
  }help_dlg_callback(struct widget *pWindow)
{cancel_help_dlg_callback(struct widget *pWidget)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    if (pHelpDlg) {
      popdown_window_group_dialog(pHelpDlg->pBeginWidgetList,
                          pHelpDlg->pEndWidgetList);
      FC_FREE(pHelpDlg);
      if (pWidget) {
        flush_dirty();
      }
    }
  }int nation_button_callback(struct widget *pNationButton)
{
  set_wstate(pNationButton, FC_WS_SELLECTED);
  pSellected_Widget = pNationButton;
  
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    struct NAT *pSetup = (struct NAT *)(pNationDlg->pEndWidgetList->data.ptr);
      
    if (pSetup->nation == MAX_ID - pNationButton->ID) {
      widget_redraw(pNationButton);
      widget_flush(pNationButton);
      return -1;
    }
  
    pSetup->nation = MAX_ID - pNationButton->ID;
  
    change_nation_label();
  
    enable(MAX_ID - 1000 - pSetup->nation_city_style);
    pSetup->nation_city_style = city_style_of_nation(nation_by_number(pSetup->nation));
    disable(MAX_ID - 1000 - pSetup->nation_city_style);
    
    select_random_leader(pSetup->nation);
    
    redraw_group(pNationDlg->pBeginWidgetList, pNationDlg->pEndWidgetList, 0);
    widget_flush(pNationDlg->pEndWidgetList);
  } else {
    /* pop up legend info */
    struct widget *pWindow, *pOK_Button;
    SDL_String16 *pStr;
    SDL_Surface *pText, *pText2;
    SDL_Rect area, area2;
    struct nation_type *pNation = nation_by_number(MAX_ID - pNationButton->ID);
      
    widget_redraw(pNationButton);
    widget_mark_dirty(pNationButton);
  
    if (!pHelpDlg) {
    
      pHelpDlg = fc_calloc(1, sizeof(struct SMALL_DLG));
    
      pStr = create_str16_from_char("Nation's Legend", adj_font(12));
      pStr->style |= TTF_STYLE_BOLD;
  
      pWindow = create_window_skeleton(NULL, pStr, 0);
      pWindow->action = help_dlg_callback;

      set_wstate(pWindow, FC_WS_NORMAL);
    
      pHelpDlg->pEndWidgetList = pWindow;
      add_to_gui_list(ID_WINDOW, pWindow);
    
      pOK_Button = create_themeicon_button_from_chars(pTheme->OK_Icon,
                                pWindow->dst, _("OK"), adj_font(14), 0);
      pOK_Button->action = cancel_help_dlg_callback;
      set_wstate(pOK_Button, FC_WS_NORMAL);
      pOK_Button->key = SDLK_ESCAPE;
      add_to_gui_list(ID_BUTTON, pOK_Button);
      pHelpDlg->pBeginWidgetList = pOK_Button;
    } else {
      pWindow = pHelpDlg->pEndWidgetList;
      pOK_Button = pHelpDlg->pBeginWidgetList;
      /* undraw window */
      widget_undraw(pWindow);
      widget_mark_dirty(pWindow);
    }

    area = pWindow->area;
    
    if (pNation->legend && *(pNation->legend) != '\0') {
      pStr = create_str16_from_char(pNation->legend, adj_font(12));
    } else {
      pStr = create_str16_from_char("SORRY... NO INFO", adj_font(12));
    }
    
    pStr->fgcol = *get_game_colorRGB(COLOR_THEME_NATIONDLG_LEGEND);
    pText = create_text_surf_smaller_that_w(pStr, Main.screen->w - adj_size(20));
  
    copy_chars_to_string16(pStr, nation_plural_translation(pNation));
    pText2 = create_text_surf_from_str16(pStr);
  
    FREESTRING16(pStr);
    
    /* create window background */
    area.w = MAX(area.w, pText2->w + adj_size(20));
    area.w = MAX(area.w, pText->w + adj_size(20));
    area.w = MAX(area.w, pOK_Button->size.w + adj_size(20));
    area.h = MAX(area.h, adj_size(9) + pText2->h + adj_size(10) + pText->h
                         + adj_size(10) + pOK_Button->size.h + adj_size(10));

    resize_window(pWindow, NULL, get_game_colorRGB(COLOR_THEME_BACKGROUND),
                  (pWindow->size.w - pWindow->area.w) + area.w,
                  (pWindow->size.h - pWindow->area.h) + area.h);

    widget_set_position(pWindow,
                        (Main.screen->w - pWindow->size.w) / 2,
                        (Main.screen->h - pWindow->size.h) / 2);
    
    area2.x = area.x + adj_size(7);
    area2.y = area.y + adj_size(6);
    alphablit(pText2, NULL, pWindow->theme, &area2);
    area2.y += (pText2->h + adj_size(10));
    FREESURFACE(pText2);
  
    alphablit(pText, NULL, pWindow->theme, &area2);
    FREESURFACE(pText);
  
    pOK_Button->size.x = area.x + (area.w - pOK_Button->size.w) / 2;
    pOK_Button->size.y = area.y + area.h - pOK_Button->size.h - adj_size(10);
  
    /* redraw */
    redraw_group(pOK_Button, pWindow, 0);

    widget_mark_dirty(pWindow);
  
    flush_dirty();

  }int leader_name_edit_callback(struct widget *pEdit)
{
  if (Main.event.button.button == SDL_BUTTON_LEFT) {
    char *name = convert_to_chars(pEdit->string16->text);
  
    if (name) {
      FC_FREE(name);
    } else {
      /* empty input -> restore previous content */
      copy_chars_to_string16(pEdit->string16, pLeaderName);
      widget_redraw(pEdit);
      widget_mark_dirty(pEdit);
      flush_dirty();
    }
  }  
  return -1;
}change_nation_label(void)
{
  SDL_Surface *pTmp_Surf, *pTmp_Surf_zoomed;
  struct widget *pWindow = pNationDlg->pEndWidgetList;
  struct NAT *pSetup = (struct NAT *)(pWindow->data.ptr);  
  struct widget *pLabel = pSetup->pName_Edit->next;
  struct nation_type *pNation = nation_by_number(pSetup->nation);
    
  pTmp_Surf = get_nation_flag_surface(pNation);
  pTmp_Surf_zoomed = zoomSurface(pTmp_Surf, DEFAULT_ZOOM * 1.0, DEFAULT_ZOOM * 1.0, 1);  

  FREESURFACE(pLabel->theme);
  pLabel->theme = pTmp_Surf_zoomed;
  
  copy_chars_to_string16(pLabel->string16, nation_plural_translation(pNation));
  
  remake_label_size(pLabel);
  
  pLabel->size.x = pWindow->size.x + pWindow->size.w / 2 +
  				(pWindow->size.w/2 - pLabel->size.w) / 2;
    
}type_id nation)
{
  int dim;
  struct NAT *pSetup = (struct NAT *)(pNationDlg->pEndWidgetList->data.ptr);
  struct leader *leaders = get_nation_leaders(nation_by_number(nation), &dim);
  
    
  pSetup->selected_leader = myrand(dim);
  copy_chars_to_string16(pSetup->pName_Edit->string16,
  				leaders[pSetup->selected_leader].name);
  
  FC_FREE(pLeaderName);
  pLeaderName = fc_calloc(1, strlen(leaders[pSetup->selected_leader].name) + 1);
  mystrlcpy(pLeaderName, leaders[pSetup->selected_leader].name,
                       strlen(leaders[pSetup->selected_leader].name) + 1);
  
  /* initialize leader sex */
  pSetup->leader_sex = leaders[pSetup->selected_leader].is_male;

  if (pSetup->leader_sex) {
    copy_chars_to_string16(pSetup->pChange_Sex->string16, _("Male"));
  } else {
    copy_chars_to_string16(pSetup->pChange_Sex->string16, _("Female"));
  }

  /* disable navigation buttons */
  set_wstate(pSetup->pName_Prev, FC_WS_DISABLED);
  set_wstate(pSetup->pName_Next, FC_WS_DISABLED);

  if (dim > 1) {
    /* if selected leader is not the first leader, enable "previous leader" button */
    if (pSetup->selected_leader > 0) {
      set_wstate(pSetup->pName_Prev, FC_WS_NORMAL);
    }

    /* if selected leader is not the last leader, enable "next leader" button */
    if (pSetup->selected_leader < (dim - 1)) {
      set_wstate(pSetup->pName_Next, FC_WS_NORMAL);
    }
  }
  
}

static int get_playable_nation_count() {
 
  int playable_nation_count = 0;
    
  nations_iterate(pnation) {
    if (pnation->is_playable && !pnation->player && pnation->is_available)
      ++playable_nation_count;        
  } nations_iterate_end;

  return playable_nation_count;
  
}struct player *pplayer)
{
  SDL_Color bg_color = {255,255,255,128};

  struct widget *pWindow, *pWidget = NULL, *pBuf, *pLast_City_Style;
  SDL_String16 *pStr;
  int len = 0;
  int w = adj_size(10), h = adj_size(10);
  SDL_Surface *pTmp_Surf, *pTmp_Surf_zoomed = NULL;
  SDL_Surface *pMain_Bg, *pText_Name, *pText_Class;
  SDL_Rect dst;
  float zoom;
  struct NAT *pSetup;
  SDL_Rect area;
    
  #define TARGETS_ROW 5
  #define TARGETS_COL 1
  
  if (pNationDlg) {
    return;
  }
  
  races_player = pplayer;
  
  pNationDlg = fc_calloc(1, sizeof(struct ADVANCED_DLG));
  
  /* create window widget */
  pStr = create_str16_from_char(_("What nation will you be?"), adj_font(12));
  pStr->style |= TTF_STYLE_BOLD;
  
  pWindow = create_window(NULL, pStr, w, h, WF_FREE_DATA);
  pWindow->action = nations_dialog_callback;
  set_wstate(pWindow, FC_WS_NORMAL);
  pSetup = fc_calloc(1, sizeof(struct NAT));
  pWindow->data.ptr = (void *)pSetup;
    
  pNationDlg->pEndWidgetList = pWindow;
  add_to_gui_list(ID_NATION_WIZARD_WINDOW, pWindow);
  /* --------------------------------------------------------- */
  /* create nations list */

  /* Create Imprv Background Icon */
  pMain_Bg = create_surf_alpha(adj_size(96*2), adj_size(64), SDL_SWSURFACE);
  
  SDL_FillRect(pMain_Bg, NULL, map_rgba(pMain_Bg->format, bg_color));
  putframe(pMain_Bg, 0, 0, pMain_Bg->w - 1, pMain_Bg->h - 1, 
                                   map_rgba(pMain_Bg->format, *get_game_colorRGB(COLOR_THEME_NATIONDLG_FRAME)));
  
  pStr = create_string16(NULL, 0, adj_font(12));
  pStr->style |= (SF_CENTER|TTF_STYLE_BOLD);
  pStr->bgcol = (SDL_Color) {0, 0, 0, 0};

  /* fill list */
  pText_Class = NULL;
    
  nations_iterate(pNation) {

    if (!is_nation_playable(pNation) || !pNation->is_available) {
      continue;
    }

    pTmp_Surf_zoomed = adj_surf(get_nation_flag_surface(pNation));

    pTmp_Surf = crop_rect_from_surface(pMain_Bg, NULL);
          
    copy_chars_to_string16(pStr, nation_plural_translation(pNation));
    change_ptsize16(pStr, adj_font(12));
    pText_Name = create_text_surf_smaller_that_w(pStr, pTmp_Surf->w - adj_size(4));
    
#if 0      
    if (pNation->legend && *(pNation->legend) != '\0') {
      copy_chars_to_string16(pStr, pNation->legend);
      change_ptsize16(pStr, adj_font(10));
      pText_Class = create_text_surf_smaller_that_w(pStr, pTmp_Surf->w - adj_size(4));
    }
#endif    
    
    dst.x = (pTmp_Surf->w - pTmp_Surf_zoomed->w) / 2;
    len = pTmp_Surf_zoomed->h +
	    adj_size(10) + pText_Name->h + (pText_Class ? pText_Class->h : 0);
    dst.y = (pTmp_Surf->h - len) / 2;
    alphablit(pTmp_Surf_zoomed, NULL, pTmp_Surf, &dst);
    dst.y += (pTmp_Surf_zoomed->h + adj_size(10));
    
    dst.x = (pTmp_Surf->w - pText_Name->w) / 2;
    alphablit(pText_Name, NULL, pTmp_Surf, &dst);
    dst.y += pText_Name->h;
    FREESURFACE(pText_Name);
    
    if (pText_Class) {
      dst.x = (pTmp_Surf->w - pText_Class->w) / 2;
      alphablit(pText_Class, NULL, pTmp_Surf, &dst);
      FREESURFACE(pText_Class);
    }
    
    pWidget = create_icon2(pTmp_Surf, pWindow->dst,
    			(WF_RESTORE_BACKGROUND|WF_FREE_THEME));
    
    set_wstate(pWidget, FC_WS_NORMAL);
    
    pWidget->action = nation_button_callback;

    w = MAX(w, pWidget->size.w);
    h = MAX(h, pWidget->size.h);

    add_to_gui_list(MAX_ID - nation_index(pNation), pWidget);
    
    if (nation_index(pNation) > (TARGETS_ROW * TARGETS_COL - 1)) {
      set_wflag(pWidget, WF_HIDDEN);
    }
    
  } nations_iterate_end;
  
  FREESURFACE(pMain_Bg);
    
  pNationDlg->pEndActiveWidgetList = pWindow->prev;
  pNationDlg->pBeginWidgetList = pWidget;
  pNationDlg->pBeginActiveWidgetList = pNationDlg->pBeginWidgetList;
    
  if(get_playable_nation_count() > TARGETS_ROW * TARGETS_COL) {
      pNationDlg->pActiveWidgetList = pNationDlg->pEndActiveWidgetList;
      create_vertical_scrollbar(pNationDlg,
		    		TARGETS_COL, TARGETS_ROW, TRUE, TRUE);
  }
  
  /* ----------------------------------------------------------------- */
    
  /* nation name */
  
  pSetup->nation = myrand(get_playable_nation_count());
  pSetup->nation_city_style = city_style_of_nation(nation_by_number(pSetup->nation));
  
  copy_chars_to_string16(pStr, nation_plural_translation(nation_by_number(pSetup->nation)));
  change_ptsize16(pStr, adj_font(24));
  pStr->render = 2;
  pStr->fgcol = *get_game_colorRGB(COLOR_THEME_NATIONDLG_TEXT);
  
  pTmp_Surf_zoomed = adj_surf(get_nation_flag_surface(nation_by_number(pSetup->nation)));
  
  pWidget = create_iconlabel(pTmp_Surf_zoomed, pWindow->dst, pStr,
  			(WF_ICON_ABOVE_TEXT|WF_ICON_CENTER|WF_FREE_GFX));
  pBuf = pWidget;
  add_to_gui_list(ID_LABEL, pWidget);
  
  /* create leader name edit */
  pWidget = create_edit_from_unichars(NULL, pWindow->dst,
						  NULL, 0, adj_font(16), adj_size(200), 0);
  pWidget->size.h = adj_size(24);
  
  set_wstate(pWidget, FC_WS_NORMAL);
  pWidget->action = leader_name_edit_callback;
  add_to_gui_list(ID_NATION_WIZARD_LEADER_NAME_EDIT, pWidget);
  pSetup->pName_Edit = pWidget;
  
  /* create next leader name button */
  pWidget = create_themeicon_button(pTheme->R_ARROW_Icon,
						  pWindow->dst, NULL, 0);
  pWidget->action = next_name_callback;
  add_to_gui_list(ID_NATION_WIZARD_NEXT_LEADER_NAME_BUTTON, pWidget);
  pWidget->size.h = pWidget->next->size.h;
  pSetup->pName_Next = pWidget;
  
  /* create prev leader name button */
  pWidget = create_themeicon_button(pTheme->L_ARROW_Icon,
  						pWindow->dst, NULL, 0);
  pWidget->action = prev_name_callback;
  add_to_gui_list(ID_NATION_WIZARD_PREV_LEADER_NAME_BUTTON, pWidget);
  pWidget->size.h = pWidget->next->size.h;
  pSetup->pName_Prev = pWidget;
  
  /* change sex button */
  
  pWidget = create_icon_button_from_chars(NULL, pWindow->dst, _("Male"), adj_font(14), 0);
  pWidget->action = change_sex_callback;
  pWidget->size.w = adj_size(100);
  pWidget->size.h = adj_size(22);
  set_wstate(pWidget, FC_WS_NORMAL);
  pSetup->pChange_Sex = pWidget;
  
  /* add to main widget list */
  add_to_gui_list(ID_NATION_WIZARD_CHANGE_SEX_BUTTON, pWidget);

  /* ---------------------------------------------------------- */
  int i = 0;
  zoom = DEFAULT_ZOOM * 1.0;
  while (i < game.control.styles_count) {
    if (!city_style_has_requirements(&city_styles[i])) {
      pTmp_Surf = get_sample_city_surface(i);

      if (pTmp_Surf->w > 48) {
        zoom = DEFAULT_ZOOM * (48.0 / pTmp_Surf->w);
      }
      
      pTmp_Surf_zoomed = zoomSurface(get_sample_city_surface(i), zoom, zoom, 0);

      pWidget = create_icon2(pTmp_Surf_zoomed, pWindow->dst, WF_RESTORE_BACKGROUND);
      pWidget->action = city_style_callback;
      if (i != pSetup->nation_city_style) {
        set_wstate(pWidget, FC_WS_NORMAL);
      }
      len = pWidget->size.w;
      add_to_gui_list(MAX_ID - 1000 - i, pWidget);
      i++;
      break;
    }
    i++;
  }

  len += adj_size(3);
  zoom = DEFAULT_ZOOM * 1.0;
  
  for (; (i < game.control.styles_count && i < 64); i++) {
    if (!city_style_has_requirements(&city_styles[i])) {
      pTmp_Surf = get_sample_city_surface(i);
      
      if (pTmp_Surf->w > 48) {
        zoom = DEFAULT_ZOOM * (48.0 / pTmp_Surf->w);
      }
      
      pTmp_Surf_zoomed = zoomSurface(get_sample_city_surface(i), zoom, zoom, 0);

      pWidget = create_icon2(pTmp_Surf_zoomed, pWindow->dst, WF_RESTORE_BACKGROUND);
      pWidget->action = city_style_callback;
      if (i != pSetup->nation_city_style) {
        set_wstate(pWidget, FC_WS_NORMAL);
      }
      len += (pWidget->size.w + adj_size(3));
      add_to_gui_list(MAX_ID - 1000 - i, pWidget);
    }
  }
  pLast_City_Style = pWidget;
  /* ---------------------------------------------------------- */
  
  /* create Cancel button */
  pWidget = create_themeicon_button_from_chars(pTheme->CANCEL_Icon, pWindow->dst,
					 _("Cancel"), adj_font(12), 0);
  pWidget->action = races_dialog_cancel_callback;
  set_wstate(pWidget, FC_WS_NORMAL);
  
  add_to_gui_list(ID_NATION_WIZARD_DISCONNECT_BUTTON, pWidget);

  /* create OK button */
  pWidget =
      create_themeicon_button_from_chars(pTheme->OK_Icon, pWindow->dst,
				_("OK"), adj_font(12), 0);
  pWidget->action = races_dialog_ok_callback;

  set_wstate(pWidget, FC_WS_NORMAL);
  add_to_gui_list(ID_NATION_WIZARD_START_BUTTON, pWidget);
  pWidget->size.w = MAX(pWidget->size.w, pWidget->next->size.w);
  pWidget->next->size.w = pWidget->size.w;
  
  pNationDlg->pBeginWidgetList = pWidget;
  /* ---------------------------------------------------------- */
      
  pMain_Bg = theme_get_background(theme, BACKGROUND_NATIONDLG);
  if(resize_window(pWindow, pMain_Bg, NULL, adj_size(640), adj_size(480))) {
    FREESURFACE(pMain_Bg);
  }

  area = pWindow->area;
  
  widget_set_position(pWindow,
                      (Main.screen->w - pWindow->size.w) / 2,
                      (Main.screen->h - pWindow->size.h) / 2);
  
  /* nations */
  
  h = pNationDlg->pEndActiveWidgetList->size.h * TARGETS_ROW;
  i = (area.h - adj_size(43) - h) / 2;
  setup_vertical_widgets_position(TARGETS_COL,
	area.x + adj_size(10),
	area.y + i - adj_size(4),
	  0, 0, pNationDlg->pBeginActiveWidgetList,
			  pNationDlg->pEndActiveWidgetList);
  
  if(pNationDlg->pScroll) {
    SDL_Rect area2;
  
    w = pNationDlg->pEndActiveWidgetList->size.w * TARGETS_COL;    
    setup_vertical_scrollbar_area(pNationDlg->pScroll,
	area.x + w + adj_size(12),
    	area.y + i - adj_size(4), h, FALSE);
    
    area2.x = area.x + w + adj_size(11);
    area2.y = area.y + i - adj_size(4);
    area2.w = pNationDlg->pScroll->pUp_Left_Button->size.w + adj_size(2);
    area2.h = h;
    SDL_FillRectAlpha(pWindow->theme, &area2, &bg_color);
    putframe(pWindow->theme, area2.x, area2.y - 1, area2.x + area2.w, area2.y + area2.h,
             map_rgba(pWindow->theme->format, *get_game_colorRGB(COLOR_THEME_NATIONDLG_FRAME)));
  }
   
  /* Sellected Nation Name */
  pBuf->size.x = area.x + area.w / 2 + (area.w / 2 - pBuf->size.w) / 2;
  pBuf->size.y = area.y + adj_size(46);
  
  /* Leader Name Edit */
  pBuf = pBuf->prev;
  pBuf->size.x = area.x + area.w / 2 + (area.w/2 - pBuf->size.w) / 2;
  pBuf->size.y = area.y + (area.h - pBuf->size.h) / 2 - adj_size(30);
  
  /* Next Leader Name Button */
  pBuf = pBuf->prev;
  pBuf->size.x = pBuf->next->size.x + pBuf->next->size.w;
  pBuf->size.y = pBuf->next->size.y;
  
  /* Prev Leader Name Button */
  pBuf = pBuf->prev;
  pBuf->size.x = pBuf->next->next->size.x - pBuf->size.w;
  pBuf->size.y = pBuf->next->size.y;
  
  /* Change Leader Sex Button */
  pBuf = pBuf->prev;
  pBuf->size.x = area.x + area.w / 2 + (area.w/2 - pBuf->size.w) / 2;
  pBuf->size.y = pBuf->next->size.y + pBuf->next->size.h + adj_size(20);
  
  /* First City Style Button */
  pBuf = pBuf->prev;
  pBuf->size.x = area.x + area.w / 2 + (area.w/2 - len) / 2 - adj_size(20);
  pBuf->size.y = pBuf->next->size.y + pBuf->next->size.h + adj_size(20);
  
  /* Rest City Style Buttons */
  if (pBuf != pLast_City_Style) {
    do {
      pBuf = pBuf->prev;
      pBuf->size.x = pBuf->next->size.x + pBuf->next->size.w + adj_size(3);
      pBuf->size.y = pBuf->next->size.y;
    } while (pLast_City_Style != pBuf);
  }
  
  putline(pWindow->theme,
          area.x,
          area.y + area.h - adj_size(7) - pBuf->prev->size.h - adj_size(10),
          area.w - 1, 
          area.y + area.h - adj_size(7) - pBuf->prev->size.h - adj_size(10),
          map_rgba(pWindow->theme->format, *get_game_colorRGB(COLOR_THEME_NATIONDLG_FRAME)));
  
  /* Disconnect Button */
  pBuf = pBuf->prev;
  pBuf->size.x = area.x + adj_size(10);
  pBuf->size.y = area.y + area.h - adj_size(7) - pBuf->size.h;
  
  /* Start Button */
  pBuf = pBuf->prev;
  pBuf->size.x = area.w - adj_size(10) - pBuf->size.w;
  pBuf->size.y = pBuf->next->size.y;
  
  /* -------------------------------------------------------------------- */
  
  select_random_leader(pSetup->nation);
  
  redraw_group(pNationDlg->pBeginWidgetList, pWindow, 0);
  
  widget_flush(pWpNationDlg) {
    popdown_window_group_dialog(pNationDlg->pBeginWidgetList,
			  pNationDlg->pEndWidgetList);

    cancel_help_dlg_callback(NULL);
    
    FC_FREE(pLeaderName);
    
    FC_FREE(pNationDlg->pScroll);
    FC_FREE(pNationDlg);
  }
})
{
  struct NAT *pSetup;
  bool change = FALSE;
  struct widget *pNat;

  if (!pNationDlg)
    return;
  
  pSetup = (struct NAT *)(pNationDlg->pEndWidgetList->data.ptr);
  
  nations_iterate(nation) {
  
    if (!nation->is_available || nation->player) {
      freelog(LOG_DEBUG,"  [%d]: %d = %s",
	      nation_index(nation),
	      (!nation->is_available || nation->player),
	      nation_rule_name(nation));

      pNat = get_widget_pointer_form_main_list(MAX_ID - nation_index(nation));
      set_wstate(pNat, FC_WS_DISABLED);
    
      if (nation_index(nation) == pSetup->nation) {
        change = TRUE;
      }
    }
  } nations_iterate_end;
  
  if (change) {
    do {
      pSetup->nation = myrand(get_playable_nation_count());
      pNat = get_widget_pointer_form_main_list(MAX_ID - pSetup->nation);
    } while(get_wstate(pNat) == FC_WS_DISABLED);
    if (get_wstate(pSetup->pName_Edit) == FC_WS_PRESSED) {
      force_exit_from_event_loop();
      set_wstate(pSetup->pName_Edit, FC_WS_NORMAL);
    }
    change_nation_label();
    enable(MAX_ID - 1000 - pSetup->nation_city_style);
    pSetup->nation_city_style = city_style_of_nation(nation_by_number(pSetup->nation));
    disable(MAX_ID - 1000 - pSetup->nation_city_style);
    select_random_leader(pSetup->nation);
  }
  redraw_group(pNationDlg->pBeginWidgetList, pNationDlg->pEndWidgetList, 0);
  widget_flush(pNationDlg->pEndWidgetList);
}
ENDREP
id: 17f.0.r13151/94458
type: file
pred: 17f.0.r13133/257722
count: 36
text: 13151 0 3162 11384 392bb59f098b9ccb9e4cb0d1f41a0112
props: 10534 12701 111 0 3d57169d64a739976bce7d2e578e29eb
cpath: /trunk/client/gui-sdl/gotodlg.c
copyroot: 0 /

id: 17a.0.r13151/94698
type: file
pred: 17a.0.r13133/258943
count: 128
text: 13151 10820 83608 97763 644625c77330ef2bbebb65c4cd32a199
props: 10805 78030 111 0 ae073b1a8624f4e72ab3bef202bf2f05
cpath: /trunk/client/gui-sdl/dialogs.c
copyroot: 0 /

id: 17z.0.r13151/94944
type: file
pred: 17z.0.r13046/144903
count: 48
text: 13151 3188 7601 60505 072a9e2fa0f22c9e0a7265cb8245ba63
props: 10411 164601 111 0 3d57169d64a739976bce7d2e578e29eb
cpath: /trunk/client/gui-sdl/helpdlg.c
copyroot: 0 /

PLAIN
K 11
Makefile.am
V 23
file 16u.0.r12526/14581
K 16
README.SDLClient
V 21
file 16x.0.r6786/5349
K 14
SDL_rotozoom.c
V 24
file 3jy.0.r12670/115301
K 14
SDL_rotozoom.h
V 24
file 3jz.0.r12670/115888
K 9
SDL_ttf.c
V 20
file 2dz.0.r12025/79
K 9
SDL_ttf.h
V 22
file 2e0.0.r6439/49488
K 11
alphablit.c
V 24
file 3be.0.r12670/111820
K 8
canvas.c
V 21
file 39i.0.r12877/214
K 8
canvas.h
V 22
file 39j.0.r12863/1497
K 16
caravan_dialog.c
V 23
file 3bp.0.r12699/32779
K 10
chatline.c
V 22
file 16y.0.r12884/9147
K 10
chatline.h
V 23
file 16z.0.r11278/68134
K 9
citydlg.c
V 24
file 170.0.r13133/257475
K 9
citydlg.h
V 23
file 171.0.r11361/37701
K 9
cityrep.c
V 24
file 172.0.r13133/258699
K 9
cityrep.h
V 22
file 173.0.r12769/2941
K 8
cma_fe.c
V 24
file 174.0.r13046/143426
K 8
cma_fe.h
V 23
file 175.0.r11361/43495
K 8
colors.c
V 23
file 176.0.r12278/23172
K 8
colors.h
V 23
file 177.0.r11354/23855
K 12
connectdlg.c
V 21
file 178.0.r12797/114
K 12
connectdlg.h
V 23
file 179.0.r12349/45319
K 9
dialogs.c
V 23
file 17a.0.r13151/94698
K 9
dialogs.h
V 23
file 17b.0.r12387/13707
K 10
diplodlg.c
V 24
file 17c.0.r13133/259441
K 10
diplodlg.h
V 22
file 17d.0.r11584/2869
K 17
diplomat_dialog.c
V 24
file 3bn.0.r13133/259187
K 9
finddlg.c
V 24
file 17e.0.r13133/259689
K 9
finddlg.h
V 20
file 2d8.0.r5991/702
K 9
gotodlg.c
V 23
file 17f.0.r13151/94458
K 9
gotodlg.h
V 22
file 17g.0.r6515/58208
K 10
graphics.c
V 23
file 17h.0.r12611/13457
K 10
graphics.h
V 23
file 17i.0.r12611/13939
K 11
gui_iconv.c
V 22
file 17l.0.r11463/6261
K 11
gui_iconv.h
V 22
file 17m.0.r11463/6499
K 8
gui_id.h
V 22
file 17n.0.r12715/2828
K 10
gui_main.c
V 23
file 17o.0.r13140/22172
K 10
gui_main.h
V 22
file 17p.0.r12884/7238
K 11
gui_mouse.c
V 24
file 3ca.0.r12670/111532
K 11
gui_mouse.h
V 24
file 3cb.0.r12670/112397
K 12
gui_string.c
V 21
file 17r.0.r13049/366
K 12
gui_string.h
V 23
file 17s.0.r11451/16087
K 14
gui_tilespec.c
V 20
file 191.0.r13128/94
K 14
gui_tilespec.h
V 23
file 192.0.r12411/33830
K 11
happiness.c
V 23
file 17x.0.r11361/41144
K 11
happiness.h
V 23
file 17y.0.r11361/41867
K 9
helpdlg.c
V 23
file 17z.0.r13151/94944
K 9
helpdlg.h
V 23
file 180.0.r11361/47416
K 10
inputdlg.c
V 23
file 181.0.r11361/47897
K 10
inputdlg.h
V 23
file 182.0.r5500/260641
K 10
inteldlg.c
V 24
file 183.0.r13046/144655
K 10
inteldlg.h
V 22
file 2d9.0.r11409/2687
K 9
mapctrl.c
V 22
file 184.0.r12884/8434
K 9
mapctrl.h
V 22
file 185.0.r12884/8672
K 9
mapview.c
V 24
file 186.0.r13133/257968
K 9
mapview.h
V 22
file 187.0.r12884/6760
K 6
menu.c
V 24
file 188.0.r13133/258458
K 6
menu.h
V 23
file 189.0.r12378/18861
K 12
messagedlg.c
V 23
file 18a.0.r11361/49350
K 12
messagedlg.h
V 22
file 2da.0.r5989/48394
K 12
messagewin.c
V 22
file 18b.0.r12884/7473
K 12
messagewin.h
V 23
file 18c.0.r6286/140236
K 5
mmx.h
V 23
file 2e1.0.r6286/134429
K 11
optiondlg.c
V 22
file 18d.0.r12884/6046
K 11
optiondlg.h
V 22
file 18e.0.r12381/2174
K 7
pages.c
V 23
file 2qg.0.r12699/33028
K 7
pages.h
V 22
file 2qh.0.r8639/16416
K 8
plrdlg.c
V 24
file 18f.0.r13133/259935
K 8
plrdlg.h
V 22
file 18g.0.r6387/81301
K 10
ratesdlg.h
V 22
file 2db.0.r5989/47726
K 10
repodlgs.c
V 24
file 18i.0.r13133/258211
K 10
repodlgs.h
V 23
file 18j.0.r12411/34076
K 14
spaceshipdlg.c
V 24
file 18m.0.r13133/260181
K 14
spaceshipdlg.h
V 23
file 18n.0.r5500/263363
K 8
sprite.c
V 24
file 39k.0.r12670/106912
K 8
sprite.h
V 24
file 39l.0.r12670/108062
K 18
themebackgrounds.c
V 24
file 3ff.0.r12670/109497
K 18
themebackgrounds.h
V 24
file 3fg.0.r12670/110950
K 13
themecolors.c
V 24
file 392.0.r12670/113849
K 13
themecolors.h
V 24
file 393.0.r12670/114433
K 8
themes.c
V 24
file 38p.0.r12670/109789
K 11
themespec.c
V 24
file 390.0.r12670/112682
K 11
themespec.h
V 24
file 391.0.r12670/113267
K 11
unistring.c
V 21
file 18o.0.r11902/914
K 11
unistring.h
V 23
file 18p.0.r11361/40418
K 8
widget.c
V 24
file 3fu.0.r12670/109211
K 8
widget.h
V 24
file 3fv.0.r12670/110372
K 15
widget_button.c
V 24
file 3fh.0.r12670/112974
K 15
widget_button.h
V 24
file 3g7.0.r12670/113556
K 17
widget_checkbox.c
V 24
file 3fi.0.r12670/116518
K 17
widget_checkbox.h
V 24
file 3g8.0.r12670/106620
K 13
widget_core.c
V 24
file 3fj.0.r12670/114722
K 13
widget_edit.c
V 24
file 3fk.0.r12670/115009
K 13
widget_edit.h
V 24
file 3g9.0.r12670/115595
K 13
widget_icon.c
V 24
file 3fl.0.r12670/111242
K 13
widget_icon.h
V 24
file 3ga.0.r12670/112107
K 14
widget_label.c
V 24
file 3fm.0.r12670/108919
K 14
widget_label.h
V 24
file 3gb.0.r12670/110079
K 10
widget_p.h
V 24
file 3fn.0.r12670/107197
K 18
widget_scrollbar.c
V 24
file 3fo.59n.r12917/8446
K 18
widget_scrollbar.h
V 24
file 3gc.0.r12670/116811
K 15
widget_window.c
V 23
file 3fp.0.r12699/32039
K 15
widget_window.h
V 23
file 3gd.0.r12699/32533
K 7
wldlg.c
V 24
file 18q.0.r13046/145149
K 7
wldlg.h
V 23
file 18r.0.r11361/49592
END
ENDREP
id: 16t.0.r13151/99991
type: dir
pred: 16t.0.r13140/27223
count: 435
text: 13151 95188 4790 4790 2ed0d33e42ca185dd695f692a8ecea0a
props: 11108 12869 78 0 a27c61ac5fddbd709df8c1876129f940
cpath: /trunk/client/gui-sdl
copyroot: 0 /

PLAIN
K 11
Makefile.am
V 21
file 5f.0.r12357/8748
K 6
agents
V 22
dir zf.0.r13133/237048
K 11
attribute.c
V 22
file xh.0.r13068/20176
K 11
attribute.h
V 19
file xi.0.r4715/844
K 7
audio.c
V 22
file 139.0.r10416/5460
K 7
audio.h
V 22
file 13a.0.r10416/6162
K 12
audio_none.c
V 23
file 13d.0.r6129/145164
K 12
audio_none.h
V 22
file 13e.0.r4452/27228
K 11
audio_sdl.c
V 21
file 13f.0.r10418/395
K 11
audio_sdl.h
V 22
file 13g.0.r4452/26570
K 17
chatline_common.c
V 23
file 14q.0.r9577/151065
K 17
chatline_common.h
V 23
file 14r.0.r9577/151422
K 16
citydlg_common.c
V 23
file z4.0.r13133/237276
K 16
citydlg_common.h
V 22
file z5.0.r12502/22017
K 13
cityrepdata.c
V 22
file mb.0.r13027/92154
K 13
cityrepdata.h
V 21
file mc.0.r9153/21475
K 11
civclient.c
V 23
file 2f.0.r13046/158886
K 11
civclient.h
V 21
file hz.0.r11758/7740
K 8
climap.c
V 23
file 197.0.r11057/48047
K 8
climap.h
V 22
file 198.0.r11804/3994
K 9
climisc.c
V 23
file d5.0.r13133/279089
K 9
climisc.h
V 21
file i0.0.r12552/9622
K 8
clinet.c
V 20
file hc.0.r13116/185
K 8
clinet.h
V 22
file i1.0.r12484/13649
K 15
colors_common.c
V 24
file 33a.0.r13133/237514
K 15
colors_common.h
V 23
file 33b.0.r13015/10629
K 19
connectdlg_common.c
V 23
file 2fw.0.r12637/24070
K 19
connectdlg_common.h
V 23
file 2fx.0.r12637/24311
K 9
control.c
V 23
file gz.0.r13133/237755
K 9
control.h
V 22
file i2.0.r13095/70279
K 8
editor.c
V 24
file 3bg.0.r13133/279326
K 8
editor.h
V 23
file 3bh.0.r12771/15162
K 11
ggzclient.c
V 24
file 394.0.r12670/122138
K 11
ggzclient.h
V 24
file 395.0.r12670/122419
K 6
goto.c
V 23
file vu.0.r13133/257008
K 6
goto.h
V 22
file vv.0.r11378/41010
K 8
gui-ftwl
V 23
dir 2k2.0.r13133/268950
K 11
gui-gtk-2.0
V 21
dir zs.0.r13140/15250
K 7
gui-mui
V 22
dir km.0.r13133/275376
K 7
gui-sdl
V 22
dir 16t.0.r13151/99991
K 8
gui-stub
V 22
dir mh.0.r13133/278857
K 9
gui-win32
V 21
dir np.0.r13140/21940
K 7
gui-xaw
V 20
dir 9o.0.r13148/3603
K 10
helpdata.c
V 23
file h1.0.r13133/269184
K 10
helpdata.h
V 22
file i3.0.r11595/12124
K 7
include
V 21
dir b8.0.r12859/42040
K 16
mapctrl_common.c
V 24
file 15m.0.r13133/275842
K 16
mapctrl_common.h
V 23
file 15n.0.r11378/41712
K 16
mapview_common.c
V 23
file z2.0.r13027/118129
K 16
mapview_common.h
V 22
file z3.0.r12881/22258
K 19
messagewin_common.c
V 23
file 14s.0.r11057/47330
K 19
messagewin_common.h
V 23
file 14t.0.r8387/154818
K 9
options.c
V 24
file dc.0.r12988/4295264
K 9
options.h
V 21
file i4.0.r11771/7549
K 17
overview_common.c
V 23
file 2yk.0.r11057/37541
K 17
overview_common.h
V 21
file 2yl.0.r10927/997
K 10
packhand.c
V 22
file n.0.r13133/257240
K 10
packhand.h
V 22
file i5.0.r10865/39236
K 15
plrdlg_common.c
V 24
file 14u.0.r13133/265466
K 15
plrdlg_common.h
V 23
file 14v.0.r10581/10242
K 17
repodlgs_common.c
V 25
file 11i.0.r13038/2048652
K 17
repodlgs_common.h
V 23
file 11j.0.r10846/16483
K 9
reqtree.c
V 22
file 2ym.0.r13134/2003
K 9
reqtree.h
V 22
file 2yn.0.r13134/2234
K 9
servers.c
V 20
file 33x.0.r12574/52
K 9
servers.h
V 22
file 33y.0.r11098/4793
K 6
text.c
V 24
file 2g3.0.r13133/244975
K 6
text.h
V 22
file 2g4.0.r11667/8274
K 15
themes_common.c
V 22
file 352.0.r11118/5618
K 15
themes_common.h
V 22
file 353.0.r11118/5853
K 10
tilespec.c
V 22
file hl.0.r13140/27455
K 10
tilespec.h
V 22
file i6.0.r13140/27687
END
ENDREP
id: d.0.r13151/103498
type: dir
pred: d.0.r13148/7105
count: 4119
text: 13151 100222 3263 3263 88a26bc3cac927fafe9fbd05a182bcd1
props: 12883 2898 109 0 732f4656541fb514e4368d9517bdf317
cpath: /trunk/client
copyroot: 0 /

PLAIN
K 9
ABOUT-NLS
V 21
file fu.0.r3960/17632
K 7
AUTHORS
V 19
file 5u.0.r12982/94
K 7
COPYING
V 19
file 1h.0.r9643/400
K 9
ChangeLog
V 22
file 6l.0.r4863/510676
K 7
INSTALL
V 19
file 6.0.r12902/917
K 11
Makefile.am
V 21
file 59.0.r12357/8527
K 4
NEWS
V 22
file 6m.0.r11650/10062
K 6
README
V 20
file 7.0.r4421/96382
K 2
ai
V 19
dir 8.0.r13146/3960
K 5
amiga
V 21
dir kd.0.r11105/71924
K 10
autogen.sh
V 22
file 12o.0.r12319/1997
K 9
bootstrap
V 22
dir 2p5.0.r12679/13512
K 6
client
V 21
dir d.0.r13151/103498
K 6
common
V 20
dir p.0.r13136/27950
K 12
config.mac.h
V 20
file hb.0.r6045/5982
K 12
configure.ac
V 22
file 149.0.r13076/2971
K 4
data
V 20
dir w.0.r13129/12767
K 6
debian
V 19
dir 5w.0.r7821/9259
K 12
dependencies
V 22
dir 2yu.0.r13014/15977
K 11
diff_ignore
V 20
file qq.0.r10370/179
K 3
doc
V 20
dir k7.0.r13149/1427
K 4
intl
V 21
dir f4.0.r11105/23499
K 2
m4
V 21
dir 12p.0.r12833/2047
K 6
manual
V 24
dir 2m2.0.r13038/2041696
K 2
po
V 23
dir fs.0.r13150/7504399
K 7
scripts
V 20
dir 2yo.0.r11849/885
K 6
server
V 19
dir z.0.r13138/8032
K 10
stamp-h.in
V 19
file 80.0.r1125/241
K 5
tests
V 21
dir 2g9.0.r11105/7470
K 7
utility
V 20
dir 1c.0.r13088/4068
K 10
version.in
V 21
file 2lo.0.r12901/147
K 3
vms
V 21
dir u9.0.r11105/70719
K 5
win32
V 21
dir 2eu.0.r13125/7237
END
ENDREP
id: 3.0.r13151/105014
type: dir
pred: 3.0.r13150/7505914
count: 11068
text: 13151 103719 1282 1282 b0bfa987d9fafe01625bbe065bcf2b04
props: 11109 0 255 0 8cbc80e0da9c47b05b8ffee17ea9b0f1
cpath: /trunk
copyroot: 0 /

PLAIN
K 8
branches
V 19
dir 1.0.r13147/9375
K 4
tags
V 19
dir 2.0.r12895/2647
K 5
trunk
V 21
dir 3.0.r13151/105014
K 7
website
V 18
dir 3ge.0.r12388/0
END
ENDREP
id: 0.0.r13151/105391
type: dir
pred: 0.0.r13150/7506291
count: 13151
text: 13151 105229 149 149 02ee84f93756358476cb210987fa44e9
cpath: /
copyroot: 0 /

17f.0.t13150-1 modify true false /trunk/client/gui-sdl/gotodlg.c

17z.0.t13150-1 modify true false /trunk/client/gui-sdl/helpdlg.c

17a.0.t13150-1 modify true false /trunk/client/gui-sdl/dialogs.c


105391 105545
