Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/achievements.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
achievements.h
Go to the documentation of this file.
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.
7
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
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* common */
21#include "fc_types.h"
22#include "name_translation.h"
23#include "player.h"
24
25 struct achievement
26{
27 int id;
28 struct name_translation name;
29 bool ruledit_disabled;
30 enum achievement_type type;
31 int value;
32 bool unique;
33 int culture;
34 struct player *first;
35 bv_player achievers;
36
37 /* Messages at server side only */
38 char *first_msg;
39 char *cons_msg;
40};
41
42void achievements_init(void);
43void achievements_free(void);
44
45int achievement_index(const struct achievement *pach);
46int achievement_number(const struct achievement *pach);
47struct achievement *achievement_by_number(int id);
48
49const char *achievement_name_translation(struct achievement *pach);
50const char *achievement_rule_name(struct achievement *pach);
51struct achievement *achievement_by_rule_name(const char *name);
52
53struct player *achievement_plr(struct achievement *ach,
54 struct player_list *achievers);
55bool achievement_check(struct achievement *ach, struct player *pplayer);
56
57const char *achievement_first_msg(struct achievement *pach);
58const char *achievement_later_msg(struct achievement *pach);
59
60bool achievement_player_has(const struct achievement *pach,
61 const struct player *pplayer);
62bool achievement_claimed(const struct achievement *pach);
63
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_);
69
70#define achievements_iterate_end \
71 } \
72}
73
74#define achievements_re_active_iterate(_p) \
75 achievements_iterate(_p) { \
76 if (!_p->ruledit_disabled) {
77
78#define achievements_re_active_iterate_end \
79 } \
80 } achievements_iterate_end;
81
82
83int get_literacy(const struct player *pplayer);
84
85#ifdef __cplusplus
86}
87#endif /* __cplusplus */
88
89#endif /* FC__ACHIEVEMENTS_H */
achievement_check
bool achievement_check(struct achievement *ach, struct player *pplayer)
Definition achievements.c:182
achievements_free
void achievements_free(void)
Definition achievements.c:59
achievement_player_has
bool achievement_player_has(const struct achievement *pach, const struct player *pplayer)
Definition achievements.c:364
achievement_index
int achievement_index(const struct achievement *pach)
Definition achievements.c:86
achievement_plr
struct player * achievement_plr(struct achievement *ach, struct player_list *achievers)
Definition achievements.c:140
achievement_by_number
struct achievement * achievement_by_number(int id)
Definition achievements.c:96
get_literacy
int get_literacy(const struct player *pplayer)
Definition achievements.c:386
achievement_later_msg
const char * achievement_later_msg(struct achievement *pach)
Definition achievements.c:354
achievement_number
int achievement_number(const struct achievement *pach)
Definition achievements.c:76
achievement_first_msg
const char * achievement_first_msg(struct achievement *pach)
Definition achievements.c:344
achievement_rule_name
const char * achievement_rule_name(struct achievement *pach)
Definition achievements.c:114
achievement_by_rule_name
struct achievement * achievement_by_rule_name(const char *name)
Definition achievements.c:123
achievement_name_translation
const char * achievement_name_translation(struct achievement *pach)
Definition achievements.c:106
achievements_init
void achievements_init(void)
Definition achievements.c:40
achievement_claimed
bool achievement_claimed(const struct achievement *pach)
Definition achievements.c:377
incite_cost
char * incite_cost
Definition comments.c:74
fc_types.h
name
const char * name
Definition inputfile.c:127
name_translation.h
player.h
achievement
Definition achievements.h:26
achievement::first_msg
char * first_msg
Definition achievements.h:38
achievement::type
enum achievement_type type
Definition achievements.h:30
achievement::first
struct player * first
Definition achievements.h:34
achievement::value
int value
Definition achievements.h:31
achievement::achievers
bv_player achievers
Definition achievements.h:35
achievement::cons_msg
char * cons_msg
Definition achievements.h:39
achievement::unique
bool unique
Definition achievements.h:32
achievement::culture
int culture
Definition achievements.h:33
achievement::name
struct name_translation name
Definition achievements.h:28
achievement::ruledit_disabled
bool ruledit_disabled
Definition achievements.h:29
achievement::id
int id
Definition achievements.h:27
name_translation
Definition name_translation.h:35
player
Definition player.h:247