Project Alice
Loading...
Searching...
No Matches
triggers.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "dcon_generated.hpp"
5#include "container_types.hpp"
6
7namespace trigger {
8
9float read_float_from_payload(uint16_t const* data);
10int32_t read_int32_t_from_payload(uint16_t const* data);
11
12inline int32_t to_generic(dcon::province_id v) {
13 return v.index();
14}
15inline ve::tagged_vector<int32_t> to_generic(ve::tagged_vector<dcon::province_id> v) {
16 return ve::tagged_vector<int32_t>(v);
17}
18inline ve::contiguous_tags<int32_t> to_generic(ve::contiguous_tags<dcon::province_id> v) {
19 return ve::contiguous_tags<int32_t>(v.value);
20}
21inline ve::unaligned_contiguous_tags<int32_t> to_generic(ve::unaligned_contiguous_tags<dcon::province_id> v) {
22 return ve::unaligned_contiguous_tags<int32_t>(v.value);
23}
24inline ve::partial_contiguous_tags<int32_t> to_generic(ve::partial_contiguous_tags<dcon::province_id> v) {
25 return ve::partial_contiguous_tags<int32_t>(v.value, v.subcount);
26}
27inline int32_t to_generic(dcon::nation_id v) {
28 return v.index();
29}
30inline ve::tagged_vector<int32_t> to_generic(ve::tagged_vector<dcon::nation_id> v) {
31 return ve::tagged_vector<int32_t>(v);
32}
33inline ve::contiguous_tags<int32_t> to_generic(ve::contiguous_tags<dcon::nation_id> v) {
34 return ve::contiguous_tags<int32_t>(v.value);
35}
36inline ve::unaligned_contiguous_tags<int32_t> to_generic(ve::unaligned_contiguous_tags<dcon::nation_id> v) {
37 return ve::unaligned_contiguous_tags<int32_t>(v.value);
38}
39inline ve::partial_contiguous_tags<int32_t> to_generic(ve::partial_contiguous_tags<dcon::nation_id> v) {
40 return ve::partial_contiguous_tags<int32_t>(v.value, v.subcount);
41}
42inline int32_t to_generic(dcon::pop_id v) {
43 return v.index();
44}
45inline ve::tagged_vector<int32_t> to_generic(ve::tagged_vector<dcon::pop_id> v) {
46 return ve::tagged_vector<int32_t>(v);
47}
48inline ve::contiguous_tags<int32_t> to_generic(ve::contiguous_tags<dcon::pop_id> v) {
49 return ve::contiguous_tags<int32_t>(v.value);
50}
51inline ve::unaligned_contiguous_tags<int32_t> to_generic(ve::unaligned_contiguous_tags<dcon::pop_id> v) {
52 return ve::unaligned_contiguous_tags<int32_t>(v.value);
53}
54inline ve::partial_contiguous_tags<int32_t> to_generic(ve::partial_contiguous_tags<dcon::pop_id> v) {
55 return ve::partial_contiguous_tags<int32_t>(v.value, v.subcount);
56}
57inline int32_t to_generic(dcon::state_instance_id v) {
58 return v.index();
59}
60inline ve::tagged_vector<int32_t> to_generic(ve::tagged_vector<dcon::state_instance_id> v) {
61 return ve::tagged_vector<int32_t>(v);
62}
63inline ve::contiguous_tags<int32_t> to_generic(ve::contiguous_tags<dcon::state_instance_id> v) {
64 return ve::contiguous_tags<int32_t>(v.value);
65}
66inline ve::unaligned_contiguous_tags<int32_t> to_generic(ve::unaligned_contiguous_tags<dcon::state_instance_id> v) {
67 return ve::unaligned_contiguous_tags<int32_t>(v.value);
68}
69inline ve::partial_contiguous_tags<int32_t> to_generic(ve::partial_contiguous_tags<dcon::state_instance_id> v) {
70 return ve::partial_contiguous_tags<int32_t>(v.value, v.subcount);
71}
72inline int32_t to_generic(dcon::rebel_faction_id v) {
73 return v.index();
74}
75inline ve::tagged_vector<int32_t> to_generic(ve::tagged_vector<dcon::rebel_faction_id> v) {
76 return ve::tagged_vector<int32_t>(v);
77}
78inline ve::contiguous_tags<int32_t> to_generic(ve::contiguous_tags<dcon::rebel_faction_id> v) {
79 return ve::contiguous_tags<int32_t>(v.value);
80}
81inline ve::unaligned_contiguous_tags<int32_t> to_generic(ve::unaligned_contiguous_tags<dcon::rebel_faction_id> v) {
82 return ve::unaligned_contiguous_tags<int32_t>(v.value);
83}
84inline ve::partial_contiguous_tags<int32_t> to_generic(ve::partial_contiguous_tags<dcon::rebel_faction_id> v) {
85 return ve::partial_contiguous_tags<int32_t>(v.value, v.subcount);
86}
87
88inline dcon::province_id to_prov(int32_t v) {
89 return dcon::province_id(dcon::province_id::value_base_t(v));
90}
91inline ve::tagged_vector<dcon::province_id> to_prov(ve::tagged_vector<int32_t> v) {
92 return ve::tagged_vector<dcon::province_id>(v, std::true_type{});
93}
94inline ve::contiguous_tags<dcon::province_id> to_prov(ve::contiguous_tags<int32_t> v) {
95 return ve::contiguous_tags<dcon::province_id>(v.value);
96}
97inline ve::unaligned_contiguous_tags<dcon::province_id> to_prov(ve::unaligned_contiguous_tags<int32_t> v) {
98 return ve::unaligned_contiguous_tags<dcon::province_id>(v.value);
99}
100inline ve::partial_contiguous_tags<dcon::province_id> to_prov(ve::partial_contiguous_tags<int32_t> v) {
101 return ve::partial_contiguous_tags<dcon::province_id>(v.value, v.subcount);
102}
103
104inline dcon::nation_id to_nation(int32_t v) {
105 return dcon::nation_id(dcon::nation_id::value_base_t(v));
106}
107inline ve::tagged_vector<dcon::nation_id> to_nation(ve::tagged_vector<int32_t> v) {
108 return ve::tagged_vector<dcon::nation_id>(v, std::true_type{});
109}
110inline ve::contiguous_tags<dcon::nation_id> to_nation(ve::contiguous_tags<int32_t> v) {
111 return ve::contiguous_tags<dcon::nation_id>(v.value);
112}
113inline ve::unaligned_contiguous_tags<dcon::nation_id> to_nation(ve::unaligned_contiguous_tags<int32_t> v) {
114 return ve::unaligned_contiguous_tags<dcon::nation_id>(v.value);
115}
116inline ve::partial_contiguous_tags<dcon::nation_id> to_nation(ve::partial_contiguous_tags<int32_t> v) {
117 return ve::partial_contiguous_tags<dcon::nation_id>(v.value, v.subcount);
118}
119
120inline dcon::pop_id to_pop(int32_t v) {
121 return dcon::pop_id(dcon::pop_id::value_base_t(v));
122}
123inline ve::tagged_vector<dcon::pop_id> to_pop(ve::tagged_vector<int32_t> v) {
124 return ve::tagged_vector<dcon::pop_id>(v, std::true_type{});
125}
126inline ve::contiguous_tags<dcon::pop_id> to_pop(ve::contiguous_tags<int32_t> v) {
127 return ve::contiguous_tags<dcon::pop_id>(v.value);
128}
129inline ve::unaligned_contiguous_tags<dcon::pop_id> to_pop(ve::unaligned_contiguous_tags<int32_t> v) {
130 return ve::unaligned_contiguous_tags<dcon::pop_id>(v.value);
131}
132inline ve::partial_contiguous_tags<dcon::pop_id> to_pop(ve::partial_contiguous_tags<int32_t> v) {
133 return ve::partial_contiguous_tags<dcon::pop_id>(v.value, v.subcount);
134}
135
136inline dcon::state_instance_id to_state(int32_t v) {
137 return dcon::state_instance_id(dcon::state_instance_id::value_base_t(v));
138}
139inline ve::tagged_vector<dcon::state_instance_id> to_state(ve::tagged_vector<int32_t> v) {
140 return ve::tagged_vector<dcon::state_instance_id>(v, std::true_type{});
141}
142inline ve::contiguous_tags<dcon::state_instance_id> to_state(ve::contiguous_tags<int32_t> v) {
143 return ve::contiguous_tags<dcon::state_instance_id>(v.value);
144}
145inline ve::unaligned_contiguous_tags<dcon::state_instance_id> to_state(ve::unaligned_contiguous_tags<int32_t> v) {
146 return ve::unaligned_contiguous_tags<dcon::state_instance_id>(v.value);
147}
148inline ve::partial_contiguous_tags<dcon::state_instance_id> to_state(ve::partial_contiguous_tags<int32_t> v) {
149 return ve::partial_contiguous_tags<dcon::state_instance_id>(v.value, v.subcount);
150}
151
152inline dcon::rebel_faction_id to_rebel(int32_t v) {
153 return dcon::rebel_faction_id(dcon::rebel_faction_id::value_base_t(v));
154}
155inline ve::tagged_vector<dcon::rebel_faction_id> to_rebel(ve::tagged_vector<int32_t> v) {
156 return ve::tagged_vector<dcon::rebel_faction_id>(v, std::true_type{});
157}
158inline ve::contiguous_tags<dcon::rebel_faction_id> to_rebel(ve::contiguous_tags<int32_t> v) {
159 return ve::contiguous_tags<dcon::rebel_faction_id>(v.value);
160}
161inline ve::unaligned_contiguous_tags<dcon::rebel_faction_id> to_rebel(ve::unaligned_contiguous_tags<int32_t> v) {
162 return ve::unaligned_contiguous_tags<dcon::rebel_faction_id>(v.value);
163}
164inline ve::partial_contiguous_tags<dcon::rebel_faction_id> to_rebel(ve::partial_contiguous_tags<int32_t> v) {
165 return ve::partial_contiguous_tags<dcon::rebel_faction_id>(v.value, v.subcount);
166}
167
168float evaluate_multiplicative_modifier(sys::state& state, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot);
169ve::fp_vector evaluate_multiplicative_modifier(sys::state& state, dcon::value_modifier_key modifier, ve::contiguous_tags<int32_t> primary, ve::tagged_vector<int32_t> this_slot, int32_t from_slot);
170ve::fp_vector evaluate_multiplicative_modifier(sys::state& state, dcon::value_modifier_key modifier, ve::contiguous_tags<int32_t> primary, ve::contiguous_tags<int32_t> this_slot, int32_t from_slot);
171
172ve::fp_vector evaluate_additive_modifier(sys::state& state, dcon::value_modifier_key modifier, ve::contiguous_tags<int32_t> primary, ve::tagged_vector<int32_t> this_slot, int32_t from_slot);
173float evaluate_additive_modifier(sys::state& state, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot);
174ve::fp_vector evaluate_additive_modifier(sys::state& state, dcon::value_modifier_key modifier, ve::contiguous_tags<int32_t> primary, ve::contiguous_tags<int32_t> this_slot, int32_t from_slot);
175
176ve::fp_vector evaluate_purely_additive_modifier(sys::state& state, dcon::value_modifier_key modifier, ve::contiguous_tags<int32_t> primary, ve::tagged_vector<int32_t> this_slot, int32_t from_slot);
177float evaluate_purely_additive_modifier(sys::state& state, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot);
178ve::fp_vector evaluate_purely_additive_modifier(sys::state& state, dcon::value_modifier_key modifier, ve::contiguous_tags<int32_t> primary, ve::contiguous_tags<int32_t> this_slot, int32_t from_slot);
179
180bool evaluate(sys::state& state, dcon::trigger_key key, int32_t primary, int32_t this_slot, int32_t from_slot);
181bool evaluate(sys::state& state, uint16_t const* data, int32_t primary, int32_t this_slot, int32_t from_slot);
182
183ve::mask_vector evaluate(sys::state& state, dcon::trigger_key key, ve::contiguous_tags<int32_t> primary,
184 ve::tagged_vector<int32_t> this_slot, int32_t from_slot);
185ve::mask_vector evaluate(sys::state& state, uint16_t const* data, ve::contiguous_tags<int32_t> primary,
186 ve::tagged_vector<int32_t> this_slot, int32_t from_slot);
187ve::mask_vector evaluate(sys::state& state, dcon::trigger_key key, ve::tagged_vector<int32_t> primary,
188 ve::tagged_vector<int32_t> this_slot, int32_t from_slot);
189ve::mask_vector evaluate(sys::state& state, uint16_t const* data, ve::tagged_vector<int32_t> primary,
190 ve::tagged_vector<int32_t> this_slot, int32_t from_slot);
191ve::mask_vector evaluate(sys::state& state, dcon::trigger_key key, ve::contiguous_tags<int32_t> primary,
192 ve::contiguous_tags<int32_t> this_slot, int32_t from_slot);
193ve::mask_vector evaluate(sys::state& state, uint16_t const* data, ve::contiguous_tags<int32_t> primary,
194 ve::contiguous_tags<int32_t> this_slot, int32_t from_slot);
195} // namespace trigger
int32_t to_generic(dcon::province_id v)
Definition: triggers.hpp:12
dcon::state_instance_id to_state(int32_t v)
Definition: triggers.hpp:136
dcon::pop_id to_pop(int32_t v)
Definition: triggers.hpp:120
dcon::province_id to_prov(int32_t v)
Definition: triggers.hpp:88
int32_t read_int32_t_from_payload(uint16_t const *data)
Definition: triggers.cpp:133
bool evaluate(sys::state &state, dcon::trigger_key key, int32_t primary, int32_t this_slot, int32_t from_slot)
Definition: triggers.cpp:5865
dcon::rebel_faction_id to_rebel(int32_t v)
Definition: triggers.hpp:152
float read_float_from_payload(uint16_t const *data)
Definition: triggers.cpp:119
float evaluate_additive_modifier(sys::state &state, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot)
Definition: triggers.cpp:5796
dcon::nation_id to_nation(int32_t v)
Definition: triggers.hpp:104
ve::fp_vector evaluate_purely_additive_modifier(sys::state &state, dcon::value_modifier_key modifier, ve::contiguous_tags< int32_t > primary, ve::tagged_vector< int32_t > this_slot, int32_t from_slot)
float evaluate_multiplicative_modifier(sys::state &state, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot)
Definition: triggers.cpp:5782