Freeciv-3.2
Loading...
Searching...
No Matches
Functions | Variables
plrdlg_common.c File Reference
#include <string.h>
#include "fcintl.h"
#include "log.h"
#include "support.h"
#include "connection.h"
#include "game.h"
#include "government.h"
#include "nation.h"
#include "research.h"
#include "client_main.h"
#include "climisc.h"
#include "options.h"
#include "text.h"
#include "plrdlg_g.h"
#include "plrdlg_common.h"

Go to the source code of this file.

Functions

static const charcol_name (const struct player *player)
 
static int cmp_name (const struct player *pplayer1, const struct player *pplayer2)
 
static const charcol_username (const struct player *player)
 
static const charcol_nation (const struct player *player)
 
static const charcol_team (const struct player *player)
 
static bool col_ai (const struct player *plr)
 
static const charcol_embassy (const struct player *player)
 
static const charcol_diplstate (const struct player *player)
 
static int diplstate_value (const struct player *plr)
 
static int cmp_diplstate (const struct player *player1, const struct player *player2)
 
static const charcol_love (const struct player *player)
 
static int cmp_love (const struct player *player1, const struct player *player2)
 
static const charcol_vision (const struct player *player)
 
const charplrdlg_col_state (const struct player *plr)
 
static const charcol_host (const struct player *pplayer)
 
static const charcol_idle (const struct player *plr)
 
static int cmp_score (const struct player *player1, const struct player *player2)
 
static const charcol_government (const struct player *them)
 
static int cmp_culture (const struct player *player1, const struct player *player2)
 
static const charget_culture_info (const struct player *them)
 
static const charcol_culture (const struct player *pplayer)
 
static int cmp_gold (const struct player *player1, const struct player *player2)
 
static const charget_gold_info (const struct player *them)
 
static const charcol_gold (const struct player *pplayer)
 
static int cmp_tax (const struct player *player1, const struct player *player2)
 
static const charget_tax_info (const struct player *them)
 
static const charcol_tax (const struct player *pplayer)
 
static int cmp_science (const struct player *player1, const struct player *player2)
 
static const charget_science_info (const struct player *them)
 
static const charcol_science (const struct player *pplayer)
 
static int cmp_luxury (const struct player *player1, const struct player *player2)
 
static const charget_luxury_info (const struct player *them)
 
static const charcol_luxury (const struct player *pplayer)
 
static const charget_researching_info (const struct player *them)
 
static const charcol_research (const struct player *pplayer)
 
int player_dlg_default_sort_column (void)
 
void init_player_dlg_common (void)
 

Variables

struct player_dlg_column player_dlg_columns []
 
const int num_player_dlg_columns = ARRAY_SIZE(player_dlg_columns)
 

Function Documentation

◆ cmp_culture()

static int cmp_culture ( const struct player player1,
const struct player player2 
)
static

Compare culture of two players in players dialog, needed to sort column

Definition at line 341 of file plrdlg_common.c.

◆ cmp_diplstate()

static int cmp_diplstate ( const struct player player1,
const struct player player2 
)
static

Compares diplomatic status of two players in players dialog

Definition at line 171 of file plrdlg_common.c.

◆ cmp_gold()

static int cmp_gold ( const struct player player1,
const struct player player2 
)
static

Compare gold of two players in players dialog, needed to sort column

Definition at line 381 of file plrdlg_common.c.

◆ cmp_love()

static int cmp_love ( const struct player player1,
const struct player player2 
)
static

Compares ai's attitude toward the player

Definition at line 193 of file plrdlg_common.c.

◆ cmp_luxury()

static int cmp_luxury ( const struct player player1,
const struct player player2 
)
static

Compare luxury of two players in players dialog, needed to sort column

Definition at line 502 of file plrdlg_common.c.

◆ cmp_name()

static int cmp_name ( const struct player pplayer1,
const struct player pplayer2 
)
static

Compares the names of two players in players dialog.

Definition at line 55 of file plrdlg_common.c.

◆ cmp_science()

static int cmp_science ( const struct player player1,
const struct player player2 
)
static

Compare science of two players in players dialog, needed to sort column

Definition at line 462 of file plrdlg_common.c.

◆ cmp_score()

static int cmp_score ( const struct player player1,
const struct player player2 
)
static

Compare score of two players in players dialog

Definition at line 310 of file plrdlg_common.c.

◆ cmp_tax()

static int cmp_tax ( const struct player player1,
const struct player player2 
)
static

Compare tax of two players in players dialog, needed to sort column

Definition at line 422 of file plrdlg_common.c.

◆ col_ai()

static bool col_ai ( const struct player plr)
static

TRUE if the player is AI-controlled.

Definition at line 88 of file plrdlg_common.c.

◆ col_culture()

static const char * col_culture ( const struct player pplayer)
static

Player's culture value

Definition at line 372 of file plrdlg_common.c.

◆ col_diplstate()

static const char * col_diplstate ( const struct player player)
static

