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)
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
18 #endif /* __cplusplus */
22 #include "name_translation.h"
28 struct name_translation name
;
30 enum achievement_type type
;
37 /* Messages at server side only */
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_) \
67 for (_i_ = 0; _i_ < game.control.num_achievement_types; _i_++) { \
68 struct achievement *_ach_ = achievement_by_number(_i_);
70 #define achievements_iterate_end \
74 #define achievements_active_iterate(_p) \
75 achievements_iterate(_p) { \
78 #define achievements_active_iterate_end \
80 } achievements_iterate_end;
85 #endif /* __cplusplus */
87 #endif /* FC__ACHIEVEMENTS_H */