forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
emit.h
75 lines (56 loc) · 1.77 KB
/
emit.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#ifndef CATA_SRC_EMIT_H
#define CATA_SRC_EMIT_H
#include <iosfwd>
#include <map>
#include <string>
#include "field_type.h"
#include "type_id.h"
class JsonObject;
class emit
{
public:
emit();
const emit_id &id() const {
return id_;
}
/** When null @ref field is always fd_null */
bool is_null() const;
/** When valid @ref field is never fd_null */
bool is_valid() const;
/** Type of field to emit @see emit::is_valid */
field_type_id field() const {
return field_;
}
/** Intensity of output fields, range [1..maximum_intensity] */
int intensity() const {
return intensity_;
}
/** Units of field to generate per turn subject to @ref chance */
int qty() const {
return qty_;
}
/** Chance to emit each turn, range [1..100] */
int chance() const {
return chance_;
}
/** Load emission data from JSON definition */
static void load_emit( const JsonObject &jo );
/** Get all currently loaded emission data */
static const std::map<emit_id, emit> &all();
/** Check consistency of all loaded emission data */
static void finalize();
/** Check consistency of all loaded emission data */
static void check_consistency();
/** Clear all loaded emission data (invalidating any pointers) */
static void reset();
private:
emit_id id_;
field_type_id field_ = fd_null.id_or( INVALID_FIELD_TYPE_ID );
int intensity_ = 1;
int qty_ = 1;
int chance_ = 100;
/** used during JSON loading only */
std::string field_name;
};
#endif // CATA_SRC_EMIT_H