Stop sharing requirement_unit_state_ereq().
[freeciv.git] / common / achievements.h
blob19641f1a1a6aea5220386497a1e68f2c27b1f4ca
1 /***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
13 #ifndef FC__ACHIEVEMENTS_H
14 #define FC__ACHIEVEMENTS_H
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 /* common */
21 #include "fc_types.h"
22 #include "name_translation.h"
23 #include "player.h"
25 struct achievement
27 int id;
28 struct name_translation name;
29 bool disabled;
30 enum achievement_type type;
31 int value;
32 bool unique;
33 int culture;
34 struct player *first;
35 bv_player achievers;
37 /* Messages at server side only */
38 char *first_msg;
39 char *cons_msg;
42 void achievements_init(void);
43 void achievements_free(void);
45 int achievement_index(const struct achievement *pach);
46 int achievement_number(const struct achievement *pach);
47 struct achievement *achievement_by_number(int id);
49 const char *achievement_name_translation(struct achievement *pach);
50 const char *achievement_rule_name(struct achievement *pach);
51 struct achievement *achievement_by_rule_name(const char *name);
53 struct player *achievement_plr(struct achievement *ach,
54 struct player_list *achievers);
55 bool achievement_check(struct achievement *ach, struct player *pplayer);
57 const char *achievement_first_msg(struct achievement *pach);
58 const char *achievement_later_msg(struct achievement *pach);
60 bool achievement_player_has(const struct achievement *pach,
61 const struct player *pplayer);
62 bool achievement_claimed(const struct achievement *pach);
64 #define achievements_iterate(_ach_) \
65 { \
66 int _i_; \
67 for (_i_ = 0; _i_ < game.control.num_achievement_types; _i_++) { \
68 struct achievement *_ach_ = achievement_by_number(_i_);
70 #define achievements_iterate_end \
71 } \
74 #define achievements_active_iterate(_p) \
75 achievements_iterate(_p) { \
76 if (!_p->disabled) {
78 #define achievements_active_iterate_end \
79 } \
80 } achievements_iterate_end;
83 #ifdef __cplusplus
85 #endif /* __cplusplus */
87 #endif /* FC__ACHIEVEMENTS_H */