Prettify long option values in /show output.
[freeciv.git] / common / disaster.h
blob977ff7ca037f8f4e04594d70a1ef87c84fc4ddc8
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__DISASTER_H
14 #define FC__DISASTER_H
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 /* Used in the network protocol. */
21 #define SPECENUM_NAME disaster_effect_id
22 #define SPECENUM_VALUE0 DE_DESTROY_BUILDING
23 #define SPECENUM_VALUE0NAME "DestroyBuilding"
24 #define SPECENUM_VALUE1 DE_REDUCE_POP
25 #define SPECENUM_VALUE1NAME "ReducePopulation"
26 #define SPECENUM_VALUE2 DE_EMPTY_FOODSTOCK
27 #define SPECENUM_VALUE2NAME "EmptyFoodStock"
28 #define SPECENUM_VALUE3 DE_EMPTY_PRODSTOCK
29 #define SPECENUM_VALUE3NAME "EmptyProdStock"
30 #define SPECENUM_VALUE4 DE_POLLUTION
31 #define SPECENUM_VALUE4NAME "Pollution"
32 #define SPECENUM_VALUE5 DE_FALLOUT
33 #define SPECENUM_VALUE5NAME "Fallout"
34 #define SPECENUM_COUNT DE_COUNT
35 #include "specenum_gen.h"
37 BV_DEFINE(bv_disaster_effects, DE_COUNT); /* Used in the network protocol. */
39 #define DISASTER_BASE_RARITY 1000000
41 struct disaster_type {
42 int id;
43 struct name_translation name;
45 struct requirement_vector reqs;
47 /* Final probability for each city each turn is
48 * this frequency * game.info.disasters frequency setting / DISASTER_BASE_RARITY */
49 int frequency;
51 bv_disaster_effects effects;
54 /* Initialization and iteration */
55 void disaster_types_init(void);
56 void disaster_types_free(void);
58 /* General disaster type accessor functions. */
59 Disaster_type_id disaster_count(void);
60 Disaster_type_id disaster_index(const struct disaster_type *pdis);
61 Disaster_type_id disaster_number(const struct disaster_type *proad);
63 struct disaster_type *disaster_by_number(Disaster_type_id id);
65 const char *disaster_name_translation(struct disaster_type *pdis);
66 const char *disaster_rule_name(struct disaster_type *pdis);
68 bool disaster_has_effect(const struct disaster_type *pdis,
69 enum disaster_effect_id effect);
71 bool can_disaster_happen(struct disaster_type *pdis, struct city *pcity);
73 #define disaster_type_iterate(_p) \
74 { \
75 int _i_; \
76 for (_i_ = 0; _i_ < game.control.num_disaster_types ; _i_++) { \
77 struct disaster_type *_p = disaster_by_number(_i_);
79 #define disaster_type_iterate_end \
82 #ifdef __cplusplus
84 #endif /* __cplusplus */
86 #endif /* FC__DISASTER_H */