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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2011-08-28 22:40:00 UTC
  • mfrom: (1.2.19 upstream)
  • Revision ID: package-import@ubuntu.com-20110828224000-j2r1erewlem25dox
Tags: 2.3.0-1
[ Karl Goetz ]
* New upstream version.
* Fix themes_sdl_use_system_fonts.diff to apply cleanly on 2.3.0
* Massage work_around_unity_induced_breakage.diff to get it
  applying to the new codebase (The patch assumes commits made
  after 2.3.0 was tagged upstream).

[ Clint Adams ]
* Fudge build system to think there is no libtool mismatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
/* common */
25
25
#include "government.h"
 
26
#include "research.h"
26
27
 
27
28
/* client */
28
29
#include "client_main.h"
70
71
*****************************************************************/
71
72
void intel_dialog_done()
72
73
{
73
 
  dialog_list_free(dialog_list);
 
74
  dialog_list_destroy(dialog_list);
74
75
}
75
76
 
76
77
/****************************************************************
126
127
  return -1;
127
128
}
128
129
 
 
130
/**************************************************************************
 
131
  Close an intelligence dialog for the given player.
 
132
**************************************************************************/
 
133
void close_intel_dialog(struct player *p)
 
134
{
 
135
  popdown_intel_dialog(p);
 
136
}
 
137
 
129
138
static struct intel_dialog *create_intel_dialog(struct player *pPlayer) {
130
139
 
131
140
  struct intel_dialog *pdialog = fc_calloc(1, sizeof(struct intel_dialog));
172
181
    popdown_window_group_dialog(pdialog->pdialog->pBeginWidgetList,
173
182
                                          pdialog->pdialog->pEndWidgetList);
174
183
      
175
 
    dialog_list_unlink(dialog_list, pdialog);
 
184
    dialog_list_remove(dialog_list, pdialog);
176
185
      
177
186
    FC_FREE(pdialog->pdialog->pScroll);
178
187
    FC_FREE(pdialog->pdialog);  
202
211
  SDL_Surface *pText1, *pInfo, *pText2 = NULL;
203
212
  SDL_String16 *pStr;
204
213
  SDL_Rect dst;
205
 
  char cBuf[256];
 
214
  char cBuf[256], plr_buf[4 * MAX_LEN_NAME];
206
215
  int n = 0, count = 0, col;
207
216
  struct city *pCapital;
208
217
  SDL_Rect area;
236
245
    /* ---------- */
237
246
    /* exit button */
238
247
    pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
239
 
                            WF_WIDGET_HAS_INFO_LABEL | WF_RESTORE_BACKGROUND);
240
 
    pBuf->string16 = create_str16_from_char(_("Close Dialog (Esc)"), adj_font(12));
 
248
                            WF_WIDGET_HAS_INFO_LABEL
 
249
                            | WF_RESTORE_BACKGROUND);
 
250
    pBuf->info_label = create_str16_from_char(_("Close Dialog (Esc)"),
 
251
                                              adj_font(12));
241
252
    area.w = MAX(area.w, pBuf->size.w + adj_size(10));
242
253
    pBuf->action = exit_intel_dlg_callback;
243
254
    set_wstate(pBuf, FC_WS_NORMAL);
252
263
    pLogo = pText1;
253
264
          
254
265
    pBuf = create_icon2(pLogo, pWindow->dst,
255
 
          (WF_RESTORE_BACKGROUND|WF_WIDGET_HAS_INFO_LABEL|
256
 
                                          WF_FREE_STRING|WF_FREE_THEME));
 
266
                        WF_RESTORE_BACKGROUND | WF_WIDGET_HAS_INFO_LABEL
 
267
                        | WF_FREE_THEME);
257
268
    pBuf->action = spaceship_callback;
258
269
    set_wstate(pBuf, FC_WS_NORMAL);
259
270
    pBuf->data.player = p;
