Project Alice
Loading...
Searching...
No Matches
modifiers.cpp
Go to the documentation of this file.
1#include "modifiers.hpp"
2#include "system_state.hpp"
3#include "demographics.hpp"
4#include "military.hpp"
6#include "province.hpp"
8#include "triggers.hpp"
10
11namespace sys {
12
13// NOTE: these functions do not add or remove a modifier from the list of modifiers for an entity
14void apply_modifier_values_to_nation(sys::state& state, dcon::nation_id target_nation, dcon::modifier_id mod_id) {
15 auto& nat_values = state.world.modifier_get_national_values(mod_id);
17 if(!(nat_values.offsets[i]))
18 break; // no more modifier values
19
20 auto fixed_offset = nat_values.offsets[i];
21 auto modifier_amount = nat_values.values[i];
22 state.world.nation_get_modifier_values(target_nation, fixed_offset) += modifier_amount;
23 }
24}
25
26void apply_scaled_modifier_values_to_nation(sys::state& state, dcon::nation_id target_nation, dcon::modifier_id mod_id,
27 float scale) {
28 auto& nat_values = state.world.modifier_get_national_values(mod_id);
30 if(!(nat_values.offsets[i]))
31 break; // no more modifier values
32
33 auto fixed_offset = nat_values.offsets[i];
34 auto modifier_amount = nat_values.values[i];
35 state.world.nation_get_modifier_values(target_nation, fixed_offset) += modifier_amount * scale;
36 }
37}
38
39void apply_modifier_values_to_province(sys::state& state, dcon::province_id target_prov, dcon::modifier_id mod_id) {
40 auto& prov_values = state.world.modifier_get_province_values(mod_id);
41 auto owner = state.world.province_get_nation_from_province_ownership(target_prov);
43 if(!(prov_values.offsets[i]))
44 break; // no more modifier values
45
46 auto fixed_offset = prov_values.offsets[i];
47 auto modifier_amount = prov_values.values[i];
48 state.world.province_get_modifier_values(target_prov, fixed_offset) += modifier_amount;
49 }
50 if(owner) {
51 auto& nat_values = state.world.modifier_get_national_values(mod_id);
53 if(!(nat_values.offsets[i]))
54 break; // no more modifier values
55
56 auto fixed_offset = nat_values.offsets[i];
57 auto modifier_amount = nat_values.values[i];
58 state.world.nation_get_modifier_values(owner, fixed_offset) += modifier_amount;
59 }
60 }
61}
62
63void add_modifier_to_nation(sys::state& state, dcon::nation_id target_nation, dcon::modifier_id mod_id, sys::date expiration) {
64 auto lst = state.world.nation_get_current_modifiers(target_nation);
65 for(auto& m : lst) {
66 if(m.mod_id == mod_id) {
67 if(!expiration || (m.expiration && m.expiration < expiration)) {
68 m.expiration = expiration;
69 }
70 return;
71 }
72 }
73 lst.push_back(sys::dated_modifier{expiration, mod_id});
74}
75void add_modifier_to_province(sys::state& state, dcon::province_id target_prov, dcon::modifier_id mod_id, sys::date expiration) {
76 auto lst = state.world.province_get_current_modifiers(target_prov);
77 for(auto& m : lst) {
78 if(m.mod_id == mod_id) {
79 if(!expiration || (m.expiration && m.expiration < expiration)) {
80 m.expiration = expiration;
81 }
82 return;
83 }
84 }
85 lst.push_back(sys::dated_modifier{expiration, mod_id});
86}
87void remove_modifier_from_nation(sys::state& state, dcon::nation_id target_nation, dcon::modifier_id mod_id) {
88 auto modifiers_range = state.world.nation_get_current_modifiers(target_nation);
89 auto count = modifiers_range.size();
90 for(uint32_t i = count; i-- > 0;) {
91 if(modifiers_range.at(i).mod_id == mod_id) {
92 modifiers_range.remove_at(i);
93 return;
94 }
95 }
96}
97
98void remove_modifier_from_province(sys::state& state, dcon::province_id target_prov, dcon::modifier_id mod_id) {
99 auto modifiers_range = state.world.province_get_current_modifiers(target_prov);
100 auto count = modifiers_range.size();
101 for(uint32_t i = count; i-- > 0;) {
102 if(modifiers_range.at(i).mod_id == mod_id) {
103 modifiers_range.remove_at(i);
104 return;
105 }
106 }
107}
108
109void toggle_modifier_from_province(sys::state& state, dcon::province_id target_prov, dcon::modifier_id mod_id, sys::date expiration) {
110 auto lst = state.world.province_get_current_modifiers(target_prov);
111 auto modifiers_range = state.world.province_get_current_modifiers(target_prov);
112 auto count = modifiers_range.size();
113 for(uint32_t i = count; i-- > 0;) {
114 if(modifiers_range.at(i).mod_id == mod_id) {
115 modifiers_range.remove_at(i);
116 return;
117 }
118 }
119 lst.push_back(sys::dated_modifier{ expiration, mod_id });
120}
121
122template<typename F>
123void bulk_apply_masked_modifier_to_nations(sys::state& state, dcon::modifier_id m, F const& mask_functor) {
124 auto& nat_values = state.world.modifier_get_national_values(m);
126 if(!(nat_values.offsets[i]))
127 break; // no more modifier values attached
128
129 state.world.execute_serial_over_nation(
130 [&, fixed_offset = nat_values.offsets[i], modifier_amount = nat_values.values[i]](auto nation_indices) {
131 auto has_mod_mask = mask_functor(nation_indices);
132 auto old_mod_value = state.world.nation_get_modifier_values(nation_indices, fixed_offset);
133 state.world.nation_set_modifier_values(nation_indices, fixed_offset,
134 ve::select(has_mod_mask, old_mod_value + modifier_amount, old_mod_value));
135 });
136 }
137}
138
139template<typename F>
140void bulk_apply_scaled_modifier_to_nations(sys::state& state, dcon::modifier_id m, F const& scale_functor) {
141 auto& nat_values = state.world.modifier_get_national_values(m);
143 if(!(nat_values.offsets[i]))
144 break; // no more modifier values attached
145
146 state.world.execute_serial_over_nation(
147 [&, fixed_offset = nat_values.offsets[i], modifier_amount = nat_values.values[i]](auto nation_indices) {
148 auto scaling_factor = scale_functor(nation_indices);
149 auto old_mod_value = state.world.nation_get_modifier_values(nation_indices, fixed_offset);
150 state.world.nation_set_modifier_values(nation_indices, fixed_offset, old_mod_value + scaling_factor * modifier_amount);
151 });
152 }
153}
154
155template<typename F>
156void bulk_apply_masked_modifier_to_provinces(sys::state& state, dcon::modifier_id mod_id, F const& mask_functor) {
157 auto& prov_values = state.world.modifier_get_province_values(mod_id);
158
160 if(!(prov_values.offsets[i]))
161 break; // no more modifier values
162
163 auto fixed_offset = prov_values.offsets[i];
164 auto modifier_amount = prov_values.values[i];
165
167 auto has_mod_mask = mask_functor(ids);
168 auto old_value = state.world.province_get_modifier_values(ids, fixed_offset);
169 state.world.province_set_modifier_values(ids, fixed_offset,
170 ve::select(has_mod_mask, old_value + modifier_amount, old_value));
171 });
172 }
173
174 auto& nat_values = state.world.modifier_get_national_values(mod_id);
175
177 if(!(nat_values.offsets[i]))
178 break; // no more modifier values
179
180 auto fixed_offset = nat_values.offsets[i];
181 auto modifier_amount = nat_values.values[i];
182
184 auto owners = state.world.province_get_nation_from_province_ownership(ids);
185 auto has_mod_mask = mask_functor(ids) && (owners != dcon::nation_id{});
186
187 auto old_value = state.world.nation_get_modifier_values(owners, fixed_offset);
188 state.world.nation_set_modifier_values(owners, fixed_offset,
189 ve::select(has_mod_mask, old_value + modifier_amount, old_value));
190 });
191 }
192}
193
194void bulk_apply_modifier_to_provinces(sys::state& state, dcon::modifier_id mod_id) {
195 auto& prov_values = state.world.modifier_get_province_values(mod_id);
196
198 if(!(prov_values.offsets[i]))
199 break; // no more modifier values
200
201 auto fixed_offset = prov_values.offsets[i];
202 auto modifier_amount = prov_values.values[i];
203
205 auto old_value = state.world.province_get_modifier_values(ids, fixed_offset);
206 state.world.province_set_modifier_values(ids, fixed_offset, old_value + modifier_amount);
207 });
208 }
209}
210
211template<typename F>
212void bulk_apply_scaled_modifier_to_provinces(sys::state& state, dcon::modifier_id mod_id, F const& scale_functor) {
213 auto& prov_values = state.world.modifier_get_province_values(mod_id);
214
216 if(!(prov_values.offsets[i]))
217 break; // no more modifier values
218
219 auto fixed_offset = prov_values.offsets[i];
220 auto modifier_amount = prov_values.values[i];
221
223 auto scale = scale_functor(ids);
224 auto old_value = state.world.province_get_modifier_values(ids, fixed_offset);
225 state.world.province_set_modifier_values(ids, fixed_offset, old_value + modifier_amount * scale);
226 });
227 }
228
229 auto& nat_values = state.world.modifier_get_national_values(mod_id);
230
232 if(!(nat_values.offsets[i]))
233 break; // no more modifier values
234
235 auto fixed_offset = nat_values.offsets[i];
236 auto modifier_amount = nat_values.values[i];
237
239 auto owners = state.world.province_get_nation_from_province_ownership(ids);
240 auto scale = ve::select(owners != dcon::nation_id{}, scale_functor(ids), 0.0f);
241
242 auto old_value = state.world.nation_get_modifier_values(owners, fixed_offset);
243 state.world.nation_set_modifier_values(owners, fixed_offset, old_value + modifier_amount * scale);
244 });
245 }
246}
247
249
250 // purge expired triggered modifiers
251 for(auto n : state.world.in_nation) {
252 auto timed_modifiers = n.get_current_modifiers();
253 for(uint32_t i = timed_modifiers.size(); i-- > 0;) {
254 if(bool(timed_modifiers[i].expiration) && timed_modifiers[i].expiration < state.current_date) {
255 timed_modifiers.remove_at(i);
256 }
257 }
258 }
259
260 concurrency::parallel_for(uint32_t(0), sys::national_mod_offsets::count, [&](uint32_t i) {
261 dcon::national_modifier_value mid{dcon::national_modifier_value::value_base_t(i)};
262 state.world.execute_serial_over_nation([&](auto ids) { state.world.nation_set_modifier_values(ids, mid, ve::fp_vector{}); });
263 });
264
265 for(auto n : state.world.in_nation) {
266 if(auto ts = n.get_tech_school(); ts)
268 }
269 for(auto n : state.world.in_nation) {
270 if(auto nv = n.get_national_value(); nv)
272 }
273 for(auto n : state.world.in_nation) {
274 for(auto mpr : state.world.nation_get_current_modifiers(n)) {
276 }
277 }
278 state.world.for_each_technology([&](dcon::technology_id t) {
279 auto tmod = state.world.technology_get_modifier(t);
280 if(tmod) {
282 [&](auto ids) { return state.world.nation_get_active_technologies(ids, t); });
283 }
284 });
285 state.world.for_each_invention([&](dcon::invention_id i) {
286 auto tmod = state.world.invention_get_modifier(i);
287 if(tmod) {
289 [&](auto ids) { return state.world.nation_get_active_inventions(ids, i); });
290 }
291 });
292 state.world.for_each_issue([&](dcon::issue_id i) {
293 for(auto n : state.world.in_nation) {
294 auto iopt = state.world.nation_get_issues(n, i);
295 auto imod = state.world.issue_option_get_modifier(iopt);
296 if(imod && (n.get_is_civilized() || state.world.issue_get_issue_type(i) == uint8_t(culture::issue_type::party))) {
298 }
299 }
300 });
301 state.world.for_each_reform([&](dcon::reform_id i) {
302 for(auto n : state.world.in_nation) {
303 auto iopt = state.world.nation_get_reforms(n, i);
304 auto imod = state.world.reform_option_get_modifier(iopt);
305 if(imod && !n.get_is_civilized()) {
307 }
308 }
309 });
310 for(auto n : state.world.in_nation) {
311 auto in_wars = n.get_war_participant();
312 if(in_wars.begin() != in_wars.end()) {
315 } else {
318 }
319 }
320
323 [&](auto ids) { return state.world.nation_get_infamy(ids); });
324 }
327 [&](auto ids) { return state.world.nation_get_plurality(ids); });
328 }
331 [&](auto ids) { return state.world.nation_get_war_exhaustion(ids); });
332 }
335 auto total = state.world.nation_get_demographics(ids, demographics::total);
336 return ve::select(total > 0, state.world.nation_get_demographics(ids, demographics::literacy) / total, 0.0f);
337 });
338 }
341 auto bc = ve::to_float(state.world.nation_get_central_blockaded(ids));
342 auto c = ve::to_float(state.world.nation_get_central_ports(ids));
343 return ve::select(c > 0.0f, bc / c, 0.0f);
344 });
345 }
348 return ve::apply(
349 [&](dcon::nation_id nid) {
350 auto n = fatten(state.world, nid);
351 auto cap_continent = n.get_capital().get_continent();
352 float total = 0.0f;
353 float occupied = 0.0f;
354 for(auto owned : n.get_province_ownership()) {
355 if(owned.get_province().get_continent() == cap_continent) {
356 total += 1.0f;
357 if(auto c = owned.get_province().get_nation_from_province_control().id; c && c != n.id) {
358 occupied += 1.0f;
359 }
360 }
361 }
362 if(total > 0.0f)
363 return 100.0f * occupied / total;
364 else
365 return 0.0f;
366 },
367 ids);
368 });
369 }
370 for(auto n : state.world.in_nation) {
371 if(n.get_is_civilized() == false) {
372 if(state.national_definitions.unciv_nation) {
373 apply_modifier_values_to_nation(state, n, state.national_definitions.unciv_nation);
374 }
375 } else if(nations::is_great_power(state, n)) {
376 if(state.national_definitions.great_power)
377 apply_modifier_values_to_nation(state, n, state.national_definitions.great_power);
378 } else if(n.get_rank() <= uint16_t(state.defines.colonial_rank)) {
379 if(state.national_definitions.second_power)
380 apply_modifier_values_to_nation(state, n, state.national_definitions.second_power);
381 } else {
382 if(state.national_definitions.civ_nation)
383 apply_modifier_values_to_nation(state, n, state.national_definitions.civ_nation);
384 }
385 }
386 if(state.national_definitions.disarming) {
387 for(auto n : state.world.in_nation) {
388 if(bool(n.get_disarmed_until()) && n.get_disarmed_until() > state.current_date) {
389 apply_modifier_values_to_nation(state, n, state.national_definitions.disarming);
390 }
391 }
392 }
393 if(state.national_definitions.in_bankrupcy) {
394 bulk_apply_masked_modifier_to_nations(state, state.national_definitions.in_bankrupcy,
395 [&](auto ids) { return state.world.nation_get_is_bankrupt(ids); });
396 }
397 // TODO: debt
398
399 for(auto tm : state.national_definitions.triggered_modifiers) {
400 if(tm.trigger_condition && tm.linked_modifier) {
401 auto& nat_values = state.world.modifier_get_national_values(tm.linked_modifier);
402 auto size_used = state.world.nation_size();
403 ve::execute_serial_fast<dcon::nation_id>(size_used, [&](auto nids) {
404 auto trigger_condition_satisfied =
405 trigger::evaluate(state, tm.trigger_condition, trigger::to_generic(nids), trigger::to_generic(nids), 0) &&
406 ve::apply([size_used](auto n) { return n.index() < int32_t(size_used); }, nids);
407 auto compressed_res = ve::compress_mask(trigger_condition_satisfied);
408 if(compressed_res.v == ve::vbitfield_type::storage(0)) {
409 return;
410 } else {
412 if(!(nat_values.offsets[i]))
413 break; // no more modifier values attached
414
415 auto fixed_offset = nat_values.offsets[i];
416 auto modifier_amount = nat_values.values[i];
417 auto old_mod_value = state.world.nation_get_modifier_values(nids, fixed_offset);
418 state.world.nation_set_modifier_values(nids, fixed_offset,
419 ve::select(trigger_condition_satisfied, old_mod_value + modifier_amount, old_mod_value));
420 }
421 }
422 });
423 }
424 }
425}
426
428
430 dcon::national_modifier_value mid{dcon::national_modifier_value::value_base_t(i)};
431 state.world.nation_set_modifier_values(n, mid, 0.0f);
432 }
433
434 if(auto ts = state.world.nation_get_tech_school(n); ts)
436
437 if(auto nv = state.world.nation_get_national_value(n); nv)
439
440 for(auto mpr : state.world.nation_get_current_modifiers(n)) {
442 }
443
444 state.world.for_each_technology([&](dcon::technology_id t) {
445 auto tmod = state.world.technology_get_modifier(t);
446 if(tmod && state.world.nation_get_active_technologies(n, t)) {
447 apply_modifier_values_to_nation(state, n, tmod);
448 }
449 });
450 state.world.for_each_invention([&](dcon::invention_id i) {
451 auto tmod = state.world.invention_get_modifier(i);
452 if(tmod && state.world.nation_get_active_inventions(n, i)) {
453 apply_modifier_values_to_nation(state, n, tmod);
454 }
455 });
456 state.world.for_each_issue([&](dcon::issue_id i) {
457 auto iopt = state.world.nation_get_issues(n, i);
458 auto imod = state.world.issue_option_get_modifier(iopt);
459 if(imod &&
460 (state.world.nation_get_is_civilized(n) || state.world.issue_get_issue_type(i) == uint8_t(culture::issue_type::party))) {
462 }
463 });
464 if(!state.world.nation_get_is_civilized(n)) {
465 state.world.for_each_reform([&](dcon::reform_id i) {
466 auto iopt = state.world.nation_get_reforms(n, i);
467 auto imod = state.world.reform_option_get_modifier(iopt);
468 if(imod) {
470 }
471 });
472 }
473
474 auto in_wars = state.world.nation_get_war_participant(n);
475 if(in_wars.begin() != in_wars.end()) {
478 } else {
481 }
482
485 }
488 }
491 state.world.nation_get_war_exhaustion(n));
492 }
494 auto total = state.world.nation_get_demographics(n, demographics::total);
496 total > 0 ? state.world.nation_get_demographics(n, demographics::literacy) / total : 0.0f);
497 }
499 auto bc = ve::to_float(state.world.nation_get_central_blockaded(n));
500 auto c = ve::to_float(state.world.nation_get_central_ports(n));
501
503 }
505 auto nid = fatten(state.world, n);
506 auto cap_continent = nid.get_capital().get_continent();
507 float total = 0.0f;
508 float occupied = 0.0f;
509 for(auto owned : nid.get_province_ownership()) {
510 if(owned.get_province().get_continent() == cap_continent) {
511 total += 1.0f;
512 if(auto c = owned.get_province().get_nation_from_province_control().id; c && c != n) {
513 occupied += 1.0f;
514 }
515 }
516 }
517
519 total > 0.0f ? occupied / total : 0.0f);
520 }
521
522 if(state.world.nation_get_is_civilized(n) == false) {
525 } else if(nations::is_great_power(state, n)) {
528 } else if(state.world.nation_get_rank(n) <= uint16_t(state.defines.colonial_rank)) {
531 } else {
534 }
535
537 if(bool(state.world.nation_get_disarmed_until(n)) && state.world.nation_get_disarmed_until(n) > state.current_date) {
539 }
540 }
542 if(bool(state.world.nation_get_is_bankrupt(n))) {
544 }
545 }
546 // TODO: debt
547
549 if(tm.trigger_condition && tm.linked_modifier) {
550
551 auto trigger_condition_satisfied =
552 trigger::evaluate(state, tm.trigger_condition, trigger::to_generic(n), trigger::to_generic(n), 0);
553
554 if(trigger_condition_satisfied) {
555 apply_modifier_values_to_nation(state, n, tm.linked_modifier);
556 }
557 }
558 }
559}
560
562 // purge expired triggered modifiers
563 province::for_each_land_province(state, [&](dcon::province_id p) {
564 auto timed_modifiers = state.world.province_get_current_modifiers(p);
565 for(uint32_t i = timed_modifiers.size(); i-- > 0;) {
566 if(bool(timed_modifiers[i].expiration) && timed_modifiers[i].expiration < state.current_date) {
567 timed_modifiers.remove_at(i);
568 }
569 }
570 });
571
572 concurrency::parallel_for(uint32_t(0), sys::provincial_mod_offsets::count, [&](uint32_t i) {
573 dcon::provincial_modifier_value mid{dcon::provincial_modifier_value::value_base_t(i)};
575 [&](auto ids) { state.world.province_set_modifier_values(ids, mid, ve::fp_vector{}); });
576 });
577
578 if(state.national_definitions.land_province)
579 bulk_apply_modifier_to_provinces(state, state.national_definitions.land_province);
580
581 province::for_each_land_province(state, [&](dcon::province_id p) {
582 for(auto mpr : state.world.province_get_current_modifiers(p)) {
583 apply_modifier_values_to_province(state, p, mpr.mod_id);
584 }
585 });
586
587 province::for_each_land_province(state, [&](dcon::province_id p) {
588 if(auto m = state.world.province_get_terrain(p); m)
590 });
591 province::for_each_land_province(state, [&](dcon::province_id p) {
592 if(auto m = state.world.province_get_climate(p); m)
594 });
595 province::for_each_land_province(state, [&](dcon::province_id p) {
596 if(auto m = state.world.province_get_continent(p); m)
598 });
599 province::for_each_land_province(state, [&](dcon::province_id p) {
600 if(auto m = state.world.province_get_state_membership(p).get_owner_focus(); m)
601 apply_modifier_values_to_province(state, p, m.get_modifier());
602 });
603 province::for_each_land_province(state, [&](dcon::province_id p) {
604 if(auto c = state.world.province_get_crime(p); c) {
605 if(auto m = state.culture_definitions.crimes[c].modifier; m)
606 apply_modifier_values_to_province(state, p, m);
607 }
608 });
609
611 if(state.economy_definitions.building_definitions[int32_t(t)].province_modifier) {
612 bulk_apply_scaled_modifier_to_provinces(state, state.economy_definitions.building_definitions[int32_t(t)].province_modifier,
613 [&](auto ids) { return ve::to_float(state.world.province_get_building_level(ids, uint8_t(t))); });
614 }
615 }
616 if(state.national_definitions.infrastructure) {
617 bulk_apply_scaled_modifier_to_provinces(state, state.national_definitions.infrastructure, [&](auto ids) {
618 return ve::to_float(state.world.province_get_building_level(ids, uint8_t(economy::province_building_type::railroad))) *
619 state.economy_definitions.building_definitions[int32_t(economy::province_building_type::railroad)].infrastructure;
620 });
621 }
622 if(state.national_definitions.nationalism) {
623 bulk_apply_scaled_modifier_to_provinces(state, state.national_definitions.nationalism, [&](auto ids) {
624 return ve::select(state.world.province_get_is_owner_core(ids), 0.0f, state.world.province_get_nationalism(ids));
625 });
626 }
627 if(state.national_definitions.non_coastal) {
628 bulk_apply_masked_modifier_to_provinces(state, state.national_definitions.non_coastal,
629 [&](auto ids) { return !state.world.province_get_is_coast(ids); });
630 }
631 if(state.national_definitions.coastal) {
632 bulk_apply_masked_modifier_to_provinces(state, state.national_definitions.coastal,
633 [&](auto ids) { return state.world.province_get_is_coast(ids); });
634 }
635 if(state.national_definitions.overseas) {
636 bulk_apply_masked_modifier_to_provinces(state, state.national_definitions.overseas,
637 [&](auto ids) { return province::is_overseas(state, ids); });
638 }
639 if(state.national_definitions.core) {
640 bulk_apply_masked_modifier_to_provinces(state, state.national_definitions.core,
641 [&](auto ids) { return state.world.province_get_is_owner_core(ids); });
642 }
643 if(state.national_definitions.has_siege) {
644 bulk_apply_masked_modifier_to_provinces(state, state.national_definitions.has_siege,
645 [&](auto ids) { return military::province_is_under_siege(state, ids); });
646 }
647 if(state.national_definitions.blockaded) {
648 bulk_apply_masked_modifier_to_provinces(state, state.national_definitions.blockaded,
649 [&](auto ids) { return military::province_is_blockaded(state, ids); });
650 }
651}
652
653// restores values after loading a save
657 for(auto n : state.world.in_nation) {
659 }
660}
661
665 for(auto n : state.world.in_nation) {
667 }
668}
669
670} // namespace sys
constexpr dcon::demographics_key total(0)
constexpr dcon::demographics_key literacy(5)
void bound_budget_settings(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8812
province_building_type
Definition: constants.hpp:578
bool is_great_power(sys::state const &state, dcon::nation_id id)
Definition: nations.cpp:1068
void ve_for_each_land_province(sys::state &state, F const &func)
void for_each_land_province(sys::state &state, F const &func)
MOD_NAT_LIST constexpr uint32_t count
Definition: modifiers.hpp:215
MOD_PROV_LIST constexpr uint32_t count
Definition: modifiers.hpp:207
Definition: constants.hpp:4
void recreate_province_modifiers(sys::state &state)
Definition: modifiers.cpp:561
void bulk_apply_masked_modifier_to_nations(sys::state &state, dcon::modifier_id m, F const &mask_functor)
Definition: modifiers.cpp:123
void toggle_modifier_from_province(sys::state &state, dcon::province_id target_prov, dcon::modifier_id mod_id, sys::date expiration)
Definition: modifiers.cpp:109
void apply_modifier_values_to_nation(sys::state &state, dcon::nation_id target_nation, dcon::modifier_id mod_id)
Definition: modifiers.cpp:14
void remove_modifier_from_nation(sys::state &state, dcon::nation_id target_nation, dcon::modifier_id mod_id)
Definition: modifiers.cpp:87
void update_single_nation_modifiers(sys::state &state, dcon::nation_id n)
Definition: modifiers.cpp:427
void repopulate_modifier_effects(sys::state &state)
Definition: modifiers.cpp:654
void recreate_national_modifiers(sys::state &state)
Definition: modifiers.cpp:248
void bulk_apply_scaled_modifier_to_nations(sys::state &state, dcon::modifier_id m, F const &scale_functor)
Definition: modifiers.cpp:140
void update_modifier_effects(sys::state &state)
Definition: modifiers.cpp:662
void apply_modifier_values_to_province(sys::state &state, dcon::province_id target_prov, dcon::modifier_id mod_id)
Definition: modifiers.cpp:39
void add_modifier_to_nation(sys::state &state, dcon::nation_id target_nation, dcon::modifier_id mod_id, sys::date expiration)
Definition: modifiers.cpp:63
void bulk_apply_modifier_to_provinces(sys::state &state, dcon::modifier_id mod_id)
Definition: modifiers.cpp:194
void bulk_apply_masked_modifier_to_provinces(sys::state &state, dcon::modifier_id mod_id, F const &mask_functor)
Definition: modifiers.cpp:156
void add_modifier_to_province(sys::state &state, dcon::province_id target_prov, dcon::modifier_id mod_id, sys::date expiration)
Definition: modifiers.cpp:75
void bulk_apply_scaled_modifier_to_provinces(sys::state &state, dcon::modifier_id mod_id, F const &scale_functor)
Definition: modifiers.cpp:212
void apply_scaled_modifier_values_to_nation(sys::state &state, dcon::nation_id target_nation, dcon::modifier_id mod_id, float scale)
Definition: modifiers.cpp:26
void remove_modifier_from_province(sys::state &state, dcon::province_id target_prov, dcon::modifier_id mod_id)
Definition: modifiers.cpp:98
int32_t to_generic(dcon::province_id v)
Definition: triggers.hpp:12
bool evaluate(sys::state &state, dcon::trigger_key key, int32_t primary, int32_t this_slot, int32_t from_slot)
Definition: triggers.cpp:5895
T select(bool v, T a, T b)
bool compress_mask(bool v)
float to_float(int32_t a)
uint uint32_t
uchar uint8_t
dcon::modifier_id total_occupation
Definition: nations.hpp:121
dcon::modifier_id total_blockaded
Definition: nations.hpp:122
dcon::modifier_id badboy
Definition: nations.hpp:111
dcon::modifier_id unciv_nation
Definition: nations.hpp:117
dcon::modifier_id in_bankrupcy
Definition: nations.hpp:123
dcon::modifier_id disarming
Definition: nations.hpp:109
dcon::modifier_id civ_nation
Definition: nations.hpp:116
dcon::modifier_id plurality
Definition: nations.hpp:119
dcon::modifier_id peace
Definition: nations.hpp:108
std::vector< triggered_modifier > triggered_modifiers
Definition: nations.hpp:71
dcon::modifier_id great_power
Definition: nations.hpp:114
dcon::modifier_id war_exhaustion
Definition: nations.hpp:110
dcon::modifier_id average_literacy
Definition: nations.hpp:118
dcon::modifier_id second_power
Definition: nations.hpp:115
static constexpr uint32_t modifier_definition_size
Definition: modifiers.hpp:231
static constexpr uint32_t modifier_definition_size
Definition: modifiers.hpp:219
Holds important data about the game world, state, and other data regarding windowing,...
dcon::data_container world
parsing::defines defines
sys::date current_date
nations::global_national_state national_definitions