Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-gtk-3.22/repodlgs.c File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
repodlgs.c File Reference
`#include <math.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <gtk/gtk.h>`
`#include <gdk/gdkkeysyms.h>`
`#include "fcintl.h"`
`#include "log.h"`
`#include "shared.h"`
`#include "support.h"`
`#include "fc_types.h"`
`#include "game.h"`
`#include "government.h"`
`#include "packets.h"`
`#include "research.h"`
`#include "tech.h"`
`#include "unitlist.h"`
`#include "chatline_common.h"`
`#include "client_main.h"`
`#include "climisc.h"`
`#include "control.h"`
`#include "mapview_common.h"`
`#include "options.h"`
`#include "packhand_gen.h"`
`#include "reqtree.h"`
`#include "text.h"`
`#include "canvas.h"`
`#include "cityrep.h"`
`#include "dialogs.h"`
`#include "gui_main.h"`
`#include "gui_stuff.h"`
`#include "helpdlg.h"`
`#include "plrdlg.h"`
`#include "sprite.h"`
`#include "repodlgs.h"`

Go to the source code of this file.

## Data Structures

class | science_report
struct | economy_report
struct | units_report
class | endgame_report

## Enumerations

enum | science_report_columns { SRD_COL_NAME , SRD_COL_STEPS , SRD_COL_ID , SRD_COL_NUM }
enum | economy_report_response { ERD_RES_SELL_REDUNDANT = 1 , ERD_RES_SELL_ALL , ERD_RES_DISBAND_UNITS }
enum | economy_report_columns { ERD_COL_SPRITE , ERD_COL_NAME , ERD_COL_REDUNDANT , ERD_COL_COUNT , ERD_COL_COST , ERD_COL_TOTAL_COST , ERD_COL_EMPTY , ERD_COL_IS_IMPROVEMENT , ERD_COL_CID , ERD_COL_NUM }
enum | units_report_response { URD_RES_NEAREST = 1 , URD_RES_UPGRADE }

enum

units_report_columns {
URD_COL_UTYPE_NAME , URD_COL_UPGRADABLE , URD_COL_N_UPGRADABLE , URD_COL_IN_PROGRESS ,
URD_COL_ACTIVE , URD_COL_SHIELD , URD_COL_FOOD , URD_COL_GOLD ,
URD_COL_EMPTY , URD_COL_TEXT_WEIGHT , URD_COL_UPG_VISIBLE , URD_COL_NUPG_VISIBLE ,
URD_COL_UTYPE_ID , URD_COL_NUM
}

enum | endgame_report_columns { FRD_COL_PLAYER , FRD_COL_NATION , FRD_COL_SCORE , FRD_COL_TOOLTIP , FRD_COL_NUM }

## Functions

