Project Alice
Loading...
Searching...
No Matches
nations_parsing.cpp
Go to the documentation of this file.
1#include "system_state.hpp"
2#include "nations.hpp"
4#include "trigger_parsing.hpp"
5#include "effect_parsing.hpp"
6
7namespace parsers {
8void national_identity_file::any_value(std::string_view tag, association_type, std::string_view txt, error_handler& err,
9 int32_t line, scenario_building_context& context) {
10 if(tag.length() != 3) {
11 err.accumulated_errors += err.file_name + " line " + std::to_string(line) + ": encountered a tag that was not three characters\n";
12 return;
13 }
14
15 // Avoid issues that the original had, where defining a tag 'NOT' or 'AND' caused
16 // crashes, here we tell the modder that she shouldn't do THAT
17 if(is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "not")
18 || is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "and")) {
19 err.accumulated_errors += err.file_name + " line " + std::to_string(line) + ": A tag which conflicts with a conditional 'NOT' or 'AND'\n";
20 return;
21 }
22
23 if(is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "war")
24 || is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "tag")
25 || is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "any")
26 || is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "log")) {
27 err.accumulated_errors += err.file_name + " line " + std::to_string(line) + ": A tag which conflicts with a built-in 'war', 'any', 'log' or 'tag'\n";
28 return;
29 }
30
31 if(is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "who")
32 || is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "oob")
33 || is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "yes")) {
34 err.accumulated_warnings += err.file_name + " line " + std::to_string(line) + ": A tag which may conflict with a built-in 'who' or 'oob'\n";
35 }
36
37 auto as_int = nations::tag_to_int(tag[0], tag[1], tag[2]);
38 auto new_ident = context.state.world.create_national_identity();
39 if(is_fixed_token_ci(tag.data(), tag.data() + tag.length(), "reb")) {
40 context.state.national_definitions.rebel_id = new_ident;
41 }
42
43 auto name_id = context.state.add_key_win1252(tag);
44 auto adj_id = context.state.add_key_win1252(std::string(tag) + "_ADJ");
45 context.state.world.national_identity_set_name(new_ident, name_id);
46 context.state.world.national_identity_set_adjective(new_ident, adj_id);
47 context.state.world.national_identity_set_identifying_int(new_ident, as_int);
48
49 context.file_names_for_idents.resize(context.state.world.national_identity_size());
50 context.file_names_for_idents[new_ident] = txt;
51 context.map_of_ident_names.insert_or_assign(as_int, new_ident);
52}
53
55 auto name_id = text::find_or_add_key(context.outer_context.state, context.name, false);
56
57 auto modifier_id = context.outer_context.state.world.create_modifier();
58
59 context.outer_context.state.world.modifier_set_icon(modifier_id, uint8_t(icon_index));
60 context.outer_context.state.world.modifier_set_name(modifier_id, name_id);
61 context.outer_context.state.world.modifier_set_desc(modifier_id, text::find_or_add_key(context.outer_context.state, std::string(context.name) + "_desc", false));
62 context.outer_context.state.world.modifier_set_national_values(modifier_id, force_national_mod());
63
64 context.outer_context.map_of_modifiers.insert_or_assign(std::string(context.name), modifier_id);
65
66 context.outer_context.state.national_definitions.triggered_modifiers[context.index].linked_modifier = modifier_id;
67}
68
71 gen.discard_group();
72}
73
74void make_triggered_modifier(std::string_view name, token_generator& gen, error_handler& err,
76 auto index = uint32_t(context.state.national_definitions.triggered_modifiers.size());
77 context.state.national_definitions.triggered_modifiers.emplace_back();
78
79 triggered_modifier_context new_context{context, index, name};
80 parse_triggered_modifier(gen, err, new_context);
81}
82
83void make_national_value(std::string_view name, token_generator& gen, error_handler& err, scenario_building_context& context) {
84 auto name_id = text::find_or_add_key(context.state, name, false);
85
86 auto parsed_modifier = parse_modifier_base(gen, err, context);
87
88 auto new_modifier = context.state.world.create_modifier();
89
90 context.state.world.modifier_set_icon(new_modifier, uint8_t(context.number_of_national_values_seen));
91 context.state.world.modifier_set_name(new_modifier, name_id);
92 context.state.world.modifier_set_desc(new_modifier, text::find_or_add_key(context.state, std::string(name) + "_desc", false));
93 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
94
95 context.map_of_modifiers.insert_or_assign(std::string(name), new_modifier);
96
98}
99
101 auto name_id = text::find_or_add_key(context.state, "very_easy_player", true);
102
103 auto parsed_modifier = parse_modifier_base(gen, err, context);
104
105 auto new_modifier = context.state.world.create_modifier();
106
107 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
108 context.state.world.modifier_set_name(new_modifier, name_id);
109 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
110
111 context.map_of_modifiers.insert_or_assign(std::string("very_easy_player"), new_modifier);
112 context.state.national_definitions.very_easy_player = new_modifier;
113}
114
116 auto name_id = text::find_or_add_key(context.state, "easy_player", true);
117
118 auto parsed_modifier = parse_modifier_base(gen, err, context);
119
120 auto new_modifier = context.state.world.create_modifier();
121
122 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
123 context.state.world.modifier_set_name(new_modifier, name_id);
124 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
125
126 context.map_of_modifiers.insert_or_assign(std::string("easy_player"), new_modifier);
127 context.state.national_definitions.easy_player = new_modifier;
128}
129
131 auto name_id = text::find_or_add_key(context.state, "hard_player", true);
132
133 auto parsed_modifier = parse_modifier_base(gen, err, context);
134
135 auto new_modifier = context.state.world.create_modifier();
136
137 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
138 context.state.world.modifier_set_name(new_modifier, name_id);
139 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
140
141 context.map_of_modifiers.insert_or_assign(std::string("hard_player"), new_modifier);
142 context.state.national_definitions.hard_player = new_modifier;
143}
144
146 auto name_id = text::find_or_add_key(context.state, "very_hard_player", true);
147
148 auto parsed_modifier = parse_modifier_base(gen, err, context);
149
150 auto new_modifier = context.state.world.create_modifier();
151
152 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
153 context.state.world.modifier_set_name(new_modifier, name_id);
154 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
155
156 context.map_of_modifiers.insert_or_assign(std::string("very_hard_player"), new_modifier);
157 context.state.national_definitions.very_hard_player = new_modifier;
158}
159
161 auto name_id = text::find_or_add_key(context.state, "very_easy_ai", true);
162
163 auto parsed_modifier = parse_modifier_base(gen, err, context);
164
165 auto new_modifier = context.state.world.create_modifier();
166
167 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
168 context.state.world.modifier_set_name(new_modifier, name_id);
169 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
170
171 context.map_of_modifiers.insert_or_assign(std::string("very_easy_ai"), new_modifier);
172 context.state.national_definitions.very_easy_ai = new_modifier;
173}
174
176 auto name_id = text::find_or_add_key(context.state, "easy_ai", true);
177
178 auto parsed_modifier = parse_modifier_base(gen, err, context);
179
180 auto new_modifier = context.state.world.create_modifier();
181
182 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
183 context.state.world.modifier_set_name(new_modifier, name_id);
184 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
185
186 context.map_of_modifiers.insert_or_assign(std::string("easy_ai"), new_modifier);
187 context.state.national_definitions.easy_ai = new_modifier;
188}
189
191 auto name_id = text::find_or_add_key(context.state, "hard_ai", true);
192
193 auto parsed_modifier = parse_modifier_base(gen, err, context);
194
195 auto new_modifier = context.state.world.create_modifier();
196
197 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
198 context.state.world.modifier_set_name(new_modifier, name_id);
199 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
200
201 context.map_of_modifiers.insert_or_assign(std::string("hard_ai"), new_modifier);
202 context.state.national_definitions.hard_ai = new_modifier;
203}
204
206 auto name_id = text::find_or_add_key(context.state, "very_hard_ai", true);
207
208 auto parsed_modifier = parse_modifier_base(gen, err, context);
209
210 auto new_modifier = context.state.world.create_modifier();
211
212 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
213 context.state.world.modifier_set_name(new_modifier, name_id);
214 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
215
216 context.map_of_modifiers.insert_or_assign(std::string("very_hard_ai"), new_modifier);
217 context.state.national_definitions.very_hard_ai = new_modifier;
218}
219
221 auto name_id = text::find_or_add_key(context.state, "overseas", true);
222
223 auto parsed_modifier = parse_modifier_base(gen, err, context);
224
225 auto new_modifier = context.state.world.create_modifier();
226
227 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
228 context.state.world.modifier_set_name(new_modifier, name_id);
229 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
230 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
231
232 context.map_of_modifiers.insert_or_assign(std::string("overseas"), new_modifier);
233 context.state.national_definitions.overseas = new_modifier;
234}
235
237 auto name_id = text::find_or_add_key(context.state, "coastal", true);
238
239 auto parsed_modifier = parse_modifier_base(gen, err, context);
240
241 auto new_modifier = context.state.world.create_modifier();
242
243 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
244 context.state.world.modifier_set_name(new_modifier, name_id);
245 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
246 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
247
248 context.map_of_modifiers.insert_or_assign(std::string("coastal"), new_modifier);
249 context.state.national_definitions.coastal = new_modifier;
250}
251
253 auto name_id = text::find_or_add_key(context.state, "non_coastal", true);
254
255 auto parsed_modifier = parse_modifier_base(gen, err, context);
256
257 auto new_modifier = context.state.world.create_modifier();
258
259 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
260 context.state.world.modifier_set_name(new_modifier, name_id);
261 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
262 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
263
264 context.map_of_modifiers.insert_or_assign(std::string("non_coastal"), new_modifier);
265 context.state.national_definitions.non_coastal = new_modifier;
266}
267
269 auto name_id = text::find_or_add_key(context.state, "coastal_sea", true);
270
271 auto parsed_modifier = parse_modifier_base(gen, err, context);
272
273 auto new_modifier = context.state.world.create_modifier();
274
275 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
276 context.state.world.modifier_set_name(new_modifier, name_id);
277 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
278 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
279
280 context.map_of_modifiers.insert_or_assign(std::string("coastal_sea"), new_modifier);
281 context.state.national_definitions.coastal_sea = new_modifier;
282}
283
285 auto name_id = text::find_or_add_key(context.state, "sea_zone", true);
286
287 auto parsed_modifier = parse_modifier_base(gen, err, context);
288
289 auto new_modifier = context.state.world.create_modifier();
290
291 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
292 context.state.world.modifier_set_name(new_modifier, name_id);
293 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
294 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
295
296 context.map_of_modifiers.insert_or_assign(std::string("sea_zone"), new_modifier);
297 context.state.national_definitions.sea_zone = new_modifier;
298}
299
301 auto name_id = text::find_or_add_key(context.state, "land_province", true);
302
303 auto parsed_modifier = parse_modifier_base(gen, err, context);
304
305 auto new_modifier = context.state.world.create_modifier();
306
307 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
308 context.state.world.modifier_set_name(new_modifier, name_id);
309 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
310 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
311
312 context.map_of_modifiers.insert_or_assign(std::string("land_province"), new_modifier);
313 context.state.national_definitions.land_province = new_modifier;
314}
315
317 auto name_id = text::find_or_add_key(context.state, "blockaded", true);
318
319 auto parsed_modifier = parse_modifier_base(gen, err, context);
320
321 auto new_modifier = context.state.world.create_modifier();
322
323 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
324 context.state.world.modifier_set_name(new_modifier, name_id);
325 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
326 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
327
328 context.map_of_modifiers.insert_or_assign(std::string("blockaded"), new_modifier);
329 context.state.national_definitions.blockaded = new_modifier;
330}
331
333 auto name_id = text::find_or_add_key(context.state, "no_adjacent_controlled", true);
334
335 auto parsed_modifier = parse_modifier_base(gen, err, context);
336
337 auto new_modifier = context.state.world.create_modifier();
338
339 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
340 context.state.world.modifier_set_name(new_modifier, name_id);
341 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
342 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
343
344 context.map_of_modifiers.insert_or_assign(std::string("no_adjacent_controlled"), new_modifier);
346}
347
349 auto name_id = text::find_or_add_key(context.state, "core", true);
350
351 auto parsed_modifier = parse_modifier_base(gen, err, context);
352
353 auto new_modifier = context.state.world.create_modifier();
354
355 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
356 context.state.world.modifier_set_name(new_modifier, name_id);
357 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
358 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
359
360 context.map_of_modifiers.insert_or_assign(std::string("core"), new_modifier);
361 context.state.national_definitions.core = new_modifier;
362}
363
365 auto name_id = text::find_or_add_key(context.state, "has_siege", true);
366
367 auto parsed_modifier = parse_modifier_base(gen, err, context);
368
369 auto new_modifier = context.state.world.create_modifier();
370
371 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
372 context.state.world.modifier_set_name(new_modifier, name_id);
373 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
374 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
375
376 context.map_of_modifiers.insert_or_assign(std::string("has_siege"), new_modifier);
377 context.state.national_definitions.has_siege = new_modifier;
378}
379
381 auto name_id = text::find_or_add_key(context.state, "occupied", true);
382
383 auto parsed_modifier = parse_modifier_base(gen, err, context);
384
385 auto new_modifier = context.state.world.create_modifier();
386
387 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
388 context.state.world.modifier_set_name(new_modifier, name_id);
389 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
390 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
391
392 context.map_of_modifiers.insert_or_assign(std::string("occupied"), new_modifier);
393 context.state.national_definitions.occupied = new_modifier;
394}
395
397 auto name_id = text::find_or_add_key(context.state, "nationalism", true);
398
399 auto parsed_modifier = parse_modifier_base(gen, err, context);
400
401 auto new_modifier = context.state.world.create_modifier();
402
403 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
404 context.state.world.modifier_set_name(new_modifier, name_id);
405 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
406 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
407
408 context.map_of_modifiers.insert_or_assign(std::string("nationalism"), new_modifier);
409 context.state.national_definitions.nationalism = new_modifier;
410}
411
413 auto name_id = text::find_or_add_key(context.state, "infrastructure", true);
414
415 auto parsed_modifier = parse_modifier_base(gen, err, context);
416
417 auto new_modifier = context.state.world.create_modifier();
418
419 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
420 context.state.world.modifier_set_name(new_modifier, name_id);
421 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
422 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
423
424 context.map_of_modifiers.insert_or_assign(std::string("infrastructure"), new_modifier);
425 context.state.national_definitions.infrastructure = new_modifier;
426}
427
429 auto name_id = text::find_or_add_key(context.state, "base_values", true);
430
431 auto parsed_modifier = parse_modifier_base(gen, err, context);
432
433 auto new_modifier = context.state.world.create_modifier();
434
435 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
436 context.state.world.modifier_set_name(new_modifier, name_id);
437 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
438
439 context.map_of_modifiers.insert_or_assign(std::string("base_values"), new_modifier);
440 context.state.national_definitions.base_values = new_modifier;
441}
442
444 auto name_id = text::find_or_add_key(context.state, "war", true);
445
446 auto parsed_modifier = parse_modifier_base(gen, err, context);
447
448 auto new_modifier = context.state.world.create_modifier();
449
450 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
451 context.state.world.modifier_set_name(new_modifier, name_id);
452 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
453
454 context.map_of_modifiers.insert_or_assign(std::string("war"), new_modifier);
455 context.state.national_definitions.war = new_modifier;
456}
457
459 auto name_id = text::find_or_add_key(context.state, "peace", true);
460
461 auto parsed_modifier = parse_modifier_base(gen, err, context);
462
463 auto new_modifier = context.state.world.create_modifier();
464
465 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
466 context.state.world.modifier_set_name(new_modifier, name_id);
467 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
468
469 context.map_of_modifiers.insert_or_assign(std::string("peace"), new_modifier);
470 context.state.national_definitions.peace = new_modifier;
471}
472
474 auto name_id = text::find_or_add_key(context.state, "disarming", true);
475
476 auto parsed_modifier = parse_modifier_base(gen, err, context);
477
478 auto new_modifier = context.state.world.create_modifier();
479
480 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
481 context.state.world.modifier_set_name(new_modifier, name_id);
482 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
483
484 context.map_of_modifiers.insert_or_assign(std::string("disarming"), new_modifier);
485 context.state.national_definitions.disarming = new_modifier;
486}
487
489 auto name_id = text::find_or_add_key(context.state, "war_exhaustion", true);
490
491 auto parsed_modifier = parse_modifier_base(gen, err, context);
492
493 auto new_modifier = context.state.world.create_modifier();
494
495 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
496 context.state.world.modifier_set_name(new_modifier, name_id);
497 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
498
499 context.map_of_modifiers.insert_or_assign(std::string("war_exhaustion"), new_modifier);
500 context.state.national_definitions.war_exhaustion = new_modifier;
501}
502
504 auto name_id = text::find_or_add_key(context.state, "badboy", true);
505
506 auto parsed_modifier = parse_modifier_base(gen, err, context);
507
508 auto new_modifier = context.state.world.create_modifier();
509
510 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
511 context.state.world.modifier_set_name(new_modifier, name_id);
512 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
513
514 context.map_of_modifiers.insert_or_assign(std::string("badboy"), new_modifier);
515 context.state.national_definitions.badboy = new_modifier;
516}
517
519 auto name_id = text::find_or_add_key(context.state, "debt_default_to", true);
520
521 auto parsed_modifier = parse_modifier_base(gen, err, context);
522
523 auto new_modifier = context.state.world.create_modifier();
524
525 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
526 context.state.world.modifier_set_name(new_modifier, name_id);
527 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
528
529 context.map_of_modifiers.insert_or_assign(std::string("debt_default_to"), new_modifier);
530 context.state.national_definitions.debt_default_to = new_modifier;
531}
532
534 auto name_id = text::find_or_add_key(context.state, "bad_debter", true);
535
536 auto parsed_modifier = parse_modifier_base(gen, err, context);
537
538 auto new_modifier = context.state.world.create_modifier();
539
540 context.state.world.modifier_set_icon(new_modifier, uint8_t(10));
541 context.state.world.modifier_set_name(new_modifier, name_id);
542 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
543
544 context.map_of_modifiers.insert_or_assign(std::string("bad_debter"), new_modifier);
545 context.state.national_definitions.bad_debter = new_modifier;
546}
547
549 auto name_id = text::find_or_add_key(context.state, "great_power", true);
550
551 auto parsed_modifier = parse_modifier_base(gen, err, context);
552
553 auto new_modifier = context.state.world.create_modifier();
554
555 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
556 context.state.world.modifier_set_name(new_modifier, name_id);
557 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
558
559 context.map_of_modifiers.insert_or_assign(std::string("great_power"), new_modifier);
560 context.state.national_definitions.great_power = new_modifier;
561}
562
564 auto name_id = text::find_or_add_key(context.state, "second_power", true);
565
566 auto parsed_modifier = parse_modifier_base(gen, err, context);
567
568 auto new_modifier = context.state.world.create_modifier();
569
570 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
571 context.state.world.modifier_set_name(new_modifier, name_id);
572 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
573
574 context.map_of_modifiers.insert_or_assign(std::string("second_power"), new_modifier);
575 context.state.national_definitions.second_power = new_modifier;
576}
577
579 auto name_id = text::find_or_add_key(context.state, "civ_nation", true);
580
581 auto parsed_modifier = parse_modifier_base(gen, err, context);
582
583 auto new_modifier = context.state.world.create_modifier();
584
585 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
586 context.state.world.modifier_set_name(new_modifier, name_id);
587 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
588
589 context.map_of_modifiers.insert_or_assign(std::string("civ_nation"), new_modifier);
590 context.state.national_definitions.civ_nation = new_modifier;
591}
592
594 auto name_id = text::find_or_add_key(context.state, "unciv_nation", true);
595
596 auto parsed_modifier = parse_modifier_base(gen, err, context);
597
598 auto new_modifier = context.state.world.create_modifier();
599
600 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
601 context.state.world.modifier_set_name(new_modifier, name_id);
602 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
603
604 context.map_of_modifiers.insert_or_assign(std::string("unciv_nation"), new_modifier);
605 context.state.national_definitions.unciv_nation = new_modifier;
606}
607
609 auto name_id = text::find_or_add_key(context.state, "average_literacy", true);
610
611 auto parsed_modifier = parse_modifier_base(gen, err, context);
612
613 auto new_modifier = context.state.world.create_modifier();
614
615 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
616 context.state.world.modifier_set_name(new_modifier, name_id);
617 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
618
619 context.map_of_modifiers.insert_or_assign(std::string("average_literacy"), new_modifier);
620 context.state.national_definitions.average_literacy = new_modifier;
621}
622
624 auto name_id = text::find_or_add_key(context.state, "plurality", true);
625
626 auto parsed_modifier = parse_modifier_base(gen, err, context);
627
628 auto new_modifier = context.state.world.create_modifier();
629
630 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
631 context.state.world.modifier_set_name(new_modifier, name_id);
632 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
633
634 context.map_of_modifiers.insert_or_assign(std::string("plurality"), new_modifier);
635 context.state.national_definitions.plurality = new_modifier;
636}
637
639 auto name_id = text::find_or_add_key(context.state, "generalised_debt_default", true);
640
641 auto parsed_modifier = parse_modifier_base(gen, err, context);
642
643 auto new_modifier = context.state.world.create_modifier();
644
645 context.state.world.modifier_set_icon(new_modifier, uint8_t(10));
646 context.state.world.modifier_set_name(new_modifier, name_id);
647 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
648
649 context.map_of_modifiers.insert_or_assign(std::string("generalised_debt_default"), new_modifier);
651}
652
654 auto name_id = text::find_or_add_key(context.state, "total_occupation", true);
655
656 auto parsed_modifier = parse_modifier_base(gen, err, context);
657
658 auto new_modifier = context.state.world.create_modifier();
659
660 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
661 context.state.world.modifier_set_name(new_modifier, name_id);
662 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
663
664 context.map_of_modifiers.insert_or_assign(std::string("total_occupation"), new_modifier);
665 context.state.national_definitions.total_occupation = new_modifier;
666}
667
669 auto name_id = text::find_or_add_key(context.state, "total_blockaded", true);
670
671 auto parsed_modifier = parse_modifier_base(gen, err, context);
672
673 auto new_modifier = context.state.world.create_modifier();
674
675 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
676 context.state.world.modifier_set_name(new_modifier, name_id);
677 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
678
679 context.map_of_modifiers.insert_or_assign(std::string("total_blockaded"), new_modifier);
680 context.state.national_definitions.total_blockaded = new_modifier;
681}
682
684 auto name_id = text::find_or_add_key(context.state, "in_bankrupcy", true);
685
686 auto parsed_modifier = parse_modifier_base(gen, err, context);
687
688 auto new_modifier = context.state.world.create_modifier();
689
690 context.state.world.modifier_set_icon(new_modifier, uint8_t(10));
691 context.state.world.modifier_set_name(new_modifier, name_id);
692 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.force_national_mod());
693
694 context.map_of_modifiers.insert_or_assign(std::string("in_bankrupcy"), new_modifier);
695 context.state.national_definitions.in_bankrupcy = new_modifier;
696}
697
698void make_event_modifier(std::string_view name, token_generator& gen, error_handler& err, scenario_building_context& context) {
699 auto name_id = text::find_or_add_key(context.state, name, true);
700
701 auto parsed_modifier = parse_modifier_base(gen, err, context);
702
703 auto new_modifier = context.state.world.create_modifier();
704
705 context.state.world.modifier_set_icon(new_modifier, uint8_t(parsed_modifier.icon_index));
706 context.state.world.modifier_set_name(new_modifier, name_id);
707 auto desc_1 = text::find_or_add_key(context.state, std::string(name) + "_desc", false);
708
709 context.state.world.modifier_set_desc(new_modifier, desc_1);
710
711 context.state.world.modifier_set_province_values(new_modifier, parsed_modifier.peek_province_mod());
712 context.state.world.modifier_set_national_values(new_modifier, parsed_modifier.peek_national_mod());
713
714 context.map_of_modifiers.insert_or_assign(std::string(name), new_modifier);
715}
716
718 auto party_id = context.outer_context.state.world.create_political_party();
719 if(!(context.outer_context.state.world.national_identity_get_political_party_first(context.id))) {
720 context.outer_context.state.world.national_identity_set_political_party_first(context.id, party_id);
721 context.outer_context.state.world.national_identity_set_political_party_count(context.id, uint8_t(1));
722 } else {
723 context.outer_context.state.world.national_identity_get_political_party_count(context.id) += uint8_t(1);
724 }
725
726 party_context new_context{ context.outer_context, party_id };
727 parse_party(gen, err, new_context);
728}
729
730void make_unit_names_list(std::string_view name, token_generator& gen, error_handler& err, country_file_context& context) {
731 if(auto it = context.outer_context.map_of_unit_types.find(std::string(name));
732 it != context.outer_context.map_of_unit_types.end()) {
733 auto found_type = it->second;
734 unit_names_context new_context{context.outer_context, context.id, found_type};
735 parse_unit_names_list(gen, err, new_context);
736 } else {
737 err.accumulated_errors += "No unit type named " + std::string(name) + " (" + err.file_name + ")\n";
738 gen.discard_group();
739 }
740}
741
742dcon::national_variable_id scenario_building_context::get_national_variable(std::string const& name) {
743 if(auto it = map_of_national_variables.find(name); it != map_of_national_variables.end()) {
744 return it->second;
745 } else {
746 dcon::national_variable_id new_id = dcon::national_variable_id(
747 dcon::national_variable_id::value_base_t(state.national_definitions.num_allocated_national_variables));
749 map_of_national_variables.insert_or_assign(name, new_id);
751 return new_id;
752 }
753}
754
755dcon::national_flag_id scenario_building_context::get_national_flag(std::string const& name) {
756 if(auto it = map_of_national_flags.find(name); it != map_of_national_flags.end()) {
757 return it->second;
758 } else {
759 dcon::national_flag_id new_id =
760 dcon::national_flag_id(dcon::national_flag_id::value_base_t(state.national_definitions.num_allocated_national_flags));
762 map_of_national_flags.insert_or_assign(name, new_id);
764 return new_id;
765 }
766}
767
768dcon::global_flag_id scenario_building_context::get_global_flag(std::string const& name) {
769 if(auto it = map_of_global_flags.find(name); it != map_of_global_flags.end()) {
770 return it->second;
771 } else {
772 dcon::global_flag_id new_id =
773 dcon::global_flag_id(dcon::global_flag_id::value_base_t(state.national_definitions.num_allocated_global_flags));
775 map_of_global_flags.insert_or_assign(name, new_id);
777 return new_id;
778 }
779}
780
784 return make_trigger(gen, err, t_context);
785}
786
790 return make_trigger(gen, err, t_context);
791}
792void make_focus(std::string_view name, token_generator& gen, error_handler& err, national_focus_context& context) {
793 auto name_id = text::find_or_add_key(context.outer_context.state, name, false);
794 auto new_focus = context.outer_context.state.world.create_national_focus();
795 context.outer_context.state.world.national_focus_set_name(new_focus, name_id);
796 context.outer_context.state.world.national_focus_set_type(new_focus, uint8_t(context.type));
797 context.id = new_focus;
798 auto modifier = parse_national_focus(gen, err, context);
799
800 context.outer_context.state.world.national_focus_set_icon(new_focus, uint8_t(modifier.icon_index));
801
802 if(modifier.next_to_add_n != 0 || modifier.next_to_add_p != 0) {
803 auto new_modifier = context.outer_context.state.world.create_modifier();
804 context.outer_context.state.world.modifier_set_name(new_modifier, name_id);
805 context.outer_context.state.world.modifier_set_icon(new_modifier, uint8_t(modifier.icon_index));
806 context.outer_context.state.world.modifier_set_province_values(new_modifier, modifier.peek_province_mod());
807 context.outer_context.state.world.modifier_set_national_values(new_modifier, modifier.peek_national_mod());
808 context.outer_context.state.world.national_focus_set_modifier(new_focus, new_modifier);
809 }
810
811 context.outer_context.map_of_national_focuses.insert_or_assign(std::string(name), new_focus);
812}
813void make_focus_group(std::string_view name, token_generator& gen, error_handler& err, scenario_building_context& context) {
815
816 if(is_fixed_token_ci(name.data(), name.data() + name.length(), "rail_focus"))
818 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "immigration_focus"))
820 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "diplomatic_focus"))
822 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "promotion_focus"))
824 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "production_focus"))
826 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "party_loyalty_focus"))
828 // non vanilla but present in some MP mods
829 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "policy_focus"))
831 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "tier_1_focus"))
833 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "tier_2_focus"))
835 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "tier_3_focus"))
837 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "tier_4_focus"))
839 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "tier_5_focus"))
841 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "tier_6_focus"))
843 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "tier_7_focus"))
845 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "tier_8_focus"))
847 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "building_focus"))
849 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "population_focus"))
851 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "heavy_industry_focus"))
853 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "consumer_goods_focus"))
855 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "military_goods_focus"))
857 else if(is_fixed_token_ci(name.data(), name.data() + name.length(), "immigration_colonization_focus"))
859 else
860 err.accumulated_errors += "Unknown national focus group name " + std::string(name) + " (" + err.file_name + ")\n";
861
862 national_focus_context new_context{context, dcon::national_focus_id{}, t};
863 parse_focus_group(gen, err, new_context);
864}
865
866dcon::value_modifier_key make_decision_ai_choice(token_generator& gen, error_handler& err, decision_context& context) {
869 return make_value_modifier(gen, err, t_context);
870}
874 return make_trigger(gen, err, t_context);
875}
879 e_context.effect_is_for_event = false;
880 return make_effect(gen, err, e_context);
881}
882
883void make_decision(std::string_view name, token_generator& gen, error_handler& err, scenario_building_context& context) {
884 auto new_decision = context.state.world.create_decision();
885
886 auto name_id = text::find_or_add_key(context.state, std::string(name) + "_title", false);
887 auto desc_id = text::find_or_add_key(context.state, std::string(name) + "_desc", false);
888
889 auto root = get_root(context.state.common_fs);
890 auto gfx = open_directory(root, NATIVE("gfx"));
891 auto pictures = open_directory(gfx, NATIVE("pictures"));
892 auto decisions = open_directory(pictures, NATIVE("decisions"));
893
894
895 context.state.world.decision_set_name(new_decision, name_id);
896 context.state.world.decision_set_description(new_decision, desc_id);
897
898 decision_context new_context{context, new_decision};
899 parse_decision(gen, err, new_context);
900
901 if(!context.state.world.decision_get_image(new_decision)) {
902 std::string file_name = simple_fs::remove_double_backslashes(std::string("gfx\\pictures\\decisions\\") + [&]() {
903 if(peek_file(decisions, simple_fs::utf8_to_native(name) + NATIVE(".dds"))) {
904 return std::string(name) + ".tga";
905 } else if(peek_file(decisions, simple_fs::utf8_to_native(name) + NATIVE(".tga"))) {
906 return std::string(name) + ".tga";
907 } else if(peek_file(decisions, simple_fs::utf8_to_native(name) + NATIVE(".png"))) {
908 return std::string(name) + ".tga";
909 } else {
910 return std::string("noimage.tga");
911 }
912 }());
913 if(auto it = context.gfx_context.map_of_names.find(file_name); it != context.gfx_context.map_of_names.end()) {
914 context.state.world.decision_set_image(new_decision, it->second);
915 } else {
916 auto gfxindex = context.state.ui_defs.gfx.size();
917 context.state.ui_defs.gfx.emplace_back();
918 ui::gfx_object& new_obj = context.state.ui_defs.gfx.back();
919 auto new_id = dcon::gfx_object_id(uint16_t(gfxindex));
920
921 context.gfx_context.map_of_names.insert_or_assign(file_name, new_id);
922
923 new_obj.number_of_frames = uint8_t(1);
924
925 if(auto itb = context.gfx_context.map_of_texture_names.find(file_name);
926 itb != context.gfx_context.map_of_texture_names.end()) {
927 new_obj.primary_texture_handle = itb->second;
928 } else {
929 auto index = context.state.ui_defs.textures.size();
930 context.state.ui_defs.textures.emplace_back(context.state.add_key_win1252(file_name));
931 new_obj.primary_texture_handle = dcon::texture_id(dcon::texture_id::value_base_t(index));
932 context.gfx_context.map_of_texture_names.insert_or_assign(file_name, new_obj.primary_texture_handle);
933 }
935
936 context.state.world.decision_set_image(new_decision, new_id);
937 }
938 }
939}
940
942 token_generator scan_copy = gen;
943 auto scan_result = parse_scan_event(scan_copy, err, context);
944
945 if(scan_result.is_triggered_only) {
946 if(auto it = context.map_of_provincial_events.find(scan_result.id); it != context.map_of_provincial_events.end()) {
947 if(it->second.text_assigned) {
948 err.accumulated_errors += "More than one event given id " + std::to_string(scan_result.id) + " (" + err.file_name + ")\n";
949 } else {
950 it->second.generator_state = gen;
951 it->second.text_assigned = true;
952 it->second.original_file = err.file_name;
953 }
954 } else {
955 context.map_of_provincial_events.insert_or_assign(scan_result.id,
956 pending_prov_event{ err.file_name, dcon::provincial_event_id(), trigger::slot_contents::empty, trigger::slot_contents::empty,
957 trigger::slot_contents::empty, gen, false});
958 }
959 gen = scan_copy;
960 } else {
961 if(auto it = context.map_of_provincial_events.find(scan_result.id); it != context.map_of_provincial_events.end()) {
962 if(it->second.text_assigned) {
963 err.accumulated_errors += "More than one event given id " + std::to_string(scan_result.id) + " (" + err.file_name + ")\n";
964 } else {
965 it->second.generator_state = gen;
966 it->second.text_assigned = true;
967 it->second.original_file = err.file_name;
968 }
969 } else {
970 context.map_of_provincial_events.insert_or_assign(scan_result.id,
971 pending_prov_event{ err.file_name, dcon::provincial_event_id(), trigger::slot_contents::empty, trigger::slot_contents::empty,
972 trigger::slot_contents::empty, gen, true });
973 }
974
977 auto event_result = parse_generic_event(gen, err, e_context);
978 auto new_id = context.state.world.create_free_provincial_event();
979 auto fid = fatten(context.state.world, new_id);
980 fid.set_description(event_result.desc_);
981 fid.set_immediate_effect(event_result.immediate_);
982 fid.set_name(event_result.title_);
983 fid.set_mtth(event_result.mean_time_to_happen);
984 fid.set_only_once(event_result.fire_only_once);
985 fid.set_trigger(event_result.trigger);
986 fid.get_options() = event_result.options;
987 }
988}
990 token_generator scan_copy = gen;
991 auto scan_result = parse_scan_event(scan_copy, err, context);
992
993 if(scan_result.is_triggered_only) {
994 if(auto it = context.map_of_national_events.find(scan_result.id); it != context.map_of_national_events.end()) {
995 if(it->second.text_assigned) {
996 err.accumulated_errors += "More than one event given id " + std::to_string(scan_result.id) + " (" + err.file_name + ")\n";
997 } else {
998 it->second.generator_state = gen;
999 it->second.text_assigned = true;
1000 it->second.original_file = err.file_name;
1001 }
1002 } else {
1003 context.map_of_national_events.insert_or_assign(scan_result.id,
1004 pending_nat_event{ err.file_name, dcon::national_event_id(), trigger::slot_contents::empty, trigger::slot_contents::empty,
1005 trigger::slot_contents::empty, gen, false});
1006 }
1007 gen = scan_copy;
1008 } else {
1009 if(auto it = context.map_of_national_events.find(scan_result.id); it != context.map_of_national_events.end()) {
1010 if(it->second.text_assigned) {
1011 err.accumulated_errors += "More than one event given id " + std::to_string(scan_result.id) + " (" + err.file_name + ")\n";
1012 } else {
1013 it->second.generator_state = gen;
1014 it->second.text_assigned = true;
1015 it->second.original_file = err.file_name;
1016 }
1017 } else {
1018 context.map_of_national_events.insert_or_assign(scan_result.id,
1019 pending_nat_event{ err.file_name, dcon::national_event_id(), trigger::slot_contents::empty, trigger::slot_contents::empty,
1020 trigger::slot_contents::empty, gen, true });
1021 }
1022
1025 auto event_result = parse_generic_event(gen, err, e_context);
1026 auto new_id = context.state.world.create_free_national_event();
1027 auto fid = fatten(context.state.world, new_id);
1028 fid.set_description(event_result.desc_);
1029 fid.set_name(event_result.title_);
1030 fid.set_image(event_result.picture_);
1031 fid.set_immediate_effect(event_result.immediate_);
1032 fid.set_is_major(event_result.major);
1033 fid.set_mtth(event_result.mean_time_to_happen);
1034 fid.set_only_once(event_result.fire_only_once);
1035 fid.set_trigger(event_result.trigger);
1036 fid.get_options() = event_result.options;
1037 fid.set_legacy_id(uint32_t(event_result.id));
1038 }
1039}
1040
1043 auto event_result = parse_generic_event(gen, err, e_context);
1044 auto id = context.outer_context.state.world.create_national_event();
1045 auto fid = dcon::fatten(context.outer_context.state.world, id);
1046 fid.set_description(event_result.desc_);
1047 fid.set_name(event_result.title_);
1048 fid.set_image(event_result.picture_);
1049 fid.set_allow_multiple_instances(event_result.allow_multiple_instances);
1050 fid.set_immediate_effect(event_result.immediate_);
1051 fid.set_is_major(event_result.major);
1052 fid.get_options() = event_result.options;
1053 //Effect
1054 ef_country_event value;
1055 value.days = 0;
1056 value.id_ = id;
1058 if(value.days <= 0) {
1060 context.compiled_effect.push_back(uint16_t(effect::country_event_immediate_this_nation));
1062 context.compiled_effect.push_back(uint16_t(effect::country_event_immediate_this_province));
1063 else if(context.this_slot == trigger::slot_contents::state)
1064 context.compiled_effect.push_back(uint16_t(effect::country_event_immediate_this_state));
1065 else if(context.this_slot == trigger::slot_contents::pop)
1066 context.compiled_effect.push_back(uint16_t(effect::country_event_immediate_this_pop));
1067 else {
1068 err.accumulated_errors +=
1069 "lambda_country_event effect used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
1070 return;
1071 }
1072 context.compiled_effect.push_back(trigger::payload(value.id_).value);
1073 } else {
1075 context.compiled_effect.push_back(uint16_t(effect::country_event_this_nation));
1077 context.compiled_effect.push_back(uint16_t(effect::country_event_this_province));
1078 else if(context.this_slot == trigger::slot_contents::state)
1079 context.compiled_effect.push_back(uint16_t(effect::country_event_this_state));
1080 else if(context.this_slot == trigger::slot_contents::pop)
1081 context.compiled_effect.push_back(uint16_t(effect::country_event_this_pop));
1082 else {
1083 err.accumulated_errors +=
1084 "lambda_country_event effect used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
1085 return;
1086 }
1087 context.compiled_effect.push_back(trigger::payload(value.id_).value);
1088 context.compiled_effect.push_back(uint16_t(value.days));
1089 }
1090 } else if(context.main_slot == trigger::slot_contents::province) {
1091 if(value.days <= 0) {
1093 context.compiled_effect.push_back(uint16_t(effect::country_event_immediate_province_this_nation));
1095 context.compiled_effect.push_back(uint16_t(effect::country_event_immediate_province_this_province));
1096 else if(context.this_slot == trigger::slot_contents::state)
1097 context.compiled_effect.push_back(uint16_t(effect::country_event_immediate_province_this_state));
1098 else if(context.this_slot == trigger::slot_contents::pop)
1099 context.compiled_effect.push_back(uint16_t(effect::country_event_immediate_province_this_pop));
1100 else {
1101 err.accumulated_errors +=
1102 "lambda_country_event effect used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
1103 return;
1104 }
1105 context.compiled_effect.push_back(trigger::payload(value.id_).value);
1106 } else {
1108 context.compiled_effect.push_back(uint16_t(effect::country_event_province_this_nation));
1110 context.compiled_effect.push_back(uint16_t(effect::country_event_province_this_province));
1111 else if(context.this_slot == trigger::slot_contents::state)
1112 context.compiled_effect.push_back(uint16_t(effect::country_event_province_this_state));
1113 else if(context.this_slot == trigger::slot_contents::pop)
1114 context.compiled_effect.push_back(uint16_t(effect::country_event_province_this_pop));
1115 else {
1116 err.accumulated_errors +=
1117 "lambda_country_event effect used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
1118 return;
1119 }
1120 context.compiled_effect.push_back(trigger::payload(value.id_).value);
1121 context.compiled_effect.push_back(uint16_t(value.days));
1122 }
1123 } else {
1124 err.accumulated_errors +=
1125 "lambda_country_event effect used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
1126 return;
1127 }
1128}
1131 auto event_result = parse_generic_event(gen, err, e_context);
1132 auto id = context.outer_context.state.world.create_provincial_event();
1133 auto fid = dcon::fatten(context.outer_context.state.world, id);
1134 fid.set_description(event_result.desc_);
1135 fid.set_immediate_effect(event_result.immediate_);
1136 fid.set_name(event_result.title_);
1137 fid.get_options() = event_result.options;
1138 //Effect
1139 ef_province_event value;
1140 value.days = 0;
1141 value.id_ = id;
1143 if(value.days <= 0) {
1145 context.compiled_effect.push_back(uint16_t(effect::province_event_immediate_this_nation));
1147 context.compiled_effect.push_back(uint16_t(effect::province_event_immediate_this_province));
1148 else if(context.this_slot == trigger::slot_contents::state)
1149 context.compiled_effect.push_back(uint16_t(effect::province_event_immediate_this_state));
1150 else if(context.this_slot == trigger::slot_contents::pop)
1151 context.compiled_effect.push_back(uint16_t(effect::province_event_immediate_this_pop));
1152 else {
1153 err.accumulated_errors += "lambda_province_event effect used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
1154 return;
1155 }
1156 context.compiled_effect.push_back(trigger::payload(value.id_).value);
1157 } else {
1159 context.compiled_effect.push_back(uint16_t(effect::province_event_this_nation));
1161 context.compiled_effect.push_back(uint16_t(effect::province_event_this_province));
1162 else if(context.this_slot == trigger::slot_contents::state)
1163 context.compiled_effect.push_back(uint16_t(effect::province_event_this_state));
1164 else if(context.this_slot == trigger::slot_contents::pop)
1165 context.compiled_effect.push_back(uint16_t(effect::province_event_this_pop));
1166 else {
1167 err.accumulated_errors += "lambda_province_event effect used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
1168 return;
1169 }
1170 context.compiled_effect.push_back(trigger::payload(value.id_).value);
1171 context.compiled_effect.push_back(uint16_t(value.days));
1172 }
1173 } else {
1174 err.accumulated_errors +=
1175 "lambda_province_event effect used in an incorrect scope type " + slot_contents_to_string(context.main_slot) + " (" + err.file_name + ")\n";
1176 return;
1177 }
1178}
1179
1181 trigger_building_context t_context{context.outer_context, context.main_slot, context.this_slot, context.from_slot};
1182 return make_trigger(gen, err, t_context);
1183}
1185 effect_building_context e_context{context.outer_context, context.main_slot, context.this_slot, context.from_slot};
1186 e_context.effect_is_for_event = true;
1187 return make_effect(gen, err, e_context);
1188}
1189dcon::value_modifier_key make_event_mtth(token_generator& gen, error_handler& err, event_building_context& context) {
1190 trigger_building_context t_context{context.outer_context, context.main_slot, context.this_slot, context.from_slot};
1191 return make_value_modifier(gen, err, t_context);
1192}
1193dcon::value_modifier_key make_option_ai_chance(token_generator& gen, error_handler& err, effect_building_context& context) {
1194 trigger_building_context t_context{context.outer_context, context.main_slot, context.this_slot, context.from_slot};
1195 return make_value_modifier(gen, err, t_context);
1196}
1198 effect_building_context e_context{context.outer_context, context.main_slot, context.this_slot, context.from_slot};
1199 e_context.effect_is_for_event = true;
1200
1201 e_context.compiled_effect.push_back(uint16_t(effect::generic_scope | effect::scope_has_limit));
1202 e_context.compiled_effect.push_back(uint16_t(0));
1203 auto payload_size_offset = e_context.compiled_effect.size() - 1;
1204 e_context.limit_position = e_context.compiled_effect.size();
1205 e_context.compiled_effect.push_back(trigger::payload(dcon::trigger_key()).value);
1206
1207 auto old_err_size = err.accumulated_errors.size();
1208 auto opt_result = parse_event_option(gen, err, e_context);
1209
1210 e_context.compiled_effect[payload_size_offset] = uint16_t(e_context.compiled_effect.size() - payload_size_offset);
1211
1212 if(e_context.compiled_effect.size() >= std::numeric_limits<uint16_t>::max()) {
1213 err.accumulated_errors += "effect " + text::produce_simple_string(context.outer_context.state, opt_result.name_) + " is " +
1214 std::to_string(e_context.compiled_effect.size()) +
1215 " cells big, which exceeds 64 KB bytecode limit (" + err.file_name + ")\n";
1216 return sys::event_option{opt_result.name_, opt_result.ai_chance, dcon::effect_key{0}};
1217 }
1218
1219 if(err.accumulated_errors.size() == old_err_size) {
1220 auto const new_size = simplify_effect(e_context.compiled_effect.data());
1221 e_context.compiled_effect.resize(static_cast<size_t>(new_size));
1222 } else {
1223 e_context.compiled_effect.clear();
1224 }
1225
1226 auto effect_id = context.outer_context.state.commit_effect_data(e_context.compiled_effect);
1227 return sys::event_option{opt_result.name_, opt_result.ai_chance, effect_id};
1228}
1230 int32_t count = 0;
1231 do {
1232 count = 0;
1233 auto fixed_size = context.map_of_national_events.size();
1234 for(auto& e : context.map_of_national_events) {
1235 if(!e.second.processed && e.second.text_assigned && !e.second.just_in_case_placeholder&& e.second.main_slot != trigger::slot_contents::empty) {
1236 e.second.processed = true;
1237 ++count;
1238
1239 if(!bool(e.second.id))
1240 e.second.id = context.state.world.create_national_event();
1241
1242 auto data_copy = e.second;
1243
1244 err.file_name = e.second.original_file + " [pending]";
1245
1246 event_building_context e_context{context, data_copy.main_slot, data_copy.this_slot, data_copy.from_slot};
1247 auto event_result = parse_generic_event(data_copy.generator_state, err, e_context);
1248
1249 auto fid = fatten(context.state.world, data_copy.id);
1250 fid.set_description(event_result.desc_);
1251 fid.set_name(event_result.title_);
1252 fid.set_image(event_result.picture_);
1253 fid.set_immediate_effect(event_result.immediate_);
1254 fid.set_is_major(event_result.major);
1255 fid.set_allow_multiple_instances(event_result.allow_multiple_instances);
1256 fid.get_options() = event_result.options;
1257
1258 for(auto& r : context.state.national_definitions.on_yearly_pulse) {
1259 if(r.id == data_copy.id) {
1260 r.condition = event_result.trigger;
1261 }
1262 }
1263 for(auto& r : context.state.national_definitions.on_quarterly_pulse) {
1264 if(r.id == data_copy.id) {
1265 r.condition = event_result.trigger;
1266 }
1267 }
1268 for(auto& r : context.state.national_definitions.on_surrender) {
1269 if(r.id == data_copy.id) {
1270 r.condition = event_result.trigger;
1271 }
1272 }
1273 for(auto& r : context.state.national_definitions.on_new_great_nation) {
1274 if(r.id == data_copy.id) {
1275 r.condition = event_result.trigger;
1276 }
1277 }
1278 for(auto& r : context.state.national_definitions.on_lost_great_nation) {
1279 if(r.id == data_copy.id) {
1280 r.condition = event_result.trigger;
1281 }
1282 }
1283 for(auto& r : context.state.national_definitions.on_election_tick) {
1284 if(r.id == data_copy.id) {
1285 r.condition = event_result.trigger;
1286 r.issue_group = event_result.issue_group_;
1287 }
1288 }
1289 for(auto& r : context.state.national_definitions.on_colony_to_state) {
1290 if(r.id == data_copy.id) {
1291 r.condition = event_result.trigger;
1292 }
1293 }
1294 for(auto& r : context.state.national_definitions.on_state_conquest) {
1295 if(r.id == data_copy.id) {
1296 r.condition = event_result.trigger;
1297 }
1298 }
1300 if(r.id == data_copy.id) {
1301 r.condition = event_result.trigger;
1302 }
1303 }
1304 for(auto& r : context.state.national_definitions.on_debtor_default) {
1305 if(r.id == data_copy.id) {
1306 r.condition = event_result.trigger;
1307 }
1308 }
1309 for(auto& r : context.state.national_definitions.on_debtor_default_small) {
1310 if(r.id == data_copy.id) {
1311 r.condition = event_result.trigger;
1312 }
1313 }
1314 for(auto& r : context.state.national_definitions.on_debtor_default_second) {
1315 if(r.id == data_copy.id) {
1316 r.condition = event_result.trigger;
1317 }
1318 }
1319 for(auto& r : context.state.national_definitions.on_civilize) {
1320 if(r.id == data_copy.id) {
1321 r.condition = event_result.trigger;
1322 }
1323 }
1325 if(r.id == data_copy.id) {
1326 r.condition = event_result.trigger;
1327 }
1328 }
1330 if(r.id == data_copy.id) {
1331 r.condition = event_result.trigger;
1332 }
1333 }
1334 for(auto& r : context.state.national_definitions.on_election_started) {
1335 if(r.id == data_copy.id) {
1336 r.condition = event_result.trigger;
1337 }
1338 }
1339 for(auto& r : context.state.national_definitions.on_election_finished) {
1340 if(r.id == data_copy.id) {
1341 r.condition = event_result.trigger;
1342 }
1343 }
1344
1345 if(context.map_of_national_events.size() != fixed_size)
1346 break;
1347 }
1348 }
1349
1350 fixed_size = context.map_of_provincial_events.size();
1351 for(auto& e : context.map_of_provincial_events) {
1352 if(!e.second.processed && e.second.text_assigned && !e.second.just_in_case_placeholder && e.second.main_slot != trigger::slot_contents::empty) {
1353 e.second.processed = true;
1354 ++count;
1355
1356 if(!bool(e.second.id))
1357 e.second.id = context.state.world.create_provincial_event();
1358
1359 auto data_copy = e.second;
1360
1361 err.file_name = e.second.original_file + " [pending]";
1362
1363 event_building_context e_context{context, data_copy.main_slot, data_copy.this_slot, data_copy.from_slot};
1364 auto event_result = parse_generic_event(data_copy.generator_state, err, e_context);
1365
1366 auto fid = fatten(context.state.world, data_copy.id);
1367 fid.set_description(event_result.desc_);
1368 fid.set_immediate_effect(event_result.immediate_);
1369 fid.set_name(event_result.title_);
1370 fid.get_options() = event_result.options;
1371
1372 for(auto& r : context.state.national_definitions.on_battle_won) {
1373 if(r.id == data_copy.id) {
1374 r.condition = event_result.trigger;
1375 }
1376 }
1377 for(auto& r : context.state.national_definitions.on_battle_lost) {
1378 if(r.id == data_copy.id) {
1379 r.condition = event_result.trigger;
1380 }
1381 }
1382
1383 if(context.map_of_provincial_events.size() != fixed_size)
1384 break;
1385 }
1386 }
1387 } while(count > 0);
1388
1389 for(auto& e : context.map_of_national_events) {
1390 if(!e.second.just_in_case_placeholder) {
1391 if(!e.second.text_assigned) {
1392 err.accumulated_warnings += "Event id: " + std::to_string(e.first) + " referenced but never defined. \n";
1393 } else if(!e.second.processed) {
1394 err.accumulated_warnings += "Event id: " + std::to_string(e.first) + " defined but never triggered. \n";
1395 }
1396 }
1397 }
1398 for(auto& e : context.map_of_provincial_events) {
1399 if(!e.second.just_in_case_placeholder) {
1400 if(!e.second.text_assigned) {
1401 err.accumulated_warnings += "Event id: " + std::to_string(e.first) + " referenced but never defined. \n";
1402 } else if(!e.second.processed) {
1403 err.accumulated_warnings += "Event id: " + std::to_string(e.first) + " defined but never triggered. \n";
1404 }
1405 }
1406 }
1407}
1408
1409void make_oob_relationship(std::string_view tag, token_generator& gen, error_handler& err, oob_file_context& context) {
1410 if(tag.length() == 3) {
1411 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
1412 it != context.outer_context.map_of_ident_names.end()) {
1413 auto holder = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
1414 if(holder) {
1415 oob_file_relation_context new_context{context.outer_context, context.nation_for, holder};
1416 parse_oob_relationship(gen, err, new_context);
1417 } else {
1418 gen.discard_group();
1419 }
1420 } else {
1421 err.accumulated_errors += "invalid tag " + std::string(tag) + " encountered (" + err.file_name + ")\n";
1422 gen.discard_group();
1423 }
1424 } else {
1425 err.accumulated_errors += "invalid tag " + std::string(tag) + " encountered (" + err.file_name + ")\n";
1426 gen.discard_group();
1427 }
1428}
1429
1431 auto a = parse_alliance(gen, err, context);
1432
1433 if(a.invalid || !a.first_ || !a.second_)
1434 return;
1435
1436 auto rel = context.state.world.get_diplomatic_relation_by_diplomatic_pair(a.first_, a.second_);
1437 if(rel) {
1438 context.state.world.diplomatic_relation_set_are_allied(rel, true);
1439 } else {
1440 auto new_rel = context.state.world.force_create_diplomatic_relation(a.first_, a.second_);
1441 context.state.world.diplomatic_relation_set_are_allied(new_rel, true);
1442 }
1443}
1445 auto a = parse_vassal_description(gen, err, context);
1446 if(!a.invalid && a.second_ && a.first_) {
1447 context.state.world.force_create_overlord(a.second_, a.first_);
1448 }
1449}
1451 auto a = parse_vassal_description(gen, err, context);
1452 if(!a.invalid && a.second_ && a.first_) {
1453 context.state.world.force_create_overlord(a.second_, a.first_);
1454 context.state.world.nation_set_is_substate(a.second_, true);
1455 }
1456}
1457
1459 auto ymd = parse_date(label, 0, err);
1461 context.in_dated_block = true;
1462 parse_country_history_file(gen, err, context);
1463 context.in_dated_block = false;
1464 } else {
1465 gen.discard_group();
1466 }
1467}
1468
1469} // namespace parsers
std::string accumulated_errors
Definition: parsers.hpp:62
std::string accumulated_warnings
Definition: parsers.hpp:63
std::string file_name
Definition: parsers.hpp:61
tag_type emplace_back(T &&... ts)
auto size() const
value_type & safe_get(tag_type t)
void resize(size_t size)
tagged_vector< gfx_object, dcon::gfx_object_id > gfx
tagged_vector< dcon::text_key, dcon::texture_id > textures
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr uint16_t generic_scope
constexpr uint16_t scope_has_limit
focus_type
Definition: nations.hpp:40
uint32_t tag_to_int(char first, char second, char third)
Definition: nations.hpp:7
void m_disarming(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_infrastructure(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_hard_ai(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_land_province(token_generator &gen, error_handler &err, scenario_building_context &context)
void make_oob_relationship(std::string_view tag, token_generator &gen, error_handler &err, oob_file_context &context)
void m_no_adjacent_controlled(token_generator &gen, error_handler &err, scenario_building_context &context)
void register_trigger(token_generator &gen, error_handler &err, triggered_modifier_context &context)
dcon::trigger_key read_triggered_modifier_condition(token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::trigger_key make_trigger(token_generator &gen, error_handler &err, trigger_building_context &context)
void m_badboy(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_total_occupation(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_civ_nation(token_generator &gen, error_handler &err, scenario_building_context &context)
void make_alliance(token_generator &gen, error_handler &err, scenario_building_context &context)
association_type
Definition: parsers.hpp:28
void make_unit_names_list(std::string_view name, token_generator &gen, error_handler &err, country_file_context &context)
void m_base_values(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_has_siege(token_generator &gen, error_handler &err, scenario_building_context &context)
void lambda_country_event(token_generator &gen, error_handler &err, effect_building_context &context)
void scan_province_event(token_generator &gen, error_handler &err, scenario_building_context &context)
void make_triggered_modifier(std::string_view name, token_generator &gen, error_handler &err, scenario_building_context &context)
void m_second_power(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_non_coastal(token_generator &gen, error_handler &err, scenario_building_context &context)
int32_t simplify_effect(uint16_t *source)
void m_easy_ai(token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::trigger_key make_event_trigger(token_generator &gen, error_handler &err, event_building_context &context)
void commit_pending_events(error_handler &err, scenario_building_context &context)
void m_easy_player(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_overseas(token_generator &gen, error_handler &err, scenario_building_context &context)
void lambda_province_event(token_generator &gen, error_handler &err, effect_building_context &context)
void make_event_modifier(std::string_view name, token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::trigger_key make_focus_limit(token_generator &gen, error_handler &err, national_focus_context &context)
dcon::effect_key make_decision_effect(token_generator &gen, error_handler &err, decision_context &context)
void enter_country_file_dated_block(std::string_view label, token_generator &gen, error_handler &err, country_history_context &context)
void m_coastal_sea(token_generator &gen, error_handler &err, scenario_building_context &context)
void make_focus_group(std::string_view name, token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::value_modifier_key make_event_mtth(token_generator &gen, error_handler &err, event_building_context &context)
dcon::value_modifier_key make_value_modifier(token_generator &gen, error_handler &err, trigger_building_context &context)
void m_peace(token_generator &gen, error_handler &err, scenario_building_context &context)
void scan_country_event(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_very_easy_ai(token_generator &gen, error_handler &err, scenario_building_context &context)
void make_party(token_generator &gen, error_handler &err, country_file_context &context)
void m_average_literacy(token_generator &gen, error_handler &err, scenario_building_context &context)
bool is_fixed_token_ci(char const *start, char const *end, char const (&t)[N])
Definition: parsers.hpp:275
dcon::trigger_key make_decision_trigger(token_generator &gen, error_handler &err, decision_context &context)
void make_vassal(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_plurality(token_generator &gen, error_handler &err, scenario_building_context &context)
sys::event_option make_event_option(token_generator &gen, error_handler &err, event_building_context &context)
sys::year_month_day parse_date(std::string_view content, int32_t line, error_handler &err)
Definition: parsers.cpp:253
void make_decision(std::string_view name, token_generator &gen, error_handler &err, scenario_building_context &context)
void m_great_power(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_hard_player(token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::effect_key make_effect(token_generator &gen, error_handler &err, effect_building_context &context)
void m_very_hard_player(token_generator &gen, error_handler &err, scenario_building_context &context)
void make_national_value(std::string_view name, token_generator &gen, error_handler &err, scenario_building_context &context)
void m_debt_default_to(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_unciv_nation(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_occupied(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_very_easy_player(token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::effect_key make_immediate_effect(token_generator &gen, error_handler &err, event_building_context &context)
void m_core(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_generalised_debt_default(token_generator &gen, error_handler &err, scenario_building_context &context)
void make_substate(token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::value_modifier_key make_option_ai_chance(token_generator &gen, error_handler &err, effect_building_context &context)
dcon::value_modifier_key make_decision_ai_choice(token_generator &gen, error_handler &err, decision_context &context)
std::string slot_contents_to_string(trigger::slot_contents v)
void m_bad_debter(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_total_blockaded(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_nationalism(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_war_exhaustion(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_very_hard_ai(token_generator &gen, error_handler &err, scenario_building_context &context)
void make_focus(std::string_view name, token_generator &gen, error_handler &err, national_focus_context &context)
void m_sea_zone(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_in_bankrupcy(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_blockaded(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_coastal(token_generator &gen, error_handler &err, scenario_building_context &context)
void m_war(token_generator &gen, error_handler &err, scenario_building_context &context)
native_string utf8_to_native(std::string_view data_in)
std::string remove_double_backslashes(std::string_view data_in)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
Definition: text.cpp:617
dcon::text_key find_or_add_key(sys::state &state, std::string_view key, bool as_unicode)
Definition: text.cpp:695
#define NATIVE(X)
uint uint32_t
uchar uint8_t
std::vector< fixed_event > on_surrender
Definition: nations.hpp:139
std::vector< fixed_event > on_colony_to_state
Definition: nations.hpp:143
std::vector< fixed_event > on_lost_great_nation
Definition: nations.hpp:141
dcon::modifier_id overseas
Definition: nations.hpp:87
std::vector< fixed_event > on_yearly_pulse
Definition: nations.hpp:135
dcon::modifier_id total_occupation
Definition: nations.hpp:117
dcon::modifier_id total_blockaded
Definition: nations.hpp:118
std::vector< fixed_event > on_civilize
Definition: nations.hpp:149
std::vector< fixed_event > on_debtor_default_small
Definition: nations.hpp:147
std::vector< fixed_event > on_state_conquest
Definition: nations.hpp:144
std::vector< fixed_event > on_election_started
Definition: nations.hpp:152
dcon::modifier_id land_province
Definition: nations.hpp:92
dcon::modifier_id easy_ai
Definition: nations.hpp:82
tagged_vector< dcon::text_key, dcon::national_variable_id > variable_names
Definition: nations.hpp:73
dcon::modifier_id very_hard_ai
Definition: nations.hpp:84
dcon::modifier_id base_values
Definition: nations.hpp:102
dcon::modifier_id generalised_debt_default
Definition: nations.hpp:116
dcon::modifier_id coastal_sea
Definition: nations.hpp:90
dcon::national_identity_id rebel_id
Definition: nations.hpp:75
dcon::modifier_id very_hard_player
Definition: nations.hpp:80
dcon::modifier_id hard_ai
Definition: nations.hpp:83
std::vector< fixed_event > on_election_finished
Definition: nations.hpp:153
dcon::modifier_id nationalism
Definition: nations.hpp:98
std::vector< fixed_province_event > on_battle_won
Definition: nations.hpp:137
dcon::modifier_id debt_default_to
Definition: nations.hpp:108
dcon::modifier_id badboy
Definition: nations.hpp:107
dcon::modifier_id coastal
Definition: nations.hpp:88
tagged_vector< dcon::text_key, dcon::global_flag_id > global_flag_variable_names
Definition: nations.hpp:72
std::vector< fixed_event > on_colony_to_state_free_slaves
Definition: nations.hpp:145
dcon::modifier_id hard_player
Definition: nations.hpp:79
dcon::modifier_id very_easy_ai
Definition: nations.hpp:81
dcon::modifier_id unciv_nation
Definition: nations.hpp:113
std::vector< fixed_event > on_quarterly_pulse
Definition: nations.hpp:136
dcon::modifier_id non_coastal
Definition: nations.hpp:89
dcon::modifier_id in_bankrupcy
Definition: nations.hpp:119
dcon::modifier_id disarming
Definition: nations.hpp:105
dcon::modifier_id easy_player
Definition: nations.hpp:78
dcon::modifier_id bad_debter
Definition: nations.hpp:109
tagged_vector< dcon::text_key, dcon::national_flag_id > flag_variable_names
Definition: nations.hpp:71
dcon::modifier_id civ_nation
Definition: nations.hpp:112
dcon::modifier_id plurality
Definition: nations.hpp:115
dcon::modifier_id no_adjacent_controlled
Definition: nations.hpp:94
std::vector< fixed_event > on_debtor_default
Definition: nations.hpp:146
std::vector< fixed_event > on_crisis_declare_interest
Definition: nations.hpp:151
dcon::modifier_id sea_zone
Definition: nations.hpp:91
dcon::modifier_id blockaded
Definition: nations.hpp:93
dcon::modifier_id peace
Definition: nations.hpp:104
std::vector< triggered_modifier > triggered_modifiers
Definition: nations.hpp:67
std::vector< fixed_event > on_my_factories_nationalized
Definition: nations.hpp:150
dcon::modifier_id great_power
Definition: nations.hpp:110
std::vector< fixed_election_event > on_election_tick
Definition: nations.hpp:142
dcon::modifier_id war_exhaustion
Definition: nations.hpp:106
dcon::modifier_id infrastructure
Definition: nations.hpp:99
dcon::modifier_id average_literacy
Definition: nations.hpp:114
dcon::modifier_id second_power
Definition: nations.hpp:111
dcon::modifier_id occupied
Definition: nations.hpp:97
dcon::modifier_id very_easy_player
Definition: nations.hpp:77
dcon::modifier_id has_siege
Definition: nations.hpp:96
dcon::modifier_id core
Definition: nations.hpp:95
std::vector< fixed_event > on_new_great_nation
Definition: nations.hpp:140
std::vector< fixed_event > on_debtor_default_second
Definition: nations.hpp:148
std::vector< fixed_province_event > on_battle_lost
Definition: nations.hpp:138
ankerl::unordered_dense::map< std::string, dcon::gfx_object_id > map_of_names
ankerl::unordered_dense::map< std::string, dcon::texture_id > map_of_texture_names
scenario_building_context & outer_context
scenario_building_context & outer_context
scenario_building_context & outer_context
trigger::slot_contents this_slot
scenario_building_context & outer_context
std::vector< uint16_t > compiled_effect
trigger::slot_contents from_slot
trigger::slot_contents main_slot
scenario_building_context & outer_context
sys::national_modifier_definition force_national_mod() const
scenario_building_context & outer_context
void any_value(std::string_view tag, association_type, std::string_view txt, error_handler &err, int32_t line, scenario_building_context &context)
scenario_building_context & outer_context
tagged_vector< std::string, dcon::national_identity_id > file_names_for_idents
ankerl::unordered_dense::map< std::string, dcon::unit_type_id > map_of_unit_types
ankerl::unordered_dense::map< std::string, dcon::national_variable_id > map_of_national_variables
ankerl::unordered_dense::map< std::string, dcon::national_flag_id > map_of_national_flags
ankerl::unordered_dense::map< std::string, dcon::national_focus_id > map_of_national_focuses
ankerl::unordered_dense::map< std::string, dcon::modifier_id > map_of_modifiers
ankerl::unordered_dense::map< std::string, dcon::global_flag_id > map_of_global_flags
ankerl::unordered_dense::map< int32_t, pending_nat_event > map_of_national_events
dcon::global_flag_id get_global_flag(std::string const &name)
dcon::national_flag_id get_national_flag(std::string const &name)
ankerl::unordered_dense::map< int32_t, pending_prov_event > map_of_provincial_events
std::vector< pending_triggered_modifier_content > set_of_triggered_modifiers
ankerl::unordered_dense::map< uint32_t, dcon::national_identity_id > map_of_ident_names
dcon::national_variable_id get_national_variable(std::string const &name)
scenario_building_context & outer_context
void finish(triggered_modifier_context &)
dcon::value_modifier_key ai_chance
dcon::text_key add_key_win1252(std::string const &text)
dcon::data_container world
dcon::effect_key commit_effect_data(std::vector< uint16_t > data)
simple_fs::file_system common_fs
absolute_time_point start_date
sys::date current_date
ui::definitions ui_defs
nations::global_national_state national_definitions
dcon::texture_id primary_texture_handle
uint8_t number_of_frames