Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/plrdlg_common.c File Reference

Freeciv-3.1

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 "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 char * | col_name (const struct player *player)
static int | cmp_name (const struct player *pplayer1, const struct player *pplayer2)
static const char * | col_username (const struct player *player)
static const char * | col_nation (const struct player *player)
static const char * | col_team (const struct player *player)
static bool | col_ai (const struct player *plr)
static const char * | col_embassy (const struct player *player)
static const char * | col_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 char * | col_love (const struct player *player)
static int | cmp_love (const struct player *player1, const struct player *player2)
static const char * | col_vision (const struct player *player)
const char * | plrdlg_col_state (const struct player *plr)
static const char * | col_host (const struct player *player)
static const char * | col_idle (const struct player *plr)
static int | cmp_score (const struct player *player1, const struct player *player2)
static const char * | col_government (const struct player *them)
static int | cmp_culture (const struct player *player1, const struct player *player2)
static const char * | get_culture_info (const struct player *them)
static const char * | col_culture (const struct player *pplayer)
static int | cmp_gold (const struct player *player1, const struct player *player2)
static const char * | get_gold_info (const struct player *them)
static const char * | col_gold (const struct player *pplayer)
static int | cmp_tax (const struct player *player1, const struct player *player2)
static const char * | get_tax_info (const struct player *them)
static const char * | col_tax (const struct player *pplayer)
static int | cmp_science (const struct player *player1, const struct player *player2)
static const char * | get_science_info (const struct player *them)
static const char * | col_science (const struct player *pplayer)
static int | cmp_luxury (const struct player *player1, const struct player *player2)
static const char * | get_luxury_info (const struct player *them)
static const char * | col_luxury (const struct player *pplayer)
static const char * | get_researching_info (const struct player *them)
static const char * | col_research (const struct player *pplayer)
int | player_dlg_default_sort_column (void)
void | init_player_dlg_common (void)
const char * | player_addr_hack (const struct player *pplayer)

## 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 331 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 170 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 371 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 192 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 492 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 54 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 452 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 300 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 412 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 87 of file plrdlg_common.c.

## ◆ col_culture()

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

static

Player's culture value

Definition at line 362 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 108 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 99 of file plrdlg_common.c.

## ◆ col_gold()

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

static

Player's gold

Definition at line 403 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 309 of file plrdlg_common.c.

## ◆ col_host()

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

static

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

Definition at line 275 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 283 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 179 of file plrdlg_common.c.

## ◆ col_luxury()

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

static

Player's luxury rate

Definition at line 523 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 46 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 71 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 556 of file plrdlg_common.c.

## ◆ col_science()

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

static

Player's science rate

Definition at line 483 of file plrdlg_common.c.

## ◆ col_tax()

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

static

Player's tax rate

Definition at line 443 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 79 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 63 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 219 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 134 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 340 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 380 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 501 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 531 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 461 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 421 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 604 of file plrdlg_common.c.

Referenced by client_main().

## ◆ player_addr_hack()

const char * player_addr_hack | ( | const struct player * | pplayer | ) |

The only place where this is used is the player dialog. Eventually this should go the way of the dodo with everything here moved into col_host above.

This code in this function is only really needed so that the host is kept as a blank address if no one is controlling a player, but there are observers.

Definition at line 622 of file plrdlg_common.c.

Referenced by col_host().

## ◆ player_dlg_default_sort_column()

int player_dlg_default_sort_column | ( | void |  | ) |

Return default player dlg sorting column.

Definition at line 596 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 229 of file plrdlg_common.c.

## Variable Documentation

## ◆ num_player_dlg_columns

const int num_player_dlg_columns = ARRAY_SIZE(player_dlg_columns)

Definition at line 591 of file plrdlg_common.c.

Referenced by plr_item::columnCount(), plr_model::columnCount(), create_players_dialog(), create_show_menu(), create_show_menu(), fill_row(), plr_model::headerData(), init_player_dlg_common(), options_dialogs_set(), options_dialogs_update(), players_dialog_store_new(), real_players_dialog_update(), and update_views().