static GtkListStore * | science_report_store_new (void)
static void | science_report_store_set (GtkListStore *store, GtkTreeIter *iter, Tech_type_id tech)
static bool | science_report_combo_get_active (GtkComboBox *combo, Tech_type_id *tech, char **name)
static void | science_report_combo_set_active (GtkComboBox *combo, Tech_type_id tech)
static gboolean | science_diagram_button_release_callback (GtkWidget *widget, GdkEventButton *event, gpointer data)
static gboolean | science_diagram_update (GtkWidget *widget, cairo_t *cr, gpointer data)
static GtkWidget * | science_diagram_new (void)
static void | science_diagram_data (GtkWidget *widget, bool show_all)
static void | science_diagram_center (GtkWidget *diagram, Tech_type_id tech)
static void | science_report_redraw (struct science_report *preport)
static gint | cmp_func (gconstpointer a_p, gconstpointer b_p)
static void | science_report_update (struct science_report *preport)
static void | science_report_current_callback (GtkComboBox *combo, gpointer data)
static void | science_report_show_all_callback (GtkComboBox *combo, gpointer data)
static void | science_report_goal_callback (GtkComboBox *combo, gpointer data)
static void | science_report_init (struct science_report *preport)
static void | science_report_free (struct science_report *preport)
void | science_report_dialog_popup (bool raise)
void | science_report_dialog_popdown (void)
void | real_science_report_dialog_update (void *unused)
void | science_report_dialog_redraw (void)
static GtkListStore * | economy_report_store_new (void)
static const char * | economy_report_column_name (enum economy_report_columns col)
static void | economy_report_update (struct economy_report *preport)
static void | economy_report_command_callback (struct gui_dialog *pdialog, int response, gpointer data)
static void | economy_report_selection_callback (GtkTreeSelection *selection, gpointer data)
static void | economy_report_init (struct economy_report *preport)
static void | economy_report_free (struct economy_report *preport)
void | economy_report_dialog_popup (bool raise)
void | economy_report_dialog_popdown (void)
void | real_economy_report_dialog_update (void *unused)
static GtkListStore * | units_report_store_new (void)
static void | units_report_update (struct units_report *preport)
static void | units_report_selection_callback (GtkTreeSelection *selection, gpointer data)
static struct unit * | find_nearest_unit (const struct unit_type *utype, struct tile *ptile)
static void | units_report_command_callback (struct gui_dialog *pdialog, int response, gpointer data)
static void | units_report_init (struct units_report *preport)
static void | units_report_free (struct units_report *preport)
void | units_report_dialog_popup (bool raise)
void | units_report_dialog_popdown (void)
void | real_units_report_dialog_update (void *unused)
static const char * | endgame_report_column_name (enum endgame_report_columns col)
static void | endgame_report_update (struct endgame_report *preport, const struct packet_endgame_report *packet)
void | endgame_report_dialog_player (const struct packet_endgame_player *packet)
static void | endgame_report_init (struct endgame_report *preport)
void | endgame_report_dialog_start (const struct packet_endgame_report *packet)

## Variables

static struct science_report | science_report = { NULL, }
static bool | science_report_no_combo_callback = FALSE
static struct economy_report | economy_report = { NULL, NULL, NULL }
static struct units_report | units_report = { NULL, NULL }
struct { |
GType type |
const char * title |
const char * tooltip |
bool rightalign |
int visible_col |
} | unit_report_columns [] |
static struct endgame_report | endgame_report = { NULL, NULL }

## Enumeration Type Documentation

## ◆ economy_report_columns

enum economy_report_columns

Enumerator
ERD_COL_SPRITE |
ERD_COL_NAME |
ERD_COL_REDUNDANT |
ERD_COL_COUNT |
ERD_COL_COST |
ERD_COL_TOTAL_COST |
ERD_COL_EMPTY |
ERD_COL_IS_IMPROVEMENT |
ERD_COL_CID |
ERD_COL_NUM |

Definition at line 787 of file repodlgs.c.

## ◆ economy_report_response

enum economy_report_response

Enumerator
ERD_RES_SELL_REDUNDANT |
ERD_RES_SELL_ALL |
ERD_RES_DISBAND_UNITS |

Definition at line 779 of file repodlgs.c.

## ◆ endgame_report_columns

enum endgame_report_columns

Enumerator
FRD_COL_PLAYER |
FRD_COL_NATION |
FRD_COL_SCORE |
FRD_COL_TOOLTIP |
FRD_COL_NUM |

Definition at line 1810 of file repodlgs.c.

## ◆ science_report_columns

enum science_report_columns

Enumerator
SRD_COL_NAME |
SRD_COL_STEPS |
SRD_COL_ID |
SRD_COL_NUM |

Definition at line 112 of file repodlgs.c.

## ◆ units_report_columns

enum units_report_columns

Enumerator
URD_COL_UTYPE_NAME |
URD_COL_UPGRADABLE |
URD_COL_N_UPGRADABLE |
URD_COL_IN_PROGRESS |
URD_COL_ACTIVE |
URD_COL_SHIELD |
URD_COL_FOOD |
URD_COL_GOLD |
URD_COL_EMPTY |
URD_COL_TEXT_WEIGHT |
URD_COL_UPG_VISIBLE |
URD_COL_NUPG_VISIBLE |
URD_COL_UTYPE_ID |
URD_COL_NUM |

Definition at line 1290 of file repodlgs.c.

## ◆ units_report_response

enum units_report_response

Enumerator
URD_RES_NEAREST |
URD_RES_UPGRADE |

Definition at line 1284 of file repodlgs.c.

## Function Documentation

