forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subbodypart.h
89 lines (64 loc) · 1.86 KB
/
subbodypart.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once
#ifndef CATA_SRC_SUBBODYPART_H
#define CATA_SRC_SUBBODYPART_H
#include <array>
#include <cstddef>
#include <initializer_list>
#include <iosfwd>
#include <string>
#include <utility>
#include <vector>
#include "enums.h"
#include "flat_set.h"
#include "int_id.h"
#include "string_id.h"
#include "translations.h"
#include "type_id.h"
class JsonObject;
class JsonOut;
class JsonValue;
struct sub_body_part_type;
struct body_part_type;
using sub_bodypart_str_id = string_id<sub_body_part_type>;
using sub_bodypart_id = int_id<sub_body_part_type>;
enum class side : int {
BOTH,
LEFT,
RIGHT,
num_sides
};
template<>
struct enum_traits<side> {
static constexpr side last = side::num_sides;
};
struct sub_body_part_type {
sub_bodypart_str_id id;
std::vector<std::pair<sub_bodypart_str_id, mod_id>> src;
sub_bodypart_str_id opposite;
bool was_loaded = false;
// name of the sub part
translation name;
translation name_multiple;
side part_side = side::BOTH;
// the body part this belongs to
string_id<body_part_type> parent;
// this flags that the sub location
// is in addition to the normal limb
// parts. Currently used for torso for
// hanging locations.
bool secondary = false;
// the maximum coverage value for this part
// if something entirely covered this part it
// would have this value
int max_coverage = 0;
static void load_bp( const JsonObject &jo, const std::string &src );
void load( const JsonObject &jo, const std::string &src );
// combine matching body part strings together for printing
static std::vector<translation> consolidate( std::vector<sub_bodypart_id> &covered );
// Clears all bps
static void reset();
// Post-load finalization
static void finalize_all();
static void finalize();
};
#endif // CATA_SRC_SUBBODYPART_H