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

Freeciv-3.3

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