## ◆ cmp_func()

static gint cmp_func | ( | gconstpointer | a_p,
|  | gconstpointer | b_p
| ) |  |

static

Utility for g_list_sort.

Definition at line 368 of file repodlgs.c.

## ◆ economy_report_column_name()

static const char * economy_report_column_name | ( | enum economy_report_columns | col | ) |

static

Returns the title of the column (translated).

Definition at line 825 of file repodlgs.c.

## ◆ economy_report_command_callback()

static void economy_report_command_callback | ( | struct gui_dialog * | pdialog,
|  | int | response,
|  | gpointer | data
| ) |  |

static

Issue a command on the economy report.

Definition at line 951 of file repodlgs.c.

## ◆ economy_report_dialog_popdown()

void economy_report_dialog_popdown | ( | void |  | ) |

Close the economy report dialog.

Definition at line 1256 of file repodlgs.c.

## ◆ economy_report_dialog_popup()

void economy_report_dialog_popup | ( | bool | raise | ) |

Create the economy report if needed.

Definition at line 1241 of file repodlgs.c.

## ◆ economy_report_free()

static void economy_report_free | ( | struct economy_report * | preport | ) |

static

Free an economy report.

Definition at line 1228 of file repodlgs.c.

## ◆ economy_report_init()

static void economy_report_init | ( | struct economy_report * | preport | ) |

static

Create a new economy report.

Definition at line 1115 of file repodlgs.c.

## ◆ economy_report_selection_callback()

static void economy_report_selection_callback | ( | GtkTreeSelection * | selection,
|  | gpointer | data
| ) |  |

static

Called when a building or a unit type is selected in the economy list.

Definition at line 1066 of file repodlgs.c.

## ◆ economy_report_store_new()

static GtkListStore * economy_report_store_new | ( | void |  | ) |

static

Create a new economy report list store.

Definition at line 806 of file repodlgs.c.

## ◆ economy_report_update()

static void economy_report_update | ( | struct economy_report * | preport | ) |

static

Update the economy report dialog.

Definition at line 857 of file repodlgs.c.

## ◆ endgame_report_column_name()

static const char * endgame_report_column_name | ( | enum endgame_report_columns | col | ) |

static

Returns the title of the column (translated).

Definition at line 1825 of file repodlgs.c.

## ◆ endgame_report_dialog_player()

void endgame_report_dialog_player | ( | const struct packet_endgame_player * | packet | ) |

Handle endgame report information about one player.

Definition at line 1914 of file repodlgs.c.

## ◆ endgame_report_dialog_start()

void endgame_report_dialog_start | ( | const struct packet_endgame_report * | packet | ) |

Start building a dialog with player statistics at endgame.

Definition at line 1980 of file repodlgs.c.

## ◆ endgame_report_init()

static void endgame_report_init | ( | struct endgame_report * | preport | ) |

static

Prepare a final report.

Definition at line 1945 of file repodlgs.c.

## ◆ endgame_report_update()

static void endgame_report_update | ( | struct endgame_report * | preport,
|  | const struct packet_endgame_report * | packet
| ) |  |

static

Fill a final report with statistics for each player.

Definition at line 1845 of file repodlgs.c.

## ◆ find_nearest_unit()

static struct unit * find_nearest_unit | ( | const struct unit_type * | utype,
|  | struct tile * | ptile
| ) |  |

static

Returns the nearest unit of the type 'utype'.

Definition at line 1536 of file repodlgs.c.

## ◆ real_economy_report_dialog_update()

void real_economy_report_dialog_update | ( | void * | unused | ) |

Update the economy report dialog.

Definition at line 1266 of file repodlgs.c.

## ◆ real_science_report_dialog_update()

void real_science_report_dialog_update | ( | void * | unused | ) |

Update the science report dialog.

Definition at line 750 of file repodlgs.c.

## ◆ real_units_report_dialog_update()

void real_units_report_dialog_update | ( | void * | unused | ) |

Update the units report dialog.

Definition at line 1791 of file repodlgs.c.

## ◆ science_diagram_button_release_callback()

static gboolean science_diagram_button_release_callback | ( | GtkWidget * | widget,
|  | GdkEventButton * | event,
|  | gpointer | data
| ) |  |

