Freeciv21
Develop your civilization from humble roots to a global empire
score.cpp File Reference
#include <cstdio>
#include <cstring>
#include <QString>
#include "bitvector.h"
#include "log.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"
+ Include dependency graph for score.cpp:

Go to the source code of this file.

Classes

struct  claim_map
 

Macros

#define USER_AREA_MULT   1000
 Allocates, fills and returns a land area claim map. More...
 
#define LAND_AREA_DEBUG   0
 Land Area Debug... More...
 

Functions

static int get_spaceship_score (const struct player *pplayer)
 Return the spaceship score. More...
 
static void build_landarea_map (struct claim_map *pcmap)
 Count landarea, settled area, and claims map for all players. More...
 
static void get_player_landarea (struct claim_map *pcmap, struct player *pplayer, int *return_landarea, int *return_settledarea)
 Returns the given player's land and settled areas from a claim map. More...
 
void calc_civ_score (struct player *pplayer)
 Calculates the civilization score for the player. More...
 
static int get_units_score (const struct player *pplayer)
 Return the score given by the units stats. More...
 
int get_civ_score (const struct player *pplayer)
 Return the civilization score (a numerical value) for the player. More...
 
int total_player_citizens (const struct player *pplayer)
 Return the total number of citizens in the player's nation. More...
 
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. More...
 

Macro Definition Documentation

◆ LAND_AREA_DEBUG

#define LAND_AREA_DEBUG   0

Land Area Debug...

Definition at line 58 of file score.cpp.

◆ USER_AREA_MULT

#define USER_AREA_MULT   1000

Allocates, fills and returns a land area claim map.

Call free_landarea_map(&cmap) to free allocated memory.

Definition at line 46 of file score.cpp.

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 159 of file score.cpp.

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 255 of file score.cpp.

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 380 of file score.cpp.

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 224 of file score.cpp.

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 392 of file score.cpp.

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 372 of file score.cpp.

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 his 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 440 of file score.cpp.

Referenced by freeciv::server::end_turn().

◆ 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 408 of file score.cpp.

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