Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
disaster.h File Reference
#include "name_translation.h"
#include "requirements.h"
#include "specenum_gen.h"

Go to the source code of this file.

Data Structures

struct  disaster_type
 

Macros

#define SPECENUM_NAME   disaster_effect_id
 
#define SPECENUM_VALUE0   DE_DESTROY_BUILDING
 
#define SPECENUM_VALUE0NAME   "DestroyBuilding"
 
#define SPECENUM_VALUE1   DE_REDUCE_POP
 
#define SPECENUM_VALUE1NAME   "ReducePopulation"
 
#define SPECENUM_VALUE2   DE_EMPTY_FOODSTOCK
 
#define SPECENUM_VALUE2NAME   "EmptyFoodStock"
 
#define SPECENUM_VALUE3   DE_EMPTY_PRODSTOCK
 
#define SPECENUM_VALUE3NAME   "EmptyProdStock"
 
#define SPECENUM_VALUE4   DE_POLLUTION
 
#define SPECENUM_VALUE4NAME   "Pollution"
 
#define SPECENUM_VALUE5   DE_FALLOUT
 
#define SPECENUM_VALUE5NAME   "Fallout"
 
#define SPECENUM_VALUE6   DE_REDUCE_DESTROY
 
#define SPECENUM_VALUE6NAME   "ReducePopDestroy"
 
#define SPECENUM_COUNT   DE_COUNT
 
#define SPECENUM_BITVECTOR   bv_disaster_effects
 
#define DISASTER_BASE_RARITY   1000000
 
#define disaster_type_iterate(_p)
 
#define disaster_type_iterate_end
 
#define disaster_type_re_active_iterate(_p)    disaster_type_iterate(_p)
 
#define disaster_type_re_active_iterate_end    disaster_type_iterate_end;
 

Functions

void disaster_types_init (void)
 
void disaster_types_free (void)
 
Disaster_type_id disaster_count (void)
 
Disaster_type_id disaster_index (const struct disaster_type *pdis)
 
Disaster_type_id disaster_number (const struct disaster_type *pdis)
 
struct disaster_typedisaster_by_number (Disaster_type_id id)
 
const chardisaster_name_translation (struct disaster_type *pdis)
 
const chardisaster_rule_name (struct disaster_type *pdis)
 
struct disaster_typedisaster_by_rule_name (const char *name)
 
bool disaster_has_effect (const struct disaster_type *pdis, enum disaster_effect_id effect)
 
bool can_disaster_happen (const struct disaster_type *pdis, const struct city *pcity)
 

Macro Definition Documentation

◆ DISASTER_BASE_RARITY

#define DISASTER_BASE_RARITY   1000000

Definition at line 44 of file disaster.h.

◆ disaster_type_iterate

#define disaster_type_iterate (   _p)
Value:
{ \
int _i_; \
char * incite_cost
Definition comments.c:75
struct disaster_type * disaster_by_number(Disaster_type_id id)
Definition disaster.c:87
struct civ_game game
Definition game.c:62
struct packet_ruleset_control control
Definition game.h:83

Definition at line 80 of file disaster.h.

◆ disaster_type_iterate_end

#define disaster_type_iterate_end
Value:
} \
}

Definition at line 86 of file disaster.h.

◆ disaster_type_re_active_iterate

#define disaster_type_re_active_iterate (   _p)     disaster_type_iterate(_p)

Definition at line 91 of file disaster.h.

◆ disaster_type_re_active_iterate_end

#define disaster_type_re_active_iterate_end    disaster_type_iterate_end;

Definition at line 94 of file disaster.h.

◆ SPECENUM_BITVECTOR

#define SPECENUM_BITVECTOR   bv_disaster_effects

Definition at line 41 of file disaster.h.

◆ SPECENUM_COUNT

#define SPECENUM_COUNT   DE_COUNT

Definition at line 40 of file disaster.h.

◆ SPECENUM_NAME

Definition at line 25 of file disaster.h.

◆ SPECENUM_VALUE0

#define SPECENUM_VALUE0   DE_DESTROY_BUILDING

Definition at line 26 of file disaster.h.

◆ SPECENUM_VALUE0NAME

