141 struct player_list *achievers)
143 struct player *credited = NULL;
151 player_list_append(achievers, pplayer);
155 if (ach->
first != NULL) {
160 if (player_list_size(achievers) > 0) {
163 credited = player_list_get(achievers,
fc_rand(player_list_size(achievers)));
165 ach->
first = credited;
191 case ACHIEVEMENT_SPACESHIP:
193 case ACHIEVEMENT_MAP:
209 max_unknown = (total * (100 - ach->
value)) / 100;
210 required = total - max_unknown;
213 bool this_is_known =
FALSE;
217 this_is_known =
TRUE;
222 this_is_known =
TRUE;
228 if (known >= required) {
233 if (unknown >= max_unknown) {
241 case ACHIEVEMENT_MULTICULTURAL:
243 bv_player seen_citizens;
252 if (!
BV_ISSET(seen_citizens, idx)) {
253 BV_SET(seen_citizens, idx);
255 if (count >= ach->
value) {
265 case ACHIEVEMENT_CULTURED_CITY:
273 case ACHIEVEMENT_CULTURED_NATION:
279 case ACHIEVEMENT_LUCKY:
281 case ACHIEVEMENT_HUTS:
283 case ACHIEVEMENT_METROPOLIS:
291 case ACHIEVEMENT_LITERATE:
293 case ACHIEVEMENT_LAND_AHOY:
299 bool this_is_known =
FALSE;
303 this_is_known =
TRUE;
308 this_is_known =
TRUE;
315 if (ptile->continent > 0 && !seen[ptile->continent - 1]) {
316 if (++count >= ach->
value) {
320 seen[ptile->continent - 1] =
TRUE;
328 case ACHIEVEMENT_COUNT:
332 log_error(
"achievement_check(): Illegal achievement type %d", ach->
type);
361 const struct player *pplayer)
363 if (pplayer == NULL) {
375 return pach->
first != NULL;
388 }
else if (pop >= 10000) {
bool achievement_check(struct achievement *ach, struct player *pplayer)
void achievements_free(void)
bool achievement_player_has(const struct achievement *pach, const struct player *pplayer)
static struct achievement achievements[MAX_ACHIEVEMENT_TYPES]
int achievement_index(const struct achievement *pach)
struct player * achievement_plr(struct achievement *ach, struct player_list *achievers)
struct achievement * achievement_by_number(int id)
int get_literacy(const struct player *pplayer)
const char * achievement_later_msg(struct achievement *pach)
int achievement_number(const struct achievement *pach)
const char * achievement_first_msg(struct achievement *pach)
const char * achievement_rule_name(struct achievement *pach)
struct achievement * achievement_by_rule_name(const char *name)
const char * achievement_name_translation(struct achievement *pach)
void achievements_init(void)
bool achievement_claimed(const struct achievement *pach)
#define achievements_iterate_end
#define achievements_iterate(_ach_)
bool dbv_isset(const struct dbv *pdbv, int bit)
#define BV_ISSET(bv, bit)
#define citizens_iterate_end
#define citizens_iterate(_pcity, _pslot, _nationality)
#define city_list_iterate(citylist, pcity)
static citizens city_size_get(const struct city *pcity)
#define city_list_iterate_end
int city_culture(const struct city *pcity)
int player_culture(const struct player *plr)
static bool is_server(void)
#define MAX_ACHIEVEMENT_TYPES
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_error(message,...)
#define whole_map_iterate(_map, _tile)
#define whole_map_iterate_end
#define fc_calloc(n, esz)
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
int player_index(const struct player *pplayer)
struct player * player_slot_get_player(const struct player_slot *pslot)
#define players_iterate_end
#define players_iterate(_pplayer)
enum achievement_type type
struct name_translation name
struct packet_ruleset_control control
int num_achievement_types
enum spaceship_state state
struct city_list * cities
struct player_spaceship spaceship
struct player_score score
struct player::@69::@71 server
int fc_strcasecmp(const char *str0, const char *str1)