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