Project Alice
Loading...
Searching...
No Matches
parsers_declarations.cpp
Go to the documentation of this file.
2#include "system_state.hpp"
3#include "rebels.hpp"
4#include "fonts.hpp"
5#include "demographics.hpp"
6
7namespace parsers {
8
9scenario_building_context::scenario_building_context(sys::state& state) : gfx_context(state, state.ui_defs), state(state) { }
10
11void religion_def::icon(association_type, int32_t v, error_handler& err, int32_t line, religion_context& context) {
12 context.outer_context.state.world.religion_set_icon(context.id, uint8_t(v));
13}
14
15void religion_def::color(color_from_3f v, error_handler& err, int32_t line, religion_context& context) {
16 context.outer_context.state.world.religion_set_color(context.id, v.value);
17}
18
19void religion_def::pagan(association_type, bool v, error_handler& err, int32_t line, religion_context& context) {
20 context.outer_context.state.world.religion_set_is_pagan(context.id, v);
21}
22
23void names_list::free_value(std::string_view text, error_handler& err, int32_t line, names_context& context) {
24 auto new_id = context.outer_context.state.add_unit_name(text);
25 if(context.first_names) {
26 context.outer_context.state.world.culture_get_first_names(context.id).push_back(new_id);
27 } else {
28 context.outer_context.state.world.culture_get_last_names(context.id).push_back(new_id);
29 }
30}
31
32void culture::color(color_from_3i v, error_handler& err, int32_t line, culture_context& context) {
33 context.outer_context.state.world.culture_set_color(context.id, v.value);
34}
35
36void culture::radicalism(association_type, int32_t v, error_handler& err, int32_t line, culture_context& context) {
37 context.outer_context.state.world.culture_set_radicalism(context.id, int8_t(v));
38}
39
40void culture_group::leader(association_type, std::string_view name, error_handler& err, int32_t line,
41 culture_group_context& context) {
42
43 if(auto it = context.outer_context.map_of_leader_graphics.find(std::string(name)); it != context.outer_context.map_of_leader_graphics.end()) {
44 context.outer_context.state.world.culture_group_set_leader(context.id, it->second);
45 } else {
47 "Unknown leader type " + std::string(name) + " in file " + err.file_name + " line " + std::to_string(line) + "\n";
48 }
49}
50
52 context.outer_context.state.world.culture_group_set_is_overseas(context.id, v);
53}
54
56 auto nat_tag = context.outer_context.map_of_ident_names.find(v);
57 if(nat_tag != context.outer_context.map_of_ident_names.end())
58 context.outer_context.state.world.force_create_cultural_union_of(nat_tag->second, context.id);
59 else
60 err.accumulated_errors += "Unknown national tag in file " + err.file_name + " line " + std::to_string(line) + "\n";
61}
62
63void good::money(association_type, bool v, error_handler& err, int32_t line, good_context& context) {
64 if(v) {
65 if(context.outer_context.money_set) {
66 context.outer_context.state.world.commodity_set_money_rgo(context.id, true);
67 } else {
68 context.outer_context.state.world.commodity_set_color(economy::money,
69 context.outer_context.state.world.commodity_get_color(context.id));
70 context.outer_context.state.world.commodity_set_cost(economy::money,
71 context.outer_context.state.world.commodity_get_cost(context.id));
72 context.outer_context.state.world.commodity_set_commodity_group(economy::money,
73 context.outer_context.state.world.commodity_get_commodity_group(context.id));
74 context.outer_context.state.world.commodity_set_name(economy::money,
75 context.outer_context.state.world.commodity_get_name(context.id));
76 context.outer_context.state.world.commodity_set_is_available_from_start(economy::money,
77 context.outer_context.state.world.commodity_get_is_available_from_start(context.id));
78 context.outer_context.state.world.commodity_set_money_rgo(economy::money, true);
79
80 for(auto& pr : context.outer_context.map_of_commodity_names) {
81 if(pr.second == context.id) {
82 pr.second = economy::money;
83 break;
84 }
85 }
86 context.id = economy::money;
87 context.outer_context.state.world.pop_back_commodity();
88 context.outer_context.money_set = true;
89 }
90 }
91}
92
93void good::color(color_from_3i v, error_handler& err, int32_t line, good_context& context) {
94 context.outer_context.state.world.commodity_set_color(context.id, v.value);
95}
96
97void good::cost(association_type, float v, error_handler& err, int32_t line, good_context& context) {
98 context.outer_context.state.world.commodity_set_cost(context.id, v);
99}
100
101void good::available_from_start(association_type, bool b, error_handler& err, int32_t line, good_context& context) {
102 context.outer_context.state.world.commodity_set_is_available_from_start(context.id, b);
103}
104
105void good::overseas_penalty(association_type, bool b, error_handler& err, int32_t line, good_context& context) {
106 context.outer_context.state.world.commodity_set_overseas_penalty(context.id, b);
107}
108
111 context.outer_context.state.world.commodity_set_icon(context.id, uint8_t(context.outer_context.number_of_commodities_seen));
112}
113
114void issue::next_step_only(association_type, bool value, error_handler& err, int32_t line, issue_context& context) {
115 context.outer_context.state.world.issue_set_is_next_step_only(context.id, value);
116}
117
118void issue::administrative(association_type, bool value, error_handler& err, int32_t line, issue_context& context) {
119 context.outer_context.state.world.issue_set_is_administrative(context.id, value);
120}
121
122void issue::next_step_only(association_type, bool value, error_handler& err, int32_t line, reform_context& context) {
123 context.outer_context.state.world.reform_set_is_next_step_only(context.id, value);
124}
125
126void issue::administrative(association_type, bool value, error_handler& err, int32_t line, reform_context& context) {
127 err.accumulated_errors +=
128 "Error, only issues can be administrative (" + err.file_name + " line " + std::to_string(line) + ")\n";
129}
130
132 context.outer_context.state.world.government_type_set_has_elections(context.id, value);
133}
134
136 government_type_context& context) {
137 context.outer_context.state.world.government_type_set_can_appoint_ruling_party(context.id, value);
138}
139
140void government_type::duration(association_type, int32_t value, error_handler& err, int32_t line,
141 government_type_context& context) {
142 context.outer_context.state.world.government_type_set_duration(context.id, int8_t(value));
143}
144
145void government_type::flagtype(association_type, std::string_view value, error_handler& err, int32_t line,
146 government_type_context& context) {
147 if(is_fixed_token_ci(value.data(), value.data() + value.length(), "communist"))
148 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::communist));
149 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "fascist"))
150 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::fascist));
151 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "monarchy"))
152 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::monarchy));
153 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "republic"))
154 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::republic));
155 // Non-vanilla flags
156 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "theocracy"))
157 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::theocracy));
158 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "special"))
159 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::special));
160 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "spare"))
161 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::spare));
162 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "populist"))
163 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::populist));
164 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "realm"))
165 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::realm));
166 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "other"))
167 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::other));
168 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "monarchy2"))
169 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::monarchy2));
170 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "monarchy3"))
171 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::monarchy3));
172 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "republic2"))
173 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::republic2));
174 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "republic3"))
175 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::republic3));
176 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "communist2"))
177 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::communist2));
178 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "communist3"))
179 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::communist3));
180 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "fascist2"))
181 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::fascist2));
182 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "fascist3"))
183 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::fascist3));
184 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "theocracy2"))
185 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::theocracy2));
186 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "theocracy3"))
187 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::theocracy3));
188 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "cosmetic_1"))
189 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::cosmetic_1));
190 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "cosmetic_2"))
191 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::cosmetic_2));
192 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "colonial"))
193 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::colonial));
194 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "nationalist"))
195 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::nationalist));
196 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "sectarian"))
197 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::sectarian));
198 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "socialist"))
199 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::socialist));
200 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "dominion"))
201 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::dominion));
202 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "agrarism"))
203 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::agrarism));
204 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "national_syndicalist"))
205 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::national_syndicalist));
206 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "theocratic"))
207 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::theocratic));
208 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "slot1"))
209 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::slot1));
210 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "slot2"))
211 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::slot2));
212 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "slot3"))
213 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::slot3));
214 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "slot4"))
215 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::slot4));
216 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "anarcho_liberal"))
217 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::anarcho_liberal));
218 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "green"))
219 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::green));
220 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "traditionalist"))
221 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::traditionalist));
222 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "ultranationalist"))
223 context.outer_context.state.world.government_type_set_flag(context.id, uint8_t(::culture::flag_type::ultranationalist));
224 else {
225 err.accumulated_errors += "Unknown flag type " + std::string(value) + " in file " + err.file_name + " line " + std::to_string(line) + "\n";
226 }
227}
228
229void government_type::any_value(std::string_view text, association_type, bool value, error_handler& err, int32_t line,
230 government_type_context& context) {
231 if(value) {
232 auto found_ideology = context.outer_context.map_of_ideologies.find(std::string(text));
233 if(found_ideology != context.outer_context.map_of_ideologies.end()) {
234 context.outer_context.state.world.government_type_get_ideologies_allowed(context.id) |=
235 ::culture::to_bits(found_ideology->second.id);
236 } else {
237 err.accumulated_errors +=
238 "Unknown ideology " + std::string(text) + " in file " + err.file_name + " line " + std::to_string(line) + "\n";
239 }
240 }
241}
242
243void cb_list::free_value(std::string_view text, error_handler& err, int32_t line, scenario_building_context& context) {
244 //dcon::cb_type_id new_id = context.state.world.create_cb_type();
245 //context.map_of_cb_types.insert_or_assign(std::string(text), pending_cb_content{token_generator{}, new_id});
246}
247
248void trait::organisation(association_type, float value, error_handler& err, int32_t line, trait_context& context) {
249 context.outer_context.state.world.leader_trait_set_organisation(context.id, value);
250}
251
252void trait::morale(association_type, float value, error_handler& err, int32_t line, trait_context& context) {
253 context.outer_context.state.world.leader_trait_set_morale(context.id, value);
254}
255
256void trait::attack(association_type, float value, error_handler& err, int32_t line, trait_context& context) {
257 context.outer_context.state.world.leader_trait_set_attack(context.id, value);
258}
259
260void trait::defence(association_type, float value, error_handler& err, int32_t line, trait_context& context) {
261 context.outer_context.state.world.leader_trait_set_defense(context.id, value);
262}
263
264void trait::reconnaissance(association_type, float value, error_handler& err, int32_t line, trait_context& context) {
265 context.outer_context.state.world.leader_trait_set_reconnaissance(context.id, value);
266}
267
268void trait::speed(association_type, float value, error_handler& err, int32_t line, trait_context& context) {
269 context.outer_context.state.world.leader_trait_set_speed(context.id, value);
270}
271
272void trait::experience(association_type, float value, error_handler& err, int32_t line, trait_context& context) {
273 context.outer_context.state.world.leader_trait_set_experience(context.id, value);
274}
275
276void trait::reliability(association_type, float value, error_handler& err, int32_t line, trait_context& context) {
277 context.outer_context.state.world.leader_trait_set_reliability(context.id, value);
278}
279
280void sea_list::free_value(int32_t value, error_handler& err, int32_t line, scenario_building_context& context) {
281 if(size_t(value - 1) > context.prov_id_to_original_id_map.size()) {
282 err.accumulated_errors +=
283 "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
284 } else {
285 context.prov_id_to_original_id_map[dcon::province_id(dcon::province_id::value_base_t(value - 1))].is_sea = true;
286 }
287}
288
289void state_definition::free_value(int32_t value, error_handler& err, int32_t line, state_def_building_context& context) {
290 if(size_t(value) >= context.outer_context.original_id_to_prov_id_map.size()) {
291 err.accumulated_errors += "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
292 } else {
293 auto prov = context.outer_context.original_id_to_prov_id_map[value];
294 if(prov) {
295 context.provinces.push_back(prov);
296 } else {
297 err.accumulated_warnings += "Province id " + std::to_string(value) + " was not found (" + err.file_name + " line " + std::to_string(line) + ")\n";
298 }
299 }
300}
301
302void continent_provinces::free_value(int32_t value, error_handler& err, int32_t line, continent_building_context& context) {
303 if(size_t(value) >= context.outer_context.original_id_to_prov_id_map.size()) {
304 err.accumulated_errors += "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
305 } else {
306 auto province_id = context.outer_context.original_id_to_prov_id_map[value];
307 if(province_id) {
308 if(context.outer_context.state.world.province_get_continent(province_id)) {
309 err.accumulated_warnings += "Province " + std::to_string(context.outer_context.prov_id_to_original_id_map.safe_get(province_id).id) + " (" + std::to_string(value) + ")" + " assigned to multiple continents (" + err.file_name + " line " + std::to_string(line) + ")\n";
310 }
311 context.outer_context.state.world.province_set_continent(province_id, context.id);
312 }
313 }
314}
315
316void continent_definition::free_value(int32_t value, error_handler& err, int32_t line, continent_building_context& context) {
317 if(size_t(value) >= context.outer_context.original_id_to_prov_id_map.size()) {
318 err.accumulated_errors += "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
319 } else {
320 auto province_id = context.outer_context.original_id_to_prov_id_map[value];
321 if(province_id) {
322 if(context.outer_context.state.world.province_get_continent(province_id)) {
323 err.accumulated_warnings += "Province " + std::to_string(context.outer_context.prov_id_to_original_id_map.safe_get(province_id).id) + " (" + std::to_string(value) + ")" + " assigned to multiple continents (" + err.file_name + " line " + std::to_string(line) + ")\n";
324 }
325 context.outer_context.state.world.province_set_continent(province_id, context.id);
326 }
327 }
328}
329
330void climate_definition::free_value(int32_t value, error_handler& err, int32_t line, climate_building_context& context) {
331 if(size_t(value) >= context.outer_context.original_id_to_prov_id_map.size()) {
332 err.accumulated_errors +=
333 "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
334 } else {
335 auto province_id = context.outer_context.original_id_to_prov_id_map[value];
336 if(province_id) {
337 if(context.outer_context.state.world.province_get_climate(province_id)) {
338 err.accumulated_warnings += "Province " + std::to_string(context.outer_context.prov_id_to_original_id_map.safe_get(province_id).id) + " (" + std::to_string(value) + ")" + " assigned to multiple climates (" + err.file_name + " line " + std::to_string(line) + ")\n";
339 }
340 context.outer_context.state.world.province_set_climate(province_id, context.id);
341 }
342 }
343}
344
345void tech_folder_list::free_value(std::string_view name, error_handler& err, int32_t line, tech_group_context& context) {
346 auto name_id = text::find_or_add_key(context.outer_context.state, name, false);
347 auto cindex = context.outer_context.state.culture_definitions.tech_folders.size();
349 context.outer_context.map_of_tech_folders.insert_or_assign(std::string(name), int32_t(cindex));
350}
351
352void commodity_set::any_value(std::string_view name, association_type, float value, error_handler& err, int32_t line,
353 scenario_building_context& context) {
354 auto found_commodity = context.map_of_commodity_names.find(std::string(name));
355 if(found_commodity != context.map_of_commodity_names.end()) {
358 commodity_type[num_added] = found_commodity->second;
359 ++num_added;
360 } else {
361 err.accumulated_errors += "Too many items in a commodity set, in file " + err.file_name + " line " + std::to_string(line) + "\n";
362 }
363 } else {
364 err.accumulated_errors += "Unknown commodity " + std::string(name) + " in file " + err.file_name + " line " + std::to_string(line) + "\n";
365 }
366}
367
369 // minimum discipline for land units
370 if(is_land) {
371 if(discipline_or_evasion <= 0.0f)
373 }
374}
375
376void party::ideology(association_type, std::string_view text, error_handler& err, int32_t line, party_context& context) {
377 if(auto it = context.outer_context.map_of_ideologies.find(std::string(text));
378 it != context.outer_context.map_of_ideologies.end()) {
379 context.outer_context.state.world.political_party_set_ideology(context.id, it->second.id);
380 } else {
381 err.accumulated_errors += std::string(text) + " is not a valid ideology (" + err.file_name + " line " + std::to_string(line) + ")\n";
382 }
383}
384
385void party::name(association_type, std::string_view text, error_handler& err, int32_t line, party_context& context) {
386 auto name_id = text::find_or_add_key(context.outer_context.state, text, false);
387 context.outer_context.state.world.political_party_set_name(context.id, name_id);
388}
389
391 auto date_tag = sys::date(ymd, context.outer_context.state.start_date);
392 context.outer_context.state.world.political_party_set_start_date(context.id, date_tag);
393}
394
396 auto date_tag = sys::date(ymd, context.outer_context.state.start_date);
397 context.outer_context.state.world.political_party_set_end_date(context.id, date_tag);
398}
399
401 context.outer_context.state.world.political_party_set_trigger(context.id, trigger);
402}
403
404void party::any_value(std::string_view issue, association_type, std::string_view option, error_handler& err, int32_t line,
405 party_context& context) {
406 if(auto it = context.outer_context.map_of_iissues.find(std::string(issue)); it != context.outer_context.map_of_iissues.end()) {
407 if(auto oit = context.outer_context.map_of_ioptions.find(std::string(option)); oit != context.outer_context.map_of_ioptions.end()) {
408 context.outer_context.state.world.political_party_set_party_issues(context.id, it->second, oit->second.id);
409 } else {
410 err.accumulated_errors +=
411 std::string(option) + " is not a valid option name (" + err.file_name + " line " + std::to_string(line) + ")\n";
412 }
413 // context.outer_context.state.world.political_party_set_ideology(context.id, it->second.id);
414 } else {
415 err.accumulated_errors += std::string(issue) + " is not a valid issue name (" + err.file_name + " line " + std::to_string(line) + ")\n";
416 }
417}
418
419void unit_names_list::free_value(std::string_view text, error_handler& err, int32_t line, unit_names_context& context) {
420 if(text.length() <= 2)
421 return;
422
423 auto existing_count = context.outer_context.state.world.national_identity_get_unit_names_count(context.id, context.u_id);
424 if(existing_count == 0) {
425 auto first_id = context.outer_context.state.add_unit_name(text);
426 context.outer_context.state.world.national_identity_set_unit_names_first(context.id, context.u_id, first_id);
427 context.outer_context.state.world.national_identity_set_unit_names_count(context.id, context.u_id, uint8_t(1));
428 } else {
430 context.outer_context.state.world.national_identity_set_unit_names_count(context.id, context.u_id,
431 uint8_t(existing_count + 1));
432 }
433}
434
435void pop_history_definition::culture(association_type, std::string_view value, error_handler& err, int32_t line,
437 if(auto it = context.outer_context.map_of_culture_names.find(std::string(value));
438 it != context.outer_context.map_of_culture_names.end()) {
439 cul_id = it->second;
440 } else {
441 err.accumulated_errors +=
442 "Invalid culture " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
443 }
444}
445
446void pop_history_definition::religion(association_type, std::string_view value, error_handler& err, int32_t line,
448 if(auto it = context.outer_context.map_of_religion_names.find(std::string(value));
449 it != context.outer_context.map_of_religion_names.end()) {
450 rel_id = it->second;
451 } else {
452 err.accumulated_errors +=
453 "Invalid religion " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
454 }
455}
456
457void pop_history_definition::rebel_type(association_type, std::string_view value, error_handler& err, int32_t line,
459 if(auto it = context.outer_context.map_of_rebeltypes.find(std::string(value));
460 it != context.outer_context.map_of_rebeltypes.end()) {
461 reb_id = it->second.id;
462 } else {
463 err.accumulated_errors +=
464 "Invalid rebel type " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
465 }
466}
467
468void pop_province_list::any_group(std::string_view type, pop_history_definition const& def, error_handler& err, int32_t line,
470 dcon::pop_type_id ptype;
471 if(auto it = context.outer_context.map_of_poptypes.find(std::string(type)); it != context.outer_context.map_of_poptypes.end()) {
472 ptype = it->second;
473 } else {
474 err.accumulated_errors +=
475 "Invalid pop type " + std::string(type) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
476 }
477 for(auto pops_by_location : context.outer_context.state.world.province_get_pop_location(context.id)) {
478 auto pop_id = pops_by_location.get_pop();
479 if(pop_id.get_culture() == def.cul_id && pop_id.get_poptype() == ptype && pop_id.get_religion() == def.rel_id) {
480 pop_id.get_size() += float(def.size);
481 return; // done with this pop
482 }
483 }
484 // no existing pop matched -- make a new pop
485 auto new_pop = fatten(context.outer_context.state.world, context.outer_context.state.world.create_pop());
486 new_pop.set_culture(def.cul_id);
487 new_pop.set_religion(def.rel_id);
488 new_pop.set_size(float(def.size));
489 new_pop.set_poptype(ptype);
491 // new_pop.set_rebel_group(def.reb_id);
492
493 auto pop_owner = context.outer_context.state.world.province_get_nation_from_province_ownership(context.id);
494 if(def.reb_id) {
495 if(pop_owner) {
496 auto existing_faction = rebel::get_faction_by_type(context.outer_context.state, pop_owner, def.reb_id);
497 if(existing_faction) {
498 context.outer_context.state.world.try_create_pop_rebellion_membership(new_pop, existing_faction);
499 } else {
500 auto new_faction = fatten(context.outer_context.state.world, context.outer_context.state.world.create_rebel_faction());
501 new_faction.set_type(def.reb_id);
502 context.outer_context.state.world.try_create_rebellion_within(new_faction, pop_owner);
503 context.outer_context.state.world.try_create_pop_rebellion_membership(new_pop, new_faction);
504 }
505 } else {
506 err.accumulated_warnings += "Rebel specified on a province without owner (" + err.file_name + " line " + std::to_string(line) + ")\n";
507 }
508 }
509
510 context.outer_context.state.world.force_create_pop_location(new_pop, context.id);
511}
512
513void poptype_file::sprite(association_type, int32_t value, error_handler& err, int32_t line, poptype_context& context) {
514 context.outer_context.state.world.pop_type_set_sprite(context.id, uint8_t(value));
515}
516
517void poptype_file::color(color_from_3i cvalue, error_handler& err, int32_t line, poptype_context& context) {
518 context.outer_context.state.world.pop_type_set_color(context.id, cvalue.value);
519}
520
521void poptype_file::is_artisan(association_type, bool value, error_handler& err, int32_t line, poptype_context& context) {
522 if(value)
524}
525
526void poptype_file::strata(association_type, std::string_view value, error_handler& err, int32_t line, poptype_context& context) {
527 if(is_fixed_token_ci(value.data(), value.data() + value.length(), "rich"))
528 context.outer_context.state.world.pop_type_set_strata(context.id, uint8_t(::culture::pop_strata::rich));
529 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "middle"))
530 context.outer_context.state.world.pop_type_set_strata(context.id, uint8_t(::culture::pop_strata::middle));
531 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "poor"))
532 context.outer_context.state.world.pop_type_set_strata(context.id, uint8_t(::culture::pop_strata::poor));
533 else {
534 err.accumulated_errors +=
535 "Invalid pop strata " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
536 }
537}
538
539void poptype_file::unemployment(association_type, bool value, error_handler& err, int32_t line, poptype_context& context) {
540 context.outer_context.state.world.pop_type_set_has_unemployment(context.id, value);
541}
542
543void poptype_file::is_slave(association_type, bool value, error_handler& err, int32_t line, poptype_context& context) {
544 if(value)
546}
547
548void poptype_file::allowed_to_vote(association_type, bool value, error_handler& err, int32_t line, poptype_context& context) {
549 if(value == false) {
550 context.outer_context.state.world.pop_type_set_voting_forbidden(context.id, true);
551 }
552}
553
554void poptype_file::can_be_recruited(association_type, bool value, error_handler& err, int32_t line, poptype_context& context) {
555 if(value)
557}
558
560 context.outer_context.state.world.pop_type_set_state_capital_only(context.id, value);
561}
562
563void poptype_file::leadership(association_type, int32_t value, error_handler& err, int32_t line, poptype_context& context) {
566}
567
568void poptype_file::research_optimum(association_type, float value, error_handler& err, int32_t line, poptype_context& context) {
569 context.outer_context.state.world.pop_type_set_research_optimum(context.id, value);
570}
571
573 poptype_context& context) {
574 if(value)
576}
577
578void poptype_file::tax_eff(association_type, float value, error_handler& err, int32_t line, poptype_context& context) {
580}
581
582void poptype_file::can_build(association_type, bool value, error_handler& err, int32_t line, poptype_context& context) {
583 if(value)
585}
586
587void poptype_file::research_points(association_type, float value, error_handler& err, int32_t line, poptype_context& context) {
588 context.outer_context.state.world.pop_type_set_research_points(context.id, value);
589}
590
592 poptype_context& context) {
593 if(value)
595}
596
597void poptype_file::workplace_input(association_type, float value, error_handler& err, int32_t line, poptype_context& context) {
598 // discard
599}
600
601void poptype_file::workplace_output(association_type, float value, error_handler& err, int32_t line, poptype_context& context) {
602 // discard
603}
604
605void poptype_file::equivalent(association_type, std::string_view value, error_handler& err, int32_t line,
606 poptype_context& context) {
607 if(value.length() > 0 && value[0] == 'f') {
609 } else if(value.length() > 0 && value[0] == 'l') {
611 }
612}
613
614void poptype_file::life_needs(commodity_array const& value, error_handler& err, int32_t line, poptype_context& context) {
615 context.outer_context.state.world.for_each_commodity([&](dcon::commodity_id cid) {
616 if(cid.index() < value.data.ssize())
617 context.outer_context.state.world.pop_type_set_life_needs(context.id, cid, value.data[cid]);
618 });
619}
620
621void poptype_file::everyday_needs(commodity_array const& value, error_handler& err, int32_t line, poptype_context& context) {
622 context.outer_context.state.world.for_each_commodity([&](dcon::commodity_id cid) {
623 if(cid.index() < value.data.ssize())
624 context.outer_context.state.world.pop_type_set_everyday_needs(context.id, cid, value.data[cid]);
625 });
626}
627
628void poptype_file::luxury_needs(commodity_array const& value, error_handler& err, int32_t line, poptype_context& context) {
629 context.outer_context.state.world.for_each_commodity([&](dcon::commodity_id cid) {
630 if(cid.index() < value.data.ssize())
631 context.outer_context.state.world.pop_type_set_luxury_needs(context.id, cid, value.data[cid]);
632 });
633}
634
635void poptype_file::life_needs_income(income const& value, error_handler& err, int32_t line, poptype_context& context) {
636 // context.outer_context.state.world.pop_type_set_life_needs_income_weight(context.id, value.weight);
637 context.outer_context.state.world.pop_type_set_life_needs_income_type(context.id, uint8_t(value.itype));
638}
639
640void poptype_file::everyday_needs_income(income const& value, error_handler& err, int32_t line, poptype_context& context) {
641 // context.outer_context.state.world.pop_type_set_everyday_needs_income_weight(context.id, value.weight);
642 context.outer_context.state.world.pop_type_set_everyday_needs_income_type(context.id, uint8_t(value.itype));
643}
644
645void poptype_file::luxury_needs_income(income const& value, error_handler& err, int32_t line, poptype_context& context) {
646 // context.outer_context.state.world.pop_type_set_luxury_needs_income_weight(context.id, value.weight);
647 context.outer_context.state.world.pop_type_set_luxury_needs_income_type(context.id, uint8_t(value.itype));
648}
649
651 if(!bool(context.outer_context.state.world.ideology_get_activation_date(context.id))) {
652 context.outer_context.state.world.ideology_set_enabled(context.id, true);
653 }
654}
655
658 if(value)
660}
661
663 context.outer_context.state.world.ideology_set_is_civilized_only(context.id, !value);
664}
665
667 context.outer_context.state.world.ideology_set_is_civilized_only(context.id, value);
668}
669
671 context.outer_context.state.world.ideology_set_color(context.id, cvalue.value);
672}
673
676 auto date_tag = sys::date(ymd, context.outer_context.state.start_date);
677 context.outer_context.state.world.ideology_set_activation_date(context.id, date_tag);
678}
679
680void individual_ideology::add_political_reform(dcon::value_modifier_key value, error_handler& err, int32_t line,
682 context.outer_context.state.world.ideology_set_add_political_reform(context.id, value);
683}
684
685void individual_ideology::remove_political_reform(dcon::value_modifier_key value, error_handler& err, int32_t line,
687 context.outer_context.state.world.ideology_set_remove_political_reform(context.id, value);
688}
689
690void individual_ideology::add_social_reform(dcon::value_modifier_key value, error_handler& err, int32_t line,
692 context.outer_context.state.world.ideology_set_add_social_reform(context.id, value);
693}
694
695void individual_ideology::remove_social_reform(dcon::value_modifier_key value, error_handler& err, int32_t line,
697 context.outer_context.state.world.ideology_set_remove_social_reform(context.id, value);
698}
699
700void individual_ideology::add_military_reform(dcon::value_modifier_key value, error_handler& err, int32_t line,
702 context.outer_context.state.world.ideology_set_add_military_reform(context.id, value);
703}
704
705void individual_ideology::add_economic_reform(dcon::value_modifier_key value, error_handler& err, int32_t line,
707 context.outer_context.state.world.ideology_set_add_economic_reform(context.id, value);
708}
709
711 auto bits = context.outer_context.state.world.cb_type_get_type_bits(context.id);
714}
715
716void cb_body::is_civil_war(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
717 if(value) {
718 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::is_civil_war;
720 }
721}
722
723void cb_body::months(association_type, int32_t value, error_handler& err, int32_t line, individual_cb_context& context) {
724 context.outer_context.state.world.cb_type_set_months(context.id, uint8_t(value));
725}
726
727void cb_body::truce_months(association_type, int32_t value, error_handler& err, int32_t line, individual_cb_context& context) {
728 context.outer_context.state.world.cb_type_set_truce_months(context.id, uint8_t(value));
729}
730
731void cb_body::sprite_index(association_type, int32_t value, error_handler& err, int32_t line, individual_cb_context& context) {
732 context.outer_context.state.world.cb_type_set_sprite_index(context.id, uint8_t(value));
733}
734
735void cb_body::always(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
736 if(value) {
737 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::always;
738 }
739}
740
742 if(value) {
743 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::is_triggered_only;
744 }
745}
746
747void cb_body::constructing_cb(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
748 if(!value) {
749 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::is_not_constructing_cb;
750 }
751}
752
754 individual_cb_context& context) {
755 if(value) {
756 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::great_war_obligatory;
758 }
759}
760
762 if(value) {
763 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::all_allowed_states;
764 }
765}
766
767void cb_body::crisis(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
768 if(!value) {
769 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::not_in_crisis;
770 }
771}
772
774 individual_cb_context& context) {
775 if(value) {
776 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_clear_union_sphere;
777 }
778}
779
780void cb_body::po_gunboat(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
781 if(value) {
782 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_gunboat;
783 }
784}
785
786void cb_body::po_annex(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
787 if(value) {
788 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_annex;
789 }
790}
791
792void cb_body::po_demand_state(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
793 if(value) {
794 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_demand_state;
795 }
796}
797
798void cb_body::po_add_to_sphere(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
799 if(value) {
800 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_add_to_sphere;
801 }
802}
803
804void cb_body::po_disarmament(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
805 if(value) {
806 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_disarmament;
807 }
808}
809
810void cb_body::po_reparations(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
811 if(value) {
812 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_reparations;
813 }
814}
815
817 individual_cb_context& context) {
818 if(value) {
819 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_transfer_provinces;
820 }
821}
822
824 if(value) {
825 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_remove_prestige;
826 }
827}
828
829void cb_body::po_make_puppet(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
830 if(value) {
831 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_make_puppet;
832 }
833}
834
836 if(value) {
837 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_release_puppet;
838 }
839}
840
841void cb_body::po_status_quo(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
842 if(value) {
843 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_status_quo;
844 }
845}
846
848 individual_cb_context& context) {
849 if(value) {
850 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_install_communist_gov_type;
851 }
852}
853
855 individual_cb_context& context) {
856 if(value) {
857 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_uninstall_communist_gov_type;
858 }
859}
860
861void cb_body::po_remove_cores(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
862 if(value) {
863 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_remove_cores;
864 }
865}
866
867void cb_body::po_colony(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
868 if(value) {
869 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_colony;
871 }
872}
873
874void cb_body::po_destroy_forts(association_type, bool value, error_handler& err, int32_t line, individual_cb_context& context) {
875 if(value) {
876 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_destroy_forts;
877 }
878}
879
881 individual_cb_context& context) {
882 if(value) {
883 context.outer_context.state.world.cb_type_get_type_bits(context.id) |= military::cb_flag::po_destroy_naval_bases;
884 }
885}
886
887void cb_body::war_name(association_type, std::string_view value, error_handler& err, int32_t line,
888 individual_cb_context& context) {
889 context.outer_context.state.world.cb_type_set_war_name(context.id,
890 text::find_or_add_key(context.outer_context.state, std::string("normal_") + std::string(value), false));
891}
892
893void cb_body::badboy_factor(association_type, float value, error_handler& err, int32_t line, individual_cb_context& context) {
894 context.outer_context.state.world.cb_type_set_badboy_factor(context.id, value);
895}
896
897void cb_body::prestige_factor(association_type, float value, error_handler& err, int32_t line, individual_cb_context& context) {
898 context.outer_context.state.world.cb_type_set_prestige_factor(context.id, value);
899}
900
901void cb_body::peace_cost_factor(association_type, float value, error_handler& err, int32_t line, individual_cb_context& context) {
902 context.outer_context.state.world.cb_type_set_peace_cost_factor(context.id, value);
903}
904
905void cb_body::penalty_factor(association_type, float value, error_handler& err, int32_t line, individual_cb_context& context) {
906 context.outer_context.state.world.cb_type_set_penalty_factor(context.id, value);
907}
908
910 individual_cb_context& context) {
911 context.outer_context.state.world.cb_type_set_break_truce_prestige_factor(context.id, value);
912}
913
915 individual_cb_context& context) {
916 context.outer_context.state.world.cb_type_set_break_truce_infamy_factor(context.id, value);
917}
918
920 individual_cb_context& context) {
921 context.outer_context.state.world.cb_type_set_break_truce_militancy_factor(context.id, value);
922}
923
925 individual_cb_context& context) {
926 context.outer_context.state.world.cb_type_set_good_relation_prestige_factor(context.id, value);
927}
928
930 individual_cb_context& context) {
931 context.outer_context.state.world.cb_type_set_good_relation_infamy_factor(context.id, value);
932}
933
935 individual_cb_context& context) {
936 context.outer_context.state.world.cb_type_set_good_relation_militancy_factor(context.id, value);
937}
938
939void cb_body::construction_speed(association_type, float value, error_handler& err, int32_t line,
940 individual_cb_context& context) {
941 context.outer_context.state.world.cb_type_set_construction_speed(context.id, value);
942}
943
944void cb_body::tws_battle_factor(association_type, float value, error_handler& err, int32_t line, individual_cb_context& context) {
945 context.outer_context.state.world.cb_type_set_tws_battle_factor(context.id, value);
946}
947
948void cb_body::allowed_states(dcon::trigger_key value, error_handler& err, int32_t line, individual_cb_context& context) {
949 context.outer_context.state.world.cb_type_set_allowed_states(context.id, value);
950}
951
952void cb_body::allowed_states_in_crisis(dcon::trigger_key value, error_handler& err, int32_t line,
953 individual_cb_context& context) {
954 context.outer_context.state.world.cb_type_set_allowed_states_in_crisis(context.id, value);
955}
956
957void cb_body::allowed_substate_regions(dcon::trigger_key value, error_handler& err, int32_t line,
958 individual_cb_context& context) {
959 context.outer_context.state.world.cb_type_set_allowed_substate_regions(context.id, value);
960}
961
962void cb_body::allowed_countries(dcon::trigger_key value, error_handler& err, int32_t line, individual_cb_context& context) {
963 context.outer_context.state.world.cb_type_set_allowed_countries(context.id, value);
964}
965
966void cb_body::can_use(dcon::trigger_key value, error_handler& err, int32_t line, individual_cb_context& context) {
967 context.outer_context.state.world.cb_type_set_can_use(context.id, value);
968}
969
970void cb_body::on_add(dcon::effect_key value, error_handler& err, int32_t line, individual_cb_context& context) {
971 context.outer_context.state.world.cb_type_set_on_add(context.id, value);
972}
973
974void cb_body::on_po_accepted(dcon::effect_key value, error_handler& err, int32_t line, individual_cb_context& context) {
975 context.outer_context.state.world.cb_type_set_on_po_accepted(context.id, value);
976}
977
978void option_rules::build_factory(association_type, bool value, error_handler& err, int32_t line,
979 individual_option_context& context) {
980 if(value)
981 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::build_factory;
982}
983
985 individual_option_context& context) {
986 if(value)
987 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::expand_factory;
988}
989
990void option_rules::open_factory(association_type, bool value, error_handler& err, int32_t line,
991 individual_option_context& context) {
992 if(value)
993 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::open_factory;
994}
995
997 individual_option_context& context) {
998 if(value)
999 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::destroy_factory;
1000}
1001
1003 individual_option_context& context) {
1004 if(value)
1005 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::factory_priority;
1006}
1007
1009 individual_option_context& context) {
1010 if(value)
1011 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::can_subsidise;
1012}
1013
1015 individual_option_context& context) {
1016 if(value)
1017 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::pop_build_factory;
1018}
1019
1021 individual_option_context& context) {
1022 if(value)
1023 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::pop_expand_factory;
1024}
1025
1027 individual_option_context& context) {
1028 if(value)
1029 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::pop_open_factory;
1030}
1031
1033 individual_option_context& context) {
1034 if(value)
1035 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::delete_factory_if_no_input;
1036}
1037
1039 individual_option_context& context) {
1040 if(value)
1041 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::build_factory_invest;
1042}
1043
1045 individual_option_context& context) {
1046 if(value)
1047 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::expand_factory_invest;
1048}
1049
1051 individual_option_context& context) {
1052 if(value)
1053 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::open_factory_invest;
1054}
1055
1057 individual_option_context& context) {
1058 if(value)
1059 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::build_railway_invest;
1060}
1061
1063 individual_option_context& context) {
1064 if(value)
1065 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::can_invest_in_pop_projects;
1066}
1067
1069 individual_option_context& context) {
1070 if(value)
1071 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::pop_build_factory_invest;
1072}
1073
1075 individual_option_context& context) {
1076 if(value)
1077 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::pop_expand_factory_invest;
1078}
1079
1081 individual_option_context& context) {
1082 if(value)
1083 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::pop_open_factory_invest;
1084}
1085
1087 individual_option_context& context) {
1088 if(value)
1089 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::allow_foreign_investment;
1090}
1091
1093 individual_option_context& context) {
1094 if(value)
1095 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::slavery_allowed;
1096}
1097
1099 individual_option_context& context) {
1100 if(value)
1101 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::primary_culture_voting;
1102}
1103
1105 individual_option_context& context) {
1106 if(value)
1107 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::culture_voting;
1108}
1109
1110void option_rules::all_voting(association_type, bool value, error_handler& err, int32_t line,
1111 individual_option_context& context) {
1112 if(value)
1113 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::all_voting;
1114}
1115
1117 individual_option_context& context) {
1118 if(value)
1119 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::largest_share;
1120}
1121
1122void option_rules::dhont(association_type, bool value, error_handler& err, int32_t line, individual_option_context& context) {
1123 if(value)
1124 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::dhont;
1125}
1126
1127void option_rules::sainte_laque(association_type, bool value, error_handler& err, int32_t line,
1128 individual_option_context& context) {
1129 if(value)
1130 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::sainte_laque;
1131}
1132
1134 individual_option_context& context) {
1135 if(value)
1136 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::same_as_ruling_party;
1137}
1138
1140 if(value)
1141 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::rich_only;
1142}
1143
1144void option_rules::state_vote(association_type, bool value, error_handler& err, int32_t line,
1145 individual_option_context& context) {
1146 if(value)
1147 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::state_vote;
1148}
1149
1151 individual_option_context& context) {
1152 if(value)
1153 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::population_vote;
1154}
1155
1157 individual_option_context& context) {
1158 if(value)
1159 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::build_railway;
1160}
1161
1162void option_rules::build_bank(association_type, bool value, error_handler& err, int32_t line,
1163 individual_option_context& context) {
1164 if(value)
1165 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::build_bank;
1166}
1167
1169 individual_option_context& context) {
1170 if(value)
1171 context.outer_context.state.world.issue_option_get_rules(context.id) |= issue_rule::build_university;
1172}
1173
1175 individual_roption_context& context) {
1176 if(value)
1177 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::build_factory;
1178}
1179
1181 individual_roption_context& context) {
1182 if(value)
1183 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::expand_factory;
1184}
1185
1186void option_rules::open_factory(association_type, bool value, error_handler& err, int32_t line,
1187 individual_roption_context& context) {
1188 if(value)
1189 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::open_factory;
1190}
1191
1193 individual_roption_context& context) {
1194 if(value)
1195 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::destroy_factory;
1196}
1197
1199 individual_roption_context& context) {
1200 if(value)
1201 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::factory_priority;
1202}
1203
1205 individual_roption_context& context) {
1206 if(value)
1207 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::can_subsidise;
1208}
1209
1211 individual_roption_context& context) {
1212 if(value)
1213 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::pop_build_factory;
1214}
1215
1217 individual_roption_context& context) {
1218 if(value)
1219 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::pop_expand_factory;
1220}
1221
1223 individual_roption_context& context) {
1224 if(value)
1225 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::pop_open_factory;
1226}
1227
1229 individual_roption_context& context) {
1230 if(value)
1231 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::delete_factory_if_no_input;
1232}
1233
1235 individual_roption_context& context) {
1236 if(value)
1237 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::build_factory_invest;
1238}
1239
1241 individual_roption_context& context) {
1242 if(value)
1243 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::expand_factory_invest;
1244}
1245
1247 individual_roption_context& context) {
1248 if(value)
1249 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::open_factory_invest;
1250}
1251
1253 individual_roption_context& context) {
1254 if(value)
1255 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::build_railway_invest;
1256}
1257
1259 individual_roption_context& context) {
1260 if(value)
1261 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::can_invest_in_pop_projects;
1262}
1263
1265 individual_roption_context& context) {
1266 if(value)
1267 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::pop_build_factory_invest;
1268}
1269
1271 individual_roption_context& context) {
1272 if(value)
1273 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::pop_expand_factory_invest;
1274}
1275
1277 individual_roption_context& context) {
1278 if(value)
1279 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::pop_open_factory_invest;
1280}
1281
1283 individual_roption_context& context) {
1284 if(value)
1285 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::allow_foreign_investment;
1286}
1287
1289 individual_roption_context& context) {
1290 if(value)
1291 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::slavery_allowed;
1292}
1293
1295 individual_roption_context& context) {
1296 if(value)
1297 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::primary_culture_voting;
1298}
1299
1301 individual_roption_context& context) {
1302 if(value)
1303 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::culture_voting;
1304}
1305
1306void option_rules::all_voting(association_type, bool value, error_handler& err, int32_t line,
1307 individual_roption_context& context) {
1308 if(value)
1309 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::all_voting;
1310}
1311
1313 individual_roption_context& context) {
1314 if(value)
1315 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::largest_share;
1316}
1317
1318void option_rules::dhont(association_type, bool value, error_handler& err, int32_t line, individual_roption_context& context) {
1319 if(value)
1320 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::dhont;
1321}
1322
1323void option_rules::sainte_laque(association_type, bool value, error_handler& err, int32_t line,
1324 individual_roption_context& context) {
1325 if(value)
1326 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::sainte_laque;
1327}
1328
1330 individual_roption_context& context) {
1331 if(value)
1332 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::same_as_ruling_party;
1333}
1334
1335void option_rules::rich_only(association_type, bool value, error_handler& err, int32_t line,
1336 individual_roption_context& context) {
1337 if(value)
1338 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::rich_only;
1339}
1340
1341void option_rules::state_vote(association_type, bool value, error_handler& err, int32_t line,
1342 individual_roption_context& context) {
1343 if(value)
1344 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::state_vote;
1345}
1346
1348 individual_roption_context& context) {
1349 if(value)
1350 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::population_vote;
1351}
1352
1354 individual_roption_context& context) {
1355 if(value)
1356 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::build_railway;
1357}
1358
1359void option_rules::build_bank(association_type, bool value, error_handler& err, int32_t line,
1360 individual_roption_context& context) {
1361 if(value)
1362 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::build_bank;
1363}
1364
1366 individual_roption_context& context) {
1367 if(value)
1368 context.outer_context.state.world.reform_option_get_rules(context.id) |= issue_rule::build_university;
1369}
1370
1372 individual_option_context& context) {
1373
1374 err.accumulated_errors +=
1375 "Only uncivilized nation reforms may have a tech cost (" + err.file_name + " line " + std::to_string(line) + ")\n";
1376}
1377
1379 individual_option_context& context) {
1380 context.outer_context.state.world.issue_option_set_war_exhaustion_effect(context.id, value);
1381}
1382
1384 individual_option_context& context) {
1385 context.outer_context.state.world.issue_option_set_administrative_multiplier(context.id, value);
1386}
1387
1389 individual_option_context& context) {
1390 if(value)
1392}
1393
1395 individual_roption_context& context) {
1396 context.outer_context.state.world.reform_option_set_technology_cost(context.id, value);
1397}
1398
1400 individual_roption_context& context) {
1401 context.outer_context.state.world.reform_option_set_war_exhaustion_effect(context.id, value);
1402}
1403
1405 individual_roption_context& context) {
1406 err.accumulated_errors +=
1407 "Error, only issues can have an administrative multiplier (" + err.file_name + " line " + std::to_string(line) + ")\n";
1408}
1409
1411 individual_option_context& context) {
1412 context.outer_context.state.world.issue_option_set_on_execute_trigger(context.id, value.trigger);
1413 context.outer_context.state.world.issue_option_set_on_execute_effect(context.id, value.effect);
1414}
1415
1417 individual_roption_context& context) {
1418 context.outer_context.state.world.reform_option_set_on_execute_trigger(context.id, value.trigger);
1419 context.outer_context.state.world.reform_option_set_on_execute_effect(context.id, value.effect);
1420}
1421
1422void national_focus::railroads(association_type, float value, error_handler& err, int32_t line, national_focus_context& context) {
1423 context.outer_context.state.world.national_focus_set_railroads(context.id, value);
1424}
1425
1426void national_focus::limit(dcon::trigger_key value, error_handler& err, int32_t line, national_focus_context& context) {
1427 context.outer_context.state.world.national_focus_set_limit(context.id, value);
1428}
1429
1431 national_focus_context& context) {
1432 if(value)
1434}
1435
1437 national_focus_context& context) {
1439}
1440
1441void national_focus::ideology(association_type, std::string_view value, error_handler& err, int32_t line,
1442 national_focus_context& context) {
1443 if(auto it = context.outer_context.map_of_ideologies.find(std::string(value));
1444 it != context.outer_context.map_of_ideologies.end()) {
1445 context.outer_context.state.world.national_focus_set_ideology(context.id, it->second.id);
1446 } else {
1447 err.accumulated_errors +=
1448 "Invalid ideology " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1449 }
1450}
1451
1453 national_focus_context& context) {
1454 context.outer_context.state.world.national_focus_set_loyalty_value(context.id, value);
1455}
1456
1457void national_focus::any_value(std::string_view label, association_type, float value, error_handler& err, int32_t line,
1458 national_focus_context& context) {
1459 std::string str_label{label};
1460 if(auto it = context.outer_context.map_of_poptypes.find(str_label); it != context.outer_context.map_of_poptypes.end()) {
1461 context.outer_context.state.world.national_focus_set_promotion_type(context.id, it->second);
1462 context.outer_context.state.world.national_focus_set_promotion_amount(context.id, value);
1463 } else if(auto itb = context.outer_context.map_of_commodity_names.find(str_label);
1464 itb != context.outer_context.map_of_commodity_names.end()) {
1465 context.outer_context.state.world.national_focus_set_production_focus(context.id, itb->second, value);
1466 } else {
1467 err.accumulated_errors +=
1468 "Invalid pop type / commodity " + str_label + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1469 }
1470}
1471
1472void main_pop_type_file::promotion_chance(dcon::value_modifier_key value, error_handler& err, int32_t line,
1473 scenario_building_context& context) {
1475}
1476
1477void main_pop_type_file::demotion_chance(dcon::value_modifier_key value, error_handler& err, int32_t line,
1478 scenario_building_context& context) {
1480}
1481
1482void main_pop_type_file::migration_chance(dcon::value_modifier_key value, error_handler& err, int32_t line,
1483 scenario_building_context& context) {
1485}
1486
1487void main_pop_type_file::colonialmigration_chance(dcon::value_modifier_key value, error_handler& err, int32_t line,
1488 scenario_building_context& context) {
1490}
1491
1492void main_pop_type_file::emigration_chance(dcon::value_modifier_key value, error_handler& err, int32_t line,
1493 scenario_building_context& context) {
1495}
1496
1497void main_pop_type_file::assimilation_chance(dcon::value_modifier_key value, error_handler& err, int32_t line,
1498 scenario_building_context& context) {
1500}
1501
1502void main_pop_type_file::conversion_chance(dcon::value_modifier_key value, error_handler& err, int32_t line,
1503 scenario_building_context& context) {
1505}
1506
1507void tech_rgo_goods_output::any_value(std::string_view label, association_type, float value, error_handler& err, int32_t line,
1508 tech_context& context) {
1509 if(auto it = context.outer_context.map_of_commodity_names.find(std::string(label));
1510 it != context.outer_context.map_of_commodity_names.end()) {
1511 context.outer_context.state.world.technology_get_rgo_goods_output(context.id)
1512 .push_back(sys::commodity_modifier{value, it->second});
1513 } else {
1514 err.accumulated_errors +=
1515 "Invalid commodity " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1516 }
1517}
1518
1519void tech_fac_goods_output::any_value(std::string_view label, association_type, float value, error_handler& err, int32_t line,
1520 tech_context& context) {
1521 if(auto it = context.outer_context.map_of_commodity_names.find(std::string(label));
1522 it != context.outer_context.map_of_commodity_names.end()) {
1523 context.outer_context.state.world.technology_get_factory_goods_output(context.id)
1524 .push_back(sys::commodity_modifier{value, it->second});
1525 } else {
1526 err.accumulated_errors +=
1527 "Invalid commodity " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1528 }
1529}
1530
1531void tech_rgo_size::any_value(std::string_view label, association_type, float value, error_handler& err, int32_t line, tech_context& context) {
1532 if(auto it = context.outer_context.map_of_commodity_names.find(std::string(label));
1533 it != context.outer_context.map_of_commodity_names.end()) {
1534 context.outer_context.state.world.technology_get_rgo_size(context.id).push_back(sys::commodity_modifier{value, it->second});
1535 } else {
1536 err.accumulated_errors +=
1537 "Invalid commodity " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1538 }
1539}
1540void tech_rgo_size::any_value(std::string_view label, association_type, float value, error_handler& err, int32_t line, invention_context& context) {
1541 if(auto it = context.outer_context.map_of_commodity_names.find(std::string(label));
1542 it != context.outer_context.map_of_commodity_names.end()) {
1543 context.outer_context.state.world.invention_get_rgo_size(context.id).push_back(sys::commodity_modifier{ value, it->second });
1544 } else {
1545 err.accumulated_errors +=
1546 "Invalid commodity " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1547 }
1548}
1549
1550void technology_contents::any_group(std::string_view label, unit_modifier_body const& value, error_handler& err, int32_t line,
1551 tech_context& context) {
1552 if(auto it = context.outer_context.map_of_unit_types.find(std::string(label));
1553 it != context.outer_context.map_of_unit_types.end()) {
1554 sys::unit_modifier temp = value;
1555 temp.type = it->second;
1556 context.outer_context.state.world.technology_get_modified_units(context.id).push_back(temp);
1557 } else {
1558 err.accumulated_errors +=
1559 "Invalid unit type " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1560 }
1561}
1562
1563void technology_contents::ai_chance(dcon::value_modifier_key value, error_handler& err, int32_t line, tech_context& context) {
1564 context.outer_context.state.world.technology_set_ai_chance(context.id, value);
1565}
1566
1567void technology_contents::year(association_type, int32_t value, error_handler& err, int32_t line, tech_context& context) {
1568 context.outer_context.state.world.technology_set_year(context.id, int16_t(value));
1569}
1570
1571void technology_contents::cost(association_type, int32_t value, error_handler& err, int32_t line, tech_context& context) {
1572 context.outer_context.state.world.technology_set_cost(context.id, value);
1573}
1574
1575void technology_contents::area(association_type, std::string_view value, error_handler& err, int32_t line,
1576 tech_context& context) {
1577 if(auto it = context.outer_context.map_of_tech_folders.find(std::string(value));
1578 it != context.outer_context.map_of_tech_folders.end()) {
1579 context.outer_context.state.world.technology_set_folder_index(context.id, uint8_t(it->second));
1580 } else {
1581 err.accumulated_errors += "Invalid technology folder name " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1582 }
1583}
1584
1586 tech_context& context) {
1587 context.outer_context.state.world.technology_set_colonial_points(context.id, int16_t(value));
1588}
1589
1590void technology_contents::activate_unit(association_type, std::string_view value, error_handler& err, int32_t line,
1591 tech_context& context) {
1592 if(auto it = context.outer_context.map_of_unit_types.find(std::string(value));
1593 it != context.outer_context.map_of_unit_types.end()) {
1594 context.outer_context.state.world.technology_set_activate_unit(context.id, it->second, true);
1595 } else {
1596 err.accumulated_errors +=
1597 "Invalid unit type " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1598 }
1599}
1600
1601void technology_contents::activate_building(association_type, std::string_view value, error_handler& err, int32_t line,
1602 tech_context& context) {
1604 if(std::string(value) == economy::province_building_type_get_name(t)) {
1605 context.outer_context.state.world.technology_set_increase_building(context.id, t, true);
1606 return;
1607 }
1608 }
1609
1610 if(auto it = context.outer_context.map_of_factory_names.find(std::string(value));
1611 it != context.outer_context.map_of_factory_names.end()) {
1612 context.outer_context.state.world.technology_set_activate_building(context.id, it->second, true);
1613 } else {
1614 err.accumulated_errors +=
1615 "Invalid factory type " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1616 }
1617}
1618
1619void technology_contents::any_value(std::string_view name, association_type, int32_t value, error_handler& err, int32_t line, tech_context& context) {
1620 if(has_fixed_prefix_ci(name.data(), name.data() + name.length(), "max_")) {
1622 if(std::string(name).substr(4) == economy::province_building_type_get_name(t)) {
1623 if(value == 1) {
1624 context.outer_context.state.world.technology_set_increase_building(context.id, t, true);
1625 } else {
1626 err.accumulated_errors += "max_" + std::string(economy::province_building_type_get_name(t)) + " may only be 1 (" + err.file_name + " line " + std::to_string(line) + ")\n";
1627 }
1628 return;
1629 }
1630 }
1631 }
1632 err.accumulated_errors += "unknown technology key " + std::string(name) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";//err.unhandled_association_key();
1633}
1634
1635void inv_rgo_goods_output::any_value(std::string_view label, association_type, float value, error_handler& err, int32_t line,
1636 invention_context& context) {
1637 if(auto it = context.outer_context.map_of_commodity_names.find(std::string(label));
1638 it != context.outer_context.map_of_commodity_names.end()) {
1639 context.outer_context.state.world.invention_get_rgo_goods_output(context.id)
1640 .push_back(sys::commodity_modifier{value, it->second});
1641 } else {
1642 err.accumulated_errors +=
1643 "Invalid commodity " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1644 }
1645}
1646
1647void inv_fac_goods_output::any_value(std::string_view label, association_type, float value, error_handler& err, int32_t line,
1648 invention_context& context) {
1649 if(auto it = context.outer_context.map_of_commodity_names.find(std::string(label));
1650 it != context.outer_context.map_of_commodity_names.end()) {
1651 context.outer_context.state.world.invention_get_factory_goods_output(context.id)
1652 .push_back(sys::commodity_modifier{value, it->second});
1653 } else {
1654 err.accumulated_errors +=
1655 "Invalid commodity " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1656 }
1657}
1658
1659void inv_fac_goods_throughput::any_value(std::string_view label, association_type, float value, error_handler& err, int32_t line,
1660 invention_context& context) {
1661 if(auto it = context.outer_context.map_of_commodity_names.find(std::string(label));
1662 it != context.outer_context.map_of_commodity_names.end()) {
1663 context.outer_context.state.world.invention_get_factory_goods_throughput(context.id)
1664 .push_back(sys::commodity_modifier{value, it->second});
1665 } else {
1666 err.accumulated_errors +=
1667 "Invalid commodity " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1668 }
1669}
1670
1671void inv_rebel_org_gain::faction(association_type, std::string_view v, error_handler& err, int32_t line,
1672 invention_context& context) {
1673 if(is_fixed_token_ci(v.data(), v.data() + v.size(), "all")) {
1674 // do nothing
1675 } else if(auto it = context.outer_context.map_of_rebeltypes.find(std::string(v));
1676 it != context.outer_context.map_of_rebeltypes.end()) {
1677 faction_ = it->second.id;
1678 } else {
1679 err.accumulated_errors +=
1680 "Invalid rebel type " + std::string(v) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1681 }
1682}
1683
1684void inv_effect::any_group(std::string_view label, unit_modifier_body const& value, error_handler& err, int32_t line,
1685 invention_context& context) {
1686 if(auto it = context.outer_context.map_of_unit_types.find(std::string(label));
1687 it != context.outer_context.map_of_unit_types.end()) {
1688 sys::unit_modifier temp = value;
1689 temp.type = it->second;
1690 context.outer_context.state.world.invention_get_modified_units(context.id).push_back(temp);
1691 } else {
1692 err.accumulated_errors +=
1693 "Invalid unit type " + std::string(label) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1694 }
1695}
1696
1697void inv_effect::activate_unit(association_type, std::string_view value, error_handler& err, int32_t line,
1698 invention_context& context) {
1699 if(auto it = context.outer_context.map_of_unit_types.find(std::string(value));
1700 it != context.outer_context.map_of_unit_types.end()) {
1701 context.outer_context.state.world.invention_set_activate_unit(context.id, it->second, true);
1702 } else {
1703 err.accumulated_errors +=
1704 "Invalid unit type " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1705 }
1706}
1707
1708void inv_effect::activate_building(association_type, std::string_view value, error_handler& err, int32_t line, invention_context& context) {
1710 if(std::string(value) == economy::province_building_type_get_name(t)) {
1711 context.outer_context.state.world.invention_set_increase_building(context.id, t, true);
1712 return;
1713 }
1714 }
1715
1716 if(auto it = context.outer_context.map_of_factory_names.find(std::string(value));
1717 it != context.outer_context.map_of_factory_names.end()) {
1718 context.outer_context.state.world.invention_set_activate_building(context.id, it->second, true);
1719 } else {
1720 err.accumulated_errors +=
1721 "Invalid factory type " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1722 }
1723}
1724
1725void inv_effect::any_value(std::string_view name, association_type, int32_t value, error_handler& err, int32_t line, invention_context& context) {
1726 if(has_fixed_prefix_ci(name.data(), name.data() + name.length(), "max_")) {
1728 if(std::string(name).substr(4) == economy::province_building_type_get_name(t)) {
1729 if(value == 1) {
1730 context.outer_context.state.world.invention_set_increase_building(context.id, t, true);
1731 } else {
1732 err.accumulated_errors += "max_" + std::string(economy::province_building_type_get_name(t)) + " may only be 1 (" + err.file_name + " line " + std::to_string(line) + ")\n";
1733 }
1734 return;
1735 }
1736 }
1737 }
1738 err.accumulated_errors += "unknown technology key " + std::string(name) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";//err.unhandled_association_key();
1739}
1740
1741void inv_effect::shared_prestige(association_type, float value, error_handler& err, int32_t line, invention_context& context) {
1742 context.outer_context.state.world.invention_set_shared_prestige(context.id, value);
1743}
1744void inv_effect::plurality(association_type, float value, error_handler& err, int32_t line, invention_context& context) {
1745 context.outer_context.state.world.invention_set_plurality(context.id, value);
1746}
1747void technology_contents::plurality(association_type, float value, error_handler& err, int32_t line, tech_context& context) {
1748 context.outer_context.state.world.technology_set_plurality(context.id, value);
1749}
1750void inv_effect::colonial_points(association_type, int32_t value, error_handler& err, int32_t line, invention_context& context) {
1751 context.outer_context.state.world.invention_set_colonial_points(context.id, int16_t(value));
1752}
1753
1754void inv_effect::enable_crime(association_type, std::string_view value, error_handler& err, int32_t line,
1755 invention_context& context) {
1756 if(auto it = context.outer_context.map_of_crimes.find(std::string(value)); it != context.outer_context.map_of_crimes.end()) {
1757 context.outer_context.state.world.invention_set_activate_crime(context.id, it->second.id, true);
1758 } else {
1759 err.accumulated_errors +=
1760 "Invalid crime " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
1761 }
1762}
1763
1764void inv_effect::gas_attack(association_type, bool value, error_handler& err, int32_t line, invention_context& context) {
1765 context.outer_context.state.world.invention_set_enable_gas_attack(context.id, value);
1766}
1767
1768void inv_effect::gas_defence(association_type, bool value, error_handler& err, int32_t line, invention_context& context) {
1769 context.outer_context.state.world.invention_set_enable_gas_defense(context.id, value);
1770}
1771
1772void inv_effect::rebel_org_gain(inv_rebel_org_gain const& value, error_handler& err, int32_t line, invention_context& context) {
1773 context.outer_context.state.world.invention_get_rebel_org(context.id)
1774 .push_back(sys::rebel_org_modifier{value.value, value.faction_});
1775}
1776
1778 context.outer_context.state.world.invention_set_shared_prestige(context.id, value);
1779}
1780
1781void invention_contents::limit(dcon::trigger_key value, error_handler& err, int32_t line, invention_context& context) {
1782 context.outer_context.state.world.invention_set_limit(context.id, value);
1783}
1784
1785void invention_contents::chance(dcon::value_modifier_key value, error_handler& err, int32_t line, invention_context& context) {
1786 context.outer_context.state.world.invention_set_chance(context.id, value);
1787}
1788
1789void invention_contents::effect(inv_effect const& value, error_handler& err, int32_t line, invention_context& context) {
1790 for(uint32_t i = 0; i < value.next_to_add_n; ++i) {
1792 err.accumulated_errors +=
1793 "Too many modifiers attached to invention (" + err.file_name + " line " + std::to_string(line) + ")\n";
1794 break;
1795 }
1796 constructed_definition_n.offsets[next_to_add_n] = value.peek_national_mod().offsets[i];
1797 constructed_definition_n.values[next_to_add_n] = value.peek_national_mod().values[i];
1798 ++next_to_add_n;
1799 }
1800 for(uint32_t i = 0; i < value.next_to_add_p; ++i) {
1802 err.accumulated_errors +=
1803 "Too many modifiers attached to invention (" + err.file_name + " line " + std::to_string(line) + ")\n";
1804 break;
1805 }
1806 constructed_definition_p.offsets[next_to_add_p] = value.peek_province_mod().offsets[i];
1807 constructed_definition_p.values[next_to_add_p] = value.peek_province_mod().values[i];
1808 ++next_to_add_p;
1809 }
1810}
1811
1812void s_on_yearly_pulse::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1813 scenario_building_context& context) {
1814 int32_t value = parse_int(chance, line, err);
1815 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1816 context.state.national_definitions.on_yearly_pulse.push_back(
1817 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1818 } else {
1819 auto id = context.state.world.create_national_event();
1820 context.map_of_national_events.insert_or_assign(event,
1822 context.state.national_definitions.on_yearly_pulse.push_back(nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1823 }
1824}
1825
1826void s_on_quarterly_pulse::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1827 scenario_building_context& context) {
1828 int32_t value = parse_int(chance, line, err);
1829 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1831 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1832 } else {
1833 auto id = context.state.world.create_national_event();
1834 context.map_of_national_events.insert_or_assign(event,
1837 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1838 }
1839}
1840
1841void s_on_battle_won::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1842 scenario_building_context& context) {
1843 int32_t value = parse_int(chance, line, err);
1844 if(auto it = context.map_of_provincial_events.find(event); it != context.map_of_provincial_events.end()) {
1845 context.state.national_definitions.on_battle_won.push_back(
1846 nations::fixed_province_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1847 } else {
1848 auto id = context.state.world.create_provincial_event();
1849 context.map_of_provincial_events.insert_or_assign(event,
1851 context.state.national_definitions.on_battle_won.push_back(
1852 nations::fixed_province_event{int16_t(value), id, dcon::trigger_key{}});
1853 }
1854}
1855
1856void s_on_battle_lost::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1857 scenario_building_context& context) {
1858 int32_t value = parse_int(chance, line, err);
1859 if(auto it = context.map_of_provincial_events.find(event); it != context.map_of_provincial_events.end()) {
1860 context.state.national_definitions.on_battle_lost.push_back(
1861 nations::fixed_province_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1862 } else {
1863 auto id = context.state.world.create_provincial_event();
1864 context.map_of_provincial_events.insert_or_assign(event,
1866 context.state.national_definitions.on_battle_lost.push_back(
1867 nations::fixed_province_event{int16_t(value), id, dcon::trigger_key{}});
1868 }
1869}
1870
1871void s_on_surrender::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1872 scenario_building_context& context) {
1873 int32_t value = parse_int(chance, line, err);
1874 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1875 context.state.national_definitions.on_surrender.push_back(
1876 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1877 } else {
1878 auto id = context.state.world.create_national_event();
1879 context.map_of_national_events.insert_or_assign(event,
1881 context.state.national_definitions.on_surrender.push_back(nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1882 }
1883}
1884
1885void s_on_new_great_nation::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1886 scenario_building_context& context) {
1887 int32_t value = parse_int(chance, line, err);
1888 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1890 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1891 } else {
1892 auto id = context.state.world.create_national_event();
1893 context.map_of_national_events.insert_or_assign(event,
1896 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1897 }
1898}
1899
1900void s_on_lost_great_nation::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1901 scenario_building_context& context) {
1902 int32_t value = parse_int(chance, line, err);
1903 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1905 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1906 } else {
1907 auto id = context.state.world.create_national_event();
1908 context.map_of_national_events.insert_or_assign(event,
1911 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1912 }
1913}
1914
1915void s_on_election_tick::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1916 scenario_building_context& context) {
1917 int32_t value = parse_int(chance, line, err);
1918 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1920 nations::fixed_election_event{ int16_t(value), it->second.id, dcon::trigger_key{}, dcon::issue_id{} });
1921 } else {
1922 auto id = context.state.world.create_national_event();
1923 context.map_of_national_events.insert_or_assign(event,
1925 context.state.national_definitions.on_election_tick.push_back(nations::fixed_election_event{ int16_t(value), id, dcon::trigger_key{}, dcon::issue_id{} });
1926 }
1927}
1928
1929void s_on_colony_to_state::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1930 scenario_building_context& context) {
1931 int32_t value = parse_int(chance, line, err);
1932 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1934 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1935 } else {
1936 auto id = context.state.world.create_national_event();
1937 context.map_of_national_events.insert_or_assign(event,
1940 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1941 }
1942}
1943
1944void s_on_state_conquest::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1945 scenario_building_context& context) {
1946 int32_t value = parse_int(chance, line, err);
1947 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1949 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1950 } else {
1951 auto id = context.state.world.create_national_event();
1952 context.map_of_national_events.insert_or_assign(event,
1954 context.state.national_definitions.on_state_conquest.push_back(nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1955 }
1956}
1957
1959 int32_t line, scenario_building_context& context) {
1960 int32_t value = parse_int(chance, line, err);
1961 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1963 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1964 } else {
1965 auto id = context.state.world.create_national_event();
1966 context.map_of_national_events.insert_or_assign(event,
1969 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1970 }
1971}
1972
1973void s_on_debtor_default::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
1974 scenario_building_context& context) {
1975 int32_t value = parse_int(chance, line, err);
1976 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1978 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1979 } else {
1980 auto id = context.state.world.create_national_event();
1981 context.map_of_national_events.insert_or_assign(event,
1983 context.state.national_definitions.on_debtor_default.push_back(nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1984 }
1985}
1986
1988 int32_t line, scenario_building_context& context) {
1989 int32_t value = parse_int(chance, line, err);
1990 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
1992 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
1993 } else {
1994 auto id = context.state.world.create_national_event();
1995 context.map_of_national_events.insert_or_assign(event,
1998 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
1999 }
2000}
2001
2003 int32_t line, scenario_building_context& context) {
2004 int32_t value = parse_int(chance, line, err);
2005 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
2007 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
2008 } else {
2009 auto id = context.state.world.create_national_event();
2010 context.map_of_national_events.insert_or_assign(event,
2013 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
2014 }
2015}
2016
2017void s_on_civilize::any_value(std::string_view chance, association_type, int32_t event, error_handler& err, int32_t line,
2018 scenario_building_context& context) {
2019 int32_t value = parse_int(chance, line, err);
2020 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
2021 context.state.national_definitions.on_civilize.push_back(
2022 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
2023 } else {
2024 auto id = context.state.world.create_national_event();
2025 context.map_of_national_events.insert_or_assign(event,
2027 context.state.national_definitions.on_civilize.push_back(nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
2028 }
2029}
2030
2032 int32_t line, scenario_building_context& context) {
2033 int32_t value = parse_int(chance, line, err);
2034 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
2036 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
2037 } else {
2038 auto id = context.state.world.create_national_event();
2039 context.map_of_national_events.insert_or_assign(event,
2042 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
2043 }
2044}
2045
2046void s_on_election_started::any_value(std::string_view chance, association_type, int32_t event, error_handler& err,
2047 int32_t line, scenario_building_context& context) {
2048 int32_t value = parse_int(chance, line, err);
2049 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
2051 nations::fixed_event{ int16_t(value), it->second.id, dcon::trigger_key{} });
2052 } else {
2053 auto id = context.state.world.create_national_event();
2054 context.map_of_national_events.insert_or_assign(event,
2057 nations::fixed_event{ int16_t(value), id, dcon::trigger_key{} });
2058 }
2059}
2060
2061void s_on_election_finished::any_value(std::string_view chance, association_type, int32_t event, error_handler& err,
2062 int32_t line, scenario_building_context& context) {
2063 int32_t value = parse_int(chance, line, err);
2064 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
2066 nations::fixed_event{ int16_t(value), it->second.id, dcon::trigger_key{} });
2067 } else {
2068 auto id = context.state.world.create_national_event();
2069 context.map_of_national_events.insert_or_assign(event,
2072 nations::fixed_event{ int16_t(value), id, dcon::trigger_key{} });
2073 }
2074}
2075
2077 int32_t line, scenario_building_context& context) {
2078 int32_t value = parse_int(chance, line, err);
2079 if(auto it = context.map_of_national_events.find(event); it != context.map_of_national_events.end()) {
2081 nations::fixed_event{int16_t(value), it->second.id, dcon::trigger_key{}});
2082 } else {
2083 auto id = context.state.world.create_national_event();
2084 context.map_of_national_events.insert_or_assign(event,
2087 nations::fixed_event{int16_t(value), id, dcon::trigger_key{}});
2088 }
2089}
2090
2091void rebel_gov_list::any_value(std::string_view from_gov, association_type, std::string_view to_gov, error_handler& err,
2092 int32_t line, rebel_context& context) {
2093 if(auto frit = context.outer_context.map_of_governments.find(std::string(from_gov)); frit != context.outer_context.map_of_governments.end()) {
2094 if(auto toit = context.outer_context.map_of_governments.find(std::string(to_gov)); toit != context.outer_context.map_of_governments.end()) {
2095 context.outer_context.state.world.rebel_type_set_government_change(context.id, frit->second, toit->second);
2096 } else {
2097 err.accumulated_errors +=
2098 "Invalid government " + std::string(to_gov) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2099 }
2100 } else {
2101 err.accumulated_errors +=
2102 "Invalid government " + std::string(from_gov) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2103 }
2104}
2105
2106void rebel_body::icon(association_type, int32_t value, error_handler& err, int32_t line, rebel_context& context) {
2107 context.outer_context.state.world.rebel_type_set_icon(context.id, uint8_t(value));
2108}
2109
2111 context.outer_context.state.world.rebel_type_set_break_alliance_on_win(context.id, value);
2112}
2113
2114void rebel_body::area(association_type, std::string_view value, error_handler& err, int32_t line, rebel_context& context) {
2115 if(is_fixed_token_ci(value.data(), value.data() + value.length(), "none"))
2116 context.outer_context.state.world.rebel_type_set_area(context.id, uint8_t(::culture::rebel_area::none));
2117 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "nation"))
2118 context.outer_context.state.world.rebel_type_set_area(context.id, uint8_t(::culture::rebel_area::nation));
2119 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "culture"))
2120 context.outer_context.state.world.rebel_type_set_area(context.id, uint8_t(::culture::rebel_area::culture));
2121 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "nation_culture"))
2122 context.outer_context.state.world.rebel_type_set_area(context.id, uint8_t(::culture::rebel_area::nation_culture));
2123 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "nation_religion"))
2124 context.outer_context.state.world.rebel_type_set_area(context.id, uint8_t(::culture::rebel_area::nation_religion));
2125 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "religion"))
2126 context.outer_context.state.world.rebel_type_set_area(context.id, uint8_t(::culture::rebel_area::religion));
2127 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "culture_group"))
2128 context.outer_context.state.world.rebel_type_set_area(context.id, uint8_t(::culture::rebel_area::culture_group));
2129 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "all"))
2130 context.outer_context.state.world.rebel_type_set_area(context.id, uint8_t(::culture::rebel_area::all));
2131 else {
2132 err.accumulated_errors +=
2133 "Invalid rebel area " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2134 }
2135}
2136
2137void rebel_body::defection(association_type, std::string_view value, error_handler& err, int32_t line, rebel_context& context) {
2138 if(is_fixed_token_ci(value.data(), value.data() + value.length(), "none"))
2139 context.outer_context.state.world.rebel_type_set_defection(context.id, uint8_t(::culture::rebel_defection::none));
2140 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "ideology"))
2141 context.outer_context.state.world.rebel_type_set_defection(context.id, uint8_t(::culture::rebel_defection::ideology));
2142 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "culture"))
2143 context.outer_context.state.world.rebel_type_set_defection(context.id, uint8_t(::culture::rebel_defection::culture));
2144 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "any"))
2145 context.outer_context.state.world.rebel_type_set_defection(context.id, uint8_t(::culture::rebel_defection::any));
2146 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "pan_nationalist"))
2147 context.outer_context.state.world.rebel_type_set_defection(context.id, uint8_t(::culture::rebel_defection::pan_nationalist));
2148 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "religion"))
2149 context.outer_context.state.world.rebel_type_set_defection(context.id, uint8_t(::culture::rebel_defection::religion));
2150 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "culture_group"))
2151 context.outer_context.state.world.rebel_type_set_defection(context.id, uint8_t(::culture::rebel_defection::culture_group));
2152 else {
2153 err.accumulated_errors +=
2154 "Invalid rebel defection " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2155 }
2156}
2157
2158void rebel_body::independence(association_type, std::string_view value, error_handler& err, int32_t line,
2159 rebel_context& context) {
2160 if(is_fixed_token_ci(value.data(), value.data() + value.length(), "none"))
2161 context.outer_context.state.world.rebel_type_set_independence(context.id, uint8_t(::culture::rebel_independence::none));
2162 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "colonial"))
2163 context.outer_context.state.world.rebel_type_set_independence(context.id, uint8_t(::culture::rebel_independence::colonial));
2164 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "culture"))
2165 context.outer_context.state.world.rebel_type_set_independence(context.id, uint8_t(::culture::rebel_independence::culture));
2166 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "any"))
2167 context.outer_context.state.world.rebel_type_set_independence(context.id, uint8_t(::culture::rebel_independence::any));
2168 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "pan_nationalist"))
2169 context.outer_context.state.world.rebel_type_set_independence(context.id,
2171 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "religion"))
2172 context.outer_context.state.world.rebel_type_set_independence(context.id, uint8_t(::culture::rebel_independence::religion));
2173 else if(is_fixed_token_ci(value.data(), value.data() + value.length(), "culture_group"))
2174 context.outer_context.state.world.rebel_type_set_independence(context.id,
2176 else {
2177 err.accumulated_errors +=
2178 "Invalid rebel independence " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2179 }
2180}
2181
2182void rebel_body::defect_delay(association_type, int32_t value, error_handler& err, int32_t line, rebel_context& context) {
2183 context.outer_context.state.world.rebel_type_set_defect_delay(context.id, uint8_t(value));
2184}
2185
2186void rebel_body::ideology(association_type, std::string_view value, error_handler& err, int32_t line, rebel_context& context) {
2187 if(auto it = context.outer_context.map_of_ideologies.find(std::string(value));
2188 it != context.outer_context.map_of_ideologies.end()) {
2189 context.outer_context.state.world.rebel_type_set_ideology(context.id, it->second.id);
2190 } else {
2191 err.accumulated_errors +=
2192 "Invalid ideology " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2193 }
2194}
2195
2196void rebel_body::allow_all_cultures(association_type, bool value, error_handler& err, int32_t line, rebel_context& context) {
2197 context.outer_context.state.world.rebel_type_set_culture_restriction(context.id, !value);
2198}
2199void rebel_body::allow_all_ideologies(association_type, bool value, error_handler& err, int32_t line, rebel_context& context) {
2200 context.outer_context.state.world.rebel_type_set_ideology_restriction(context.id, !value);
2201}
2203 rebel_context& context) {
2204 context.outer_context.state.world.rebel_type_set_culture_group_restriction(context.id, !value);
2205}
2206
2207void rebel_body::occupation_mult(association_type, float value, error_handler& err, int32_t line, rebel_context& context) {
2208 context.outer_context.state.world.rebel_type_set_occupation_multiplier(context.id, uint8_t(value));
2209}
2210
2211void rebel_body::will_rise(dcon::value_modifier_key value, error_handler& err, int32_t line, rebel_context& context) {
2212 context.outer_context.state.world.rebel_type_set_will_rise(context.id, value);
2213}
2214
2215void rebel_body::spawn_chance(dcon::value_modifier_key value, error_handler& err, int32_t line, rebel_context& context) {
2216 context.outer_context.state.world.rebel_type_set_spawn_chance(context.id, value);
2217}
2218
2219void rebel_body::movement_evaluation(dcon::value_modifier_key value, error_handler& err, int32_t line, rebel_context& context) {
2220 context.outer_context.state.world.rebel_type_set_movement_evaluation(context.id, value);
2221}
2222
2223void rebel_body::siege_won_trigger(dcon::trigger_key value, error_handler& err, int32_t line, rebel_context& context) {
2224 context.outer_context.state.world.rebel_type_set_siege_won_trigger(context.id, value);
2225}
2226
2227void rebel_body::demands_enforced_trigger(dcon::trigger_key value, error_handler& err, int32_t line, rebel_context& context) {
2228 context.outer_context.state.world.rebel_type_set_demands_enforced_trigger(context.id, value);
2229}
2230
2231void rebel_body::siege_won_effect(dcon::effect_key value, error_handler& err, int32_t line, rebel_context& context) {
2232 context.outer_context.state.world.rebel_type_set_siege_won_effect(context.id, value);
2233}
2234
2235void rebel_body::demands_enforced_effect(dcon::effect_key value, error_handler& err, int32_t line, rebel_context& context) {
2236 context.outer_context.state.world.rebel_type_set_demands_enforced_effect(context.id, value);
2237}
2238
2239void decision::potential(dcon::trigger_key value, error_handler& err, int32_t line, decision_context& context) {
2240 context.outer_context.state.world.decision_set_potential(context.id, value);
2241 if(!value) {
2242 err.accumulated_warnings += "Empty potential for decision is implicit already (" + err.file_name + " line " + std::to_string(line) + ")\n";
2243 }
2244}
2245
2246void decision::allow(dcon::trigger_key value, error_handler& err, int32_t line, decision_context& context) {
2247 context.outer_context.state.world.decision_set_allow(context.id, value);
2248 if(!value) {
2249 err.accumulated_warnings += "Empty allow for decision is implicit already (" + err.file_name + " line " + std::to_string(line) + ")\n";
2250 }
2251}
2252
2253void decision::effect(dcon::effect_key value, error_handler& err, int32_t line, decision_context& context) {
2254 context.outer_context.state.world.decision_set_effect(context.id, value);
2255 if(!value) {
2256 err.accumulated_warnings += "Empty effect for decision is implicit already (" + err.file_name + " line " + std::to_string(line) + ")\n";
2257 }
2258}
2259
2260void decision::ai_will_do(dcon::value_modifier_key value, error_handler& err, int32_t line, decision_context& context) {
2261 context.outer_context.state.world.decision_set_ai_will_do(context.id, value);
2262 if(!value) {
2263 err.accumulated_warnings += "Empty ai_will_do for decision is implicit already (" + err.file_name + " line " + std::to_string(line) + ")\n";
2264 }
2265}
2266
2268 // "always = yes" assumed when no allow is specified
2269}
2270
2271void decision::picture(association_type, std::string_view value, error_handler& err, int32_t line, decision_context& context) {
2272 auto root = get_root(context.outer_context.state.common_fs);
2273 auto gfx = open_directory(root, NATIVE("gfx"));
2274 auto pictures = open_directory(gfx, NATIVE("pictures"));
2275 auto decisions = open_directory(pictures, NATIVE("decisions"));
2276 if(!peek_file(decisions, simple_fs::utf8_to_native(value) + NATIVE(".dds")).has_value()
2277 && !peek_file(decisions, simple_fs::utf8_to_native(value) + NATIVE(".tga")).has_value()
2278 && !peek_file(decisions, simple_fs::utf8_to_native(value) + NATIVE(".png")).has_value()) {
2279 err.accumulated_warnings += "Picture " + std::string(value) + " does not exist " + " (" + err.file_name + ")\n";
2280 return; // Picture not found
2281 }
2282
2283 std::string file_name = simple_fs::remove_double_backslashes(std::string("gfx\\pictures\\decisions\\") + std::string(value) + ".tga");
2284 if(auto it = context.outer_context.gfx_context.map_of_names.find(file_name); it != context.outer_context.gfx_context.map_of_names.end()) {
2285 context.outer_context.state.world.decision_set_image(context.id, it->second);
2286 } else {
2287 auto gfxindex = context.outer_context.state.ui_defs.gfx.size();
2288 context.outer_context.state.ui_defs.gfx.emplace_back();
2289 ui::gfx_object& new_obj = context.outer_context.state.ui_defs.gfx.back();
2290 auto new_id = dcon::gfx_object_id(uint16_t(gfxindex));
2291
2292 context.outer_context.gfx_context.map_of_names.insert_or_assign(file_name, new_id);
2293
2294 new_obj.number_of_frames = uint8_t(1);
2295
2296 if(auto itb = context.outer_context.gfx_context.map_of_texture_names.find(file_name);
2297 itb != context.outer_context.gfx_context.map_of_texture_names.end()) {
2298 new_obj.primary_texture_handle = itb->second;
2299 } else {
2300 auto index = context.outer_context.state.ui_defs.textures.size();
2302 new_obj.primary_texture_handle = dcon::texture_id(uint16_t(index));
2303 context.outer_context.gfx_context.map_of_texture_names.insert_or_assign(file_name, dcon::texture_id(uint16_t(index)));
2304 }
2306
2307 context.outer_context.state.world.decision_set_image(context.id, new_id);
2308 }
2309}
2310
2311void oob_leader::name(association_type, std::string_view value, error_handler& err, int32_t line, oob_file_context& context) {
2312 name_ = context.outer_context.state.add_unit_name(value);
2313}
2314
2316 date_ = sys::date(value, context.outer_context.state.start_date);
2317}
2318
2319void oob_army::name(association_type, std::string_view value, error_handler& err, int32_t line, oob_file_army_context& context) {
2320 context.outer_context.state.world.army_set_name(context.id, context.outer_context.state.add_unit_name(value));
2321}
2322
2323void oob_army::location(association_type, int32_t value, error_handler& err, int32_t line, oob_file_army_context& context) {
2324 if(size_t(value) >= context.outer_context.original_id_to_prov_id_map.size()) {
2325 err.accumulated_errors +=
2326 "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
2327 } else {
2328 auto province_id = context.outer_context.original_id_to_prov_id_map[value];
2329 context.outer_context.state.world.force_create_army_location(context.id, province_id);
2330 }
2331}
2332
2333void oob_army::leader(oob_leader const& value, error_handler& err, int32_t line, oob_file_army_context& context) {
2334 if(value.is_general) {
2335 auto l_id = fatten(context.outer_context.state.world, context.outer_context.state.world.create_leader());
2336 l_id.set_background(value.background_);
2337 l_id.set_personality(value.personality_);
2338 l_id.set_prestige(value.prestige);
2339 l_id.set_since(value.date_);
2340 l_id.set_name(value.name_);
2341 l_id.set_is_admiral(false);
2342 context.outer_context.state.world.force_create_leader_loyalty(context.nation_for, l_id);
2343 context.outer_context.state.world.force_create_army_leadership(context.id, l_id);
2344 } else {
2345 err.accumulated_errors += "Cannot attach an admiral to an army (" + err.file_name + " line " + std::to_string(line) + ")\n";
2346 }
2347}
2348
2349void oob_navy::name(association_type, std::string_view value, error_handler& err, int32_t line, oob_file_navy_context& context) {
2350 context.outer_context.state.world.navy_set_name(context.id, context.outer_context.state.add_unit_name(value));
2351}
2352
2353void oob_navy::location(association_type, int32_t value, error_handler& err, int32_t line, oob_file_navy_context& context) {
2354 if(size_t(value) >= context.outer_context.original_id_to_prov_id_map.size()) {
2355 err.accumulated_errors +=
2356 "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
2357 } else {
2358 auto province_id = context.outer_context.original_id_to_prov_id_map[value];
2359 context.outer_context.state.world.force_create_navy_location(context.id, province_id);
2360 }
2361}
2362void oob_navy::leader(oob_leader const& value, error_handler& err, int32_t line, oob_file_navy_context& context) {
2363 if(!value.is_general) {
2364 auto l_id = fatten(context.outer_context.state.world, context.outer_context.state.world.create_leader());
2365 l_id.set_background(value.background_);
2366 l_id.set_personality(value.personality_);
2367 l_id.set_prestige(value.prestige);
2368 l_id.set_since(value.date_);
2369 l_id.set_name(value.name_);
2370 l_id.set_is_admiral(false);
2371 context.outer_context.state.world.force_create_leader_loyalty(context.nation_for, l_id);
2372 context.outer_context.state.world.force_create_navy_leadership(context.id, l_id);
2373 } else {
2374 err.accumulated_errors += "Cannot attach an general to a navy (" + err.file_name + " line " + std::to_string(line) + ")\n";
2375 }
2376}
2377
2378void oob_ship::name(association_type, std::string_view value, error_handler& err, int32_t line, oob_file_ship_context& context) {
2379 context.outer_context.state.world.ship_set_name(context.id, context.outer_context.state.add_unit_name(value));
2380}
2381
2382void oob_ship::type(association_type, std::string_view value, error_handler& err, int32_t line, oob_file_ship_context& context) {
2383 if(auto it = context.outer_context.map_of_unit_types.find(std::string(value));
2384 it != context.outer_context.map_of_unit_types.end()) {
2385 context.outer_context.state.world.ship_set_type(context.id, it->second);
2386 } else {
2387 err.accumulated_errors +=
2388 "Invalid unit type " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2389 }
2390}
2391
2392void oob_regiment::name(association_type, std::string_view value, error_handler& err, int32_t line,
2393 oob_file_regiment_context& context) {
2394 context.outer_context.state.world.regiment_set_name(context.id, context.outer_context.state.add_unit_name(value));
2395}
2396
2397void oob_regiment::type(association_type, std::string_view value, error_handler& err, int32_t line,
2398 oob_file_regiment_context& context) {
2399 if(auto it = context.outer_context.map_of_unit_types.find(std::string(value));
2400 it != context.outer_context.map_of_unit_types.end()) {
2401 context.outer_context.state.world.regiment_set_type(context.id, it->second);
2402 } else {
2403 err.accumulated_errors +=
2404 "Invalid unit type " + std::string(value) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2405 }
2406}
2407
2408void oob_regiment::home(association_type, int32_t value, error_handler& err, int32_t line, oob_file_regiment_context& context) {
2409 if(size_t(value) >= context.outer_context.original_id_to_prov_id_map.size()) {
2410 err.accumulated_errors +=
2411 "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
2412 } else {
2413 auto province_id = context.outer_context.original_id_to_prov_id_map[value];
2414 for(auto pl : context.outer_context.state.world.province_get_pop_location(province_id)) {
2415 auto p = pl.get_pop();
2416 if(p.get_poptype() == context.outer_context.state.culture_definitions.soldiers) {
2417 context.outer_context.state.world.force_create_regiment_source(context.id, p);
2418 return;
2419 }
2420 }
2422 "No soldiers in province regiment comes from (" + err.file_name + " line " + std::to_string(line) + ")\n";
2423 }
2424}
2425
2427 if(v < -200 || v > 200) {
2428 err.accumulated_warnings += "Relation value " + std::to_string(v) + " is not between [-200,-200] (" + err.file_name + " line " + std::to_string(line) + ")\n";
2429 v = std::clamp(v, -200, 200);
2430 }
2431
2432 auto rel =
2433 context.outer_context.state.world.get_diplomatic_relation_by_diplomatic_pair(context.nation_for, context.nation_with);
2434 if(rel) {
2435 context.outer_context.state.world.diplomatic_relation_set_value(rel, float(v));
2436 } else if(v != 0) {
2437 auto new_rel = context.outer_context.state.world.force_create_diplomatic_relation(context.nation_for, context.nation_with);
2438 context.outer_context.state.world.diplomatic_relation_set_value(new_rel, float(v));
2439 }
2440}
2441
2443 auto rel = context.outer_context.state.world.get_gp_relationship_by_gp_influence_pair(context.nation_with, context.nation_for);
2444 auto status_level = [&]() {
2445 switch(v) {
2446 case 0:
2448 case 1:
2450 case 2:
2452 case 3:
2454 case 4:
2456 case 5:
2458 default:
2460 }
2461 }();
2462 if(rel) {
2463 context.outer_context.state.world.gp_relationship_set_status(rel, status_level);
2464 } else if(status_level != nations::influence::level_neutral) {
2465 auto new_rel = context.outer_context.state.world.force_create_gp_relationship(context.nation_with, context.nation_for);
2466 context.outer_context.state.world.gp_relationship_set_status(new_rel, status_level);
2467 }
2468 if(uint32_t(v) > 5) {
2469 err.accumulated_warnings += "Influence level " + std::to_string(v) + " defaults to 'neutral' (" + err.file_name + " line " + std::to_string(line) + ")\n";
2470 }
2471}
2472
2474 auto rel = context.outer_context.state.world.get_gp_relationship_by_gp_influence_pair(context.nation_with, context.nation_for);
2475 if(rel) {
2476 context.outer_context.state.world.gp_relationship_set_influence(rel, v);
2477 } else if(v != 0) {
2478 auto new_rel = context.outer_context.state.world.force_create_gp_relationship(context.nation_with, context.nation_for);
2479 context.outer_context.state.world.gp_relationship_set_influence(new_rel, v);
2480 }
2481 if(v < 0.f || v > 100.f) {
2482 err.accumulated_warnings += "Influence value " + std::to_string(v) + " is not between [0,100] (" + err.file_name + " line " + std::to_string(line) + ")\n";
2483 }
2484}
2485
2487 auto rel = context.outer_context.state.world.get_diplomatic_relation_by_diplomatic_pair(context.nation_with, context.nation_for);
2488 if(rel) {
2489 context.outer_context.state.world.diplomatic_relation_set_truce_until(rel, sys::date(v, context.outer_context.state.start_date));
2490 } else {
2491 auto new_rel = context.outer_context.state.world.force_create_diplomatic_relation(context.nation_with, context.nation_for);
2492 context.outer_context.state.world.diplomatic_relation_set_truce_until(rel, sys::date(v, context.outer_context.state.start_date));
2493 }
2494}
2495
2496void oob_file::leader(oob_leader const& value, error_handler& err, int32_t line, oob_file_context& context) {
2497 if(value.is_general) {
2498 auto l_id = fatten(context.outer_context.state.world, context.outer_context.state.world.create_leader());
2499 l_id.set_background(value.background_);
2500 l_id.set_personality(value.personality_);
2501 l_id.set_prestige(value.prestige);
2502 l_id.set_since(value.date_);
2503 l_id.set_name(value.name_);
2504 l_id.set_is_admiral(false);
2505 context.outer_context.state.world.force_create_leader_loyalty(context.nation_for, l_id);
2506 } else {
2507 auto l_id = fatten(context.outer_context.state.world, context.outer_context.state.world.create_leader());
2508 l_id.set_background(value.background_);
2509 l_id.set_personality(value.personality_);
2510 l_id.set_prestige(value.prestige);
2511 l_id.set_since(value.date_);
2512 l_id.set_name(value.name_);
2513 l_id.set_is_admiral(true);
2514 context.outer_context.state.world.force_create_leader_loyalty(context.nation_for, l_id);
2515 }
2516}
2517
2518void production_employee::poptype(association_type, std::string_view v, error_handler& err, int32_t line, production_context& context) {
2519 if(is_fixed_token_ci(v.data(), v.data() + v.length(), "artisan")) {
2521 } else if(auto it = context.outer_context.map_of_poptypes.find(std::string(v)); it != context.outer_context.map_of_poptypes.end()) {
2522 type = it->second;
2523 } else {
2524 err.accumulated_errors += "Invalid pop type " + std::string(v) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2525 }
2526}
2527
2528void alliance::first(association_type, std::string_view tag, error_handler& err, int32_t line, scenario_building_context& context) {
2529 if(tag.length() == 3) {
2530 if(auto it = context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2])); it != context.map_of_ident_names.end()) {
2531 first_ = context.state.world.national_identity_get_nation_from_identity_holder(it->second);
2532 } else {
2533 err.accumulated_errors +=
2534 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2535 }
2536 } else {
2537 err.accumulated_errors +=
2538 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2539 }
2540}
2541
2542void alliance::second(association_type, std::string_view tag, error_handler& err, int32_t line, scenario_building_context& context) {
2543 if(tag.length() == 3) {
2544 if(auto it = context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2])); it != context.map_of_ident_names.end()) {
2545 second_ = context.state.world.national_identity_get_nation_from_identity_holder(it->second);
2546 } else {
2547 err.accumulated_errors +=
2548 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2549 }
2550 } else {
2551 err.accumulated_errors +=
2552 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2553 }
2554}
2557 invalid = true;
2558}
2561 invalid = true;
2562}
2563
2564void vassal_description::first(association_type, std::string_view tag, error_handler& err, int32_t line, scenario_building_context& context) {
2565 if(tag.length() == 3) {
2566 if(auto it = context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2])); it != context.map_of_ident_names.end()) {
2567 first_ = context.state.world.national_identity_get_nation_from_identity_holder(it->second);
2568 } else {
2569 err.accumulated_errors +=
2570 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2571 }
2572 } else {
2573 err.accumulated_errors +=
2574 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2575 }
2576}
2577
2578void vassal_description::second(association_type, std::string_view tag, error_handler& err, int32_t line, scenario_building_context& context) {
2579 if(tag.length() == 3) {
2580 if(auto it = context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2])); it != context.map_of_ident_names.end()) {
2581 second_ = context.state.world.national_identity_get_nation_from_identity_holder(it->second);
2582 } else {
2583 err.accumulated_errors +=
2584 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2585 }
2586 } else {
2587 err.accumulated_errors +=
2588 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2589 }
2590}
2591
2594 invalid = true;
2595}
2598 invalid = true;
2599}
2600
2601void govt_flag_block::flag(association_type, std::string_view value, error_handler& err, int32_t line, country_history_context& context) {
2602 if(auto it = context.outer_context.map_of_governments.find(std::string(value)); it != context.outer_context.map_of_governments.end()) {
2603 flag_ = ::culture::flag_type(context.outer_context.state.world.government_type_get_flag(it->second));
2604 } else {
2605 err.accumulated_errors += "invalid government type " + std::string(value) + " encountered (" + err.file_name + " line " +
2606 std::to_string(line) + ")\n";
2607 }
2608}
2609
2610void upper_house_block::any_value(std::string_view value, association_type, float v, error_handler& err, int32_t line, country_history_context& context) {
2611 if(!context.holder_id)
2612 return;
2613
2614 if(auto it = context.outer_context.map_of_ideologies.find(std::string(value)); it != context.outer_context.map_of_ideologies.end()) {
2615 context.outer_context.state.world.nation_set_upper_house(context.holder_id, it->second.id, v);
2616 } else {
2617 err.accumulated_errors +=
2618 "invalid ideology " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2619 }
2620}
2621
2622void foreign_investment_block::any_value(std::string_view tag, association_type, float v, error_handler& err, int32_t line, country_history_context& context) {
2623 if(!context.holder_id)
2624 return;
2625
2626 if(tag.length() == 3) {
2627 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
2628 it != context.outer_context.map_of_ident_names.end()) {
2629 auto other = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
2630 auto rel_id = context.outer_context.state.world.force_create_unilateral_relationship(other, context.holder_id);
2631 context.outer_context.state.world.unilateral_relationship_set_foreign_investment(rel_id, v);
2632 } else {
2633 err.accumulated_errors +=
2634 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2635 }
2636 } else {
2637 err.accumulated_errors +=
2638 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2639 }
2640}
2641
2642void country_history_file::set_country_flag(association_type, std::string_view value, error_handler& err, int32_t line, country_history_context& context) {
2643 if(!context.holder_id)
2644 return;
2645 if(auto it = context.outer_context.map_of_national_flags.find(std::string(value)); it != context.outer_context.map_of_national_flags.end()) {
2646 context.outer_context.state.world.nation_set_flag_variables(context.holder_id, it->second, true);
2647 } else {
2648 // unused flag variable: ignore
2649 }
2650}
2651
2652void country_history_file::set_global_flag(association_type, std::string_view value, error_handler& err, int32_t line, country_history_context& context) {
2653 if(!context.holder_id)
2654 return;
2655 if(auto it = context.outer_context.map_of_global_flags.find(std::string(value)); it != context.outer_context.map_of_global_flags.end()) {
2657 } else {
2658 // unused flag variable: ignore
2659 }
2660}
2661
2663 context.outer_context.state.world.nation_set_permanent_colonial_points(context.holder_id, int16_t(value));
2664}
2665
2666void country_history_file::capital(association_type, int32_t value, error_handler& err, int32_t line,
2667 country_history_context& context) {
2668 if(size_t(value) >= context.outer_context.original_id_to_prov_id_map.size()) {
2669 err.accumulated_errors += "Province id " + std::to_string(value) + " is too large (" + err.file_name + " line " + std::to_string(line) + ")\n";
2670 } else {
2671 auto province_id = context.outer_context.original_id_to_prov_id_map[value];
2672 if(!context.in_dated_block)
2673 context.outer_context.state.world.national_identity_set_capital(context.nat_ident, province_id);
2674 if(context.holder_id)
2675 context.outer_context.state.world.nation_set_capital(context.holder_id, province_id);
2676 }
2677}
2678
2679void country_history_file::any_value(std::string_view label, association_type, std::string_view value, error_handler& err,
2680 int32_t line, country_history_context& context) {
2681 if(!context.holder_id)
2682 return;
2683
2684 std::string str_label(label);
2685 if(auto it = context.outer_context.map_of_technologies.find(str_label); it != context.outer_context.map_of_technologies.end()) {
2686 auto v = parse_bool(value, line, err);
2687 context.outer_context.state.world.nation_set_active_technologies(context.holder_id, it->second.id, v);
2688 } else if(auto itb = context.outer_context.map_of_inventions.find(str_label);
2689 itb != context.outer_context.map_of_inventions.end()) {
2690 auto v = parse_bool(value, line, err);
2691 context.outer_context.state.world.nation_set_active_inventions(context.holder_id, itb->second.id, v);
2692 } else if(auto itc = context.outer_context.map_of_iissues.find(str_label); itc != context.outer_context.map_of_iissues.end()) {
2693 if(auto itd = context.outer_context.map_of_ioptions.find(std::string(value));
2694 itd != context.outer_context.map_of_ioptions.end()) {
2695 context.outer_context.state.world.nation_set_issues(context.holder_id, itc->second, itd->second.id);
2696 } else {
2697 err.accumulated_errors += "invalid issue option name " + std::string(value) + " encountered (" + err.file_name + " line " +
2698 std::to_string(line) + ")\n";
2699 }
2700 } else if(auto ite = context.outer_context.map_of_reforms.find(str_label); ite != context.outer_context.map_of_reforms.end()) {
2701 if(auto itd = context.outer_context.map_of_roptions.find(std::string(value));
2702 itd != context.outer_context.map_of_roptions.end()) {
2703 context.outer_context.state.world.nation_set_reforms(context.holder_id, ite->second, itd->second.id);
2704 } else {
2705 err.accumulated_errors += "invalid reform option name " + std::string(value) + " encountered (" + err.file_name +
2706 " line " + std::to_string(line) + ")\n";
2707 }
2708 } else {
2709 err.accumulated_errors +=
2710 "invalid key " + str_label + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2711 }
2712}
2713
2714void country_history_file::primary_culture(association_type, std::string_view value, error_handler& err, int32_t line,
2715 country_history_context& context) {
2716 if(auto it = context.outer_context.map_of_culture_names.find(std::string(value));
2717 it != context.outer_context.map_of_culture_names.end()) {
2718 if(!context.in_dated_block)
2719 context.outer_context.state.world.national_identity_set_primary_culture(context.nat_ident, it->second);
2720 if(context.holder_id)
2721 context.outer_context.state.world.nation_set_primary_culture(context.holder_id, it->second);
2722 } else {
2723 err.accumulated_errors +=
2724 "invalid culture " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2725 }
2726}
2727
2728void country_history_file::culture(association_type, std::string_view value, error_handler& err, int32_t line,
2729 country_history_context& context) {
2730 if(!context.holder_id)
2731 return;
2732
2733 if(auto it = context.outer_context.map_of_culture_names.find(std::string(value));
2734 it != context.outer_context.map_of_culture_names.end()) {
2735 context.outer_context.state.world.nation_set_accepted_cultures(context.holder_id, it->second, true);
2736 } else {
2737 err.accumulated_errors +=
2738 "invalid culture " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2739 }
2740}
2741
2742void country_history_file::remove_culture(association_type, std::string_view value, error_handler& err, int32_t line,
2743 country_history_context& context) {
2744 if(!context.holder_id)
2745 return;
2746
2747 if(auto it = context.outer_context.map_of_culture_names.find(std::string(value));
2748 it != context.outer_context.map_of_culture_names.end()) {
2749 context.outer_context.state.world.nation_set_accepted_cultures(context.holder_id, it->second, false);
2750 } else {
2751 err.accumulated_errors +=
2752 "invalid culture " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2753 }
2754}
2755
2756void country_history_file::religion(association_type, std::string_view value, error_handler& err, int32_t line,
2757 country_history_context& context) {
2758 if(auto it = context.outer_context.map_of_religion_names.find(std::string(value)); it != context.outer_context.map_of_religion_names.end()) {
2759 if(!context.in_dated_block)
2760 context.outer_context.state.world.national_identity_set_religion(context.nat_ident, it->second);
2761 if(context.holder_id)
2762 context.outer_context.state.world.nation_set_religion(context.holder_id, it->second);
2763 } else {
2764 err.accumulated_errors +=
2765 "invalid religion " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2766 }
2767}
2768
2769void country_history_file::government(association_type, std::string_view value, error_handler& err, int32_t line,
2770 country_history_context& context) {
2771 if(!context.holder_id)
2772 return;
2773
2774 if(auto it = context.outer_context.map_of_governments.find(std::string(value));
2775 it != context.outer_context.map_of_governments.end()) {
2776 context.outer_context.state.world.nation_set_government_type(context.holder_id, it->second);
2777 } else {
2778 err.accumulated_errors += "invalid government type " + std::string(value) + " encountered (" + err.file_name + " line " +
2779 std::to_string(line) + ")\n";
2780 }
2781}
2782
2784 country_history_context& context) {
2785 if(!context.holder_id)
2786 return;
2787 context.outer_context.state.world.nation_set_plurality(context.holder_id, value);
2788}
2789
2791 country_history_context& context) {
2792 if(!context.holder_id)
2793 return;
2794 context.outer_context.state.world.nation_set_prestige(context.holder_id, value);
2795}
2796
2797void country_history_file::nationalvalue(association_type, std::string_view value, error_handler& err, int32_t line,
2798 country_history_context& context) {
2799 if(!context.holder_id)
2800 return;
2801
2802 if(auto it = context.outer_context.map_of_modifiers.find(std::string(value));
2803 it != context.outer_context.map_of_modifiers.end()) {
2804 context.outer_context.state.world.nation_set_national_value(context.holder_id, it->second);
2805 } else {
2806 err.accumulated_errors +=
2807 "invalid modifier " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2808 }
2809}
2810
2811void country_history_file::schools(association_type, std::string_view value, error_handler& err, int32_t line,
2812 country_history_context& context) {
2813 if(!context.holder_id)
2814 return;
2815
2816 if(auto it = context.outer_context.map_of_modifiers.find(std::string(value));
2817 it != context.outer_context.map_of_modifiers.end()) {
2818 context.outer_context.state.world.nation_set_tech_school(context.holder_id, it->second);
2819 } else {
2820 err.accumulated_errors +=
2821 "invalid modifier " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2822 }
2823}
2824
2826 country_history_context& context) {
2827 if(!context.holder_id)
2828 return;
2829 context.outer_context.state.world.nation_set_is_civilized(context.holder_id, value);
2830}
2831
2833 country_history_context& context) {
2834 context.outer_context.state.world.national_identity_set_is_not_releasable(context.nat_ident, !value);
2835}
2836
2838 country_history_context& context) {
2839 if(!context.holder_id)
2840 return;
2841 for(auto owned_prov : context.outer_context.state.world.nation_get_province_ownership(context.holder_id)) {
2842 for(auto prov_pop : owned_prov.get_province().get_pop_location()) {
2843 pop_demographics::set_literacy(context.outer_context.state, prov_pop.get_pop(), std::clamp(value, 0.0f, 1.0f));
2844 }
2845 }
2846}
2847
2849 country_history_context& context) {
2850 if(!context.holder_id)
2851 return;
2852 auto fh = fatten(context.outer_context.state.world, context.holder_id);
2853 for(auto owned_prov : context.outer_context.state.world.nation_get_province_ownership(context.holder_id)) {
2854 for(auto prov_pop : owned_prov.get_province().get_pop_location()) {
2855 bool non_accepted = [&]() {
2856 if(prov_pop.get_pop().get_culture() == fh.get_primary_culture())
2857 return false;
2858 if(fh.get_accepted_cultures(prov_pop.get_pop().get_culture()))
2859 return false;
2860 return true;
2861 }();
2862 if(non_accepted)
2863 pop_demographics::set_literacy(context.outer_context.state, prov_pop.get_pop(), std::clamp(value, 0.0f, 1.0f));
2864 }
2865 }
2866}
2867
2869 country_history_context& context) {
2870 if(!context.holder_id)
2871 return;
2872 for(auto owned_prov : context.outer_context.state.world.nation_get_province_ownership(context.holder_id)) {
2873 for(auto prov_pop : owned_prov.get_province().get_pop_location()) {
2874 pop_demographics::set_consciousness(context.outer_context.state, prov_pop.get_pop(), std::clamp(value, 0.0f, 10.0f));
2875 }
2876 }
2877}
2878
2880 country_history_context& context) {
2881 if(!context.holder_id)
2882 return;
2883 for(auto owned_prov : context.outer_context.state.world.nation_get_province_ownership(context.holder_id)) {
2884 if(owned_prov.get_province().get_is_colonial()) {
2885 for(auto prov_pop : owned_prov.get_province().get_pop_location()) {
2886 pop_demographics::set_consciousness(context.outer_context.state, prov_pop.get_pop(), std::clamp(value, 0.0f, 10.0f));
2887 }
2888 }
2889 }
2890}
2891
2893 country_history_context& context) {
2894 context.outer_context.state.world.national_identity_set_government_flag_type(context.nat_ident, value.government_,
2895 uint8_t(value.flag_) + uint8_t(1));
2896}
2897
2898void country_history_file::ruling_party(association_type, std::string_view value, error_handler& err, int32_t line,
2899 country_history_context& context) {
2900 if(!context.holder_id)
2901 return;
2902
2903 auto value_key = context.outer_context.state.lookup_key(value);
2904
2905 if(value_key) {
2906 auto first_party = context.outer_context.state.world.national_identity_get_political_party_first(context.nat_ident);
2907 auto party_count = context.outer_context.state.world.national_identity_get_political_party_count(context.nat_ident);
2908 for(uint32_t i = 0; i < party_count; ++i) {
2909 dcon::political_party_id pid{ dcon::political_party_id::value_base_t(first_party.id.index() + i) };
2910 auto name = context.outer_context.state.world.political_party_get_name(pid);
2911 if(name == value_key) {
2912 context.outer_context.state.world.nation_set_ruling_party(context.holder_id, pid);
2913 for(auto p_issue : context.outer_context.state.culture_definitions.party_issues) {
2914 context.outer_context.state.world.nation_set_issues(context.holder_id, p_issue,
2915 context.outer_context.state.world.political_party_get_party_issues(pid, p_issue));
2916 }
2917 return;
2918 }
2919 }
2920 // alright, it didn't belong to that nation -- try checking everything to help broken mods work anyways
2921 err.accumulated_warnings += "invalid political party " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2922 for(auto p : context.outer_context.state.world.in_political_party) {
2923 auto name = p.get_name();
2924 if(name == value_key) {
2925 context.outer_context.state.world.nation_set_ruling_party(context.holder_id, p);
2926 for(auto p_issue : context.outer_context.state.culture_definitions.party_issues) {
2927 context.outer_context.state.world.nation_set_issues(context.holder_id, p_issue,
2928 context.outer_context.state.world.political_party_get_party_issues(p, p_issue));
2929 }
2930 return;
2931 }
2932 }
2933 }
2934 err.accumulated_errors += "globally invalid political party " + std::string(value) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
2935}
2936
2937void country_history_file::decision(association_type, std::string_view value, error_handler& err, int32_t line, country_history_context& context) {
2938 auto value_key = context.outer_context.state.lookup_key(std::string{ value } + "_title");
2939
2940 if(!value_key) {
2941 err.accumulated_errors += "no decision named " + std::string(value) + " found (" + err.file_name + " line " + std::to_string(line) + ")\n";
2942 return;
2943 }
2944
2945 for(auto d : context.outer_context.state.world.in_decision) {
2946 auto name = d.get_name();
2947 if(name == value_key) {
2948 context.pending_decisions.emplace_back(context.holder_id, d);
2949 return;
2950 }
2951 }
2952
2953 err.accumulated_errors += "no decision named " + std::string(value) + " found (" + err.file_name + " line " + std::to_string(line) + ")\n";
2954}
2955
2957 data.resize(context.state.world.commodity_size());
2958}
2959
2960void country_file::color(color_from_3i cvalue, error_handler& err, int32_t line, country_file_context& context) {
2961 context.outer_context.state.world.national_identity_set_color(context.id, cvalue.value);
2962 for(auto g : context.outer_context.state.world.in_government_type) {
2963 context.outer_context.state.world.national_identity_set_government_color(context.id, g, cvalue.value);
2964 }
2965}
2966
2967void country_file::template_(association_type, std::string_view value, error_handler& err, int32_t line, country_file_context& context) {
2968 auto root = simple_fs::get_root(context.outer_context.state.common_fs);
2969 auto common_dir = simple_fs::open_directory(root, NATIVE("common"));
2970 auto countries_dir = simple_fs::open_directory(common_dir, NATIVE("templates"));
2971 if(auto f = simple_fs::open_file(countries_dir, simple_fs::utf8_to_native(value)); f) {
2972 auto content = simple_fs::view_contents(*f);
2973 err.file_name = std::string(value);
2974 parsers::token_generator gen(content.data, content.data + content.file_size);
2975 parsers::parse_country_file(gen, err, context);
2976 }
2977}
2978
2979void country_file::any_group(std::string_view name, color_from_3i c, error_handler& err, int32_t line, country_file_context& context) {
2980 if(auto it = context.outer_context.map_of_governments.find(std::string(name)); it != context.outer_context.map_of_governments.end()) {
2981 context.outer_context.state.world.national_identity_set_government_color(context.id, it->second, c.value);
2982 } else {
2983 err.accumulated_errors +=
2984 "Invalid government type " + std::string(name) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
2985 }
2986}
2987
2988void generic_event::title(association_type, std::string_view value, error_handler& err, int32_t line,
2989 event_building_context& context) {
2990 title_ = text::find_or_add_key(context.outer_context.state, value, false);
2991}
2992
2993void generic_event::desc(association_type, std::string_view value, error_handler& err, int32_t line,
2994 event_building_context& context) {
2995 desc_ = text::find_or_add_key(context.outer_context.state, value, false);
2996}
2997
2998void generic_event::issue_group(association_type, std::string_view name, error_handler& err, int32_t line, event_building_context& context) {
2999 if(auto it = context.outer_context.map_of_iissues.find(std::string(name)); it != context.outer_context.map_of_iissues.end()) {
3000 issue_group_ = it->second;
3001 } else {
3002 err.accumulated_errors += "Invalid issue group " + std::string(name) + " (" + err.file_name + " line " + std::to_string(line) + ")\n";
3003 }
3004}
3005
3006void generic_event::option(sys::event_option const& value, error_handler& err, int32_t line, event_building_context& context) {
3008 options[last_option_added] = value;
3009 if(!value.name && !value.effect) {
3010 options[last_option_added].name = text::find_or_add_key(context.outer_context.state, "alice_option_no_name", true);
3011 err.accumulated_warnings += "Event with an option with no name (" + err.file_name + " line " + std::to_string(line) + ")\n";
3012 }
3014 } else {
3015 err.accumulated_errors += "Event given too many options (" + err.file_name + " line " + std::to_string(line) + ")\n";
3016 }
3017}
3018
3019void generic_event::picture(association_type, std::string_view name, error_handler& err, int32_t line, event_building_context& context) {
3020
3021 auto root = get_root(context.outer_context.state.common_fs);
3022 auto gfx = open_directory(root, NATIVE("gfx"));
3023 auto pictures = open_directory(gfx, NATIVE("pictures"));
3024 auto events = open_directory(pictures, NATIVE("events"));
3025
3026 std::string file_name = simple_fs::remove_double_backslashes(std::string("gfx\\pictures\\events\\") + [&]() {
3027 if(peek_file(events, simple_fs::utf8_to_native(name) + NATIVE(".tga"))) {
3028 return std::string(name) + ".tga";
3029 } else if(peek_file(events, simple_fs::utf8_to_native(name) + NATIVE(".dds"))) {
3030 return std::string(name) + ".tga";
3031 } else if(peek_file(events, simple_fs::utf8_to_native(name) + NATIVE(".png"))) {
3032 return std::string(name) + ".tga";
3033 } else {
3034 return std::string("GFX_event_no_image.tga");
3035 }
3036 }());
3037
3038 if(auto it = context.outer_context.gfx_context.map_of_names.find(file_name);
3039 it != context.outer_context.gfx_context.map_of_names.end()) {
3040 picture_ = it->second;
3041 } else {
3042 auto gfxindex = context.outer_context.state.ui_defs.gfx.size();
3043 context.outer_context.state.ui_defs.gfx.emplace_back();
3044 ui::gfx_object& new_obj = context.outer_context.state.ui_defs.gfx.back();
3045 auto new_id = dcon::gfx_object_id(uint16_t(gfxindex));
3046
3047 context.outer_context.gfx_context.map_of_names.insert_or_assign(file_name, new_id);
3048
3049 new_obj.number_of_frames = uint8_t(1);
3050
3051 if(auto itb = context.outer_context.gfx_context.map_of_texture_names.find(file_name);
3052 itb != context.outer_context.gfx_context.map_of_texture_names.end()) {
3053 new_obj.primary_texture_handle = itb->second;
3054 } else {
3055 auto index = context.outer_context.state.ui_defs.textures.size();
3057 new_obj.primary_texture_handle = dcon::texture_id(uint16_t(index));
3058 context.outer_context.gfx_context.map_of_texture_names.insert_or_assign(file_name, dcon::texture_id(uint16_t(index)));
3059 }
3061
3062 picture_ = new_id;
3063 }
3064}
3065
3066void history_war_goal::receiver(association_type, std::string_view tag, error_handler& err, int32_t line, war_history_context& context) {
3067 if(tag.length() == 3) {
3068 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
3069 it != context.outer_context.map_of_ident_names.end()) {
3070 receiver_ = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
3071 } else {
3072 err.accumulated_errors +=
3073 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3074 }
3075 } else {
3076 err.accumulated_errors +=
3077 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3078 }
3079}
3080
3082 if(0 <= value && size_t(value) < context.outer_context.original_id_to_prov_id_map.size()) {
3084 } else {
3085 err.accumulated_errors +=
3086 "history wargoal given an invalid province id (" + err.file_name + ", line " + std::to_string(line) + ")\n";
3087 }
3088}
3089
3091 auto root = get_root(outer_context.state.common_fs);
3092 auto gfx = open_directory(root, NATIVE("gfx"));
3093 auto infa = open_directory(gfx, NATIVE("interface"));
3094 auto leaders = open_directory(infa, NATIVE("leaders"));
3095
3096 auto all_images = simple_fs::list_files(leaders, NATIVE(".dds"));
3097 for(auto i : all_images) {
3098 auto native_name = simple_fs::get_file_name(i);
3099 auto uname = simple_fs::native_to_utf8(native_name);
3100
3101 bool admiral = false;
3102 std::string group_name;
3103
3104 auto apos = uname.find("_admiral_", 0);
3105 if(apos != std::string::npos) {
3106 admiral = true;
3107 group_name = uname.substr(0, apos);
3108 } else {
3109 auto gpos = uname.find("_general_", 0);
3110 if(gpos != std::string::npos) {
3111 group_name = uname.substr(0, gpos);
3112 } else {
3113 continue; // neither admiral nor general
3114 }
3115 }
3116
3117 dcon::leader_images_id category;
3118 if(auto it = outer_context.map_of_leader_graphics.find(group_name); it != outer_context.map_of_leader_graphics.end()) {
3119 category = it->second;
3120 } else {
3121 category = outer_context.state.world.create_leader_images();
3122 outer_context.map_of_leader_graphics.insert_or_assign(group_name, category);
3123 }
3124
3125 std::string file_name = simple_fs::remove_double_backslashes(std::string("gfx\\interface\\leaders\\") + uname);
3126
3127 auto gfxindex = outer_context.state.ui_defs.gfx.size();
3128 outer_context.state.ui_defs.gfx.emplace_back();
3129 ui::gfx_object& new_obj = outer_context.state.ui_defs.gfx.back();
3130 auto new_id = dcon::gfx_object_id(uint16_t(gfxindex));
3131
3132 outer_context.gfx_context.map_of_names.insert_or_assign(file_name, new_id);
3133
3134 new_obj.number_of_frames = uint8_t(1);
3135 if(auto itb = outer_context.gfx_context.map_of_texture_names.find(file_name); itb != outer_context.gfx_context.map_of_texture_names.end()) {
3136 new_obj.primary_texture_handle = itb->second;
3137 } else {
3138 auto index = outer_context.state.ui_defs.textures.size();
3139 outer_context.state.ui_defs.textures.emplace_back(outer_context.state.add_key_utf8(file_name));
3140 new_obj.primary_texture_handle = dcon::texture_id(uint16_t(index));
3141 outer_context.gfx_context.map_of_texture_names.insert_or_assign(file_name, new_obj.primary_texture_handle);
3142 }
3144
3145 if(admiral) {
3146 outer_context.state.world.leader_images_get_admirals(category).push_back(new_id);
3147 } else {
3148 outer_context.state.world.leader_images_get_generals(category).push_back(new_id);
3149 }
3150
3151 }
3152}
3153
3154void history_war_goal::actor(association_type, std::string_view tag, error_handler& err, int32_t line, war_history_context& context) {
3155 if(tag.length() == 3) {
3156 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
3157 it != context.outer_context.map_of_ident_names.end()) {
3158 actor_ = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
3159 } else {
3160 err.accumulated_errors +=
3161 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3162 }
3163 } else {
3164 err.accumulated_errors +=
3165 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3166 }
3167}
3168void history_war_goal::country(association_type, std::string_view tag, error_handler& err, int32_t line, war_history_context& context) {
3169 if(tag.length() == 3) {
3170 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
3171 it != context.outer_context.map_of_ident_names.end()) {
3172 secondary_ = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
3173 } else {
3174 err.accumulated_errors +=
3175 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3176 }
3177 } else {
3178 err.accumulated_errors +=
3179 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3180 }
3181}
3182void history_war_goal::casus_belli(association_type, std::string_view value, error_handler& err, int32_t line, war_history_context& context) {
3183 if(auto it = context.outer_context.map_of_cb_types.find(std::string(value));
3184 it != context.outer_context.map_of_cb_types.end()) {
3185 casus_belli_ = it->second.id;
3186 } else {
3187 err.accumulated_errors += "invalid cb type type " + std::string(value) + " encountered (" + err.file_name + " line " +
3188 std::to_string(line) + ")\n";
3189 }
3190}
3191void war_block::world_war(association_type, bool v, error_handler& err, int32_t line, war_history_context& context) {
3192 context.great_war = v;
3193}
3194void war_block::add_attacker(association_type, std::string_view tag, error_handler& err, int32_t line,
3195 war_history_context& context) {
3196 if(tag.length() == 3) {
3197 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
3198 it != context.outer_context.map_of_ident_names.end()) {
3199 auto tg = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
3200 if(tg)
3201 context.attackers.push_back(tg);
3202 } else {
3203 err.accumulated_errors +=
3204 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3205 }
3206 } else {
3207 err.accumulated_errors +=
3208 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3209 }
3210}
3211
3212void war_block::add_defender(association_type, std::string_view tag, error_handler& err, int32_t line,
3213 war_history_context& context) {
3214 if(tag.length() == 3) {
3215 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
3216 it != context.outer_context.map_of_ident_names.end()) {
3217 auto tg = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
3218 if(tg)
3219 context.defenders.push_back(tg);
3220 } else {
3221 err.accumulated_errors +=
3222 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3223 }
3224 } else {
3225 err.accumulated_errors +=
3226 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3227 }
3228}
3229
3230void war_block::rem_attacker(association_type, std::string_view tag, error_handler& err, int32_t line,
3231 war_history_context& context) {
3232 if(tag.length() == 3) {
3233 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
3234 it != context.outer_context.map_of_ident_names.end()) {
3235 auto tg = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
3236 std::erase(context.attackers, tg);
3237 } else {
3238 err.accumulated_errors +=
3239 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3240 }
3241 } else {
3242 err.accumulated_errors +=
3243 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3244 }
3245}
3246void war_block::rem_defender(association_type, std::string_view tag, error_handler& err, int32_t line,
3247 war_history_context& context) {
3248 if(tag.length() == 3) {
3249 if(auto it = context.outer_context.map_of_ident_names.find(nations::tag_to_int(tag[0], tag[1], tag[2]));
3250 it != context.outer_context.map_of_ident_names.end()) {
3251 auto tg = context.outer_context.state.world.national_identity_get_nation_from_identity_holder(it->second);
3252 std::erase(context.defenders, tg);
3253 } else {
3254 err.accumulated_errors +=
3255 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3256 }
3257 } else {
3258 err.accumulated_errors +=
3259 "invalid tag " + std::string(tag) + " encountered (" + err.file_name + " line " + std::to_string(line) + ")\n";
3260 }
3261}
3262
3263void enter_war_dated_block(std::string_view label, token_generator& gen, error_handler& err, war_history_context& context) {
3264 auto ymd = parse_date(label, 0, err);
3266 parse_war_block(gen, err, context);
3267 } else {
3268 gen.discard_group();
3269 }
3270}
3271
3272void war_history_file::name(association_type, std::string_view name, error_handler& err, int32_t line,
3273 war_history_context& context) {
3274 context.name = std::string(name);
3275}
3276
3278 if(context.attackers.size() > 0 && context.defenders.size() > 0 && context.wargoals.size() > 0) {
3279 auto new_war = fatten(context.outer_context.state.world, context.outer_context.state.world.create_war());
3280 new_war.set_start_date(sys::date(0));
3281 new_war.set_primary_attacker(context.attackers[0]);
3282 new_war.set_primary_defender(context.defenders[0]);
3283 new_war.set_is_great(context.great_war);
3284 new_war.set_original_target(context.defenders[0]);
3285 // new_war.set_name(text::find_or_add_key(context.outer_context.state, context.name));
3286
3287 new_war.set_name(context.outer_context.state.lookup_key(std::string_view{ "agression_war_name" }));// misspelling is intentional; DO NOT CORRECT
3288
3289 for(auto n : context.attackers) {
3290 auto rel = context.outer_context.state.world.force_create_war_participant(new_war, n);
3291 context.outer_context.state.world.war_participant_set_is_attacker(rel, true);
3292 }
3293 for(auto n : context.defenders) {
3294 auto rel = context.outer_context.state.world.force_create_war_participant(new_war, n);
3295 context.outer_context.state.world.war_participant_set_is_attacker(rel, false);
3296 }
3297 for(auto& wg : context.wargoals) {
3298 auto new_wg = fatten(context.outer_context.state.world, context.outer_context.state.world.create_wargoal());
3299 new_wg.set_added_by(wg.actor_);
3300 if(wg.actor_ == context.attackers[0]) {
3301 new_war.set_name(context.outer_context.state.world.cb_type_get_war_name(wg.casus_belli_));
3302 }
3303 new_wg.set_target_nation(wg.receiver_);
3304 new_wg.set_type(wg.casus_belli_);
3305 new_wg.set_secondary_nation(wg.secondary_);
3306 new_wg.set_associated_tag(context.outer_context.state.world.nation_get_identity_from_identity_holder(wg.secondary_));
3307 new_wg.set_associated_state(context.outer_context.state.world.province_get_state_from_abstract_state_membership(wg.state_province_id_));
3308 context.outer_context.state.world.force_create_wargoals_attached(new_war, new_wg);
3309 }
3310 }
3311}
3312
3313void mod_file::name(association_type, std::string_view value, error_handler& err, int32_t line, mod_file_context& context) {
3314 name_ = std::string(value);
3315}
3316
3317void mod_file::path(association_type, std::string_view value, error_handler& err, int32_t line, mod_file_context& context) {
3318 path_ = std::string(value);
3319}
3320
3321void mod_file::user_dir(association_type, std::string_view value, error_handler& err, int32_t line, mod_file_context& context) {
3322 user_dir_ = std::string(value);
3323}
3324
3325void mod_file::replace_path(association_type, std::string_view value, error_handler& err, int32_t line,
3326 mod_file_context& context) {
3327 replace_paths.push_back(std::string(value));
3328}
3329
3331 // If there isn't any path then we aren't required to do anything
3332 if(path_.empty())
3333 return;
3334
3335 // Add root of mod_path
3336 for(auto replace_path : replace_paths) {
3337 native_string path_block = simple_fs::list_roots(fs)[0];
3338 path_block += NATIVE_DIR_SEPARATOR;
3340 if(path_block.back() != NATIVE_DIR_SEPARATOR)
3341 path_block += NATIVE_DIR_SEPARATOR;
3342
3343 simple_fs::add_ignore_path(fs, path_block);
3344 }
3345
3346 native_string mod_path = simple_fs::list_roots(fs)[0];
3347 mod_path += NATIVE_DIR_SEPARATOR;
3349 add_root(fs, mod_path);
3350}
3351
3352
3353void locale_parser::body_feature(association_type, std::string_view value, error_handler& err, int32_t line, sys::state&) {
3354 body_features.push_back(hb_tag_from_string(value.data(), int(value.length())));
3355}
3356void locale_parser::header_feature(association_type, std::string_view value, error_handler& err, int32_t line, sys::state&) {
3357 header_features.push_back(hb_tag_from_string(value.data(), int(value.length())));
3358}
3359void locale_parser::map_feature(association_type, std::string_view value, error_handler& err, int32_t line, sys::state&) {
3360 map_features.push_back(hb_tag_from_string(value.data(), int(value.length())));
3361}
3362
3363void add_locale(sys::state& state, std::string_view locale_name, char const* data_start, char const* data_end) {
3364 parsers::token_generator gen(data_start, data_end);
3365 parsers::error_handler err("");
3366
3367 locale_parser new_locale = parsers::parse_locale_parser(gen, err, state);
3368 hb_language_t lang = nullptr;
3369
3370 auto new_locale_id = state.world.create_locale();
3371 auto new_locale_obj = fatten(state.world, new_locale_id);
3372 new_locale_obj.set_hb_script(hb_script_from_string(new_locale.script.c_str(), int(new_locale.script.length())));
3373 new_locale_obj.set_native_rtl(new_locale.rtl);
3374 new_locale_obj.set_prevent_letterspace(new_locale.prevent_map_letterspacing);
3375
3376 {
3377 auto f = new_locale_obj.get_body_font();
3378 f.resize(uint32_t(new_locale.body_font.length()));
3379 f.load_range((uint8_t const*)new_locale.body_font.c_str(), (uint8_t const*)new_locale.body_font.c_str() + new_locale.body_font.length());
3380 }
3381 {
3382 auto f = new_locale_obj.get_header_font();
3383 f.resize(uint32_t(new_locale.header_font.length()));
3384 f.load_range((uint8_t const*)new_locale.header_font.c_str(), (uint8_t const*)new_locale.header_font.c_str() + new_locale.header_font.length());
3385 }
3386 {
3387 auto f = new_locale_obj.get_map_font();
3388 f.resize(uint32_t(new_locale.map_font.length()));
3389 f.load_range((uint8_t const*)new_locale.map_font.c_str(), (uint8_t const*)new_locale.map_font.c_str() + new_locale.map_font.length());
3390 }
3391 {
3392 auto f = new_locale_obj.get_body_font_features();
3393 f.resize(uint32_t(new_locale.body_features.size()));
3394 f.load_range(new_locale.body_features.data(), new_locale.body_features.data() + new_locale.body_features.size());
3395 }
3396 {
3397 auto f = new_locale_obj.get_header_font_features();
3398 f.resize(uint32_t(new_locale.header_features.size()));
3399 f.load_range(new_locale.header_features.data(), new_locale.header_features.data() + new_locale.header_features.size());
3400 }
3401 {
3402 auto f = new_locale_obj.get_map_font_features();
3403 f.resize(uint32_t(new_locale.map_features.size()));
3404 f.load_range(new_locale.map_features.data(), new_locale.map_features.data() + new_locale.map_features.size());
3405 }
3406 {
3407 auto f = new_locale_obj.get_locale_name();
3408 f.resize(uint32_t(locale_name.length()));
3409 f.load_range((uint8_t const*)locale_name.data(), (uint8_t const*)locale_name.data() + locale_name.length());
3410 }
3411 {
3412 auto f = new_locale_obj.get_fallback();
3413 f.resize(uint32_t(new_locale.fallback.length()));
3414 f.load_range((uint8_t const*)new_locale.fallback.data(), (uint8_t const*)new_locale.fallback.data() + new_locale.fallback.length());
3415 }
3416 {
3417 auto f = new_locale_obj.get_display_name();
3418 f.resize(uint32_t(new_locale.display_name.length()));
3419 f.load_range((uint8_t const*)new_locale.display_name.data(), (uint8_t const*)new_locale.display_name.data() + new_locale.display_name.length());
3420 }
3421}
3422
3423
3424} // 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
year_month_day to_ymd(absolute_time_point base) const noexcept
tag_type emplace_back(T &&... ts)
auto size() const
void resize(size_t size)
tagged_vector< gfx_object, dcon::gfx_object_id > gfx
tagged_vector< dcon::text_key, dcon::texture_id > textures
constexpr uint64_t to_bits(dcon::ideology_id id)
Definition: culture.hpp:92
std::string_view province_building_type_get_name(economy::province_building_type v)
Definition: economy.hpp:56
constexpr dcon::commodity_id money(0)
province_building_type
Definition: constants.hpp:578
Definition: events.cpp:8
constexpr uint32_t pop_open_factory_invest
Definition: culture.hpp:25
constexpr uint32_t pop_expand_factory_invest
Definition: culture.hpp:24
constexpr uint32_t open_factory_invest
Definition: culture.hpp:20
constexpr uint32_t pop_open_factory
Definition: culture.hpp:16
constexpr uint32_t build_railway
Definition: culture.hpp:38
constexpr uint32_t pop_build_factory_invest
Definition: culture.hpp:23
constexpr uint32_t open_factory
Definition: culture.hpp:10
constexpr uint32_t same_as_ruling_party
Definition: culture.hpp:34
constexpr uint32_t state_vote
Definition: culture.hpp:36
constexpr uint32_t can_invest_in_pop_projects
Definition: culture.hpp:22
constexpr uint32_t build_factory
Definition: culture.hpp:8
constexpr uint32_t build_railway_invest
Definition: culture.hpp:21
constexpr uint32_t can_subsidise
Definition: culture.hpp:13
constexpr uint32_t pop_expand_factory
Definition: culture.hpp:15
constexpr uint32_t delete_factory_if_no_input
Definition: culture.hpp:17
constexpr uint32_t culture_voting
Definition: culture.hpp:29
constexpr uint32_t destroy_factory
Definition: culture.hpp:11
constexpr uint32_t slavery_allowed
Definition: culture.hpp:27
constexpr uint32_t build_bank
Definition: culture.hpp:41
constexpr uint32_t rich_only
Definition: culture.hpp:35
constexpr uint32_t build_university
Definition: culture.hpp:42
constexpr uint32_t all_voting
Definition: culture.hpp:30
constexpr uint32_t allow_foreign_investment
Definition: culture.hpp:26
constexpr uint32_t dhont
Definition: culture.hpp:32
constexpr uint32_t pop_build_factory
Definition: culture.hpp:14
constexpr uint32_t largest_share
Definition: culture.hpp:31
constexpr uint32_t primary_culture_voting
Definition: culture.hpp:28
constexpr uint32_t build_factory_invest
Definition: culture.hpp:18
constexpr uint32_t factory_priority
Definition: culture.hpp:12
constexpr uint32_t sainte_laque
Definition: culture.hpp:33
constexpr uint32_t expand_factory_invest
Definition: culture.hpp:19
constexpr uint32_t population_vote
Definition: culture.hpp:37
constexpr uint32_t expand_factory
Definition: culture.hpp:9
constexpr uint32_t po_transfer_provinces
Definition: military.hpp:23
constexpr uint32_t po_destroy_naval_bases
Definition: military.hpp:33
constexpr uint32_t po_reparations
Definition: military.hpp:22
constexpr uint32_t po_add_to_sphere
Definition: military.hpp:20
constexpr uint32_t po_demand_state
Definition: military.hpp:19
constexpr uint32_t po_install_communist_gov_type
Definition: military.hpp:28
constexpr uint32_t all_allowed_states
Definition: military.hpp:14
constexpr uint32_t po_annex
Definition: military.hpp:18
constexpr uint32_t po_status_quo
Definition: military.hpp:27
constexpr uint32_t is_triggered_only
Definition: military.hpp:11
constexpr uint32_t po_disarmament
Definition: military.hpp:21
constexpr uint32_t po_remove_prestige
Definition: military.hpp:24
constexpr uint32_t is_not_constructing_cb
Definition: military.hpp:12
constexpr uint32_t great_war_obligatory
Definition: military.hpp:13
constexpr uint32_t not_in_crisis
Definition: military.hpp:15
constexpr uint32_t po_remove_cores
Definition: military.hpp:30
constexpr uint32_t po_gunboat
Definition: military.hpp:17
constexpr uint32_t is_civil_war
Definition: military.hpp:9
constexpr uint32_t po_destroy_forts
Definition: military.hpp:32
constexpr uint32_t po_release_puppet
Definition: military.hpp:26
constexpr uint32_t po_clear_union_sphere
Definition: military.hpp:16
constexpr uint32_t po_make_puppet
Definition: military.hpp:25
constexpr uint32_t always
Definition: military.hpp:10
constexpr uint32_t po_colony
Definition: military.hpp:31
constexpr uint32_t po_uninstall_communist_gov_type
Definition: military.hpp:29
constexpr uint8_t level_friendly
Definition: nations.hpp:168
constexpr uint8_t level_opposed
Definition: nations.hpp:165
constexpr uint8_t level_neutral
Definition: nations.hpp:164
constexpr uint8_t level_hostile
Definition: nations.hpp:166
constexpr uint8_t level_in_sphere
Definition: nations.hpp:169
constexpr uint8_t level_cordial
Definition: nations.hpp:167
uint32_t tag_to_int(char first, char second, char third)
Definition: nations.hpp:7
association_type
Definition: parsers.hpp:28
void enter_war_dated_block(std::string_view label, token_generator &gen, error_handler &err, war_history_context &context)
bool is_fixed_token_ci(char const *start, char const *end, char const (&t)[N])
Definition: parsers.hpp:275
void make_leader_images(scenario_building_context &outer_context)
sys::year_month_day parse_date(std::string_view content, int32_t line, error_handler &err)
Definition: parsers.cpp:253
int32_t parse_int(std::string_view content, int32_t line, error_handler &err)
Definition: parsers.cpp:226
void add_locale(sys::state &state, std::string_view locale_name, char const *data_start, char const *data_end)
bool parse_bool(std::string_view content, int32_t, error_handler &)
Definition: parsers.cpp:201
bool has_fixed_prefix_ci(char const *start, char const *end, char const (&t)[N])
Definition: parsers.hpp:207
void set_militancy(sys::state &state, dcon::pop_id p, float v)
void set_consciousness(sys::state &state, dcon::pop_id p, float v)
void set_literacy(sys::state &state, T p, ve::fp_vector v)
dcon::rebel_faction_id get_faction_by_type(sys::state &state, dcon::nation_id n, dcon::rebel_type_id r)
Definition: rebels.cpp:29
std::vector< unopened_file > list_files(directory const &dir, native_char const *extension)
directory open_directory(directory const &dir, native_string_view directory_name)
void add_ignore_path(file_system &fs, native_string_view replaced_path)
native_string utf8_to_native(std::string_view data_in)
directory get_root(file_system const &fs)
std::vector< native_string > list_roots(file_system const &fs)
std::string remove_double_backslashes(std::string_view data_in)
native_string correct_slashes(native_string_view path)
std::optional< file > open_file(directory const &dir, native_string_view file_name)
std::string native_to_utf8(native_string_view data_in)
file_contents view_contents(file const &f)
native_string get_file_name(unopened_file const &f)
constexpr int32_t max_event_options
Definition: constants.hpp:562
Definition: bmfont.cpp:118
dcon::text_key find_or_add_key(sys::state &state, std::string_view key, bool as_unicode)
Definition: text.cpp:695
#define NATIVE(X)
std::string native_string
#define NATIVE_DIR_SEPARATOR
uint uint32_t
uchar uint8_t
dcon::value_modifier_key conversion_chance
Definition: culture.hpp:166
dcon::pop_type_id farmers
Definition: culture.hpp:139
dcon::value_modifier_key migration_chance
Definition: culture.hpp:162
dcon::pop_type_id clergy
Definition: culture.hpp:141
dcon::value_modifier_key colonialmigration_chance
Definition: culture.hpp:163
dcon::value_modifier_key demotion_chance
Definition: culture.hpp:161
dcon::pop_type_id bureaucrat
Definition: culture.hpp:145
dcon::pop_type_id artisans
Definition: culture.hpp:137
std::vector< folder_info > tech_folders
Definition: culture.hpp:131
std::vector< dcon::issue_id > party_issues
Definition: culture.hpp:125
dcon::pop_type_id soldiers
Definition: culture.hpp:142
dcon::value_modifier_key assimilation_chance
Definition: culture.hpp:165
dcon::pop_type_id officers
Definition: culture.hpp:143
dcon::issue_option_id jingoism
Definition: culture.hpp:157
dcon::pop_type_id capitalists
Definition: culture.hpp:138
dcon::ideology_id conservative
Definition: culture.hpp:155
dcon::value_modifier_key promotion_chance
Definition: culture.hpp:160
dcon::pop_type_id laborers
Definition: culture.hpp:140
dcon::pop_type_id slaves
Definition: culture.hpp:144
dcon::value_modifier_key emigration_chance
Definition: culture.hpp:164
float commodity_amounts[set_size]
dcon::commodity_id commodity_type[set_size]
static constexpr uint32_t set_size
dcon::cb_type_id standard_civil_war
Definition: military.hpp:150
dcon::cb_type_id crisis_liberate
Definition: military.hpp:159
dcon::cb_type_id crisis_colony
Definition: military.hpp:158
dcon::cb_type_id standard_great_war
Definition: military.hpp:151
dcon::national_event_id id
Definition: nations.hpp:28
dcon::national_event_id id
Definition: nations.hpp:22
dcon::provincial_event_id id
Definition: nations.hpp:35
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
std::vector< fixed_event > on_yearly_pulse
Definition: nations.hpp:135
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
std::vector< fixed_event > on_election_finished
Definition: nations.hpp:153
std::vector< fixed_province_event > on_battle_won
Definition: nations.hpp:137
std::vector< fixed_event > on_colony_to_state_free_slaves
Definition: nations.hpp:145
std::vector< fixed_event > on_quarterly_pulse
Definition: nations.hpp:136
void set_global_flag_variable(dcon::global_flag_id id, bool state)
Definition: nations.cpp:218
dcon::national_focus_id flashpoint_focus
Definition: nations.hpp:125
std::vector< fixed_event > on_debtor_default
Definition: nations.hpp:146
std::vector< fixed_event > on_crisis_declare_interest
Definition: nations.hpp:151
std::vector< fixed_event > on_my_factories_nationalized
Definition: nations.hpp:150
std::vector< fixed_election_event > on_election_tick
Definition: nations.hpp:142
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
void second(association_type, std::string_view tag, error_handler &err, int32_t line, scenario_building_context &context)
void end_date(association_type, sys::year_month_day ymd, error_handler &err, int32_t line, scenario_building_context &context)
void first(association_type, std::string_view tag, error_handler &err, int32_t line, scenario_building_context &context)
void start_date(association_type, sys::year_month_day ymd, error_handler &err, int32_t line, scenario_building_context &context)
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
void months(association_type, int32_t value, error_handler &err, int32_t line, individual_cb_context &context)
void po_status_quo(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void good_relation_prestige_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void break_truce_infamy_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void po_demand_state(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void allowed_substate_regions(dcon::trigger_key value, error_handler &err, int32_t line, individual_cb_context &context)
void allowed_states(dcon::trigger_key value, error_handler &err, int32_t line, individual_cb_context &context)
void po_make_puppet(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void break_truce_prestige_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void truce_months(association_type, int32_t value, error_handler &err, int32_t line, individual_cb_context &context)
void crisis(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void po_destroy_forts(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void po_gunboat(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void po_install_communist_gov_type(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void po_remove_prestige(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void po_annex(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void on_add(dcon::effect_key value, error_handler &err, int32_t line, individual_cb_context &context)
void po_destroy_naval_bases(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void is_civil_war(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void construction_speed(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void good_relation_infamy_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void allowed_states_in_crisis(dcon::trigger_key value, error_handler &err, int32_t line, individual_cb_context &context)
void badboy_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void constructing_cb(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void po_transfer_provinces(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void all_allowed_states(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void sprite_index(association_type, int32_t value, error_handler &err, int32_t line, individual_cb_context &context)
void po_clear_union_sphere(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void po_disarmament(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void good_relation_militancy_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void po_remove_cores(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void penalty_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void tws_battle_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void po_reparations(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void always(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void allowed_countries(dcon::trigger_key value, error_handler &err, int32_t line, individual_cb_context &context)
void on_po_accepted(dcon::effect_key value, error_handler &err, int32_t line, individual_cb_context &context)
void finish(individual_cb_context &context)
void po_release_puppet(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void break_truce_militancy_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void peace_cost_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void prestige_factor(association_type, float value, error_handler &err, int32_t line, individual_cb_context &context)
void po_colony(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void is_triggered_only(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void war_name(association_type, std::string_view value, error_handler &err, int32_t line, individual_cb_context &context)
void po_add_to_sphere(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void po_uninstall_communist_gov_type(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void great_war_obligatory(association_type, bool value, error_handler &err, int32_t line, individual_cb_context &context)
void can_use(dcon::trigger_key value, error_handler &err, int32_t line, individual_cb_context &context)
void free_value(std::string_view text, error_handler &err, int32_t line, scenario_building_context &context)
scenario_building_context & outer_context
void free_value(int32_t value, error_handler &err, int32_t line, climate_building_context &context)
tagged_vector< float, dcon::commodity_id > data
void finish(scenario_building_context &context)
void any_value(std::string_view name, association_type, float value, error_handler &err, int32_t line, scenario_building_context &context)
scenario_building_context & outer_context
void free_value(int32_t value, error_handler &err, int32_t line, continent_building_context &context)
void free_value(int32_t value, error_handler &err, int32_t line, continent_building_context &context)
scenario_building_context & outer_context
void any_group(std::string_view name, color_from_3i, error_handler &err, int32_t line, country_file_context &context)
void template_(association_type, std::string_view value, error_handler &err, int32_t line, country_file_context &context)
void color(color_from_3i cvalue, error_handler &err, int32_t line, country_file_context &context)
dcon::national_identity_id nat_ident
scenario_building_context & outer_context
std::vector< std::pair< dcon::nation_id, dcon::decision_id > > & pending_decisions
void is_releasable_vassal(association_type, bool value, error_handler &err, int32_t line, country_history_context &context)
void ruling_party(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void prestige(association_type, float value, error_handler &err, int32_t line, country_history_context &context)
void govt_flag(govt_flag_block const &value, error_handler &err, int32_t line, country_history_context &context)
void remove_culture(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void decision(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void set_country_flag(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void non_state_culture_literacy(association_type, float value, error_handler &err, int32_t line, country_history_context &context)
void religion(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void literacy(association_type, float value, error_handler &err, int32_t line, country_history_context &context)
void any_value(std::string_view label, association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void civilized(association_type, bool value, error_handler &err, int32_t line, country_history_context &context)
void consciousness(association_type, float value, error_handler &err, int32_t line, country_history_context &context)
void set_global_flag(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void nationalvalue(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void plurality(association_type, float value, error_handler &err, int32_t line, country_history_context &context)
void culture(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void capital(association_type, int32_t value, error_handler &err, int32_t line, country_history_context &context)
void primary_culture(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void schools(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void government(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void nonstate_consciousness(association_type, float value, error_handler &err, int32_t line, country_history_context &context)
void colonial_points(association_type, int32_t value, error_handler &err, int32_t line, country_history_context &context)
scenario_building_context & outer_context
scenario_building_context & outer_context
void leader(association_type, std::string_view name, error_handler &err, int32_t line, culture_group_context &context)
void union_tag(association_type, uint32_t v, error_handler &err, int32_t line, culture_group_context &context)
void is_overseas(association_type, bool v, error_handler &err, int32_t line, culture_group_context &context)
void color(color_from_3i v, error_handler &err, int32_t line, culture_context &context)
void radicalism(association_type, int32_t v, error_handler &err, int32_t line, culture_context &context)
scenario_building_context & outer_context
void effect(dcon::effect_key value, error_handler &err, int32_t line, decision_context &context)
void ai_will_do(dcon::value_modifier_key value, error_handler &err, int32_t line, decision_context &context)
void potential(dcon::trigger_key value, error_handler &err, int32_t line, decision_context &context)
void finish(decision_context &)
void picture(association_type, std::string_view value, error_handler &err, int32_t line, decision_context &context)
void allow(dcon::trigger_key value, error_handler &err, int32_t line, decision_context &context)
scenario_building_context & outer_context
void any_value(std::string_view tag, association_type, float v, error_handler &err, int32_t line, country_history_context &context)
void option(sys::event_option const &value, error_handler &err, int32_t line, event_building_context &context)
void picture(association_type, std::string_view value, error_handler &err, int32_t line, event_building_context &context)
std::array< sys::event_option, sys::max_event_options > options
void title(association_type, std::string_view value, error_handler &err, int32_t line, event_building_context &context)
void desc(association_type, std::string_view value, error_handler &err, int32_t line, event_building_context &context)
void issue_group(association_type, std::string_view value, error_handler &err, int32_t line, event_building_context &context)
scenario_building_context & outer_context
void overseas_penalty(association_type, bool b, error_handler &err, int32_t line, good_context &context)
void available_from_start(association_type, bool b, error_handler &err, int32_t line, good_context &context)
void cost(association_type, float v, error_handler &err, int32_t line, good_context &context)
void finish(good_context &context)
void color(color_from_3i v, error_handler &err, int32_t line, good_context &context)
void money(association_type, bool v, error_handler &err, int32_t line, good_context &context)
scenario_building_context & outer_context
void duration(association_type, int32_t value, error_handler &err, int32_t line, government_type_context &context)
void any_value(std::string_view text, association_type, bool value, error_handler &err, int32_t line, government_type_context &context)
void appoint_ruling_party(association_type, bool value, error_handler &err, int32_t line, government_type_context &context)
void election(association_type, bool value, error_handler &err, int32_t line, government_type_context &context)
void flagtype(association_type, std::string_view value, error_handler &err, int32_t line, government_type_context &context)
void flag(association_type, std::string_view value, error_handler &err, int32_t line, country_history_context &context)
void country(association_type, std::string_view tag, error_handler &err, int32_t line, war_history_context &context)
void casus_belli(association_type, std::string_view value, error_handler &err, int32_t line, war_history_context &context)
void actor(association_type, std::string_view tag, error_handler &err, int32_t line, war_history_context &context)
void receiver(association_type, std::string_view tag, error_handler &err, int32_t line, war_history_context &context)
void state_province_id(association_type t, int32_t value, error_handler &err, int32_t line, war_history_context &context)
scenario_building_context & outer_context
void remove_social_reform(dcon::value_modifier_key value, error_handler &err, int32_t line, individual_ideology_context &context)
void color(color_from_3i cvalue, error_handler &err, int32_t line, individual_ideology_context &context)
void can_reduce_militancy(association_type, bool value, error_handler &err, int32_t line, individual_ideology_context &context)
void date(association_type, sys::year_month_day ymd, error_handler &err, int32_t line, individual_ideology_context &context)
void add_social_reform(dcon::value_modifier_key value, error_handler &err, int32_t line, individual_ideology_context &context)
void uncivilized(association_type, bool value, error_handler &err, int32_t line, individual_ideology_context &context)
void remove_political_reform(dcon::value_modifier_key value, error_handler &err, int32_t line, individual_ideology_context &context)
void add_military_reform(dcon::value_modifier_key value, error_handler &err, int32_t line, individual_ideology_context &context)
void civilized(association_type, bool value, error_handler &err, int32_t line, individual_ideology_context &context)
void finish(individual_ideology_context &)
void add_economic_reform(dcon::value_modifier_key value, error_handler &err, int32_t line, individual_ideology_context &context)
void add_political_reform(dcon::value_modifier_key value, error_handler &err, int32_t line, individual_ideology_context &context)
scenario_building_context & outer_context
scenario_building_context & outer_context
void plurality(association_type, float value, error_handler &err, int32_t line, invention_context &context)
void gas_attack(association_type, bool value, error_handler &err, int32_t line, invention_context &context)
void shared_prestige(association_type, float value, error_handler &err, int32_t line, invention_context &context)
void activate_unit(association_type, std::string_view value, error_handler &err, int32_t line, invention_context &context)
void activate_building(association_type, std::string_view value, error_handler &err, int32_t line, invention_context &context)
void gas_defence(association_type, bool value, error_handler &err, int32_t line, invention_context &context)
void any_group(std::string_view label, unit_modifier_body const &value, error_handler &err, int32_t line, invention_context &context)
void rebel_org_gain(inv_rebel_org_gain const &value, error_handler &err, int32_t line, invention_context &context)
void enable_crime(association_type, std::string_view value, error_handler &err, int32_t line, invention_context &context)
void any_value(std::string_view name, association_type, int32_t value, error_handler &err, int32_t line, invention_context &context)
void colonial_points(association_type, int32_t value, error_handler &err, int32_t line, invention_context &context)
void any_value(std::string_view label, association_type, float value, error_handler &err, int32_t line, invention_context &context)
void any_value(std::string_view label, association_type, float value, error_handler &err, int32_t line, invention_context &context)
void faction(association_type, std::string_view v, error_handler &err, int32_t line, invention_context &context)
void any_value(std::string_view label, association_type, float value, error_handler &err, int32_t line, invention_context &context)
void effect(inv_effect const &value, error_handler &err, int32_t line, invention_context &context)
void limit(dcon::trigger_key value, error_handler &err, int32_t line, invention_context &context)
void shared_prestige(association_type, float value, error_handler &err, int32_t line, invention_context &context)
void chance(dcon::value_modifier_key value, error_handler &err, int32_t line, invention_context &context)
scenario_building_context & outer_context
scenario_building_context & outer_context
void technology_cost(association_type, int32_t value, error_handler &err, int32_t line, individual_option_context &context)
void administrative_multiplier(association_type, float value, error_handler &err, int32_t line, individual_option_context &context)
void on_execute(on_execute_body const &value, error_handler &err, int32_t line, individual_option_context &context)
void war_exhaustion_effect(association_type, float value, error_handler &err, int32_t line, individual_option_context &context)
void is_jingoism(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void administrative(association_type, bool value, error_handler &err, int32_t line, issue_context &context)
void next_step_only(association_type, bool value, error_handler &err, int32_t line, issue_context &context)
std::vector< uint32_t > map_features
std::vector< uint32_t > header_features
std::vector< uint32_t > body_features
void body_feature(association_type, std::string_view value, error_handler &err, int32_t line, sys::state &)
void header_feature(association_type, std::string_view value, error_handler &err, int32_t line, sys::state &)
void map_feature(association_type, std::string_view value, error_handler &err, int32_t line, sys::state &)
void promotion_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, scenario_building_context &context)
void conversion_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, scenario_building_context &context)
void emigration_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, scenario_building_context &context)
void assimilation_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, scenario_building_context &context)
void demotion_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, scenario_building_context &context)
void migration_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, scenario_building_context &context)
void colonialmigration_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, scenario_building_context &context)
void path(association_type, std::string_view value, error_handler &err, int32_t line, mod_file_context &context)
void name(association_type, std::string_view value, error_handler &err, int32_t line, mod_file_context &context)
void replace_path(association_type, std::string_view value, error_handler &err, int32_t line, mod_file_context &context)
void add_to_file_system(simple_fs::file_system &fs)
void user_dir(association_type, std::string_view value, error_handler &err, int32_t line, mod_file_context &context)
std::vector< std::string > replace_paths
sys::provincial_modifier_definition constructed_definition_p
sys::national_modifier_definition constructed_definition_n
scenario_building_context & outer_context
void free_value(std::string_view text, error_handler &err, int32_t line, names_context &context)
scenario_building_context & outer_context
void has_flashpoint(association_type, bool value, error_handler &err, int32_t line, national_focus_context &context)
void flashpoint_tension(association_type, float value, error_handler &err, int32_t line, national_focus_context &context)
void railroads(association_type, float value, error_handler &err, int32_t line, national_focus_context &context)
void ideology(association_type, std::string_view value, error_handler &err, int32_t line, national_focus_context &context)
void limit(dcon::trigger_key value, error_handler &err, int32_t line, national_focus_context &context)
void any_value(std::string_view label, association_type, float value, error_handler &err, int32_t line, national_focus_context &context)
void loyalty_value(association_type, float value, error_handler &err, int32_t line, national_focus_context &context)
void location(association_type, int32_t value, error_handler &err, int32_t line, oob_file_army_context &context)
void name(association_type, std::string_view value, error_handler &err, int32_t line, oob_file_army_context &context)
void leader(oob_leader const &value, error_handler &err, int32_t line, oob_file_army_context &context)
scenario_building_context & outer_context
scenario_building_context & outer_context
scenario_building_context & outer_context
scenario_building_context & outer_context
scenario_building_context & outer_context
scenario_building_context & outer_context
void leader(oob_leader const &value, error_handler &err, int32_t line, oob_file_context &context)
void date(association_type, sys::year_month_day value, error_handler &err, int32_t line, oob_file_context &context)
void name(association_type, std::string_view value, error_handler &err, int32_t line, oob_file_context &context)
void leader(oob_leader const &value, error_handler &err, int32_t line, oob_file_navy_context &context)
void location(association_type, int32_t value, error_handler &err, int32_t line, oob_file_navy_context &context)
void name(association_type, std::string_view value, error_handler &err, int32_t line, oob_file_navy_context &context)
void type(association_type, std::string_view value, error_handler &err, int32_t line, oob_file_regiment_context &context)
void name(association_type, std::string_view value, error_handler &err, int32_t line, oob_file_regiment_context &context)
void home(association_type, int32_t value, error_handler &err, int32_t line, oob_file_regiment_context &context)
void value(association_type, int32_t v, error_handler &err, int32_t line, oob_file_relation_context &context)
void level(association_type, int32_t v, error_handler &err, int32_t line, oob_file_relation_context &context)
void truce_until(association_type, sys::year_month_day v, error_handler &err, int32_t line, oob_file_relation_context &context)
void influence_value(association_type, float v, error_handler &err, int32_t line, oob_file_relation_context &context)
void type(association_type, std::string_view value, error_handler &err, int32_t line, oob_file_ship_context &context)
void name(association_type, std::string_view value, error_handler &err, int32_t line, oob_file_ship_context &context)
void open_factory(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void primary_culture_voting(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void pop_open_factory(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void build_railway_invest(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void destroy_factory(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void delete_factory_if_no_input(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void build_university(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void open_factory_invest(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void rich_only(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void largest_share(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void can_subsidise(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void population_vote(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void factory_priority(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void pop_expand_factory(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void pop_build_factory_invest(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void expand_factory(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void can_invest_in_pop_projects(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void slavery_allowed(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void build_factory_invest(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void dhont(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void expand_factory_invest(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void build_railway(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void all_voting(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void same_as_ruling_party(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void pop_open_factory_invest(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void culture_voting(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void pop_build_factory(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void sainte_laque(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void allow_foreign_investment(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void pop_expand_factory_invest(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void build_factory(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void build_bank(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
void state_vote(association_type, bool value, error_handler &err, int32_t line, individual_option_context &context)
dcon::political_party_id id
scenario_building_context & outer_context
void name(association_type, std::string_view text, error_handler &err, int32_t line, party_context &context)
void any_value(std::string_view issue, association_type, std::string_view option, error_handler &err, int32_t line, party_context &context)
void end_date(association_type, sys::year_month_day ymd, error_handler &err, int32_t line, party_context &context)
void ideology(association_type, std::string_view text, error_handler &err, int32_t line, party_context &context)
void finish(party_context &context)
void start_date(association_type, sys::year_month_day ymd, error_handler &err, int32_t line, party_context &context)
void rebel_type(association_type, std::string_view value, error_handler &err, int32_t line, pop_history_province_context &context)
void religion(association_type, std::string_view value, error_handler &err, int32_t line, pop_history_province_context &context)
void culture(association_type, std::string_view value, error_handler &err, int32_t line, pop_history_province_context &context)
void any_group(std::string_view type, pop_history_definition const &def, error_handler &err, int32_t line, pop_history_province_context &context)
scenario_building_context & outer_context
void workplace_output(association_type, float value, error_handler &err, int32_t line, poptype_context &context)
void can_build(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void strata(association_type, std::string_view value, error_handler &err, int32_t line, poptype_context &context)
void can_reduce_consciousness(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void unemployment(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void research_points(association_type, float value, error_handler &err, int32_t line, poptype_context &context)
void allowed_to_vote(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void leadership(association_type, int32_t value, error_handler &err, int32_t line, poptype_context &context)
void state_capital_only(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void luxury_needs(commodity_array const &value, error_handler &err, int32_t line, poptype_context &context)
void tax_eff(association_type, float value, error_handler &err, int32_t line, poptype_context &context)
void sprite(association_type, int32_t value, error_handler &err, int32_t line, poptype_context &context)
void can_be_recruited(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void workplace_input(association_type, float value, error_handler &err, int32_t line, poptype_context &context)
void is_artisan(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void life_needs(commodity_array const &value, error_handler &err, int32_t line, poptype_context &context)
void equivalent(association_type, std::string_view value, error_handler &err, int32_t line, poptype_context &context)
void research_optimum(association_type, float value, error_handler &err, int32_t line, poptype_context &context)
void everyday_needs_income(income const &value, error_handler &err, int32_t line, poptype_context &context)
void administrative_efficiency(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void everyday_needs(commodity_array const &value, error_handler &err, int32_t line, poptype_context &context)
void is_slave(association_type, bool value, error_handler &err, int32_t line, poptype_context &context)
void luxury_needs_income(income const &value, error_handler &err, int32_t line, poptype_context &context)
void life_needs_income(income const &value, error_handler &err, int32_t line, poptype_context &context)
void color(color_from_3i cvalue, error_handler &err, int32_t line, poptype_context &context)
scenario_building_context & outer_context
void poptype(association_type, std::string_view v, error_handler &err, int32_t line, production_context &context)
void defection(association_type, std::string_view value, error_handler &err, int32_t line, rebel_context &context)
void demands_enforced_effect(dcon::effect_key value, error_handler &err, int32_t line, rebel_context &context)
void allow_all_ideologies(association_type, bool value, error_handler &err, int32_t line, rebel_context &context)
void defect_delay(association_type, int32_t value, error_handler &err, int32_t line, rebel_context &context)
void occupation_mult(association_type, float value, error_handler &err, int32_t line, rebel_context &context)
void allow_all_culture_groups(association_type, bool value, error_handler &err, int32_t line, rebel_context &context)
void demands_enforced_trigger(dcon::trigger_key value, error_handler &err, int32_t line, rebel_context &context)
void independence(association_type, std::string_view value, error_handler &err, int32_t line, rebel_context &context)
void area(association_type, std::string_view value, error_handler &err, int32_t line, rebel_context &context)
void break_alliance_on_win(association_type, bool value, error_handler &err, int32_t line, rebel_context &context)
void siege_won_trigger(dcon::trigger_key value, error_handler &err, int32_t line, rebel_context &context)
void icon(association_type, int32_t value, error_handler &err, int32_t line, rebel_context &context)
void spawn_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, rebel_context &context)
void allow_all_cultures(association_type, bool value, error_handler &err, int32_t line, rebel_context &context)
void siege_won_effect(dcon::effect_key value, error_handler &err, int32_t line, rebel_context &context)
void will_rise(dcon::value_modifier_key value, error_handler &err, int32_t line, rebel_context &context)
void movement_evaluation(dcon::value_modifier_key value, error_handler &err, int32_t line, rebel_context &context)
void ideology(association_type, std::string_view value, error_handler &err, int32_t line, rebel_context &context)
scenario_building_context & outer_context
void any_value(std::string_view from_gov, association_type, std::string_view to_gov, error_handler &err, int32_t line, rebel_context &context)
scenario_building_context & outer_context
scenario_building_context & outer_context
void pagan(association_type, bool v, error_handler &err, int32_t line, religion_context &context)
void color(color_from_3f v, error_handler &err, int32_t line, religion_context &context)
void icon(association_type, int32_t v, error_handler &err, int32_t line, religion_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
void any_value(std::string_view chance, association_type, int32_t event, error_handler &err, int32_t line, scenario_building_context &context)
ankerl::unordered_dense::map< std::string, dcon::unit_type_id > map_of_unit_types
ankerl::unordered_dense::map< std::string, dcon::national_flag_id > map_of_national_flags
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< std::string, dcon::religion_id > map_of_religion_names
ankerl::unordered_dense::map< std::string, pending_invention_content > map_of_inventions
ankerl::unordered_dense::map< std::string, pending_roption_content > map_of_roptions
ankerl::unordered_dense::map< std::string, pending_tech_content > map_of_technologies
ankerl::unordered_dense::map< std::string, dcon::pop_type_id > map_of_poptypes
ankerl::unordered_dense::map< int32_t, pending_nat_event > map_of_national_events
ankerl::unordered_dense::map< std::string, pending_ideology_content > map_of_ideologies
ankerl::unordered_dense::map< std::string, dcon::reform_id > map_of_reforms
std::vector< dcon::province_id > original_id_to_prov_id_map
tagged_vector< province_data, dcon::province_id > prov_id_to_original_id_map
ankerl::unordered_dense::map< std::string, dcon::issue_id > map_of_iissues
ankerl::unordered_dense::map< std::string, pending_crime_content > map_of_crimes
ankerl::unordered_dense::map< std::string, pending_option_content > map_of_ioptions
ankerl::unordered_dense::map< std::string, pending_cb_content > map_of_cb_types
ankerl::unordered_dense::map< std::string, pending_rebel_type_content > map_of_rebeltypes
ankerl::unordered_dense::map< int32_t, pending_prov_event > map_of_provincial_events
ankerl::unordered_dense::map< std::string, int32_t > map_of_tech_folders
ankerl::unordered_dense::map< std::string, dcon::leader_images_id > map_of_leader_graphics
ankerl::unordered_dense::map< uint32_t, dcon::national_identity_id > map_of_ident_names
ankerl::unordered_dense::map< std::string, dcon::culture_id > map_of_culture_names
ankerl::unordered_dense::map< std::string, dcon::commodity_id > map_of_commodity_names
ankerl::unordered_dense::map< std::string, dcon::government_type_id > map_of_governments
ankerl::unordered_dense::map< std::string, dcon::factory_type_id > map_of_factory_names
void free_value(int32_t value, error_handler &err, int32_t line, scenario_building_context &context)
scenario_building_context & outer_context
std::vector< dcon::province_id > provinces
void free_value(int32_t value, error_handler &err, int32_t line, state_def_building_context &context)
scenario_building_context & outer_context
void any_value(std::string_view label, association_type, float value, error_handler &err, int32_t line, tech_context &context)
void free_value(std::string_view name, error_handler &err, int32_t line, tech_group_context &context)
::culture::tech_category category
scenario_building_context & outer_context
void any_value(std::string_view label, association_type, float value, error_handler &err, int32_t line, tech_context &context)
void any_value(std::string_view label, association_type, float value, error_handler &err, int32_t line, tech_context &context)
void activate_unit(association_type, std::string_view value, error_handler &err, int32_t line, tech_context &context)
void area(association_type, std::string_view value, error_handler &err, int32_t line, tech_context &context)
void ai_chance(dcon::value_modifier_key value, error_handler &err, int32_t line, tech_context &context)
void any_value(std::string_view name, association_type, int32_t value, error_handler &err, int32_t line, tech_context &context)
void year(association_type, int32_t value, error_handler &err, int32_t line, tech_context &context)
void plurality(association_type, float value, error_handler &err, int32_t line, tech_context &context)
void activate_building(association_type, std::string_view value, error_handler &err, int32_t line, tech_context &context)
void any_group(std::string_view label, unit_modifier_body const &value, error_handler &err, int32_t line, tech_context &context)
void colonial_points(association_type, int32_t value, error_handler &err, int32_t line, tech_context &context)
void cost(association_type, int32_t value, error_handler &err, int32_t line, tech_context &context)
scenario_building_context & outer_context
void experience(association_type, float value, error_handler &err, int32_t line, trait_context &context)
void attack(association_type, float value, error_handler &err, int32_t line, trait_context &context)
void defence(association_type, float value, error_handler &err, int32_t line, trait_context &context)
void organisation(association_type, float value, error_handler &err, int32_t line, trait_context &context)
void reconnaissance(association_type, float value, error_handler &err, int32_t line, trait_context &context)
void morale(association_type, float value, error_handler &err, int32_t line, trait_context &context)
void speed(association_type, float value, error_handler &err, int32_t line, trait_context &context)
void reliability(association_type, float value, error_handler &err, int32_t line, trait_context &context)
void finish(scenario_building_context &)
dcon::national_identity_id id
scenario_building_context & outer_context
void free_value(std::string_view text, error_handler &err, int32_t line, unit_names_context &context)
void any_value(std::string_view value, association_type, float v, error_handler &err, int32_t line, country_history_context &context)
void first(association_type, std::string_view tag, error_handler &err, int32_t line, scenario_building_context &context)
void start_date(association_type, sys::year_month_day ymd, error_handler &err, int32_t line, scenario_building_context &context)
void end_date(association_type, sys::year_month_day ymd, error_handler &err, int32_t line, scenario_building_context &context)
void second(association_type, std::string_view tag, error_handler &err, int32_t line, scenario_building_context &context)
void world_war(association_type, bool v, error_handler &err, int32_t line, war_history_context &context)
void rem_attacker(association_type, std::string_view tag, error_handler &err, int32_t line, war_history_context &context)
void add_defender(association_type, std::string_view tag, error_handler &err, int32_t line, war_history_context &context)
void rem_defender(association_type, std::string_view tag, error_handler &err, int32_t line, war_history_context &context)
void add_attacker(association_type, std::string_view tag, error_handler &err, int32_t line, war_history_context &context)
scenario_building_context & outer_context
std::vector< dcon::nation_id > defenders
std::vector< dcon::nation_id > attackers
std::vector< history_war_goal > wargoals
void name(association_type, std::string_view name, error_handler &err, int32_t line, war_history_context &context)
void finish(war_history_context &)
float values[modifier_definition_size]
Definition: modifiers.hpp:233
dcon::national_modifier_value offsets[modifier_definition_size]
Definition: modifiers.hpp:234
static constexpr uint32_t modifier_definition_size
Definition: modifiers.hpp:231
float values[modifier_definition_size]
Definition: modifiers.hpp:221
static constexpr uint32_t modifier_definition_size
Definition: modifiers.hpp:219
dcon::provincial_modifier_value offsets[modifier_definition_size]
Definition: modifiers.hpp:222
culture::global_cultural_state culture_definitions
dcon::text_key add_key_win1252(std::string const &text)
dcon::data_container world
simple_fs::file_system common_fs
absolute_time_point start_date
military::global_military_state military_definitions
sys::date current_date
dcon::unit_name_id add_unit_name(std::string_view text)
dcon::text_key lookup_key(std::string_view text) const
dcon::text_key add_key_utf8(std::string const &text)
ui::definitions ui_defs
nations::global_national_state national_definitions
dcon::texture_id primary_texture_handle
uint8_t number_of_frames