Handles damage types.
More...
#include "damagetype.h"
#include "array.h"
#include "log.h"
#include "ndata.h"
#include "nxml.h"
#include "shipstats.h"
Go to the source code of this file.
|
| static int | DTYPE_parse (DTYPE *temp, const char *file) |
| | Parses an XML file containing a DTYPE.
|
| static void | DTYPE_free (DTYPE *damtype) |
| | Frees a DTYPE.
|
| static DTYPE * | dtype_validType (int type) |
| | Gets the damage type.
|
| static int | dtype_cmp (const void *p1, const void *p2) |
| | For sorting and bsearching.
|
| int | dtype_get (const char *name) |
| | Gets the id of a dtype based on name.
|
| const char * | dtype_damageTypeToStr (int type) |
| | Gets the human readable string from damage type.
|
| int | dtype_load (void) |
| | Loads the dtype stack.
|
| void | dtype_free (void) |
| | Frees the dtype stack.
|
| int | dtype_raw (int type, double *shield, double *armour, double *knockback) |
| | Gets the raw modulation stats of a damage type.
|
| void | dtype_calcDamage (double *dshield, double *darmour, double absorb, double *knockback, const Damage *dmg, const ShipStats *s) |
| | Gives the real shield damage, armour damage and knockback modifier.
|
Handles damage types.
Definition in file damagetype.c.
◆ DTYPE_XML_ID
| #define DTYPE_XML_ID "dtype" |
◆ MELEMENT
| #define MELEMENT |
( |
| o, |
|
|
| s ) |
Value: if ( o ) \
WARN( _( "DTYPE '%s' invalid '"s \
"' element" ), \
temp->name )
◆ dtype_calcDamage()
| void dtype_calcDamage |
( |
double * | dshield, |
|
|
double * | darmour, |
|
|
double | absorb, |
|
|
double * | knockback, |
|
|
const Damage * | dmg, |
|
|
const ShipStats * | s ) |
Gives the real shield damage, armour damage and knockback modifier.
- Parameters
-
| [out] | dshield | Real shield damage. |
| [out] | darmour | Real armour damage. |
| [out] | knockback | Knockback modifier. |
| [in] | absorb | Absorption value. |
| [in] | dmg | Damage information. |
| [in] | s | Ship stats to use. |
Definition at line 275 of file damagetype.c.
◆ dtype_cmp()
| int dtype_cmp |
( |
const void * | p1, |
|
|
const void * | p2 ) |
|
static |
For sorting and bsearching.
Definition at line 51 of file damagetype.c.
◆ dtype_damageTypeToStr()
| const char * dtype_damageTypeToStr |
( |
int | type | ) |
|
Gets the human readable string from damage type.
Definition at line 184 of file damagetype.c.
◆ DTYPE_free()
| void DTYPE_free |
( |
DTYPE * | damtype | ) |
|
|
static |
◆ dtype_free()
◆ dtype_get()
| int dtype_get |
( |
const char * | name | ) |
|
Gets the id of a dtype based on name.
- Parameters
-
- Returns
- ID of the damage type or -1 on error.
Definition at line 157 of file damagetype.c.
◆ dtype_load()
Loads the dtype stack.
- Returns
- 0 on success.
Definition at line 197 of file damagetype.c.
◆ DTYPE_parse()
| int DTYPE_parse |
( |
DTYPE * | temp, |
|
|
const char * | file ) |
|
static |
Parses an XML file containing a DTYPE.
- Parameters
-
| temp | Address to load DTYPE into. |
| file | File to parse. |
- Returns
- 0 on success.
Definition at line 65 of file damagetype.c.
◆ dtype_raw()
| int dtype_raw |
( |
int | type, |
|
|
double * | shield, |
|
|
double * | armour, |
|
|
double * | knockback ) |
Gets the raw modulation stats of a damage type.
- Parameters
-
| type | Type to get stats of. |
| [out] | shield | Shield damage modulator. |
| [out] | armour | Armour damage modulator. |
| [out] | knockback | Knockback modulator. |
- Returns
- 0 on success.
Definition at line 251 of file damagetype.c.
◆ dtype_validType()
| DTYPE * dtype_validType |
( |
int | type | ) |
|
|
static |
◆ dtype_types
| DTYPE* dtype_types = NULL |
|
static |