static

Change tech goal, research or open help dialog.

Definition at line 197 of file repodlgs.c.

## ◆ science_diagram_center()

static void science_diagram_center | ( | GtkWidget * | diagram,
|  | Tech_type_id | tech
| ) |  |

static

Set the diagram parent to point to 'tech' location.

Definition at line 312 of file repodlgs.c.

## ◆ science_diagram_data()

static void science_diagram_data | ( | GtkWidget * | widget,
|  | bool | show_all
| ) |  |

static

Recreate the req tree.

Definition at line 290 of file repodlgs.c.

## ◆ science_diagram_new()

static GtkWidget * science_diagram_new | ( | void |  | ) |

static

Return the drawing area widget of new technology diagram. Set in 'x' the position of the current tech to center to it.

Definition at line 270 of file repodlgs.c.

## ◆ science_diagram_update()

static gboolean science_diagram_update | ( | GtkWidget * | widget,
|  | cairo_t * | cr,
|  | gpointer | data
| ) |  |

static

Draw the invalidated portion of the reqtree.

Definition at line 235 of file repodlgs.c.

## ◆ science_report_combo_get_active()

static bool science_report_combo_get_active | ( | GtkComboBox * | combo,
|  | Tech_type_id * | tech,
|  | char ** | name
| ) |  |

static

Get the active tech of the combo.

Definition at line 154 of file repodlgs.c.

## ◆ science_report_combo_set_active()

static void science_report_combo_set_active | ( | GtkComboBox * | combo,
|  | Tech_type_id | tech
| ) |  |

static

Set the active tech of the combo.

Definition at line 175 of file repodlgs.c.

## ◆ science_report_current_callback()

static void science_report_current_callback | ( | GtkComboBox * | combo,
|  | gpointer | data
| ) |  |

static

Activated item in the reachable techs combo box.

Definition at line 519 of file repodlgs.c.

## ◆ science_report_dialog_popdown()

void science_report_dialog_popdown | ( | void |  | ) |

Closes the science report dialog.

Definition at line 739 of file repodlgs.c.

## ◆ science_report_dialog_popup()

void science_report_dialog_popup | ( | bool | raise | ) |

Create the science report is needed.

Definition at line 715 of file repodlgs.c.

## ◆ science_report_dialog_redraw()

void science_report_dialog_redraw | ( | void |  | ) |

Resize and redraw the requirement tree.

Definition at line 760 of file repodlgs.c.

## ◆ science_report_free()

static void science_report_free | ( | struct science_report * | preport | ) |

static

Free a science report.

Definition at line 702 of file repodlgs.c.

## ◆ science_report_goal_callback()

static void science_report_goal_callback | ( | GtkComboBox * | combo,
|  | gpointer | data
| ) |  |

static

Activated item in the reachable goals combo box.

Definition at line 555 of file repodlgs.c.

## ◆ science_report_init()

static void science_report_init | ( | struct science_report * | preport | ) |

static

Initialize a science report.

Definition at line 579 of file repodlgs.c.

## ◆ science_report_redraw()

static void science_report_redraw | ( | struct science_report * | preport | ) |

static

Resize and redraw the requirement tree.

Definition at line 345 of file repodlgs.c.

## ◆ science_report_show_all_callback()

static void science_report_show_all_callback | ( | GtkComboBox * | combo,
|  | gpointer | data
| ) |  |

static

Show or hide unreachable techs.

Definition at line 544 of file repodlgs.c.

## ◆ science_report_store_new()

static GtkListStore * science_report_store_new | ( | void |  | ) |

static

Create a science report list store.

Definition at line 125 of file repodlgs.c.

## ◆ science_report_store_set()

static void science_report_store_set | ( | GtkListStore * | store,
|  | GtkTreeIter * | iter,
|  | Tech_type_id | tech
| ) |  |

inlinestatic

Append a technology to the list store.

Definition at line 136 of file repodlgs.c.

## ◆ science_report_update()

static void science_report_update | ( | struct science_report * | preport | ) |

static

Update a science report dialog.

Definition at line 383 of file repodlgs.c.

## ◆ units_report_command_callback()

