~ubuntu-branches/debian/sid/freeciv/sid

« back to all changes in this revision

Viewing changes to client/gui-sdl/finddlg.c

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2010-02-23 22:09:02 UTC
  • mfrom: (7.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100223220902-s3spqi1x4e190y0t
[ Karl Goetz ]
* Remove civserver files in /etc/ggzd/ (Closes: 523772, 517787)
* Adding ${misc:Depends} to all binary packages (lintian warnings)

[ Clint Adams ]
* New upstream version.
  - Drop data_dsc_use_bindir.diff (binary pathnames have changed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
/* utility */
23
23
#include "fcintl.h"
 
24
#include "log.h"
24
25
 
25
26
/* common */
26
27
#include "game.h"
104
105
  SDL_Surface *pLogo = NULL;
105
106
  SDL_String16 *pStr;
106
107
  char cBuf[128]; 
107
 
  int i, n = 0, w = 0, h, /*owner = 0xffff,*/ units_h = 0;
 
108
  int h = 0, n = 0, w = 0, units_h = 0;
108
109
  struct player *owner = NULL;
109
110
  struct tile *original;
110
111
  int window_x = 0, window_y = 0;
112
113
  SDL_Rect area;
113
114
  
114
115
  /* check that there are any cities to find */
115
 
  h = 0;
116
 
  i = 0;    
117
 
  while(!h && i<game.info.nplayers) {
118
 
    h = city_list_size(game.players[i++].cities);
119
 
  }
 
116
  players_iterate(pplayer) {
 
117
    h = city_list_size(pplayer->cities);
 
118
    if (h > 0) {
 
119
      break;
 
120
    }
 
121
  } players_iterate_end;
120
122
  
121
123
  if (pFind_City_Dlg && !h) {
122
124
    return;
155
157
  add_to_gui_list(ID_TERRAIN_ADV_DLG_EXIT_BUTTON, pBuf);
156
158
  /* ---------- */
157
159
  
158
 
  for(i=0; i<game.info.nplayers; i++) {
159
 
    city_list_iterate(game.players[i].cities, pCity) {
 
160
  players_iterate(pPlayer) {
 
161
    city_list_iterate(pPlayer->cities, pCity) {
160
162
    
161
163
      my_snprintf(cBuf , sizeof(cBuf), "%s (%d)", city_name(pCity), pCity->size);
162
164
      
163
165
      pStr = create_str16_from_char(cBuf , adj_font(10));
164
166
      pStr->style |= (TTF_STYLE_BOLD|SF_CENTER);
165
167
   
166
 
      if(city_owner(pCity) != owner) {
167
 
        pLogo = get_nation_flag_surface(nation_of_player(get_player(city_owner(pCity)->player_no)));
 
168
      if(!player_owns_city(owner, pCity)) {
 
169
        pLogo = get_nation_flag_surface(nation_of_player(city_owner(pCity)));
168
170
        pLogo = crop_visible_part_from_surface(pLogo);
169
171
      }
170
172
      
171
173
      pBuf = create_iconlabel(pLogo, pWindow->dst, pStr, 
172
174
        (WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE));
173
175
      
174
 
      if(city_owner(pCity) != owner) {
 
176
      if(!player_owns_city(owner, pCity)) {
175
177
        set_wflag(pBuf, WF_FREE_THEME);
176
178
        owner = city_owner(pCity);
177
179
      }
198
200
      
199
201
      n++;  
200
202
    } city_list_iterate_end;
201
 
  }
 
203
  } players_iterate_end;
202
204
  pFind_City_Dlg->pBeginWidgetList = pBuf;
203
205
  pFind_City_Dlg->pBeginActiveWidgetList = pFind_City_Dlg->pBeginWidgetList;
204
206
  pFind_City_Dlg->pEndActiveWidgetList = pWindow->prev->prev;