Freeciv-3.1: /fast/freeciv/nightly/S3_1/common/achievements.h File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Data Structures | Macros | Functions
achievements.h File Reference
`#include "fc_types.h"`
`#include "name_translation.h"`
`#include "player.h"`

Go to the source code of this file.

## Data Structures

struct | achievement

## Macros

#define | achievements_iterate(_ach_)
#define | achievements_iterate_end
#define | achievements_re_active_iterate(_p)
#define | achievements_re_active_iterate_end

## Functions

void | achievements_init (void)
void | achievements_free (void)
int | achievement_index (const struct achievement *pach)
int | achievement_number (const struct achievement *pach)
struct achievement * | achievement_by_number (int id)
const char * | achievement_name_translation (struct achievement *pach)
const char * | achievement_rule_name (struct achievement *pach)
struct achievement * | achievement_by_rule_name (const char *name)
struct player * | achievement_plr (struct achievement *ach, struct player_list *achievers)
bool | achievement_check (struct achievement *ach, struct player *pplayer)
const char * | achievement_first_msg (struct achievement *pach)
const char * | achievement_later_msg (struct achievement *pach)
bool | achievement_player_has (const struct achievement *pach, const struct player *pplayer)
bool | achievement_claimed (const struct achievement *pach)
int | get_literacy (const struct player *pplayer)

## Macro Definition Documentation

## ◆ achievements_iterate

#define achievements_iterate | ( |  | _ach_ | ) |

Value:
{ \
int _i_; \
for (_i_ = 0; _i_ < game.control.num_achievement_types; _i_++) { \
struct achievement *_ach_ = achievement_by_number(_i_);
achievement_by_number
struct achievement * achievement_by_number(int id)
Definition achievements.c:96
game
struct civ_game game
Definition game.c:57
achievement
Definition achievements.h:26
civ_game::control
struct packet_ruleset_control control
Definition game.h:83
packet_ruleset_control::num_achievement_types
int num_achievement_types
Definition packets_gen.h:1466

Definition at line 64 of file achievements.h.

## ◆ achievements_iterate_end

#define achievements_iterate_end

Value:
} \
}

Definition at line 70 of file achievements.h.

## ◆ achievements_re_active_iterate

#define achievements_re_active_iterate | ( |  | _p | ) |

Value:
achievements_iterate(_p) { \
if (!_p->ruledit_disabled) {
achievements_iterate
#define achievements_iterate(_ach_)
Definition achievements.h:64

Definition at line 74 of file achievements.h.

## ◆ achievements_re_active_iterate_end

#define achievements_re_active_iterate_end

Value:
} \
} achievements_iterate_end;
achievements_iterate_end
#define achievements_iterate_end
Definition achievements.h:70

Definition at line 78 of file achievements.h.

## Function Documentation

## ◆ achievement_by_number()

struct achievement * achievement_by_number | ( | int | id | ) |

Return achievements of given id.

Definition at line 96 of file achievements.c.

Referenced by tab_achievement::add_now(), api_find_achievement(), handle_achievement_info(), handle_ruleset_achievement(), universal_by_number(), and universal_value_initial().

## ◆ achievement_by_rule_name()

struct achievement * achievement_by_rule_name | ( | const char * | name | ) |

Returns achievement matching rule name or NULL if there is no achievement with such name.

Definition at line 123 of file achievements.c.

Referenced by api_find_achievement_by_name(), tab_achievement::initialize_new_achievement(), tab_achievement::select_achievement(), sg_load_player_main(), sg_load_player_main(), and universal_value_from_str().

## ◆ achievement_check()

bool achievement_check | ( | struct achievement * | ach,
|  | struct player * | pplayer
| ) |  |

Check if player has now achieved the achievement.

Definition at line 182 of file achievements.c.

Referenced by achievement_plr().

## ◆ achievement_claimed()

bool achievement_claimed | ( | const struct achievement * | pach | ) |

Has anybody got the achievement?

Definition at line 373 of file achievements.c.

Referenced by is_achievement_req_active().

## ◆ achievement_first_msg()

const char * achievement_first_msg | ( | struct achievement * | pach | ) |

Return message to send to first player gaining the achievement.

Definition at line 340 of file achievements.c.

Referenced by end_turn().

## ◆ achievement_index()

int achievement_index | ( | const struct achievement * | pach | ) |

Return the achievement index.

Definition at line 86 of file achievements.c.

Referenced by end_turn(), load_command(), load_game_names(), load_ruleset_game(), and tab_achievement::refresh().

## ◆ achievement_later_msg()

const char * achievement_later_msg | ( | struct achievement * | pach | ) |

Return message to send to other players gaining the achievement.

Definition at line 350 of file achievements.c.

Referenced by end_turn().

## ◆ achievement_name_translation()

const char * achievement_name_translation | ( | struct achievement * | pach | ) |

Return translated name of this achievement type.

Definition at line 106 of file achievements.c.

Referenced by api_methods_achievement_name_translation(), report_achievements(), req_text_insert(), universal_name_translation(), and worklist_item_postpone_req_vec().

## ◆ achievement_number()

int achievement_number | ( | const struct achievement * | pach | ) |

Return the achievement id.

Definition at line 76 of file achievements.c.

Referenced by send_ruleset_achievements(), and universal_number().

## ◆ achievement_player_has()

bool achievement_player_has | ( | const struct achievement * | pach,
|  | const struct player * | pplayer
| ) |  |

Has the given player got the achievement?

Definition at line 360 of file achievements.c.

Referenced by is_achievement_req_active(), load_command(), report_achievements(), and sg_save_player_main().

## ◆ achievement_plr()

struct player * achievement_plr | ( | struct achievement * | ach,
|  | struct player_list * | achievers
| ) |  |

Check if some player has now achieved the achievement and return the player in question.

Definition at line 140 of file achievements.c.

Referenced by end_turn().

## ◆ achievement_rule_name()

const char * achievement_rule_name | ( | struct achievement * | pach | ) |

Return untranslated name of this achievement type.

Definition at line 114 of file achievements.c.

Referenced by achievement_by_rule_name(), api_methods_achievement_rule_name(), tab_achievement::delete_now(), tab_achievement::edit_effects(), tab_achievement::name_given(), tab_achievement::refresh(), sanity_check_ruleset_data(), sg_save_player_main(), universal_kind_values(), universal_rule_name(), and tab_achievement::update_achievement_info().

## ◆ achievements_free()

void achievements_free | ( | void |  | ) |

Free the memory associated with achievements

Definition at line 59 of file achievements.c.

Referenced by game_ruleset_free().

## ◆ achievements_init()

void achievements_init | ( | void |  | ) |

Initialize achievements.

Definition at line 40 of file achievements.c.

Referenced by game_ruleset_init().

## ◆ get_literacy()

int get_literacy | ( | const struct player * | pplayer | ) |

Literacy score calculated one way. See also get_literacy2() for alternative way.

Definition at line 382 of file achievements.c.

Referenced by achievement_check(), and report_final_scores().