Project Alice
Loading...
Searching...
No Matches
trigger_parsing.cpp
Go to the documentation of this file.
1#include "trigger_parsing.hpp"
4#include <algorithm>
5
6namespace parsers {
7
9 context.compiled_trigger.push_back(uint16_t(trigger::generic_scope));
10 context.compiled_trigger.push_back(uint16_t(1));
11 auto payload_size_offset = context.compiled_trigger.size() - 1;
12
13 parse_trigger_body(gen, err, context);
14
15 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
16}
17
20 context.compiled_trigger.push_back(uint16_t(1));
21 auto payload_size_offset = context.compiled_trigger.size() - 1;
22
23 parse_trigger_body(gen, err, context);
24
25 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
26}
29 context.compiled_trigger.push_back(uint16_t(1));
30 auto payload_size_offset = context.compiled_trigger.size() - 1;
31
32 parse_trigger_body(gen, err, context);
33
34 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
35}
39 context.compiled_trigger.push_back(uint16_t(1));
40 auto payload_size_offset = context.compiled_trigger.size() - 1;
41
42 parse_trigger_body(gen, err, context);
43
44 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
45 } else if(context.main_slot == trigger::slot_contents::state) {
47 context.compiled_trigger.push_back(uint16_t(1));
48 auto payload_size_offset = context.compiled_trigger.size() - 1;
49
50 parse_trigger_body(gen, err, context);
51
52 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
53 } else {
54 gen.discard_group();
55 err.accumulated_errors += "any_neighbor_province trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
56 return;
57 }
58}
62 } else if(context.main_slot == trigger::slot_contents::pop) {
64 } else {
65 gen.discard_group();
66 err.accumulated_errors += "any_neighbor_country trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
67 return;
68 }
69 context.compiled_trigger.push_back(uint16_t(1));
70 auto payload_size_offset = context.compiled_trigger.size() - 1;
71
72 auto old_main = context.main_slot;
74 parse_trigger_body(gen, err, context);
75 context.main_slot = old_main;
76
77 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
78}
82 } else if(context.main_slot == trigger::slot_contents::pop) {
84 } else {
85 gen.discard_group();
86 err.accumulated_errors += "war_countries trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
87 return;
88 }
89 context.compiled_trigger.push_back(uint16_t(1));
90 auto payload_size_offset = context.compiled_trigger.size() - 1;
91 auto old_main = context.main_slot;
93 parse_trigger_body(gen, err, context);
94 context.main_slot = old_main;
95 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
96}
100 } else if(context.main_slot == trigger::slot_contents::pop) {
101 context.compiled_trigger.push_back(uint16_t(trigger::x_war_countries_scope_pop));
102 } else {
103 gen.discard_group();
104 err.accumulated_errors += "all_war_countries trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
105 return;
106 }
107 context.compiled_trigger.push_back(uint16_t(1));
108 auto payload_size_offset = context.compiled_trigger.size() - 1;
109 auto old_main = context.main_slot;
111 parse_trigger_body(gen, err, context);
112 context.main_slot = old_main;
113 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
114}
117 context.compiled_trigger.push_back(uint16_t(1));
118 auto payload_size_offset = context.compiled_trigger.size() - 1;
119 auto old_main = context.main_slot;
121 parse_trigger_body(gen, err, context);
122 context.main_slot = old_main;
123 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
124}
127 context.compiled_trigger.push_back(uint16_t(1));
128 auto payload_size_offset = context.compiled_trigger.size() - 1;
129
130 auto old_main = context.main_slot;
132 parse_trigger_body(gen, err, context);
133 context.main_slot = old_main;
134
135 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
136}
138 context.compiled_trigger.push_back(uint16_t(trigger::x_country_scope));
139 context.compiled_trigger.push_back(uint16_t(1));
140 auto payload_size_offset = context.compiled_trigger.size() - 1;
141 auto old_main = context.main_slot;
143 parse_trigger_body(gen, err, context);
144 context.main_slot = old_main;
145 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
146}
150 } else if(context.main_slot == trigger::slot_contents::state) {
152 } else if(context.main_slot == trigger::slot_contents::province) { // any province in a province -> generic scope
153 context.compiled_trigger.push_back(uint16_t(trigger::generic_scope));
154 context.compiled_trigger.push_back(uint16_t(1));
155 auto payload_size_offset = context.compiled_trigger.size() - 1;
156 parse_trigger_body(gen, err, context);
157 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
158 return;
159 } else {
160 gen.discard_group();
161 err.accumulated_errors += "any_owned_province trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
162 return;
163 }
164 context.compiled_trigger.push_back(uint16_t(1));
165 auto payload_size_offset = context.compiled_trigger.size() - 1;
166
167 auto old_main = context.main_slot;
169 parse_trigger_body(gen, err, context);
170 context.main_slot = old_main;
171
172 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
173}
177 } else if(context.main_slot == trigger::slot_contents::province) {
179 } else {
180 gen.discard_group();
181 err.accumulated_errors += "any_core trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
182 return;
183 }
184 context.compiled_trigger.push_back(uint16_t(1));
185 auto payload_size_offset = context.compiled_trigger.size() - 1;
186
187 auto old_main = context.main_slot;
188 context.main_slot =
190 parse_trigger_body(gen, err, context);
191 context.main_slot = old_main;
192
193 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
194}
197 context.compiled_trigger.push_back(uint16_t(trigger::x_core_scope_nation));
198 } else if(context.main_slot == trigger::slot_contents::province) {
199 context.compiled_trigger.push_back(uint16_t(trigger::x_core_scope_province));
200 } else {
201 gen.discard_group();
202 err.accumulated_errors += "all_core trigger scope used in an incorrect scope type " +
203 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
204 return;
205 }
206 context.compiled_trigger.push_back(uint16_t(1));
207 auto payload_size_offset = context.compiled_trigger.size() - 1;
208
209 auto old_main = context.main_slot;
210 context.main_slot =
212 parse_trigger_body(gen, err, context);
213 context.main_slot = old_main;
214
215 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
216}
220 context.compiled_trigger.push_back(uint16_t(1));
221 auto payload_size_offset = context.compiled_trigger.size() - 1;
222
223 auto old_main = context.main_slot;
225 parse_trigger_body(gen, err, context);
226 context.main_slot = old_main;
227
228 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
229 } else {
230 gen.discard_group();
231 err.accumulated_errors += "any_state trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
232 return;
233 }
234}
238 context.compiled_trigger.push_back(uint16_t(1));
239 auto payload_size_offset = context.compiled_trigger.size() - 1;
240
241 parse_trigger_body(gen, err, context);
242
243 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
244 } else {
245 gen.discard_group();
246 err.accumulated_errors += "any_substate trigger scope used in an incorrect scope type " +
247 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
248 return;
249 }
250}
254 context.compiled_trigger.push_back(uint16_t(1));
255 auto payload_size_offset = context.compiled_trigger.size() - 1;
256
257 parse_trigger_body(gen, err, context);
258
259 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
260 } else {
261 gen.discard_group();
262 err.accumulated_errors += "any_sphere_member trigger scope used in an incorrect scope type " +
263 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
264 return;
265 }
266}
270 } else if(context.main_slot == trigger::slot_contents::province) {
272 } else if(context.main_slot == trigger::slot_contents::state) {
274 } else {
275 gen.discard_group();
276 err.accumulated_errors += "any_pop trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
277 return;
278 }
279 context.compiled_trigger.push_back(uint16_t(1));
280 auto payload_size_offset = context.compiled_trigger.size() - 1;
281
282 auto old_main = context.main_slot;
284 parse_trigger_body(gen, err, context);
285 context.main_slot = old_main;
286
287 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
288}
291 context.compiled_trigger.push_back(uint16_t(trigger::x_state_scope));
292 context.compiled_trigger.push_back(uint16_t(1));
293 auto payload_size_offset = context.compiled_trigger.size() - 1;
294 auto old_main = context.main_slot;
296 parse_trigger_body(gen, err, context);
297 context.main_slot = old_main;
298 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
299 } else {
300 gen.discard_group();
301 err.accumulated_errors += "all_state trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
302 return;
303 }
304}
307 context.compiled_trigger.push_back(uint16_t(trigger::x_substate_scope));
308 context.compiled_trigger.push_back(uint16_t(1));
309 auto payload_size_offset = context.compiled_trigger.size() - 1;
310 parse_trigger_body(gen, err, context);
311 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
312 } else {
313 gen.discard_group();
314 err.accumulated_errors += "all_substate trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
315 return;
316 }
317}
320 context.compiled_trigger.push_back(uint16_t(trigger::x_sphere_member_scope));
321 context.compiled_trigger.push_back(uint16_t(1));
322 auto payload_size_offset = context.compiled_trigger.size() - 1;
323 parse_trigger_body(gen, err, context);
324 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
325 } else {
326 gen.discard_group();
327 err.accumulated_errors += "all_sphere_member trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
328 return;
329 }
330}
333 context.compiled_trigger.push_back(uint16_t(trigger::x_pop_scope_nation));
334 } else if(context.main_slot == trigger::slot_contents::province) {
335 context.compiled_trigger.push_back(uint16_t(trigger::x_pop_scope_province));
336 } else if(context.main_slot == trigger::slot_contents::state) {
337 context.compiled_trigger.push_back(uint16_t(trigger::x_pop_scope_state));
338 } else {
339 gen.discard_group();
340 err.accumulated_errors += "all_pop trigger scope used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
341 return;
342 }
343 context.compiled_trigger.push_back(uint16_t(1));
344 auto payload_size_offset = context.compiled_trigger.size() - 1;
345 auto old_main = context.main_slot;
347 parse_trigger_body(gen, err, context);
348 context.main_slot = old_main;
349 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
350}
352 context.compiled_trigger.push_back(uint16_t(trigger::x_greater_power_scope));
353 context.compiled_trigger.push_back(uint16_t(1));
354 auto payload_size_offset = context.compiled_trigger.size() - 1;
355 auto old_main = context.main_slot;
357 parse_trigger_body(gen, err, context);
358 context.main_slot = old_main;
359 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
360}
363 context.compiled_trigger.push_back(uint16_t(trigger::owner_scope_province));
364 } else if(context.main_slot == trigger::slot_contents::state) {
365 context.compiled_trigger.push_back(uint16_t(trigger::owner_scope_state));
366 } else if(context.main_slot == trigger::slot_contents::nation) {
367 context.compiled_trigger.push_back(uint16_t(trigger::generic_scope));
368 context.compiled_trigger.push_back(uint16_t(1));
369 auto payload_size_offset = context.compiled_trigger.size() - 1;
370 parse_trigger_body(gen, err, context);
371 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
372 return;
373 } else {
374 gen.discard_group();
375 err.accumulated_errors += "owner trigger scope used in an incorrect scope type " +
376 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
377 return;
378 }
379 context.compiled_trigger.push_back(uint16_t(1));
380 auto payload_size_offset = context.compiled_trigger.size() - 1;
381
382 auto old_main = context.main_slot;
384 parse_trigger_body(gen, err, context);
385 context.main_slot = old_main;
386
387 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
388}
391 context.compiled_trigger.push_back(uint16_t(trigger::controller_scope));
392 } else {
393 gen.discard_group();
394 err.accumulated_errors += "controller trigger scope used in an incorrect scope type " +
395 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
396 return;
397 }
398 context.compiled_trigger.push_back(uint16_t(1));
399 auto payload_size_offset = context.compiled_trigger.size() - 1;
400
401 auto old_main = context.main_slot;
403 parse_trigger_body(gen, err, context);
404 context.main_slot = old_main;
405
406 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
407}
410 context.compiled_trigger.push_back(uint16_t(trigger::location_scope));
411 } else if(context.main_slot == trigger::slot_contents::province) {
412 context.compiled_trigger.push_back(uint16_t(trigger::generic_scope));
413 context.compiled_trigger.push_back(uint16_t(1));
414 auto payload_size_offset = context.compiled_trigger.size() - 1;
415
416 parse_trigger_body(gen, err, context);
417
418 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
419 return;
420 } else {
421 gen.discard_group();
422 err.accumulated_errors += "location trigger scope used in an incorrect scope type " +
423 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
424 return;
425 }
426 context.compiled_trigger.push_back(uint16_t(1));
427 auto payload_size_offset = context.compiled_trigger.size() - 1;
428
429 auto old_main = context.main_slot;
431 parse_trigger_body(gen, err, context);
432 context.main_slot = old_main;
433
434 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
435}
438 context.compiled_trigger.push_back(uint16_t(trigger::country_scope_province));
439 } else if(context.main_slot == trigger::slot_contents::state) {
440 context.compiled_trigger.push_back(uint16_t(trigger::country_scope_state));
441 } else if(context.main_slot == trigger::slot_contents::nation) {
442 context.compiled_trigger.push_back(uint16_t(trigger::country_scope_nation));
443 } else if(context.main_slot == trigger::slot_contents::pop) {
444 context.compiled_trigger.push_back(uint16_t(trigger::country_scope_pop));
445 } else {
446 gen.discard_group();
447 err.accumulated_errors += "country trigger scope used in an incorrect scope type " +
448 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
449 return;
450 }
451 context.compiled_trigger.push_back(uint16_t(1));
452 auto payload_size_offset = context.compiled_trigger.size() - 1;
453
454 auto old_main = context.main_slot;
456 parse_trigger_body(gen, err, context);
457 context.main_slot = old_main;
458
459 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
460}
463 context.compiled_trigger.push_back(uint16_t(trigger::capital_scope));
464 } else if(context.main_slot == trigger::slot_contents::province) {
465 context.compiled_trigger.push_back(uint16_t(trigger::capital_scope_province));
466 } else if(context.main_slot == trigger::slot_contents::pop) {
467 context.compiled_trigger.push_back(uint16_t(trigger::capital_scope_pop));
468 } else {
469 gen.discard_group();
470 err.accumulated_errors += "capital_scope trigger scope used in an incorrect scope type " +
471 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
472 return;
473 }
474 context.compiled_trigger.push_back(uint16_t(1));
475 auto payload_size_offset = context.compiled_trigger.size() - 1;
476
477 auto old_main = context.main_slot;
479 parse_trigger_body(gen, err, context);
480 context.main_slot = old_main;
481
482 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
483}
486 context.compiled_trigger.push_back(uint16_t(trigger::this_scope_province));
487 } else if(context.main_slot == trigger::slot_contents::state) {
488 context.compiled_trigger.push_back(uint16_t(trigger::this_scope_state));
489 } else if(context.main_slot == trigger::slot_contents::nation) {
490 context.compiled_trigger.push_back(uint16_t(trigger::this_scope_nation));
491 } else if(context.main_slot == trigger::slot_contents::pop) {
492 context.compiled_trigger.push_back(uint16_t(trigger::this_scope_pop));
493 } else {
494 gen.discard_group();
495 err.accumulated_errors += "'this' trigger scope used in an incorrect scope type " +
496 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
497 return;
498 }
499 context.compiled_trigger.push_back(uint16_t(1));
500 auto payload_size_offset = context.compiled_trigger.size() - 1;
501
502 auto old_main = context.main_slot;
503 context.main_slot = context.this_slot;
504 parse_trigger_body(gen, err, context);
505 context.main_slot = old_main;
506
507 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
508}
511 context.compiled_trigger.push_back(uint16_t(trigger::from_scope_province));
512 } else if(context.main_slot == trigger::slot_contents::state) {
513 context.compiled_trigger.push_back(uint16_t(trigger::from_scope_state));
514 } else if(context.main_slot == trigger::slot_contents::nation) {
515 context.compiled_trigger.push_back(uint16_t(trigger::from_scope_nation));
516 } else if(context.main_slot == trigger::slot_contents::pop) {
517 context.compiled_trigger.push_back(uint16_t(trigger::from_scope_pop));
518 } else {
519 gen.discard_group();
520 err.accumulated_errors += "'from' trigger scope used in an incorrect scope type " +
521 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
522 return;
523 }
524 context.compiled_trigger.push_back(uint16_t(1));
525 auto payload_size_offset = context.compiled_trigger.size() - 1;
526
527 auto old_main = context.main_slot;
528 context.main_slot = context.from_slot;
529 parse_trigger_body(gen, err, context);
530 context.main_slot = old_main;
531
532 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
533}
536 context.compiled_trigger.push_back(uint16_t(trigger::sea_zone_scope));
537 context.compiled_trigger.push_back(uint16_t(1));
538 auto payload_size_offset = context.compiled_trigger.size() - 1;
539
540 parse_trigger_body(gen, err, context);
541
542 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
543 } else {
544 gen.discard_group();
545 err.accumulated_errors += "sea_zone trigger scope used in an incorrect scope type " +
546 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
547 return;
548 }
549}
552 context.compiled_trigger.push_back(uint16_t(trigger::cultural_union_scope));
553 } else if(context.main_slot == trigger::slot_contents::pop) {
554 context.compiled_trigger.push_back(uint16_t(trigger::cultural_union_scope_pop));
555 } else {
556 gen.discard_group();
557 err.accumulated_errors += "cultural_union trigger scope used in an incorrect scope type " +
558 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
559 return;
560 }
561 context.compiled_trigger.push_back(uint16_t(1));
562 auto payload_size_offset = context.compiled_trigger.size() - 1;
563
564 auto old_main = context.main_slot;
566 parse_trigger_body(gen, err, context);
567 context.main_slot = old_main;
568
569 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
570}
573 context.compiled_trigger.push_back(uint16_t(trigger::overlord_scope));
574 context.compiled_trigger.push_back(uint16_t(1));
575 auto payload_size_offset = context.compiled_trigger.size() - 1;
576
577 parse_trigger_body(gen, err, context);
578
579 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
580 } else {
581 gen.discard_group();
582 err.accumulated_errors += "overlord trigger scope used in an incorrect scope type " +
583 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
584 return;
585 }
586}
589 context.compiled_trigger.push_back(uint16_t(trigger::sphere_owner_scope));
590 context.compiled_trigger.push_back(uint16_t(1));
591 auto payload_size_offset = context.compiled_trigger.size() - 1;
592
593 parse_trigger_body(gen, err, context);
594
595 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
596 } else {
597 gen.discard_group();
598 err.accumulated_errors += "sphere_owner trigger scope used in an incorrect scope type " +
599 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
600 return;
601 }
602}
605 context.compiled_trigger.push_back(uint16_t(trigger::independence_scope));
606 context.compiled_trigger.push_back(uint16_t(1));
607 auto payload_size_offset = context.compiled_trigger.size() - 1;
608
609 auto old_main = context.main_slot;
611 parse_trigger_body(gen, err, context);
612 context.main_slot = old_main;
613
614 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
615 } else {
616 gen.discard_group();
617 err.accumulated_errors += "independence trigger scope used in an incorrect scope type " +
618 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
619 return;
620 }
621}
624 context.compiled_trigger.push_back(uint16_t(trigger::flashpoint_tag_scope));
625 context.compiled_trigger.push_back(uint16_t(1));
626 auto payload_size_offset = context.compiled_trigger.size() - 1;
627
628 auto old_main = context.main_slot;
630 parse_trigger_body(gen, err, context);
631 context.main_slot = old_main;
632
633 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
634 } else {
635 gen.discard_group();
636 err.accumulated_errors += "flashpoint_tag_scope trigger scope used in an incorrect scope type " +
637 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
638 return;
639 }
640}
642 context.compiled_trigger.push_back(uint16_t(trigger::crisis_state_scope));
643 context.compiled_trigger.push_back(uint16_t(1));
644 auto payload_size_offset = context.compiled_trigger.size() - 1;
645
646 auto old_main = context.main_slot;
648 parse_trigger_body(gen, err, context);
649 context.main_slot = old_main;
650
651 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
652}
655 context.compiled_trigger.push_back(uint16_t(trigger::generic_scope));
656 context.compiled_trigger.push_back(uint16_t(1));
657 auto payload_size_offset = context.compiled_trigger.size() - 1;
658
659 parse_trigger_body(gen, err, context);
660
661 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
662 return;
663 }
664
666 context.compiled_trigger.push_back(uint16_t(trigger::state_scope_province));
667 } else if(context.main_slot == trigger::slot_contents::pop) {
668 context.compiled_trigger.push_back(uint16_t(trigger::state_scope_pop));
669 } else {
670 gen.discard_group();
671 err.accumulated_errors += "state_scope trigger scope used in an incorrect scope type " +
672 slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
673 return;
674 }
675 context.compiled_trigger.push_back(uint16_t(1));
676 auto payload_size_offset = context.compiled_trigger.size() - 1;
677
678 auto old_main = context.main_slot;
680 parse_trigger_body(gen, err, context);
681 context.main_slot = old_main;
682
683 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
684}
685void tr_scope_variable(std::string_view name, token_generator& gen, error_handler& err, trigger_building_context& context) {
686 std::string label_str{name};
687 if(auto it = context.outer_context.map_of_state_names.find(label_str); it != context.outer_context.map_of_state_names.end()) {
689
690 context.compiled_trigger.push_back(uint16_t(1));
691 auto payload_size_offset = context.compiled_trigger.size() - 1;
692
693 context.compiled_trigger.push_back(trigger::payload(it->second).value);
694
695 auto old_main = context.main_slot;
697 parse_trigger_body(gen, err, context);
698 context.main_slot = old_main;
699
700 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
701 } else if(auto itr = context.outer_context.map_of_region_names.find(label_str); itr != context.outer_context.map_of_region_names.end()) {
703
704 context.compiled_trigger.push_back(uint16_t(1));
705 auto payload_size_offset = context.compiled_trigger.size() - 1;
706
707 context.compiled_trigger.push_back(trigger::payload(itr->second).value);
708
709 auto old_main = context.main_slot;
711 parse_trigger_body(gen, err, context);
712 context.main_slot = old_main;
713
714 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
715 } else if(is_integer(name.data(), name.data() + name.length())) {
716 auto int_value = parse_int(name, 0, err);
717 if(0 <= int_value && size_t(int_value) < context.outer_context.original_id_to_prov_id_map.size()) {
718 context.compiled_trigger.push_back(uint16_t(trigger::integer_scope));
719 context.compiled_trigger.push_back(uint16_t(1));
720 auto payload_size_offset = context.compiled_trigger.size() - 1;
722
723 auto old_main = context.main_slot;
725 parse_trigger_body(gen, err, context);
726 context.main_slot = old_main;
727
728 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
729 } else {
730 err.accumulated_errors += "integer trigger scope given an invalid province id (" + err.file_name + ")\n";
731 context.compiled_trigger.push_back(trigger::payload(dcon::province_id()).value);
732 }
733
734 } else if(name.length() == 3) {
735 if(auto itb = context.outer_context.map_of_ident_names.find(nations::tag_to_int(name[0], name[1], name[2]));
736 itb != context.outer_context.map_of_ident_names.end()) {
737 context.compiled_trigger.push_back(uint16_t(trigger::tag_scope));
738 context.compiled_trigger.push_back(uint16_t(1));
739 auto payload_size_offset = context.compiled_trigger.size() - 1;
740 context.compiled_trigger.push_back(trigger::payload(itb->second).value);
741
742 auto old_main = context.main_slot;
744 parse_trigger_body(gen, err, context);
745 context.main_slot = old_main;
746
747 context.compiled_trigger[payload_size_offset] = uint16_t(context.compiled_trigger.size() - payload_size_offset);
748 } else {
749 err.accumulated_errors += "unknown scope " + label_str + " introduced in a trigger (" + err.file_name + ")\n";
750 gen.discard_group();
751 return;
752 }
753 } else {
754 err.accumulated_errors += "unknown scope " + label_str + " introduced in a trigger (" + err.file_name + ")\n";
755 gen.discard_group();
756 return;
757 }
758}
759
760inline void invert_trigger_internal(uint16_t* source) {
761 if((source[0] & trigger::code_mask) >= trigger::first_scope_code) {
762 auto const neg_disjunctive_bit = trigger::is_disjunctive_scope & ~source[0];
763 auto const neg_existence_bit =
764 scope_has_any_all(source[0] & trigger::code_mask) ? (trigger::is_existence_scope & ~source[0]) : 0;
765 auto const masked_source = source[0] & ~(trigger::is_disjunctive_scope | trigger::is_existence_scope);
766
767 source[0] = uint16_t(masked_source | neg_disjunctive_bit | neg_existence_bit);
768 } else {
769 auto const inverse_association = invert_association(uint16_t(source[0] & trigger::association_mask));
770 source[0] = uint16_t((source[0] & ~trigger::association_mask) | inverse_association);
771 }
772}
773
774void invert_trigger(uint16_t* source) {
776}
777
778bool scope_is_empty(uint16_t const* source) {
780}
781// precondition: scope known to not be empty
782bool scope_has_single_member(uint16_t const* source) {
783 auto const data_offset = 2 + trigger::trigger_scope_data_payload(source[0]);
784 return trigger::get_trigger_scope_payload_size(source) == data_offset + trigger::get_trigger_payload_size(source + data_offset);
785}
786
787// yields new source size
788int32_t simplify_trigger(uint16_t* source) {
789 assert((0 <= (*source & trigger::code_mask) && (*source & trigger::code_mask) < trigger::first_invalid_code) ||
791 if((source[0] & trigger::code_mask) >= trigger::first_scope_code) {
792 if(scope_is_empty(source)) {
793 return 0; // simplify an empty scope to nothing
794 }
795
796 // simplify each member
797 auto source_size = 1 + trigger::get_trigger_scope_payload_size(source);
798 auto const first_member = source + 2 + trigger::trigger_scope_data_payload(source[0]);
799
800 {
801 auto sub_units_start = first_member;
802 while(sub_units_start < source + source_size) {
803 auto const old_size = 1 + trigger::get_trigger_payload_size(sub_units_start);
804 auto const new_size = simplify_trigger(sub_units_start);
805
806 if(new_size != old_size) { // has been simplified, assumes that new size always <= old size
807 std::copy(sub_units_start + old_size, source + source_size, sub_units_start + new_size);
808 source_size -= (old_size - new_size);
809 }
810 sub_units_start += new_size;
811 }
812 }
813
814 source[1] = uint16_t(source_size - 1);
815
816 if((source[0] & trigger::code_mask) == trigger::placeholder_not_scope) { // remove not scopes
817 invert_trigger(source);
818 source[0] &= ~trigger::code_mask;
819 /*
820 if((source[0] & trigger::is_disjunctive_scope) != 0) {
821 source[0] &= ~trigger::is_disjunctive_scope;
822 } else {
823 source[0] |= trigger::is_disjunctive_scope;
824 }
825 */
826 source[0] |= trigger::generic_scope;
827 }
828
830 auto sub_units_start = first_member;
831 while(sub_units_start < source + source_size) {
832 auto const size = 1 + trigger::get_trigger_payload_size(sub_units_start);
833 if(sub_units_start[0] == source[0]) {
834 std::copy(sub_units_start + 2, source + source_size, sub_units_start);
835 source_size -= 2;
836 } else {
837 sub_units_start += size;
838 }
839 }
840 source[1] = uint16_t(source_size - 1);
841 }
842
844 if((source[0] & trigger::code_mask) == trigger::generic_scope) { // remove single-member generic scopes
845 std::copy(source + 2, source + source_size, source);
846 source_size -= 2;
847 } else if((first_member[0] & trigger::code_mask) == trigger::generic_scope) {
848 // scope contains single generic scope
849
850 source[1] = uint16_t(first_member[1] + trigger::trigger_scope_data_payload(source[0]));
851 source[0] = uint16_t((source[0] & ~trigger::is_disjunctive_scope) | (first_member[0] & trigger::is_disjunctive_scope));
852
853 std::copy(first_member + 2, source + source_size, first_member);
854
855 source_size -= 2;
856 }
857 }
858
859 if((source[0] & trigger::code_mask) >= trigger::first_scope_code && scope_is_empty(source)) {
860 return 0; // simplify an empty scope to nothing
861 }
862 return source_size;
863 } else {
864 return 1 + trigger::get_trigger_non_scope_payload_size(source); // non scopes cannot be simplified
865 }
866}
867
869 tr_scope_and(gen, err, context);
870
871 auto const new_size = simplify_trigger(context.compiled_trigger.data());
872 context.compiled_trigger.resize(static_cast<size_t>(new_size));
873
875}
876
877void make_stored_trigger(std::string_view name, token_generator& gen, error_handler& err, scenario_building_context& context) {
879
880 tcontext.compiled_trigger.push_back(uint16_t(trigger::generic_scope));
881 tcontext.compiled_trigger.push_back(uint16_t(1));
882 auto payload_size_offset = tcontext.compiled_trigger.size() - 1;
883
884 parse_stored_condition(gen, err, tcontext);
885
886 tcontext.compiled_trigger[payload_size_offset] = uint16_t(tcontext.compiled_trigger.size() - payload_size_offset);
887
888 auto const new_size = simplify_trigger(tcontext.compiled_trigger.data());
889 tcontext.compiled_trigger.resize(static_cast<size_t>(new_size));
890
891 auto by_name = context.map_of_stored_triggers.find(std::string(name));
892
893 bool can_store = (by_name == context.map_of_stored_triggers.end());
894 if(!can_store) {
895 can_store = true;
896 auto& prev_stored = by_name->second;
897 for(auto e : prev_stored) {
898 if(e.main_slot == tcontext.main_slot && e.from_slot == tcontext.from_slot && e.this_slot == tcontext.this_slot) {
899 err.accumulated_errors += "two stored triggers with the name " + std::string(name) + " defined for the same types of parameters (" + err.file_name + ")\n";
900 can_store = false;
901 }
902 }
903 }
904
905 if(can_store) {
906 auto saved_trigger = context.state.commit_trigger_data(tcontext.compiled_trigger);
907 auto name_id = text::find_or_add_key(context.state, name, false);
908
909 auto stored_t_id = context.state.world.create_stored_trigger();
910 context.state.world.stored_trigger_set_function(stored_t_id, saved_trigger);
911 context.state.world.stored_trigger_set_name(stored_t_id, name_id);
912
913 if(by_name == context.map_of_stored_triggers.end()) {
914 context.map_of_stored_triggers.insert_or_assign(std::string(name), std::vector<saved_stored_condition>{ saved_stored_condition{ stored_t_id, tcontext.main_slot, tcontext.this_slot, tcontext.from_slot } });
915 } else {
916 by_name->second.push_back(saved_stored_condition{ stored_t_id, tcontext.main_slot, tcontext.this_slot, tcontext.from_slot });
917 }
918 }
919}
920
922 auto old_factor = context.factor;
923 context.factor = 0.0f;
924
925 tr_scope_and(gen, err, context);
926
927 auto new_factor = context.factor;
928 context.factor = old_factor;
929
930 auto const new_size = simplify_trigger(context.compiled_trigger.data());
931 context.compiled_trigger.resize(static_cast<size_t>(new_size));
932
933 auto tkey = context.outer_context.state.commit_trigger_data(context.compiled_trigger);
934 context.compiled_trigger.clear();
935
936 context.outer_context.state.value_modifier_segments.push_back(sys::value_modifier_segment{new_factor, tkey});
937}
938
939dcon::value_modifier_key make_value_modifier(token_generator& gen, error_handler& err, trigger_building_context& context) {
940 auto old_count = context.outer_context.state.value_modifier_segments.size();
941 value_modifier_definition result = parse_value_modifier_definition(gen, err, context);
942
943 auto multiplier = result.factor ? *result.factor : 1.0f;
944 auto overall_factor = result.base;
945 auto new_count = context.outer_context.state.value_modifier_segments.size();
946
947 return context.outer_context.state.value_modifiers.push_back(
948 sys::value_modifier_description{ multiplier, overall_factor, uint16_t(old_count), uint16_t(new_count - old_count)});
949}
950
951void trigger_body::is_canal_enabled(association_type a, int32_t value, error_handler& err, int32_t line,
952 trigger_building_context& context) {
953 if(1 <= value && value <= int32_t(context.outer_context.state.province_definitions.canals.size())) {
954 context.compiled_trigger.push_back(uint16_t(trigger::is_canal_enabled | association_to_bool_code(a)));
955 context.compiled_trigger.push_back(trigger::payload(uint16_t(value)).value);
956 } else {
957 err.accumulated_errors += "canal index " + std::to_string(value) + " out of range (" + err.file_name + ", line " + std::to_string(line) + ")\n";
958 return;
959 }
960}
961
962void trigger_body::badboy(association_type a, float value, error_handler& err, int32_t line, trigger_building_context& context) {
964 context.compiled_trigger.push_back(uint16_t(trigger::badboy | association_to_trigger_code(a)));
965 } else {
966 err.accumulated_errors += "badboy trigger used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + "(" + err.file_name + ", line " + std::to_string(line) + ")\n";
967 return;
968 }
969 context.add_float_to_payload(value * context.outer_context.state.defines.badboy_limit);
970}
971
972void trigger_body::ruling_party(association_type a, std::string_view value, error_handler& err, int32_t line,
973 trigger_building_context& context) {
975
976 context.compiled_trigger.push_back(uint16_t(trigger::ruling_party | association_to_bool_code(a)));
977 } else {
978 err.accumulated_errors += "ruling_party trigger used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ", line " + std::to_string(line) + ")\n";
979 return;
980 }
981 auto name_id = text::find_or_add_key(context.outer_context.state, value, false);
982 context.add_int32_t_to_payload(name_id.index());
983}
984
985void trigger_body::has_leader(association_type a, std::string_view value, error_handler& err, int32_t line,
986 trigger_building_context& context) {
988 context.compiled_trigger.push_back(uint16_t(trigger::has_leader | association_to_bool_code(a)));
989 } else {
990 err.accumulated_errors += "has_leader trigger used in an incorrect scope type " + slot_contents_to_string(context.main_slot) +
991 "(" + err.file_name + ", line " + std::to_string(line) + ")\n";
992 return;
993 }
994 auto name_id = context.outer_context.state.add_unit_name(value);
995 context.add_int32_t_to_payload(name_id.index());
996}
997
998void tr_party_position::position(association_type t, std::string_view v, error_handler& err, int32_t line, trigger_building_context& context) {
999 if(auto it = context.outer_context.map_of_ioptions.find(std::string(v)); it != context.outer_context.map_of_ioptions.end()) {
1000 opt_ = it->second.id;
1001 } else {
1002 err.accumulated_errors += "Invalid issue position " + std::string(v) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1003 }
1004}
1005
1006} // namespace parsers
std::string accumulated_errors
Definition: parsers.hpp:62
std::string file_name
Definition: parsers.hpp:61
#define assert(condition)
Definition: debug.h:74
uint32_t tag_to_int(char first, char second, char third)
Definition: nations.hpp:7
uint16_t association_to_trigger_code(association_type a)
bool is_integer(char const *start, char const *end)
Definition: parsers.cpp:46
void tr_scope_all_core(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_substate(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_owned_province(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_crisis_state_scope(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_core(token_generator &gen, error_handler &err, trigger_building_context &context)
dcon::trigger_key make_trigger(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_state(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_or(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_owner(token_generator &gen, error_handler &err, trigger_building_context &context)
association_type
Definition: parsers.hpp:28
void tr_scope_every_country(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_sphere_member(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_pop(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_substate(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_country(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_sea_zone(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_cultural_union(token_generator &gen, error_handler &err, trigger_building_context &context)
constexpr bool scope_has_any_all(uint16_t code)
void tr_state_scope(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_not(token_generator &gen, error_handler &err, trigger_building_context &context)
void make_stored_trigger(std::string_view name, token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::value_modifier_key make_value_modifier(token_generator &gen, error_handler &err, trigger_building_context &context)
int32_t simplify_trigger(uint16_t *source)
void tr_scope_variable(std::string_view name, token_generator &gen, error_handler &err, trigger_building_context &context)
bool scope_is_empty(uint16_t const *source)
void tr_scope_and(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_capital_scope(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_overlord(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_state(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_greater_power(token_generator &gen, error_handler &err, trigger_building_context &context)
uint16_t association_to_bool_code(association_type a)
void tr_scope_this(token_generator &gen, error_handler &err, trigger_building_context &context)
int32_t parse_int(std::string_view content, int32_t line, error_handler &err)
Definition: parsers.cpp:226
void tr_scope_country(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_controller(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_neighbor_province(token_generator &gen, error_handler &err, trigger_building_context &context)
uint16_t invert_association(uint16_t a)
void tr_scope_from(token_generator &gen, error_handler &err, trigger_building_context &context)
void invert_trigger_internal(uint16_t *source)
void tr_scope_sphere_owner(token_generator &gen, error_handler &err, trigger_building_context &context)
bool scope_has_single_member(uint16_t const *source)
void tr_scope_war_countries(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_pop(token_generator &gen, error_handler &err, trigger_building_context &context)
std::string slot_contents_to_string(trigger::slot_contents v)
void tr_flashpoint_tag_scope(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_war_countries(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_neighbor_country(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_sphere_member(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_independence(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_location(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_greater_power(token_generator &gen, error_handler &err, trigger_building_context &context)
void invert_trigger(uint16_t *source)
void make_value_modifier_segment(token_generator &gen, error_handler &err, trigger_building_context &context)
dcon::text_key find_or_add_key(sys::state &state, std::string_view key, bool as_unicode)
Definition: text.cpp:695
constexpr uint16_t country_scope_province
constexpr uint16_t generic_scope
constexpr uint16_t owner_scope_province
constexpr uint16_t x_pop_scope_province
constexpr uint16_t code_mask
int32_t get_trigger_scope_payload_size(uint16_t const *data)
constexpr uint16_t state_scope_province
constexpr uint16_t is_disjunctive_scope
constexpr uint16_t sphere_owner_scope
constexpr uint16_t this_scope_province
constexpr uint16_t x_owned_province_scope_state
constexpr uint16_t x_substate_scope
constexpr uint16_t x_country_scope
constexpr uint16_t cultural_union_scope
constexpr uint16_t country_scope_nation
constexpr uint16_t from_scope_province
constexpr uint16_t location_scope
constexpr uint16_t country_scope_pop
constexpr uint16_t integer_scope
constexpr uint16_t x_provinces_in_variable_region
constexpr uint16_t x_neighbor_country_scope_pop
constexpr uint16_t country_scope_state
constexpr uint16_t crisis_state_scope
constexpr uint16_t capital_scope_province
constexpr uint16_t state_scope_pop
constexpr uint16_t from_scope_nation
constexpr uint16_t x_state_scope
constexpr uint16_t this_scope_nation
constexpr uint16_t x_owned_province_scope_nation
constexpr uint16_t x_war_countries_scope_pop
constexpr uint16_t this_scope_pop
constexpr uint16_t owner_scope_state
constexpr uint16_t from_scope_pop
constexpr uint16_t x_pop_scope_state
constexpr uint16_t x_core_scope_nation
int32_t get_trigger_non_scope_payload_size(uint16_t const *data)
constexpr uint16_t x_neighbor_province_scope_state
constexpr uint16_t flashpoint_tag_scope
constexpr uint16_t this_scope_state
constexpr uint16_t association_mask
constexpr uint16_t x_neighbor_country_scope_nation
TRIGGER_BYTECODE_LIST constexpr uint16_t first_scope_code
constexpr uint16_t independence_scope
constexpr uint16_t cultural_union_scope_pop
constexpr uint16_t first_invalid_code
constexpr uint16_t x_pop_scope_nation
constexpr uint16_t capital_scope_pop
constexpr uint16_t placeholder_not_scope
constexpr uint16_t x_greater_power_scope
constexpr uint16_t sea_zone_scope
constexpr uint16_t x_neighbor_province_scope
constexpr uint16_t x_core_scope_province
constexpr uint16_t tag_scope
constexpr uint16_t is_existence_scope
int32_t trigger_scope_data_payload(uint16_t code)
int32_t get_trigger_payload_size(uint16_t const *data)
constexpr uint16_t capital_scope
constexpr uint16_t x_war_countries_scope_nation
uint16_t * recurse_over_triggers(uint16_t *source, T const &f)
constexpr uint16_t controller_scope
constexpr uint16_t overlord_scope
constexpr uint16_t from_scope_state
constexpr uint16_t x_provinces_in_variable_region_proper
constexpr uint16_t x_sphere_member_scope
ankerl::unordered_dense::map< std::string, dcon::state_definition_id > map_of_state_names
std::vector< dcon::province_id > original_id_to_prov_id_map
ankerl::unordered_dense::map< std::string, pending_option_content > map_of_ioptions
ankerl::unordered_dense::map< std::string, dcon::region_id > map_of_region_names
ankerl::unordered_dense::map< std::string, std::vector< saved_stored_condition > > map_of_stored_triggers
ankerl::unordered_dense::map< uint32_t, dcon::national_identity_id > map_of_ident_names
void position(association_type t, std::string_view v, error_handler &err, int32_t line, trigger_building_context &context)
dcon::issue_option_id opt_
void badboy(association_type a, float value, error_handler &err, int32_t line, trigger_building_context &context)
void has_leader(association_type a, std::string_view value, error_handler &err, int32_t line, trigger_building_context &context)
void ruling_party(association_type a, std::string_view value, error_handler &err, int32_t line, trigger_building_context &context)
void is_canal_enabled(association_type a, int32_t value, error_handler &err, int32_t line, trigger_building_context &context)
trigger::slot_contents this_slot
trigger::slot_contents from_slot
std::vector< uint16_t > compiled_trigger
trigger::slot_contents main_slot
scenario_building_context & outer_context
std::vector< dcon::province_adjacency_id > canals
Definition: province.hpp:21
dcon::trigger_key commit_trigger_data(std::vector< uint16_t > data)
std::vector< value_modifier_segment > value_modifier_segments
dcon::data_container world
parsing::defines defines
tagged_vector< value_modifier_description, dcon::value_modifier_key > value_modifiers
dcon::unit_name_id add_unit_name(std::string_view text)
province::global_provincial_state province_definitions