260
 
    my_snprintf(cBuf, sizeof(cBuf),
 
271
    fc_snprintf(cBuf, sizeof(cBuf),
261
272
                _("Intelligence Information about the %s Spaceship"), 
262
273
                nation_adjective_for_player(p));
263
 
    pBuf->string16 = create_str16_from_char(cBuf, adj_font(12));
264
 
          
 
274
    pBuf->info_label = create_str16_from_char(cBuf, adj_font(12));
 
275
 
265
276
    add_to_gui_list(ID_ICON, pBuf);
266
277
          
267
278
    /* ---------- */
268
 
    my_snprintf(cBuf, sizeof(cBuf),
 
279
    fc_snprintf(cBuf, sizeof(cBuf),
269
280
                _("Intelligence Information for the %s Empire"), 
270
281
                nation_adjective_for_player(p));
271
282
    
279
290
      
280
291
    /* ---------- */
281
292
    
282
 
    pCapital = find_palace(p);
283
 
    research = get_player_research(p);
 
293
    pCapital = player_palace(p);
 
294
    research = player_research_get(p);
284
295
    change_ptsize16(pStr, adj_font(10));
285
296
    pStr->style &= ~TTF_STYLE_BOLD;
286
297
 
288
299
    switch (research->researching) {
289
300
    case A_UNKNOWN:
290
301
    case A_UNSET:
291
 
      my_snprintf(cBuf, sizeof(cBuf),
292
 
        _("Ruler: %s %s  Government: %s\nCapital: %s  Gold: %d\nTax: %d%%"
293
 
          " Science: %d%% Luxury: %d%%\nResearching: unknown"),
294
 
        ruler_title_translation(p),
295
 
        player_name(p),
296
 
        government_name_for_player(p),
297
 
        /* TRANS: "unknown" location */
298
 
        (!pCapital) ? _("(unknown)") : city_name(pCapital),
299
 
        p->economic.gold,
300
 
        p->economic.tax, p->economic.science, p->economic.luxury);
 
302
      fc_snprintf(cBuf, sizeof(cBuf),
 
303
                  _("Ruler: %s  Government: %s\n"
 
304
                    "Capital: %s  Gold: %d\n"
 
305
                    "Tax: %d%% Science: %d%% Luxury: %d%%\n"
 
306
                    "Researching: unknown"),
 
307
                  ruler_title_for_player(p, plr_buf, sizeof(plr_buf)),
 
308
                  government_name_for_player(p),
 
309
                  /* TRANS: "unknown" location */
 
310
                  NULL != pCapital ? city_name(pCapital) : _("(unknown)"),
 
311
                  p->economic.gold, p->economic.tax,
 
312
                  p->economic.science, p->economic.luxury);
301
313
      break;
302
314
    default:
303
 
      my_snprintf(cBuf, sizeof(cBuf),
304
 
        _("Ruler: %s %s  Government: %s\nCapital: %s  Gold: %d\nTax: %d%%"
305
 
          " Science: %d%% Luxury: %d%%\nResearching: %s(%d/%d)"),
306
 
        ruler_title_translation(p),
307
 
        player_name(p),
308
 
        government_name_for_player(p),
309
 
        /* TRANS: "unknown" location */
310
 
        (!pCapital) ? _("(unknown)") : city_name(pCapital),
311
 
        p->economic.gold,
312
 
        p->economic.tax, p->economic.science, p->economic.luxury,
313
 
        advance_name_researching(p),
314
 
        research->bulbs_researched, total_bulbs_required(p));
 
315
      fc_snprintf(cBuf, sizeof(cBuf),
 
316
                  _("Ruler: %s  Government: %s\n"
 
317
                    "Capital: %s  Gold: %d\n"
 
318
                    "Tax: %d%% Science: %d%% Luxury: %d%%\n"
 
319
                    "Researching: %s(%d/%d)"),
 
320
                  ruler_title_for_player(p, plr_buf, sizeof(plr_buf)),
 
321
                  government_name_for_player(p),
 
322
                  /* TRANS: "unknown" location */
 
323
                  NULL != pCapital ? city_name(pCapital) : _("(unknown)"),
 
324
                  p->economic.gold, p->economic.tax, p->economic.science,
 
325
                  p->economic.luxury, advance_name_researching(p),
 
326
                  research->bulbs_researched, total_bulbs_required(p));
315
327
      break;
316
328
    };
317
329
    
328
340
    pLast = pBuf;
329
341
    advance_index_iterate(A_FIRST, i) {
330
342
      if (TECH_KNOWN == player_invention_state(p, i)
331
 
       && player_invention_reachable(client.conn.playing, i)
 
343
       && player_invention_reachable(client.conn.playing, i, FALSE)
332
344
       && TECH_KNOWN != player_invention_state(client.conn.playing, i)) {
333
345
 
334
346
        pBuf = create_icon2(get_tech_icon(i), pWindow->dst,
335
 
          (WF_RESTORE_BACKGROUND|WF_WIDGET_HAS_INFO_LABEL|WF_FREE_STRING | WF_FREE_THEME));
 
347
                            WF_RESTORE_BACKGROUND | WF_WIDGET_HAS_INFO_LABEL
 
348
                            | WF_FREE_THEME);
336
349
        pBuf->action = tech_callback;
337
350
        set_wstate(pBuf, FC_WS_NORMAL);
338
 
  
339
 
        pBuf->string16 = create_str16_from_char(
340
 
                           advance_name_translation(advance_by_number(i)),
341
 
                           adj_font(12));
342
 
          
 
351
 
 
352
        pBuf->info_label =
 
353
            create_str16_from_char(advance_name_translation
 
354
                                   (advance_by_number(i)), adj_font(12));
 
355
 
343
356
        add_to_gui_list(ID_ICON, pBuf);
344
357
          
345
358
        if(n > ((2 * col) - 1)) {
369
382
      
370
383
      area.w = MAX(area.w, col * pBuf->size.w + count);
371
384
      
372
 
      my_snprintf(cBuf, sizeof(cBuf), _("Their techs that we don't have :"));
 
385
      fc_snprintf(cBuf, sizeof(cBuf), _("Their techs that we don't have :"));
373
386
      copy_chars_to_string16(pStr, cBuf);
374
387
      pStr->style |= TTF_STYLE_BOLD;
375
388
      pText2 = create_text_surf_from_str16(pStr);