forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstruction_category.cpp
76 lines (60 loc) · 1.69 KB
/
construction_category.cpp
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
#include "construction_category.h"
#include <set>
#include "generic_factory.h"
#include "json.h"
namespace
{
generic_factory<construction_category> all_construction_categories( "construction categories" );
} // namespace
/** @relates string_id */
template<>
bool string_id<construction_category>::is_valid() const
{
return all_construction_categories.is_valid( *this );
}
/** @relates string_id */
template<>
const construction_category &string_id<construction_category>::obj() const
{
return all_construction_categories.obj( *this );
}
template<>
int_id<construction_category> string_id<construction_category>::id() const
{
return all_construction_categories.convert( *this, int_id<construction_category>( -1 ) );
}
template<>
bool int_id<construction_category>::is_valid() const
{
return all_construction_categories.is_valid( *this );
}
template<>
const construction_category &int_id<construction_category>::obj() const
{
return all_construction_categories.obj( *this );
}
template<>
const string_id<construction_category> &int_id<construction_category>::id() const
{
return all_construction_categories.convert( *this );
}
void construction_category::load( const JsonObject &jo, const std::string & )
{
mandatory( jo, was_loaded, "name", _name );
}
size_t construction_category::count()
{
return all_construction_categories.size();
}
void construction_categories::load( const JsonObject &jo, const std::string &src )
{
all_construction_categories.load( jo, src );
}
void construction_categories::reset()
{
all_construction_categories.reset();
}
const std::vector<construction_category> &construction_categories::get_all()
{
return all_construction_categories.get_all();
}