#define SPECENUM_VALUE0NAME   "DestroyBuilding"

Definition at line 27 of file disaster.h.

◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1   DE_REDUCE_POP

Definition at line 28 of file disaster.h.

◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME   "ReducePopulation"

Definition at line 29 of file disaster.h.

◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2   DE_EMPTY_FOODSTOCK

Definition at line 30 of file disaster.h.

◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME   "EmptyFoodStock"

Definition at line 31 of file disaster.h.

◆ SPECENUM_VALUE3

#define SPECENUM_VALUE3   DE_EMPTY_PRODSTOCK

Definition at line 32 of file disaster.h.

◆ SPECENUM_VALUE3NAME

#define SPECENUM_VALUE3NAME   "EmptyProdStock"

Definition at line 33 of file disaster.h.

◆ SPECENUM_VALUE4

#define SPECENUM_VALUE4   DE_POLLUTION

Definition at line 34 of file disaster.h.

◆ SPECENUM_VALUE4NAME

#define SPECENUM_VALUE4NAME   "Pollution"

Definition at line 35 of file disaster.h.

◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5   DE_FALLOUT

Definition at line 36 of file disaster.h.

◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME   "Fallout"

Definition at line 37 of file disaster.h.

◆ SPECENUM_VALUE6

#define SPECENUM_VALUE6   DE_REDUCE_DESTROY

Definition at line 38 of file disaster.h.

◆ SPECENUM_VALUE6NAME

#define SPECENUM_VALUE6NAME   "ReducePopDestroy"

Definition at line 39 of file disaster.h.

Function Documentation

◆ can_disaster_happen()

bool can_disaster_happen ( const struct disaster_type pdis,
const struct city pcity 
)

Whether disaster can happen in given city.

Definition at line 139 of file disaster.c.

Referenced by check_disasters(), and impr_prevents_disaster().

◆ disaster_by_number()

struct disaster_type * disaster_by_number ( Disaster_type_id  id)

Return disaster type of given id.

Definition at line 87 of file disaster.c.

Referenced by api_find_disaster(), and handle_ruleset_disaster().

◆ disaster_by_rule_name()

struct disaster_type * disaster_by_rule_name ( const char name)

Return disaster matching rule name or NULL if there is no disaster with such a name.

Definition at line 114 of file disaster.c.

Referenced by api_find_disaster_by_name().

◆ disaster_count()

Disaster_type_id disaster_count ( void  )

Return the number of disaster_types.

Definition at line 79 of file disaster.c.

◆ disaster_has_effect()

bool disaster_has_effect ( const struct disaster_type pdis,
enum disaster_effect_id  effect 
)

Check if disaster provides effect

Definition at line 130 of file disaster.c.

Referenced by apply_disaster().

◆ disaster_index()

Disaster_type_id disaster_index ( const struct disaster_type pdis)

Return the disaster index.

Currently same as disaster_number(), paired with disaster_count() indicates use as an array index.

Definition at line 69 of file disaster.c.

Referenced by load_ruleset_game().

◆ disaster_name_translation()

const char * disaster_name_translation ( struct disaster_type pdis)

Return translated name of this disaster type.

Definition at line 97 of file disaster.c.

Referenced by api_methods_disaster_name_translation(), and apply_disaster().

◆ disaster_number()

Disaster_type_id disaster_number ( const struct disaster_type pdis)

Return the disaster id.

Definition at line 56 of file disaster.c.

Referenced by send_ruleset_disasters().

◆ disaster_rule_name()

const char * disaster_rule_name ( struct disaster_type pdis)

Return untranslated name of this disaster type.

Definition at line 105 of file disaster.c.

Referenced by api_methods_disaster_rule_name(), apply_disaster(), disaster_by_rule_name(), is_universal_needed(), load_ruleset_game(), and sanity_check_ruleset_data().

◆ disaster_types_free()

void disaster_types_free ( void  )

Free the memory associated with disaster types

Definition at line 46 of file disaster.c.

Referenced by game_ruleset_free().

◆ disaster_types_init()

void disaster_types_init ( void  )

Initialize disaster_type structures.

Definition at line 33 of file disaster.c.

Referenced by game_ruleset_init().