Freeciv-3.2
Loading...
Searching...
No Matches
disaster.c
Go to the documentation of this file.
1/****************************************************************************
2 Freeciv - Copyright (C) 2004 - The Freeciv Team
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
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "fcintl.h"
20
21/* common */
22#include "fc_types.h"
23#include "game.h"
24#include "name_translation.h"
25
26#include "disaster.h"
27
29
30/************************************************************************/
34{
35 int i;
36
37 for (i = 0; i < ARRAY_SIZE(disaster_types); i++) {
40 }
41}
42
43/************************************************************************/
52
53/************************************************************************/
57{
59
60 return pdis->id;
61}
62
63/************************************************************************/
75
76/************************************************************************/
83
84/************************************************************************/
93
94/************************************************************************/
98{
99 return name_translation_get(&pdis->name);
100}
101
102/************************************************************************/
106{
107 return rule_name_get(&pdis->name);
108}
109
110/************************************************************************/
115{
116 const char *qs = Qn_(name);
117
120 return pdis;
121 }
123
124 return NULL;
125}
126
127/************************************************************************/
132{
133 return BV_ISSET(pdis->effects, effect);
134}
135
136/************************************************************************/
140 const struct city *pcity)
141{
142 return are_reqs_active(&(const struct req_context) {
143 .player = city_owner(pcity),
144 .city = pcity,
145 .tile = city_tile(pcity),
146 },
147 NULL,
148 &pdis->reqs, RPT_POSSIBLE);
149}
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
#define city_tile(_pcity_)
Definition city.h:564
#define city_owner(_pcity_)
Definition city.h:563
char * incite_cost
Definition comments.c:75
const char * disaster_rule_name(struct disaster_type *pdis)
Definition disaster.c:105
bool can_disaster_happen(const struct disaster_type *pdis, const struct city *pcity)
Definition disaster.c:139
static struct disaster_type disaster_types[MAX_DISASTER_TYPES]
Definition disaster.c:28
Disaster_type_id disaster_number(const struct disaster_type *pdis)
Definition disaster.c:56
Disaster_type_id disaster_index(const struct disaster_type *pdis)
Definition disaster.c:69
struct disaster_type * disaster_by_rule_name(const char *name)
Definition disaster.c:114
const char * disaster_name_translation(struct disaster_type *pdis)
Definition disaster.c:97
struct disaster_type * disaster_by_number(Disaster_type_id id)
Definition disaster.c:87
Disaster_type_id disaster_count(void)
Definition disaster.c:79
bool disaster_has_effect(const struct disaster_type *pdis, enum disaster_effect_id effect)
Definition disaster.c:130
void disaster_types_init(void)
Definition disaster.c:33
void disaster_types_free(void)
Definition disaster.c:46
#define disaster_type_iterate(_p)
Definition disaster.h:80
#define disaster_type_iterate_end
Definition disaster.h:86
int int id
Definition editgui_g.h:28
struct @21::@22 reqs
#define MAX_DISASTER_TYPES
Definition fc_types.h:52
@ RPT_POSSIBLE
Definition fc_types.h:700
int Disaster_type_id
Definition fc_types.h:385
#define Qn_(String)
Definition fcintl.h:89
struct civ_game game
Definition game.c:62
const char * name
Definition inputfile.c:127
#define fc_assert_ret_val(condition, val)
Definition log.h:194
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
bool are_reqs_active(const struct req_context *context, const struct player *other_player, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
#define ARRAY_SIZE(x)
Definition shared.h:85
Definition city.h:320
struct tile * tile
Definition city.h:322
struct packet_ruleset_control control
Definition game.h:83
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:189