forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspeed_description.h
65 lines (48 loc) · 1.46 KB
/
speed_description.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
#pragma once
#ifndef CATA_SRC_SPEED_DESCRIPTION_H
#define CATA_SRC_SPEED_DESCRIPTION_H
#include <string>
#include <vector>
#include "type_id.h"
class JsonIn;
class JsonObject;
class JsonOut;
template<typename T>
class generic_factory;
class speed_description_value;
class speed_description
{
public:
static void load_speed_descriptions( const JsonObject &jo, const std::string &src );
static void reset();
void load( const JsonObject &jo, const std::string &src );
static const std::vector<speed_description> &get_all();
const std::vector<speed_description_value> &values() const {
return values_;
}
private:
friend class generic_factory<speed_description>;
friend struct mod_tracker;
speed_description_id id;
std::vector<std::pair<speed_description_id, mod_id>> src;
bool was_loaded = false;
// Always sorted with highest value first
std::vector<speed_description_value> values_;
};
class speed_description_value
{
public:
bool was_loaded = false;
void load( const JsonObject &jo );
void deserialize( JsonIn &jsin );
double value() const {
return value_;
}
const std::vector<translation> &descriptions() const {
return descriptions_;
}
private:
double value_ = 0.00;
std::vector<translation> descriptions_;
};
#endif // CATA_SRC_SPEED_DESCRIPTION_H