forked from cataclysmbnteam/Cataclysm-BN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clothing_mod.h
86 lines (69 loc) · 2.12 KB
/
clothing_mod.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
#pragma once
#ifndef CATA_SRC_CLOTHING_MOD_H
#define CATA_SRC_CLOTHING_MOD_H
#include <array>
#include <cstddef>
#include <string>
#include <vector>
#include "type_id.h"
class JsonObject;
class item;
template<typename T> struct enum_traits;
enum clothing_mod_type : int {
clothing_mod_type_acid,
clothing_mod_type_fire,
clothing_mod_type_bash,
clothing_mod_type_cut,
clothing_mod_type_bullet,
clothing_mod_type_encumbrance,
clothing_mod_type_warmth,
clothing_mod_type_storage,
clothing_mod_type_invalid,
num_clothing_mod_types
};
template<>
struct enum_traits<clothing_mod_type> {
static constexpr clothing_mod_type last = clothing_mod_type::num_clothing_mod_types;
};
struct mod_value {
clothing_mod_type type = clothing_mod_type::num_clothing_mod_types;
float value = 0.0f;
bool round_up = false;
bool thickness_propotion = false;
bool coverage_propotion = false;
};
struct clothing_mod {
void load( const JsonObject &jo, const std::string &src );
float get_mod_val( const clothing_mod_type &type, const item &it ) const;
bool has_mod_type( const clothing_mod_type &type ) const;
clothing_mod_id id;
bool was_loaded = false;
std::string flag;
itype_id item_string;
std::string implement_prompt;
std::string destroy_prompt;
std::vector< mod_value > mod_values;
bool restricted = false;
static size_t count();
};
namespace clothing_mods
{
constexpr std::array<clothing_mod_type, 9> all_clothing_mod_types = {{
clothing_mod_type_acid,
clothing_mod_type_fire,
clothing_mod_type_bash,
clothing_mod_type_cut,
clothing_mod_type_bullet,
clothing_mod_type_encumbrance,
clothing_mod_type_warmth,
clothing_mod_type_storage,
clothing_mod_type_invalid
}
};
void load( const JsonObject &jo, const std::string &src );
void reset();
const std::vector<clothing_mod> &get_all();
const std::vector<clothing_mod> &get_all_with( clothing_mod_type type );
std::string string_from_clothing_mod_type( clothing_mod_type type );
} // namespace clothing_mods
#endif // CATA_SRC_CLOTHING_MOD_H