Returns a translated string giving the diplomatic status ("war" or "ceasefire (5)").

Definition at line 109 of file plrdlg_common.c.

◆ col_embassy()

static const char * col_embassy ( const struct player player)
static

Returns a translated string giving the embassy status (none/with us/with them/both).

Definition at line 100 of file plrdlg_common.c.

◆ col_gold()

static const char * col_gold ( const struct player pplayer)
static

Player's gold

Definition at line 413 of file plrdlg_common.c.

◆ col_government()

static const char * col_government ( const struct player them)
static

The name of the player's government

Definition at line 319 of file plrdlg_common.c.

◆ col_host()

static const char * col_host ( const struct player pplayer)
static

Returns a string telling the player's client's hostname (the machine from which they are connecting).

The host is kept as a blank address if no one is controlling the player, even if there is observers.

Definition at line 279 of file plrdlg_common.c.

◆ col_idle()

static const char * col_idle ( const struct player plr)
static

Returns a string telling how many turns the player has been idle.

Definition at line 293 of file plrdlg_common.c.

◆ col_love()

static const char * col_love ( const struct player player)
static

Return a string displaying the AI's love (or not) for you...

Definition at line 180 of file plrdlg_common.c.

◆ col_luxury()

static const char * col_luxury ( const struct player pplayer)
static

Player's luxury rate

Definition at line 533 of file plrdlg_common.c.

◆ col_name()

static const char * col_name ( const struct player player)
static

The player-name (aka nation leader) column of the plrdlg.

Definition at line 47 of file plrdlg_common.c.

◆ col_nation()

static const char * col_nation ( const struct player player)
static

The name of the player's nation for the plrdlg.

Definition at line 72 of file plrdlg_common.c.

◆ col_research()

static const char * col_research ( const struct player pplayer)
static

Player's current research target

Definition at line 566 of file plrdlg_common.c.

◆ col_science()

static const char * col_science ( const struct player pplayer)
static

Player's science rate

Definition at line 493 of file plrdlg_common.c.

◆ col_tax()

static const char * col_tax ( const struct player pplayer)
static

Player's tax rate

Definition at line 453 of file plrdlg_common.c.

◆ col_team()

static const char * col_team ( const struct player player)
static

The name of the player's team (or empty) for the plrdlg.

Definition at line 80 of file plrdlg_common.c.

◆ col_username()

static const char * col_username ( const struct player player)
static

The username (connection name) column of the plrdlg.

Definition at line 64 of file plrdlg_common.c.

◆ col_vision()

static const char * col_vision ( const struct player player)
static

Returns a translated string giving our shared-vision status.

Definition at line 220 of file plrdlg_common.c.

◆ diplstate_value()

static int diplstate_value ( const struct player plr)
static

Return a numerical value suitable for ordering players by their diplomatic status in the players dialog

A lower value stands for more friendly diplomatic status.

Definition at line 135 of file plrdlg_common.c.

Referenced by cmp_diplstate().

◆ get_culture_info()

static const char * get_culture_info ( const struct player them)
static

Show others player's culture to me if I am allowed to know it.

Definition at line 350 of file plrdlg_common.c.

Referenced by col_culture().

◆ get_gold_info()

static const char * get_gold_info ( const struct player them)
static

Show player's gold to me if I am allowed to know it

Definition at line 390 of file plrdlg_common.c.

Referenced by col_gold().

◆ get_luxury_info()

static const char * get_luxury_info ( const struct player them)
static

Show player's luxury to me if I am allowed to know it

Definition at line 511 of file plrdlg_common.c.

Referenced by col_luxury().

◆ get_researching_info()

static const char * get_researching_info ( const struct player them)
static

Show player's research to me if I am allowed to know it

Definition at line 541 of file plrdlg_common.c.

Referenced by col_research().

◆ get_science_info()

static const char * get_science_info ( const struct player them)
static

Show player's science to me if I am allowed to know it

Definition at line 471 of file plrdlg_common.c.

Referenced by col_science().

◆ get_tax_info()

static const char * get_tax_info ( const struct player them)
static

Show player's tax to me if I am allowed to know it.

Definition at line 431 of file plrdlg_common.c.

Referenced by col_tax().

◆ init_player_dlg_common()

void init_player_dlg_common ( void  )

Translate all titles

Definition at line 614 of file plrdlg_common.c.

Referenced by client_main().

◆ player_dlg_default_sort_column()

int player_dlg_default_sort_column ( void  )

Return default player dlg sorting column.

Definition at line 606 of file plrdlg_common.c.

Referenced by create_players_dialog().

◆ plrdlg_col_state()

const char * plrdlg_col_state ( const struct player plr)

Returns a translated string giving the player's "state".

FIXME: These terms aren't very intuitive for new players.

Definition at line 230 of file plrdlg_common.c.

Variable Documentation

◆ num_player_dlg_columns

const int num_player_dlg_columns = ARRAY_SIZE(player_dlg_columns)

