Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-gtk-4.0/inteldlg.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
inteldlg.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdio.h>
19#include <stdlib.h>
20
21#include <gtk/gtk.h>
22
23/* utility */
24#include "fcintl.h"
25#include "log.h"
26#include "shared.h"
27#include "support.h"
28
29/* common */
30#include "government.h"
31#include "packets.h"
32#include "player.h"
33#include "research.h"
34
35/* client */
36#include "client_main.h"
37#include "options.h"
38
39/* client/gui-gtk-4.0 */
40#include "gui_main.h"
41#include "gui_stuff.h"
42#include "mapview.h"
43
44#include "inteldlg.h"
45
46/******************************************************************/
47 static const char *table_text[] = {
48 N_("Ruler:"),
49 N_("Government:"),
50 N_("Capital:"),
51 N_("Gold:"),
52 NULL,
53 N_("Tax:"),
54 N_("Science:"),
55 N_("Luxury:"),
56 NULL,
57 N_("Researching:"),
58 N_("Culture:")
59};
60
61 enum table_label {
62 LABEL_RULER,
63 LABEL_GOVERNMENT,
64 LABEL_CAPITAL,
65 LABEL_GOLD,
66 LABEL_SEP1,
67 LABEL_TAX,
68 LABEL_SCIENCE,
69 LABEL_LUXURY,
70 LABEL_SEP2,
71 LABEL_RESEARCHING,
72 LABEL_CULTURE,
73 LABEL_LAST
74};
75
76/******************************************************************/
77struct intel_dialog {
78 struct player *pplayer;
79 GtkWidget *shell;
80
81 GtkTreeStore *diplstates;
82 GtkListStore *techs;
83 GtkWidget *table_labels[LABEL_LAST];
84};
85
86#define SPECLIST_TAG dialog
87#define SPECLIST_TYPE struct intel_dialog
88#include "speclist.h"
89
90#define dialog_list_iterate(dialoglist, pdialog) \
91 TYPED_LIST_ITERATE(struct intel_dialog, dialoglist, pdialog)
92#define dialog_list_iterate_end LIST_ITERATE_END
93
94struct intel_wonder_dialog {
95 struct player *pplayer;
96 GtkWidget *shell;
97
98 GtkListStore *wonders;
99 GtkWidget *rule;
100};
101
102#define SPECLIST_TAG wonder_dialog
103#define SPECLIST_TYPE struct intel_wonder_dialog
104#include "speclist.h"
105
106#define wonder_dialog_list_iterate(dialoglist, pdialog) \
107 TYPED_LIST_ITERATE(struct intel_wonder_dialog, dialoglist, pdialog)
108#define wonder_dialog_list_iterate_end LIST_ITERATE_END
109
110 static struct dialog_list *dialog_list;
111static struct intel_dialog *create_intel_dialog(struct player *p);
112 static struct wonder_dialog_list *wonder_dialogs;
113static struct intel_wonder_dialog *create_intel_wonder_dialog(struct player *p);
114
115/**********************************************************************/
118 void intel_dialog_init(void)
119{
120 dialog_list = dialog_list_new();
121 wonder_dialogs = wonder_dialog_list_new();
122}
123
124/**********************************************************************/
127 void intel_dialog_done(void)
128{
129 dialog_list_destroy(dialog_list);
130 wonder_dialog_list_destroy(wonder_dialogs);
131}
132
133/**********************************************************************/
137 static struct intel_dialog *get_intel_dialog(struct player *pplayer)
138{
139 dialog_list_iterate(dialog_list, pdialog) {
140 if (pdialog->pplayer == pplayer) {
141 return pdialog;
142 }
143 } dialog_list_iterate_end;
144
145 return NULL;
146}
147
148/**********************************************************************/
152 static struct intel_wonder_dialog *get_intel_wonder_dialog(struct player *pplayer)
153{
154 wonder_dialog_list_iterate(wonder_dialogs, pdialog) {
155 if (pdialog->pplayer == pplayer) {
156 return pdialog;
157 }
158 } wonder_dialog_list_iterate_end;
159
160 return NULL;
161}
162
163/**********************************************************************/
166 void popup_intel_dialog(struct player *p)
167{
168 struct intel_dialog *pdialog;
169
170 if (!(pdialog = get_intel_dialog(p))) {
171 pdialog = create_intel_dialog(p);
172 }
173
174 update_intel_dialog(p);
175
176 gtk_window_present(GTK_WINDOW(pdialog->shell));
177}
178
179/**********************************************************************/
182 void popup_intel_wonder_dialog(struct player *p)
183{
184 struct intel_wonder_dialog *pdialog;
185
186 if (!(pdialog = get_intel_wonder_dialog(p))) {
187 pdialog = create_intel_wonder_dialog(p);
188 }
189
190 update_intel_wonder_dialog(p);
191
192 gtk_window_present(GTK_WINDOW(pdialog->shell));
193}
194
195/**********************************************************************/
198 static void intel_destroy_callback(GtkWidget *w, gpointer data)
199{
200 struct intel_dialog *pdialog = (struct intel_dialog *)data;
201
202 dialog_list_remove(dialog_list, pdialog);
203
204 free(pdialog);
205}
206
207/**********************************************************************/
210 static void intel_wonder_destroy_callback(GtkWidget *w, gpointer data)
211{
212 struct intel_wonder_dialog *pdialog = (struct intel_wonder_dialog *)data;
213
214 wonder_dialog_list_remove(wonder_dialogs, pdialog);
215
216 free(pdialog);
217}
218
219/**********************************************************************/
222 void close_intel_dialog(struct player *p)
223{
224 struct intel_dialog *pdialog = get_intel_dialog(p);
225
226 intel_destroy_callback(NULL, pdialog);
227}
228
229/**********************************************************************/
232 void close_intel_wonder_dialog(struct player *p)
233{
234 struct intel_wonder_dialog *pdialog = get_intel_wonder_dialog(p);
235
236 intel_wonder_destroy_callback(NULL, pdialog);
237}
238
239/**********************************************************************/
243 static struct intel_dialog *create_intel_dialog(struct player *p)
244{
245 struct intel_dialog *pdialog;
246
247 GtkWidget *shell, *notebook, *label, *sw, *view, *table;
248 GtkCellRenderer *rend;
249 GtkTreeViewColumn *col;
250 int i;
251
252 pdialog = fc_malloc(sizeof(*pdialog));
253 pdialog->pplayer = p;
254
255 shell = gtk_dialog_new_with_buttons(NULL,
256 NULL,
257 0,
258 _("_Close"),
259 GTK_RESPONSE_CLOSE,
260 NULL);
261 pdialog->shell = shell;
262 gtk_window_set_default_size(GTK_WINDOW(shell), 350, 350);
263 setup_dialog(shell, toplevel);
264 gtk_dialog_set_default_response(GTK_DIALOG(shell), GTK_RESPONSE_CLOSE);
265
266 g_signal_connect(shell, "destroy",
267 G_CALLBACK(intel_destroy_callback), pdialog);
268 g_signal_connect(shell, "response",
269 G_CALLBACK(gtk_window_destroy), NULL);
270
271 notebook = gtk_notebook_new();
272 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM);
273 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(shell))), notebook);
274
275 /* overview tab. */
276 table = gtk_grid_new();
277 gtk_widget_set_margin_bottom(table, 6);
278 gtk_widget_set_margin_end(table, 6);
279 gtk_widget_set_margin_start(table, 6);
280 gtk_widget_set_margin_top(table, 6);
281
282 gtk_grid_set_row_spacing(GTK_GRID(table), 2);
283 gtk_grid_set_column_spacing(GTK_GRID(table), 12);
284
285 /* TRANS: Overview tab of foreign intelligence report dialog */
286 label = gtk_label_new_with_mnemonic(_("_Overview"));
287 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
288
289 for (i = 0; i < ARRAY_SIZE(table_text); i++) {
290 if (table_text[i]) {
291 label = gtk_label_new(_(table_text[i]));
292 gtk_widget_set_halign(label, GTK_ALIGN_START);
293 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
294 gtk_grid_attach(GTK_GRID(table), label, 0, i, 1, 1);
295
296 label = gtk_label_new(NULL);
297 pdialog->table_labels[i] = label;
298 gtk_widget_set_halign(label, GTK_ALIGN_START);
299 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
300 gtk_grid_attach(GTK_GRID(table), label, 1, i, 1, 1);
301 } else {
302 pdialog->table_labels[i] = NULL;
303 }
304 }
305
306 /* diplomacy tab. */
307 pdialog->diplstates = gtk_tree_store_new(1, G_TYPE_STRING);
308
309 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdialog->diplstates));
310 gtk_widget_set_margin_bottom(view, 6);
311 gtk_widget_set_margin_end(view, 6);
312 gtk_widget_set_margin_start(view, 6);
313 gtk_widget_set_margin_top(view, 6);
314 gtk_widget_set_hexpand(view, TRUE);
315 gtk_widget_set_vexpand(view, TRUE);
316 g_object_unref(pdialog->diplstates);
317 gtk_widget_set_margin_start(view, 6);
318 gtk_widget_set_margin_end(view, 6);
319 gtk_widget_set_margin_top(view, 6);
320 gtk_widget_set_margin_bottom(view, 6);
321 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
322
323 rend = gtk_cell_renderer_text_new();
324 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
325 "text", 0, NULL);
326 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
327
328 gtk_tree_view_expand_all(GTK_TREE_VIEW(view));
329
330 sw = gtk_scrolled_window_new();
331 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE);
332 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view);
333
334 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
335 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
336
337 label = gtk_label_new_with_mnemonic(_("_Diplomacy"));
338 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label);
339
340 /* techs tab. */
341 pdialog->techs = gtk_list_store_new(2, G_TYPE_BOOLEAN, G_TYPE_STRING);
342 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(pdialog->techs),
343 1, GTK_SORT_ASCENDING);
344
345 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdialog->techs));
346 gtk_widget_set_margin_bottom(view, 6);
347 gtk_widget_set_margin_end(view, 6);
348 gtk_widget_set_margin_start(view, 6);
349 gtk_widget_set_margin_top(view, 6);
350 gtk_widget_set_hexpand(view, TRUE);
351 gtk_widget_set_vexpand(view, TRUE);
352 g_object_unref(pdialog->techs);
353 gtk_widget_set_margin_start(view, 6);
354 gtk_widget_set_margin_end(view, 6);
355 gtk_widget_set_margin_top(view, 6);
356 gtk_widget_set_margin_bottom(view, 6);
357 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
358
359 rend = gtk_cell_renderer_toggle_new();
360 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
361 "active", 0, NULL);
362 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
363
364 rend = gtk_cell_renderer_text_new();
365 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
366 "text", 1, NULL);
367 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
368
369 sw = gtk_scrolled_window_new();
370 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE);
371 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view);
372
373 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
374 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
375
376 label = gtk_label_new_with_mnemonic(_("_Techs"));
377 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label);
378
379 gtk_widget_show(gtk_dialog_get_content_area(GTK_DIALOG(shell)));
380
381 dialog_list_prepend(dialog_list, pdialog);
382
383 return pdialog;
384}
385
386/**********************************************************************/
390 static struct intel_wonder_dialog *create_intel_wonder_dialog(struct player *p)
391{
392 struct intel_wonder_dialog *pdialog;
393 GtkWidget *shell, *sw, *view;
394 GtkCellRenderer *rend;
395 GtkWidget *box;
396
397 pdialog = fc_malloc(sizeof(*pdialog));
398 pdialog->pplayer = p;
399
400 shell = gtk_dialog_new_with_buttons(NULL,
401 NULL,
402 0,
403 _("_Close"),
404 GTK_RESPONSE_CLOSE,
405 NULL);
406 pdialog->shell = shell;
407 gtk_window_set_default_size(GTK_WINDOW(shell), 350, 350);
408 setup_dialog(shell, toplevel);
409 gtk_dialog_set_default_response(GTK_DIALOG(shell), GTK_RESPONSE_CLOSE);
410
411 g_signal_connect(shell, "destroy",
412 G_CALLBACK(intel_wonder_destroy_callback), pdialog);
413 g_signal_connect(shell, "response",
414 G_CALLBACK(gtk_window_destroy), NULL);
415
416
417 pdialog->rule = gtk_label_new("-");
418
419 /* columns: 0 - wonder name, 1 - location (city/unknown/lost),
420 * 2 - strikethrough (for lost or obsolete),
421 * 3 - font weight (great wonders in bold) */
422 pdialog->wonders = gtk_list_store_new(4, G_TYPE_STRING,
423 G_TYPE_STRING,
424 G_TYPE_BOOLEAN,
425 G_TYPE_INT);
426 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(pdialog->wonders),
427 3, GTK_SORT_DESCENDING);
428 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdialog->wonders));
429 gtk_widget_set_margin_bottom(view, 6);
430 gtk_widget_set_margin_end(view, 6);
431 gtk_widget_set_margin_start(view, 6);
432 gtk_widget_set_margin_top(view, 6);
433 gtk_widget_set_hexpand(view, TRUE);
434 gtk_widget_set_vexpand(view, TRUE);
435 g_object_unref(pdialog->wonders);
436 gtk_widget_set_margin_start(view, 6);
437 gtk_widget_set_margin_end(view, 6);
438 gtk_widget_set_margin_top(view, 6);
439 gtk_widget_set_margin_bottom(view, 6);
440 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
441
442 rend = gtk_cell_renderer_text_new();
443 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, NULL,
444 rend, "text", 0,
445 "strikethrough", 2,
446 "weight", 3,
447 NULL);
448
449 rend = gtk_cell_renderer_text_new();
450 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, NULL,
451 rend, "text", 1,
452 NULL);
453
454 sw = gtk_scrolled_window_new();
455 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE);
456 box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
457 gtk_box_append(GTK_BOX(box), pdialog->rule);
458 gtk_box_append(GTK_BOX(box), view);
459 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), box);
460
461 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
462 GTK_POLICY_AUTOMATIC,
463 GTK_POLICY_AUTOMATIC);
464
465 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(shell))), sw);
466
467 gtk_widget_show(gtk_dialog_get_content_area(GTK_DIALOG(shell)));
468
469 wonder_dialog_list_prepend(wonder_dialogs, pdialog);
470
471 return pdialog;
472}
473
474/**********************************************************************/
478 void update_intel_dialog(struct player *p)
479{
480 struct intel_dialog *pdialog = get_intel_dialog(p);
481
482 if (pdialog) {
483 const struct research *mresearch, *presearch;
484 GtkTreeIter diplstates[DS_LAST];
485 int i;
486 bool global_observer = client_is_global_observer();
487 struct player *me = client_player();
488 bool embassy_knowledge = global_observer || team_has_embassy(me->team, p);
489 bool trade_knowledge = global_observer || p == me || could_intel_with_player(me, p);
490
491 /* window title. */
492 gchar *title = g_strdup_printf(_("Foreign Intelligence: %s Empire"),
493 nation_adjective_for_player(p));
494 gtk_window_set_title(GTK_WINDOW(pdialog->shell), title);
495 g_free(title);
496
497 /* diplomacy tab. */
498 gtk_tree_store_clear(pdialog->diplstates);
499
500 for (i = 0; i < ARRAY_SIZE(diplstates); i++) {
501 GtkTreeIter it;
502 GValue v = { 0, };
503
504 gtk_tree_store_append(pdialog->diplstates, &it, NULL);
505 g_value_init(&v, G_TYPE_STRING);
506 g_value_set_static_string(&v, diplstate_type_translated_name(i));
507 gtk_tree_store_set_value(pdialog->diplstates, &it, 0, &v);
508 g_value_unset(&v);
509 diplstates[i] = it;
510 }
511
512 players_iterate(other) {
513 const struct player_diplstate *state;
514 GtkTreeIter it;
515 GValue v = { 0, };
516
517 if (other == p || !other->is_alive) {
518 continue;
519 }
520 state = player_diplstate_get(p, other);
521 gtk_tree_store_append(pdialog->diplstates, &it,
522 &diplstates[state->type]);
523 g_value_init(&v, G_TYPE_STRING);
524 g_value_set_static_string(&v, player_name(other));
525 gtk_tree_store_set_value(pdialog->diplstates, &it, 0, &v);
526 g_value_unset(&v);
527 } players_iterate_end;
528
529 /* techs tab. */
530 gtk_list_store_clear(pdialog->techs);
531
532 mresearch = research_get(client_player());
533 presearch = research_get(p);
534 advance_index_iterate(A_FIRST, advi) {
535 if (research_invention_state(presearch, advi) == TECH_KNOWN) {
536 GtkTreeIter it;
537
538 gtk_list_store_append(pdialog->techs, &it);
539
540 gtk_list_store_set(pdialog->techs, &it,
541 0, research_invention_state(mresearch, advi)
542 != TECH_KNOWN,
543 1, research_advance_name_translation(presearch,
544 advi),
545 -1);
546 }
547 } advance_index_iterate_end;
548
549 /* table labels. */
550 for (i = 0; i < ARRAY_SIZE(pdialog->table_labels); i++) {
551 if (pdialog->table_labels[i]) {
552 struct city *pcity;
553 gchar *buf = NULL;
554 char tbuf[256];
555
556 switch (i) {
557 case LABEL_RULER:
558 ruler_title_for_player(p, tbuf, sizeof(tbuf));
559 buf = g_strdup(tbuf);
560 break;
561 case LABEL_GOVERNMENT:
562 if (trade_knowledge) {
563 buf = g_strdup(government_name_for_player(p));
564 } else {
565 buf = g_strdup(_("(Unknown)"));
566 }
567 break;
568 case LABEL_CAPITAL:
569 pcity = player_primary_capital(p);
570 /* TRANS: "unknown" location */
571 buf = g_strdup((!pcity) ? _("(Unknown)") : city_name_get(pcity));
572 break;
573 case LABEL_GOLD:
574 if (trade_knowledge) {
575 buf = g_strdup_printf("%d", p->economic.gold);
576 } else {
577 buf = g_strdup(_("(Unknown)"));
578 }
579 break;
580 case LABEL_TAX:
581 if (embassy_knowledge) {
582 buf = g_strdup_printf("%d%%", p->economic.tax);
583 } else {
584 buf = g_strdup(_("(Unknown)"));
585 }
586 break;
587 case LABEL_SCIENCE:
588 if (embassy_knowledge) {
589 buf = g_strdup_printf("%d%%", p->economic.science);
590 } else {
591 buf = g_strdup(_("(Unknown)"));
592 }
593 break;
594 case LABEL_LUXURY:
595 if (embassy_knowledge) {
596 buf = g_strdup_printf("%d%%", p->economic.luxury);
597 } else {
598 buf = g_strdup(_("(Unknown)"));
599 }
600 break;
601 case LABEL_RESEARCHING:
602 {
603 struct research *research = research_get(p);
604
605 switch (research->researching) {
606 case A_UNKNOWN:
607 /* TRANS: "Unknown" advance/technology */
608 buf = g_strdup(_("(Unknown)"));
609 break;
610 case A_UNSET:
611 if (embassy_knowledge) {
612 /* TRANS: missing value */
613 buf = g_strdup(_("(none)"));
614 } else {
615 buf = g_strdup(_("(Unknown)"));
616 }
617 break;
618 default:
619 buf = g_strdup_printf("%s(%d/%d)",
620 research_advance_name_translation
621 (research, research->researching),
622 research->bulbs_researched,
623 research->client.researching_cost);
624 break;
625 }
626 break;
627 }
628 case LABEL_CULTURE:
629 if (embassy_knowledge) {
630 buf = g_strdup_printf("%d", p->client.culture);
631 } else {
632 buf = g_strdup(_("(Unknown)"));
633 }
634 break;
635 }
636
637 if (buf) {
638 gtk_label_set_text(GTK_LABEL(pdialog->table_labels[i]), buf);
639 g_free(buf);
640 }
641 }
642 }
643 }
644
645 /* Update also wonders list dialog */
646 update_intel_wonder_dialog(p);
647}
648
649/**********************************************************************/
652 void update_intel_wonder_dialog(struct player *p)
653{
654 struct intel_wonder_dialog *pdialog = get_intel_wonder_dialog(p);
655
656 if (pdialog != NULL) {
657 gchar *title = g_strdup_printf(_("Wonders of %s Empire"),
658 nation_adjective_for_player(p));
659 const char *rule = NULL;
660
661 gtk_window_set_title(GTK_WINDOW(pdialog->shell), title);
662 g_free(title);
663
664 switch (game.info.small_wonder_visibility) {
665 case WV_ALWAYS:
666 rule = _("All Wonders are known");
667 break;
668 case WV_NEVER:
669 rule = _("Small Wonders not known");
670 break;
671 }
672
673 gtk_label_set_text(GTK_LABEL(pdialog->rule), rule);
674
675 gtk_list_store_clear(pdialog->wonders);
676
677 improvement_iterate(impr) {
678 if (is_wonder(impr)) {
679 GtkTreeIter it;
680 const char *cityname;
681 bool is_lost = FALSE;
682
683 if (wonder_is_built(p, impr)) {
684 struct city *pcity = city_from_wonder(p, impr);
685
686 if (pcity) {
687 cityname = city_name_get(pcity);
688 } else {
689 cityname = _("(unknown city)");
690 }
691 if (improvement_obsolete(p, impr, NULL)) {
692 is_lost = TRUE;
693 }
694 } else if (wonder_is_lost(p, impr)) {
695 cityname = _("(lost)");
696 is_lost = TRUE;
697 } else {
698 continue;
699 }
700
701 gtk_list_store_append(pdialog->wonders, &it);
702 gtk_list_store_set(pdialog->wonders, &it,
703 0, improvement_name_translation(impr),
704 1, cityname,
705 2, is_lost,
706 /* font weight: great wonders in bold */
707 3, is_great_wonder(impr) ? 700 : 400,
708 -1);
709 }
710 } improvement_iterate_end;
711 }
712}
city_name_get
const char * city_name_get(const struct city *pcity)
Definition city.c:1111
client_is_global_observer
bool client_is_global_observer(void)
Definition client_main.c:1346
client_main.h
client_player
#define client_player()
Definition client_main.h:106
could_intel_with_player
bool could_intel_with_player(const struct player *pplayer, const struct player *aplayer)
Definition diptreaty.c:81
fcintl.h
_
#define _(String)
Definition fcintl.h:67
N_
#define N_(String)
Definition fcintl.h:69
game
struct civ_game game
Definition game.c:57
ruler_title_for_player
const char * ruler_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition government.c:390
government_name_for_player
const char * government_name_for_player(const struct player *pplayer)
Definition government.c:153
government.h
toplevel
GtkWidget * toplevel
Definition gui_main.c:124
setup_dialog
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:281
popup_intel_dialog
void popup_intel_dialog(struct player *p)
Definition inteldlg.c:166
get_intel_dialog
static struct intel_dialog * get_intel_dialog(struct player *pplayer)
Definition inteldlg.c:137
intel_wonder_destroy_callback
static void intel_wonder_destroy_callback(GtkWidget *w, gpointer data)
Definition inteldlg.c:210
close_intel_wonder_dialog
void close_intel_wonder_dialog(struct player *p)
Definition inteldlg.c:231
get_intel_wonder_dialog
static struct intel_wonder_dialog * get_intel_wonder_dialog(struct player *pplayer)
Definition inteldlg.c:152
close_intel_dialog
void close_intel_dialog(struct player *p)
Definition inteldlg.c:222
wonder_dialog_list_iterate_end
#define wonder_dialog_list_iterate_end
Definition inteldlg.c:108
table_text
static const char * table_text[]
Definition inteldlg.c:47
update_intel_wonder_dialog
void update_intel_wonder_dialog(struct player *p)
Definition inteldlg.c:634
intel_destroy_callback
static void intel_destroy_callback(GtkWidget *w, gpointer data)
Definition inteldlg.c:198
wonder_dialog_list_iterate
#define wonder_dialog_list_iterate(dialoglist, pdialog)
Definition inteldlg.c:106
dialog_list_iterate_end
#define dialog_list_iterate_end
Definition inteldlg.c:92
popup_intel_wonder_dialog
void popup_intel_wonder_dialog(struct player *p)
Definition inteldlg.c:182
dialog_list_iterate
#define dialog_list_iterate(dialoglist, pdialog)
Definition inteldlg.c:90
intel_dialog_done
void intel_dialog_done(void)
Definition inteldlg.c:127
dialog_list
static struct dialog_list * dialog_list
Definition inteldlg.c:110
wonder_dialogs
static struct wonder_dialog_list * wonder_dialogs
Definition inteldlg.c:112
table_label
table_label
Definition inteldlg.c:61
LABEL_GOLD
@ LABEL_GOLD
Definition inteldlg.c:65
LABEL_GOVERNMENT
@ LABEL_GOVERNMENT
Definition inteldlg.c:63
LABEL_SEP2
@ LABEL_SEP2
Definition inteldlg.c:70
LABEL_LUXURY
@ LABEL_LUXURY
Definition inteldlg.c:69
LABEL_SCIENCE
@ LABEL_SCIENCE
Definition inteldlg.c:68
LABEL_RULER
@ LABEL_RULER
Definition inteldlg.c:62
LABEL_CULTURE
@ LABEL_CULTURE
Definition inteldlg.c:72
LABEL_CAPITAL
@ LABEL_CAPITAL
Definition inteldlg.c:64
LABEL_RESEARCHING
@ LABEL_RESEARCHING
Definition inteldlg.c:71
LABEL_TAX
@ LABEL_TAX
Definition inteldlg.c:67
LABEL_SEP1
@ LABEL_SEP1
Definition inteldlg.c:66
LABEL_LAST
@ LABEL_LAST
Definition inteldlg.c:73
create_intel_wonder_dialog
static struct intel_wonder_dialog * create_intel_wonder_dialog(struct player *p)
Definition inteldlg.c:377
intel_dialog_init
void intel_dialog_init(void)
Definition inteldlg.c:118
create_intel_dialog
static struct intel_dialog * create_intel_dialog(struct player *p)
Definition inteldlg.c:242
update_intel_dialog
void update_intel_dialog(struct player *p)
Definition inteldlg.c:460
shell
static struct gui_dialog * shell
Definition messagedlg.c:39
title
const char * title
Definition repodlgs.c:1313
gui_stuff.h
gui_main.h
inteldlg.h
mapview.h
wonder_is_lost
bool wonder_is_lost(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:844
wonder_is_built
bool wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:857
city_from_wonder
struct city * city_from_wonder(const struct player *pplayer, const struct impr_type *pimprove)
Definition improvement.c:872
is_wonder
bool is_wonder(const struct impr_type *pimprove)
Definition improvement.c:341
is_great_wonder
bool is_great_wonder(const struct impr_type *pimprove)
Definition improvement.c:767
improvement_obsolete
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
Definition improvement.c:409
improvement_name_translation
const char * improvement_name_translation(const struct impr_type *pimprove)
Definition improvement.c:241
improvement_iterate_end
#define improvement_iterate_end
Definition improvement.h:211
improvement_iterate
#define improvement_iterate(_p)
Definition improvement.h:205
log.h
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
nation_adjective_for_player
const char * nation_adjective_for_player(const struct player *pplayer)
Definition nation.c:168
options.h
packets.h
player_name
const char * player_name(const struct player *pplayer)
Definition player.c:886
team_has_embassy
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
Definition player.c:214
player_primary_capital
struct city * player_primary_capital(const struct player *pplayer)
Definition player.c:1313
player_diplstate_get
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:317
player.h
players_iterate_end
#define players_iterate_end
Definition player.h:535
players_iterate
#define players_iterate(_pplayer)
Definition player.h:530
research_advance_name_translation
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
Definition research.c:271
research_get
struct research * research_get(const struct player *pplayer)
Definition research.c:126
research_invention_state
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Definition research.c:616
research.h
shared.h
ARRAY_SIZE
#define ARRAY_SIZE(x)
Definition shared.h:85
speclist.h
city
Definition city.h:309
civ_game::info
struct packet_game_info info
Definition game.h:89
intel_dialog
Definition inteldlg.c:77
intel_dialog::shell
GtkWidget * shell
Definition inteldlg.c:79
intel_dialog::diplstates
GtkTreeStore * diplstates
Definition inteldlg.c:81
intel_dialog::techs
GtkListStore * techs
Definition inteldlg.c:82
intel_dialog::pdialog
struct advanced_dialog * pdialog
Definition inteldlg.c:51
intel_dialog::pplayer
struct player * pplayer
Definition inteldlg.c:78
intel_dialog::table_labels
GtkWidget * table_labels[LABEL_LAST]
Definition inteldlg.c:83
intel_wonder_dialog
Definition inteldlg.c:94
intel_wonder_dialog::pplayer
struct player * pplayer
Definition inteldlg.c:95
intel_wonder_dialog::rule
GtkWidget * rule
Definition inteldlg.c:99
intel_wonder_dialog::wonders
GtkListStore * wonders
Definition inteldlg.c:98
intel_wonder_dialog::shell
GtkWidget * shell
Definition inteldlg.c:96
packet_game_info::small_wonder_visibility
enum wonder_visib_type small_wonder_visibility
Definition packets_gen.h:250
player_diplstate
Definition player.h:200
player_diplstate::type
enum diplstate_type type
Definition player.h:201
player_economic::luxury
int luxury
Definition player.h:73
player_economic::science
int science
Definition player.h:72
player_economic::tax
int tax
Definition player.h:71
player_economic::gold
int gold
Definition player.h:70
player
Definition player.h:249
player::diplstates
const struct player_diplstate ** diplstates
Definition player.h:278
player::client
struct player::@69::@72 client
player::team
struct team * team
Definition player.h:261
player::is_alive
bool is_alive
Definition player.h:268
player::economic
struct player_economic economic
Definition player.h:284
player::culture
int culture
Definition player.h:367
research
Definition research.h:39
research::researching
Tech_type_id researching
Definition research.h:52
research::client
struct research::@75::@77 client
research::researching_cost
int researching_cost
Definition research.h:98
research::bulbs_researched
int bulbs_researched
Definition research.h:53
view
Definition mapview_common.h:36
support.h
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
advance_index_iterate_end
#define advance_index_iterate_end
Definition tech.h:248
A_FIRST
#define A_FIRST
Definition tech.h:44
A_UNSET
#define A_UNSET
Definition tech.h:48
A_UNKNOWN
#define A_UNKNOWN
Definition tech.h:49
advance_index_iterate
#define advance_index_iterate(_start, _index)
Definition tech.h:244