blob: 178d46c81f52847c2a7ca61a9f0bb123e46e5aa1 (
plain)
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
|
#pragma once
#include "h-basic.hpp"
#include <boost/variant.hpp>
struct store_item_filter_by_k_idx
{
s16b k_idx = -1;
};
struct store_item_filter_by_tval
{
s16b tval = -1;
};
using store_item_filter_t = boost::variant<store_item_filter_by_k_idx, store_item_filter_by_tval>;
struct store_item
{
/**
* Filter for the store items.
*/
store_item_filter_t filter;
/**
* Percentage chance of generation if the entry is chosen.
*/
s16b chance = 0;
/**
* Create a store item based on k_info index.
*/
static store_item k_idx(s16b idx, s16b chance)
{
store_item_filter_by_k_idx k;
k.k_idx = idx;
store_item i;
i.chance = chance;
i.filter = k;
return i;
}
/**
* Create a store item based on TVAL.
*/
static store_item tval(s16b tval, s16b chance)
{
store_item_filter_by_tval k;
k.tval = tval;
store_item i;
i.chance = chance;
i.filter = k;
return i;
}
};
|