◆ player_dlg_columns

struct player_dlg_column player_dlg_columns[]
Initial value:
= {
{TRUE, COL_TEXT, N_("?Player:Name"), col_name, NULL, cmp_name, "name"},
{FALSE, COL_TEXT, N_("Username"), col_username, NULL, NULL, "username"},
{TRUE, COL_FLAG, N_("Flag"), NULL, NULL, NULL, "flag"},
{TRUE, COL_TEXT, N_("Nation"), col_nation, NULL, NULL, "nation"},
{TRUE, COL_COLOR, N_("Border"), NULL, NULL, NULL, "border"},
{TRUE, COL_RIGHT_TEXT, N_("Score"), get_score_text, NULL, cmp_score, "score"},
{TRUE, COL_TEXT, N_("Team"), col_team, NULL, NULL, "team"},
{TRUE, COL_BOOLEAN, N_("AI"), NULL, col_ai, NULL, "ai"},
{TRUE, COL_TEXT, N_("Attitude"), col_love, NULL, cmp_love, "attitude"},
{TRUE, COL_TEXT, N_("Embassy"), col_embassy, NULL, NULL, "embassy"},
"diplstate"},
{TRUE, COL_TEXT, N_("Vision"), col_vision, NULL, NULL, "vision"},
{TRUE, COL_TEXT, N_("State"), plrdlg_col_state, NULL, NULL, "state"},
{FALSE, COL_TEXT, N_("?Player_dlg:Host"), col_host, NULL, NULL, "host"},
{FALSE, COL_RIGHT_TEXT, N_("?Player_dlg:Idle"), col_idle, NULL, NULL, "idle"},
{TRUE, COL_TEXT, N_("Government"), col_government, NULL, NULL, "government"},
{TRUE, COL_RIGHT_TEXT, N_("Culture"), col_culture, NULL, cmp_culture, "culture"},
{TRUE, COL_RIGHT_TEXT, N_("Gold"), col_gold, NULL, cmp_gold, "gold"},
{TRUE, COL_RIGHT_TEXT, N_("Tax"), col_tax, NULL, cmp_tax, "tax"},
{TRUE, COL_RIGHT_TEXT, N_("Science"), col_science, NULL, cmp_science, "science"},
{TRUE, COL_RIGHT_TEXT, N_("Luxury"), col_luxury, NULL, cmp_luxury, "luxury"},
{TRUE, COL_TEXT, N_("Research"), col_research, NULL, NULL, "research"}
}
char * incite_cost
Definition comments.c:75
#define N_(String)
Definition fcintl.h:69
@ COL_TEXT
Definition unitselect.c:50
static const char * col_username(const struct player *player)
static int cmp_name(const struct player *pplayer1, const struct player *pplayer2)
static const char * col_gold(const struct player *pplayer)
static bool col_ai(const struct player *plr)
static int cmp_culture(const struct player *player1, const struct player *player2)
static int cmp_diplstate(const struct player *player1, const struct player *player2)
static const char * col_nation(const struct player *player)
static int cmp_score(const struct player *player1, const struct player *player2)
static int cmp_tax(const struct player *player1, const struct player *player2)
static const char * col_host(const struct player *pplayer)
static const char * col_vision(const struct player *player)
static const char * col_embassy(const struct player *player)
const char * plrdlg_col_state(const struct player *plr)
static const char * col_name(const struct player *player)
static const char * col_team(const struct player *player)
static const char * col_love(const struct player *player)
static int cmp_luxury(const struct player *player1, const struct player *player2)
static const char * col_science(const struct player *pplayer)
static const char * col_government(const struct player *them)
static const char * col_idle(const struct player *plr)
static int cmp_gold(const struct player *player1, const struct player *player2)
static const char * col_diplstate(const struct player *player)
static int cmp_science(const struct player *player1, const struct player *player2)
static const char * col_luxury(const struct player *pplayer)
static const char * col_research(const struct player *pplayer)
static int cmp_love(const struct player *player1, const struct player *player2)
static const char * col_tax(const struct player *pplayer)
static const char * col_culture(const struct player *pplayer)
@ COL_BOOLEAN
@ COL_FLAG
@ COL_RIGHT_TEXT
@ COL_COLOR
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
const char * get_ping_time_text(const struct player *pplayer)
Definition text.c:1621
const char * get_score_text(const struct player *pplayer)
Definition text.c:1650

Definition at line 574 of file plrdlg_common.c.

Referenced by create_players_dialog(), create_plrdlg_display_menu_item(), create_show_menu(), plr_item::data(), plr_widget::display_header_menu(), fill_row(), plr_model::headerData(), plr_model::hide_data(), init_player_dlg_common(), plr_sorter::lessThan(), options_dialogs_set(), options_dialogs_update(), plr_item_delegate::paint(), players_dialog_store_new(), plrdlg_sort_func(), real_players_dialog_update(), toggle_view(), and update_views().