Freeciv-3.2
Loading...
Searching...
No Matches
Functions | Variables
disaster.c File Reference
#include "fcintl.h"
#include "fc_types.h"
#include "game.h"
#include "name_translation.h"
#include "disaster.h"

Go to the source code of this file.

Functions

void disaster_types_init (void)
 
void disaster_types_free (void)
 
Disaster_type_id disaster_number (const struct disaster_type *pdis)
 
Disaster_type_id disaster_index (const struct disaster_type *pdis)
 
Disaster_type_id disaster_count (void)
 
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)
 

Variables

static struct disaster_type disaster_types [MAX_DISASTER_TYPES]
 

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().

Variable Documentation

◆ disaster_types

struct disaster_type disaster_types[MAX_DISASTER_TYPES]
static

Definition at line 28 of file disaster.c.

Referenced by disaster_by_number(), disaster_index(), and disaster_types_init().