Freeciv-3.3
Loading...
Searching...
No Matches
Functions | Variables
counters.c File Reference
#include <stdlib.h>
#include "game.h"
#include "fcintl.h"
#include "counters.h"

Go to the source code of this file.

Functions

void counters_init (void)
 
void counters_free (void)
 
int counters_get_city_counters_count (void)
 
struct counter * counter_by_id (int id)
 
void attach_city_counter (struct counter *counter)
 
int counter_id (struct counter *pcount)
 
struct counter * counter_by_rule_name (const char *name)
 
struct counter * counter_by_translated_name (const char *name)
 
const char * counter_name_translation (const struct counter *counter)
 
const char * counter_rule_name (struct counter *pcount)
 
int counter_index (const struct counter *pcount)
 
struct counter * counter_by_index (int index, enum counter_target target)
 

Variables

static struct counter counters [MAX_COUNTERS]
 
static struct counter * counters_city [MAX_COUNTERS]
 
static int number_city_counters
 

Function Documentation

◆ attach_city_counter()

void attach_city_counter ( struct counter *  counter)

Attaching given counter type to array containing counter type related to cities. Counter must be present in array for each counter in game, but we do not check this.

Definition at line 94 of file counters.c.

Referenced by tab_counter::add_now(), handle_ruleset_counter(), and load_ruleset_game().

◆ counter_by_id()

struct counter * counter_by_id ( int  id)

◆ counter_by_index()

struct counter * counter_by_index ( int  index,
enum counter_target  target 
)

Return counter by given index

Definition at line 183 of file counters.c.

Referenced by create_city_virtual(), sg_save_counters(), and universal_value_initial().

◆ counter_by_rule_name()

struct counter * counter_by_rule_name ( const char *  name)

Search for counter by rule name (return matched counter if found or NULL)

Definition at line 115 of file counters.c.

Referenced by api_find_counter_by_name(), tab_counter::select_counter(), sg_load_counters(), and universal_value_from_str().

◆ counter_by_translated_name()

struct counter * counter_by_translated_name ( const char *  name)

Search for counter by translated name (return matched counter if found or NULL)

Definition at line 136 of file counters.c.

◆ counter_id()

int counter_id ( struct counter *  pcount)

Return id of a given counter

Definition at line 105 of file counters.c.

Referenced by api_find_counter(), tolua_game_find_counter01(), and universal_number().

◆ counter_index()

int counter_index ( const struct counter *  pcount)

◆ counter_name_translation()

const char * counter_name_translation ( const struct counter *  counter)

◆ counter_rule_name()

const char * counter_rule_name ( struct counter *  pcount)

◆ counters_free()

void counters_free ( void  )

Free resources allocated by counters system

Definition at line 51 of file counters.c.

Referenced by game_ruleset_free().

◆ counters_get_city_counters_count()

int counters_get_city_counters_count ( void  )

◆ counters_init()

void counters_init ( void  )

Initialize counters system

Definition at line 40 of file counters.c.

Referenced by game_ruleset_init().

Variable Documentation

◆ counters

struct counter counters[MAX_COUNTERS]
static

◆ counters_city

struct counter* counters_city[MAX_COUNTERS]
static

Definition at line 34 of file counters.c.

Referenced by attach_city_counter(), and counter_by_index().

◆ number_city_counters

int number_city_counters
static