forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
butchery_requirements.h
46 lines (38 loc) · 1.47 KB
/
butchery_requirements.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
#pragma once
#ifndef CATA_SRC_BUTCHERY_REQUIREMENTS_H
#define CATA_SRC_BUTCHERY_REQUIREMENTS_H
#include <iosfwd>
#include <map>
#include <utility>
#include <vector>
#include "creature.h"
#include "type_id.h"
class JsonObject;
class read_only_visitable;
enum class butcher_type : int;
enum class creature_size : int;
/**
* Contains several requirements, each with a speed modifier.
* The goal is to iterate from highest speed modifier to lowest
* to find the first requirement satisfied to butcher a corpse.
*/
class butchery_requirements
{
public:
bool was_loaded = false;
string_id<butchery_requirements> id;
std::vector<std::pair<string_id<butchery_requirements>, mod_id>> src;
// tries to find the requirement with the highest speed bonus. if it fails it returns cata::nullopt
std::pair<float, requirement_id> get_fastest_requirements(
const read_only_visitable &crafting_inv, creature_size size, butcher_type butcher ) const;
static void load_butchery_req( const JsonObject &jo, const std::string &src );
void load( const JsonObject &jo, const std::string & );
static const std::vector<butchery_requirements> &get_all();
static void check_consistency();
static void reset();
bool is_valid() const;
private:
// int is speed bonus
std::map<float, std::map<creature_size, std::map<butcher_type, requirement_id>>> requirements;
};
#endif // CATA_SRC_BUTCHERY_REQUIREMENTS_H