Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/counters.h File Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Data Structures | Macros | Functions
counters.h File Reference
`#include "support.h"`
`#include "name_translation.h"`

Go to the source code of this file.

## Data Structures

struct | counter

## Macros

#define | city_counters_iterate(pcount)
#define | city_counters_iterate_end
#define | counters_re_iterate(pcount)
#define | counters_re_iterate_end

## Functions

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

## Macro Definition Documentation

## ◆ city_counters_iterate

#define city_counters_iterate | ( |  | pcount | ) |

Value:
{ \
int _i_##pcount; \
struct counter *pcount; \
int _ccounter_count_##pcount = counters_get_city_counters_count(); \
for (_i_##pcount = 0; _i_##pcount < _ccounter_count_##pcount; _i_##pcount++) { \
pcount = counter_by_index(_i_##pcount, CTGT_CITY);
incite_cost
char * incite_cost
Definition comments.c:74
counter_by_index
struct counter * counter_by_index(int index, enum counter_target target)
Definition counters.c:183
counters_get_city_counters_count
int counters_get_city_counters_count(void)
Definition counters.c:74
CTGT_CITY
@ CTGT_CITY
Definition fc_types.h:126
counter
Definition counters.h:27

Definition at line 57 of file counters.h.

## ◆ city_counters_iterate_end

#define city_counters_iterate_end

Value:
} \
}

Definition at line 64 of file counters.h.

## ◆ counters_re_iterate

#define counters_re_iterate | ( |  | pcount | ) |

Value:
{ \
int _i_##pcount; \
struct counter *pcount; \
int _ccounter_count_##pcount = game.control.num_counters; { \
for (_i_##pcount = 0; _i_##pcount < _ccounter_count_##pcount; _i_##pcount++) { \
pcount = counter_by_id(_i_##pcount); \
if ( ! pcount -> ruledit_disabled ) {
counter_by_id
struct counter * counter_by_id(int id)
Definition counters.c:82
game
struct civ_game game
Definition game.c:62
civ_game::control
struct packet_ruleset_control control
Definition game.h:83
counter::ruledit_disabled
bool ruledit_disabled
Definition counters.h:30
packet_ruleset_control::num_counters
int num_counters
Definition packets_gen.h:1479

Definition at line 67 of file counters.h.

## ◆ counters_re_iterate_end

#define counters_re_iterate_end

Value:
} \
} \
} \
}

Definition at line 75 of file counters.h.

## 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 | ) |

Return counter by given id

Definition at line 82 of file counters.c.

Referenced by tab_counter::add_now(), api_find_counter(), boot_help_texts(), handle_ruleset_counter(), load_game_names(), load_ruleset_game(), and universal_by_number().

## ◆ 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 | ) |

Return index in global counter's array

Definition at line 174 of file counters.c.

Referenced by api_counter_increase(), api_counter_zero(), api_methods_counter_city_get(), is_counter_req_active(), tab_counter::refresh(), and sg_load_counters().

## ◆ counter_name_translation()

const char * counter_name_translation | ( | const struct counter * | counter | ) |

Returns translated name of given counter

Definition at line 157 of file counters.c.

Referenced by api_methods_counter_name_translation(), boot_help_texts(), counter_by_translated_name(), universal_name_translation(), and worklist_item_postpone_req_vec().

## ◆ counter_rule_name()

const char * counter_rule_name | ( | struct counter * | pcount | ) |

Return rule name of a given counter

Definition at line 165 of file counters.c.

Referenced by api_methods_counter_rule_name(), counter_by_rule_name(), tab_counter::delete_now(), tab_counter::edit_effects(), tab_counter::name_given(), tab_counter::refresh(), req_text_insert(), sg_save_counters(), universal_kind_values(), and universal_rule_name().

## ◆ 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 |  | ) |

Return number of city counters.

Definition at line 74 of file counters.c.

Referenced by tab_counter::add_now(), city_counters_refresh(), create_city_virtual(), handle_city_update_counters(), handle_ruleset_counter(), tab_counter::initialize_new_counter(), sg_save_counters(), and universal_value_initial().

## ◆ counters_init()

void counters_init | ( | void |  | ) |

Initialize counters system

Definition at line 40 of file counters.c.

Referenced by game_ruleset_init().