forked from cataclysmbnteam/Cataclysm-BN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fire.h
59 lines (55 loc) · 2.3 KB
/
fire.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#ifndef CATA_SRC_FIRE_H
#define CATA_SRC_FIRE_H
#include "units.h"
/**
* Contains the state of a fire in one tile on one turn
*
* Used to pass data between the fire field calculations in @ref map::process_fields_in_submap()
* and the item::burn() function of each specific item being burned.
*
* A structure of this type is created during the burn calculation for a given turn and a given
* tile. The calculation iterates through all items on the tile, with this structure serving
* to accumulate the sum of smoke produced by and fuel contributed by each item in the fire
* this turn.
*/
struct fire_data {
fire_data() = default;
fire_data( const fire_data & ) = default;
fire_data( int intensity, bool is_contained = false ) : fire_intensity( intensity ),
contained( is_contained )
{}
/** Current intensity of the fire. This is an input to the calculations */
int fire_intensity = 0;
/** Smoke produced by each burning item this turn is summed here. */
float smoke_produced = 0.0f;
/** Fuel contributed by each burning item this turn is summed here. */
float fuel_produced = 0.0f;
/** The fire is contained and burned for fuel intentionally. */
bool contained = false;
};
/**
* Contains burning parameters for a given material.
*
* Contains the parameters which define how a given material reacts to being burned. This is
* currently used by the calculations in @ref item::burn() to determine smoke produced and fuel
* values contributed to a fire.
*
* A given material will generally contain several of these structures, indexed by fire intensity.
* This allows materials to react correctly to stronger flames.
*
* This structure is populated from json data files in @ref material_type::load()
*/
struct mat_burn_data {
/** If this is true, an object will not burn or be destroyed by fire. */
bool immune = false;
/** If non-zero and lower than item's volume, scale burning by `volume_penalty / volume`. */
units::volume volume_per_turn = 0_ml;
/** Fuel contributed per tick when this material burns. */
float fuel = 0.0f;
/** Smoke produced per tick when this material burns. */
float smoke = 0.0f;
/** Volume of material destroyed per tick when this material burns. */
float burn = 0.0f;
};
#endif // CATA_SRC_FIRE_H