## ◆ 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"},
{TRUE, COL_TEXT, N_("Dipl.State"), col_diplstate, NULL, cmp_diplstate,
"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"},
{FALSE, COL_RIGHT_TEXT, N_("Ping"), get_ping_time_text, NULL, NULL, "ping"},
{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"}
}
N_
#define N_(String)
Definition fcintl.h:69
COL_TEXT
@ COL_TEXT
Definition unitselect.c:50
col_username
static const char * col_username(const struct player *player)
Definition plrdlg_common.c:63
cmp_name
static int cmp_name(const struct player *pplayer1, const struct player *pplayer2)
Definition plrdlg_common.c:54
col_gold
static const char * col_gold(const struct player *pplayer)
Definition plrdlg_common.c:403
col_ai
static bool col_ai(const struct player *plr)
Definition plrdlg_common.c:87
cmp_culture
static int cmp_culture(const struct player *player1, const struct player *player2)
Definition plrdlg_common.c:331
cmp_diplstate
static int cmp_diplstate(const struct player *player1, const struct player *player2)
Definition plrdlg_common.c:170
col_nation
static const char * col_nation(const struct player *player)
Definition plrdlg_common.c:71
cmp_score
static int cmp_score(const struct player *player1, const struct player *player2)
Definition plrdlg_common.c:300
cmp_tax
static int cmp_tax(const struct player *player1, const struct player *player2)
Definition plrdlg_common.c:412
col_vision
static const char * col_vision(const struct player *player)
Definition plrdlg_common.c:219
col_embassy
static const char * col_embassy(const struct player *player)
Definition plrdlg_common.c:99
plrdlg_col_state
const char * plrdlg_col_state(const struct player *plr)
Definition plrdlg_common.c:229
col_name
static const char * col_name(const struct player *player)
Definition plrdlg_common.c:46
col_team
static const char * col_team(const struct player *player)
Definition plrdlg_common.c:79
col_love
static const char * col_love(const struct player *player)
Definition plrdlg_common.c:179
cmp_luxury
static int cmp_luxury(const struct player *player1, const struct player *player2)
Definition plrdlg_common.c:492
col_science
static const char * col_science(const struct player *pplayer)
Definition plrdlg_common.c:483
col_government
static const char * col_government(const struct player *them)
Definition plrdlg_common.c:309
col_idle
static const char * col_idle(const struct player *plr)
Definition plrdlg_common.c:283
cmp_gold
static int cmp_gold(const struct player *player1, const struct player *player2)
Definition plrdlg_common.c:371
col_diplstate
static const char * col_diplstate(const struct player *player)
Definition plrdlg_common.c:108
cmp_science
static int cmp_science(const struct player *player1, const struct player *player2)
Definition plrdlg_common.c:452
col_luxury
static const char * col_luxury(const struct player *pplayer)
Definition plrdlg_common.c:523
col_host
static const char * col_host(const struct player *player)
Definition plrdlg_common.c:275
col_research
static const char * col_research(const struct player *pplayer)
Definition plrdlg_common.c:556
cmp_love
static int cmp_love(const struct player *player1, const struct player *player2)
Definition plrdlg_common.c:192
col_tax
static const char * col_tax(const struct player *pplayer)
Definition plrdlg_common.c:443
col_culture
static const char * col_culture(const struct player *pplayer)
Definition plrdlg_common.c:362
COL_BOOLEAN
@ COL_BOOLEAN
Definition plrdlg_common.h:31
COL_FLAG
@ COL_FLAG
Definition plrdlg_common.h:29
COL_RIGHT_TEXT
@ COL_RIGHT_TEXT
Definition plrdlg_common.h:33
COL_COLOR
@ COL_COLOR
Definition plrdlg_common.h:30
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
get_ping_time_text
const char * get_ping_time_text(const struct player *pplayer)
Definition text.c:1654
get_score_text
const char * get_score_text(const struct player *pplayer)
Definition text.c:1683

Definition at line 564 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().