Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
score.c File Reference
#include <stdio.h>
#include <string.h>
#include "bitvector.h"
#include "log.h"
#include "mem.h"
#include "shared.h"
#include "culture.h"
#include "game.h"
#include "improvement.h"
#include "map.h"
#include "player.h"
#include "research.h"
#include "specialist.h"
#include "unit.h"
#include "unitlist.h"
#include "plrhand.h"
#include "score.h"
#include "srv_main.h"

Go to the source code of this file.

Data Structures

struct  claim_map
 

Macros

#define USER_AREA_MULT   1000
 
#define LAND_AREA_DEBUG   0
 

Functions

static int get_spaceship_score (const struct player *pplayer)
 
static void build_landarea_map (struct claim_map *pcmap)
 
static void get_player_landarea (struct claim_map *pcmap, struct player *pplayer, int *return_landarea, int *return_settledarea)
 
void calc_civ_score (struct player *pplayer)
 
static int get_units_score (const struct player *pplayer)
 
int get_civ_score (const struct player *pplayer)
 
int total_player_citizens (const struct player *pplayer)
 
void rank_users (bool interrupt)
 

Macro Definition Documentation

◆ LAND_AREA_DEBUG

#define LAND_AREA_DEBUG   0

Definition at line 62 of file score.c.

◆ USER_AREA_MULT

#define USER_AREA_MULT   1000

Definition at line 50 of file score.c.

Function Documentation

◆ build_landarea_map()

static void build_landarea_map ( struct claim_map pcmap)
static

Count landarea, settled area, and claims map for all players.

Definition at line 161 of file score.c.

Referenced by calc_civ_score().

◆ calc_civ_score()

void calc_civ_score ( struct player pplayer)

Calculates the civilization score for the player.

Definition at line 251 of file score.c.

Referenced by begin_turn(), sg_load_sanitycheck(), and srv_scores().

◆ get_civ_score()

int get_civ_score ( const struct player pplayer)

Return the civilization score (a numerical value) for the player.

Definition at line 352 of file score.c.

Referenced by api_server_player_civilization_score(), calc_civ_score(), and rank_users().

◆ get_player_landarea()

static void get_player_landarea ( struct claim_map pcmap,
struct player pplayer,
int return_landarea,
int return_settledarea 
)
static

Returns the given player's land and settled areas from a claim map.

Definition at line 219 of file score.c.

Referenced by calc_civ_score().

◆ get_spaceship_score()

static int get_spaceship_score ( const struct player pplayer)
static

Return the spaceship score

Definition at line 367 of file score.c.

Referenced by get_civ_score().

◆ get_units_score()

static int get_units_score ( const struct player pplayer)
static

Return the score given by the units stats.

Definition at line 343 of file score.c.

Referenced by get_civ_score().

◆ rank_users()

void rank_users ( bool  interrupt)

At the end of a game, figure the winners and losers of the game and output to a suitable place.

The definition of winners and losers: a winner is one who is alive at the end of the game and has not surrendered, or in the case of a team game, is alive or a teammate is alive and has not surrendered. A loser is surrendered or dead. Exception: the winner of the spacerace and their teammates will win of course.

In games ended by /endgame, endturn, or any other interruption not caused by satisfaction of victory conditions, for each team is calculated the sum of the scores of any belonging member which is alive and has not surrendered; all the players in the team with the higest sum of scores win. This condition is signaled to the function by the boolean "interrupt".

Barbarians do not count as winners or losers.

If interrupt is true, rank players by team score rather than by alive/dead status.

Definition at line 417 of file score.c.

Referenced by srv_running().

◆ total_player_citizens()

int total_player_citizens ( const struct player pplayer)

Return the total number of citizens in the player's nation.

Definition at line 382 of file score.c.

Referenced by dai_gold_reserve(), end_turn(), get_civ_score(), get_pop(), and historian_generic().