static void units_report_command_callback | ( | struct gui_dialog * | pdialog,
|  | int | response,
|  | gpointer | data
| ) |  |

static

Gui dialog handler.

Definition at line 1568 of file repodlgs.c.

## ◆ units_report_dialog_popdown()

void units_report_dialog_popdown | ( | void |  | ) |

Closes the units report dialog.

Definition at line 1780 of file repodlgs.c.

## ◆ units_report_dialog_popup()

void units_report_dialog_popup | ( | bool | raise | ) |

Create the units report if needed.

Definition at line 1765 of file repodlgs.c.

## ◆ units_report_free()

static void units_report_free | ( | struct units_report * | preport | ) |

static

Free an units report.

Definition at line 1752 of file repodlgs.c.

## ◆ units_report_init()

static void units_report_init | ( | struct units_report * | preport | ) |

static

Create a units report.

Definition at line 1650 of file repodlgs.c.

## ◆ units_report_selection_callback()

static void units_report_selection_callback | ( | GtkTreeSelection * | selection,
|  | gpointer | data
| ) |  |

static

GtkTreeSelection "changed" signal handler.

Definition at line 1498 of file repodlgs.c.

## ◆ units_report_store_new()

static GtkListStore * units_report_store_new | ( | void |  | ) |

static

Create a new units report list store.

Definition at line 1346 of file repodlgs.c.

## ◆ units_report_update()

static void units_report_update | ( | struct units_report * | preport | ) |

static

Update the units report.

Definition at line 1362 of file repodlgs.c.

## Variable Documentation

## ◆ economy_report

struct economy_report economy_report = { NULL, NULL, NULL }

static

Definition at line 777 of file repodlgs.c.

## ◆ endgame_report

struct endgame_report endgame_report = { NULL, NULL }

static

Definition at line 1819 of file repodlgs.c.

## ◆ rightalign

bool rightalign

Definition at line 1314 of file repodlgs.c.

## ◆ science_report

struct science_report science_report = { NULL, }

static

Definition at line 108 of file repodlgs.c.

## ◆ science_report_no_combo_callback

bool science_report_no_combo_callback = FALSE

static

Definition at line 109 of file repodlgs.c.

## ◆ title

const char* title

Definition at line 1312 of file repodlgs.c.

## ◆ tooltip

const char* tooltip

Definition at line 1313 of file repodlgs.c.

## ◆ type

GType type

Definition at line 1311 of file repodlgs.c.

## ◆ [struct]

const struct { ... } unit_report_columns[]

Initial value:
= {
{ G_TYPE_STRING, N_("Unit Type"),
NULL, FALSE, -1 },
{ G_TYPE_BOOLEAN, N_("?Upgradable unit [short]:U"),
N_("Upgradable"), TRUE, URD_COL_UPG_VISIBLE },
{ G_TYPE_INT, "" ,
NULL, TRUE, URD_COL_NUPG_VISIBLE },
{ G_TYPE_INT, N_("In-Prog"),
N_("In progress"), TRUE, -1 },
{ G_TYPE_INT, N_("Active"),
NULL, TRUE, -1 },
{ G_TYPE_INT, N_("Shield"),
N_("Total shield upkeep"), TRUE, -1 },
{ G_TYPE_INT, N_("Food"),
N_("Total food upkeep"), TRUE, -1 },
{ G_TYPE_INT, N_("Gold"),
N_("Total gold upkeep"), TRUE, -1 },
{ G_TYPE_STRING, " ",
" ", TRUE, -1 },
{ G_TYPE_INT, NULL },
{ G_TYPE_BOOLEAN, NULL },
{ G_TYPE_BOOLEAN, NULL },
{ G_TYPE_INT, NULL }
}
N_
#define N_(String)
Definition fcintl.h:69
URD_COL_UPG_VISIBLE
@ URD_COL_UPG_VISIBLE
Definition repodlgs.c:1304
URD_COL_NUPG_VISIBLE
@ URD_COL_NUPG_VISIBLE
Definition repodlgs.c:1305
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47

## ◆ units_report

struct units_report units_report = { NULL, NULL }

static

Definition at line 1282 of file repodlgs.c.

## ◆ visible_col

int visible_col

Definition at line 1315 of file repodlgs.c.