47 if(!state.current_scene.game_in_progress)
49 state.network_state.is_new_game =
false;
53 switch(state.network_mode) {
56 bool b = state.incoming_commands.try_push(p);
64 state.network_state.outgoing_commands.push(p);
84 if(state.world.province_get_nation_from_province_ownership(location) != source)
87 if(state.world.province_get_is_coast(location))
88 state.world.province_set_naval_rally_point(location, enable);
90 state.world.province_set_land_rally_point(location, enable);
112 dcon::national_focus_id focus) {
114 memset(&p, 0,
sizeof(
payload));
123 dcon::national_focus_id focus) {
129 auto state_owner = state.world.state_instance_get_nation_from_state_ownership(target_state);
131 if(state_owner == source) {
132 if(focus == state.national_definitions.flashpoint_focus)
134 if(
auto ideo = state.world.national_focus_get_ideology(focus); ideo) {
135 if(state.world.ideology_get_enabled(ideo) ==
false ||
136 (state.world.ideology_get_is_civilized_only(ideo) && !state.world.nation_get_is_civilized(source))) {
140 auto prov = state.world.state_instance_get_capital(target_state);
141 auto k = state.world.national_focus_get_limit(focus);
144 return num_focuses_set < num_focuses_total || bool(state.world.state_instance_get_owner_focus(target_state));
145 }
else if (focus == state.national_definitions.flashpoint_focus) {
146 auto pc = state.world.nation_get_primary_culture(source);
150 auto ident = state.world.nation_get_identity_from_identity_holder(source);
151 if(state.world.national_identity_get_is_not_releasable(
ident))
154 bool state_contains_core =
false;
156 state_contains_core = state_contains_core || bool(state.world.get_core_by_prov_tag_key(p,
ident));
158 bool rank_high = state.world.nation_get_rank(source) > uint16_t(state.defines.colonial_rank);
159 return state_contains_core && rank_high &&
160 (num_focuses_set < num_focuses_total || bool(state.world.nation_get_state_from_flashpoint_focus(source))) &&
161 bool(state.world.state_instance_get_nation_from_flashpoint_focus(target_state)) ==
false;
169 if(state.world.state_instance_get_nation_from_state_ownership(target_state) == source) {
170 state.world.state_instance_set_owner_focus(target_state, focus);
173 state.world.nation_set_state_from_flashpoint_focus(source, target_state);
175 state.world.nation_set_state_from_flashpoint_focus(source, dcon::state_instance_id{});
181 memset(&p, 0,
sizeof(
payload));
194 if(state.world.nation_get_active_technologies(source, tech))
198 if(!state.world.nation_get_is_civilized(source))
200 if(state.current_date.to_ymd(state.start_date).year >= state.world.technology_get_year(tech)) {
202 dcon::technology_id prev_tech = dcon::technology_id(dcon::technology_id::value_base_t(tech.index() - 1));
204 if(tech.index() != 0 && state.world.technology_get_folder_index(prev_tech) == state.world.technology_get_folder_index(tech)) {
206 return state.world.nation_get_active_technologies(source, prev_tech);
214 if(state.world.nation_get_current_research(source))
215 state.world.nation_set_research_points(source, 0.0f);
216 state.world.nation_set_current_research(source, tech);
221 memset(&p, 0,
sizeof(
payload));
228 return state.world.nation_get_leadership_points(source) >= state.defines.leader_recruit_cost;
236 memset(&p, 0,
sizeof(
payload));
244 return (value >= 0.f);
247 state.world.nation_set_factory_type_experience_priority_national(source, ftid, value);
253 memset(&p, 0,
sizeof(
payload));
268 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(target, source);
269 if(rel && state.world.unilateral_relationship_get_war_subsidies(rel))
272 if(state.world.nation_get_is_player_controlled(source))
273 return state.world.nation_get_diplomatic_points(source) >= state.defines.warsubsidy_diplomatic_cost;
278 state.world.nation_get_diplomatic_points(source) -= state.defines.warsubsidy_diplomatic_cost;
279 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(target, source);
281 rel = state.world.force_create_unilateral_relationship(target, source);
283 state.world.unilateral_relationship_set_war_subsidies(rel,
true);
289 "msg_wsub_start_title",
290 source, target, dcon::nation_id{},
298 memset(&p, 0,
sizeof(
payload));
311 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(target, source);
312 if(rel && !state.world.unilateral_relationship_get_war_subsidies(rel))
314 if(state.world.nation_get_is_player_controlled(source))
315 return state.world.nation_get_diplomatic_points(source) >= state.defines.cancelwarsubsidy_diplomatic_cost;
320 state.world.nation_get_diplomatic_points(source) -= state.defines.cancelwarsubsidy_diplomatic_cost;
321 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(target, source);
323 state.world.unilateral_relationship_set_war_subsidies(rel,
false);
325 if(source != state.local_player_nation) {
330 "msg_wsub_end_title",
331 source, target, dcon::nation_id{},
340 memset(&p, 0,
sizeof(
payload));
356 auto rel = state.world.get_diplomatic_relation_by_diplomatic_pair(source, target);
357 if(state.world.diplomatic_relation_get_value(rel) >= 200.f)
360 if(state.world.nation_get_is_player_controlled(source))
361 return state.world.nation_get_diplomatic_points(source) >= state.defines.increaserelation_diplomatic_cost;
366 state.world.nation_get_diplomatic_points(source) -= state.defines.increaserelation_diplomatic_cost;
373 source, target, dcon::nation_id{},
380 memset(&p, 0,
sizeof(
payload));
393 auto rel = state.world.get_diplomatic_relation_by_diplomatic_pair(source, target);
394 if(rel && state.world.diplomatic_relation_get_value(rel) <= -200.f)
396 if(state.world.nation_get_is_player_controlled(source))
397 return state.world.nation_get_diplomatic_points(source) >= state.defines.decreaserelation_diplomatic_cost;
402 state.world.nation_get_diplomatic_points(source) -= state.defines.decreaserelation_diplomatic_cost;
409 source, target, dcon::nation_id{},
416 memset(&p, 0,
sizeof(
payload));
441 auto si = state.world.province_get_state_membership(p);
443 si.set_naval_base_is_taken(
true);
448 auto& base_cost = state.economy_definitions.building_definitions[int32_t(type)].cost;
450 if(base_cost.commodity_type[j]) {
451 amount += base_cost.commodity_amounts[j] * state.world.commodity_get_cost(base_cost.commodity_type[j]);
459 auto new_rr = fatten(state.world, state.world.force_create_province_building_construction(p, source));
460 new_rr.set_is_pop_project(
false);
461 new_rr.set_type(
uint8_t(type));
467 memset(&p, 0,
sizeof(
payload));
475 auto owner = state.world.state_instance_get_nation_from_state_ownership(location);
476 for(
auto c : state.world.state_instance_get_state_building_construction(location)) {
477 if(c.get_type() == type) {
478 if(c.get_is_pop_project())
480 if(c.get_nation() != source)
488 auto owner = state.world.state_instance_get_nation_from_state_ownership(location);
489 for(
auto c : state.world.state_instance_get_state_building_construction(location)) {
490 if(c.get_type() == type) {
491 if(c.get_is_pop_project())
493 if(c.get_nation() != source)
496 state.world.delete_state_building_construction(c);
503 memset(&p, 0,
sizeof(
payload));
514 auto owner = state.world.state_instance_get_nation_from_state_ownership(location);
521 if(state.world.nation_get_active_building(source, type) ==
false && !state.world.factory_type_get_is_available_from_start(type))
523 if(state.world.province_get_is_colonial(state.world.state_instance_get_capital(location)))
529 bool has_dup =
false;
535 auto d = state.world.state_instance_get_definition(location);
536 for(
auto p : state.world.state_definition_get_abstract_state_membership(d))
537 if(p.get_province().get_nation_from_province_ownership() == owner)
538 for(
auto f : p.get_province().get_factory_location())
539 if(f.get_factory().get_building_type() == type)
543 if(state.world.nation_get_is_civilized(source) ==
false)
547 if(owner != source) {
554 auto rel = state.world.nation_get_overlord_as_subject(owner);
555 auto overlord = state.world.overlord_get_ruler(rel);
556 if(overlord != source) {
557 if(state.world.nation_get_is_great_power(source) ==
false || state.world.nation_get_is_great_power(owner) ==
true)
559 auto rules = state.world.nation_get_combined_issue_rules(owner);
563 if(state.world.nation_get_is_civilized(owner) ==
false)
573 auto rules = state.world.nation_get_combined_issue_rules(owner);
585 for(
auto p : state.world.state_instance_get_state_building_construction(location)) {
586 if(p.get_type() == type)
592 auto d = state.world.state_instance_get_definition(location);
593 for(
auto p : state.world.state_definition_get_abstract_state_membership(d)) {
594 if(p.get_province().get_nation_from_province_ownership() == owner) {
595 for(
auto f : p.get_province().get_factory_location()) {
596 if(f.get_factory().get_building_type() == type && f.get_factory().get_level() <
uint8_t(255)) {
605 if(state.world.factory_type_get_is_coastal(type)) {
611 return num_factories < int32_t(state.defines.factories_per_state);
616 auto new_up = fatten(state.world, state.world.force_create_state_building_construction(location, source));
617 new_up.set_is_pop_project(
false);
618 new_up.set_is_upgrade(is_upgrade);
619 new_up.set_type(type);
621 if(source != state.world.state_instance_get_nation_from_state_ownership(location)) {
623 auto& base_cost = state.world.factory_type_get_construction_costs(type);
625 if(base_cost.commodity_type[j]) {
626 amount += base_cost.commodity_amounts[j] * state.world.commodity_get_cost(base_cost.commodity_type[j]);
637 memset(&p, 0,
sizeof(
payload));
652 if(state.world.province_get_nation_from_province_ownership(location) != source)
654 if(state.world.province_get_nation_from_province_control(location) != source)
656 if(state.world.nation_get_active_unit(source, type) ==
false &&
657 state.military_definitions.unit_base_definitions[type].active ==
false)
659 auto disarm = state.world.nation_get_disarmed_until(source);
660 if(disarm && state.current_date < disarm)
663 if(state.military_definitions.unit_base_definitions[type].is_land) {
672 if(!state.world.province_get_is_coast(location))
675 auto overseas_allowed = state.military_definitions.unit_base_definitions[type].can_build_overseas;
676 auto level_req = state.military_definitions.unit_base_definitions[type].min_port_level;
689 auto c = fatten(state.world, state.world.try_create_province_naval_construction(location, source));
691 c.set_template_province(template_province);
694void start_land_unit_construction(
sys::state& state, dcon::nation_id source, dcon::province_id location, dcon::culture_id soldier_culture, dcon::unit_type_id type, dcon::province_id template_province) {
696 memset(&p, 0,
sizeof(
payload));
711 if(state.world.province_get_nation_from_province_ownership(location) != source)
713 if(state.world.province_get_nation_from_province_control(location) != source)
715 if(state.world.nation_get_active_unit(source, type) ==
false &&
716 state.military_definitions.unit_base_definitions[type].active ==
false)
718 if(state.military_definitions.unit_base_definitions[type].primary_culture && soldier_culture != state.world.nation_get_primary_culture(source) && state.world.nation_get_accepted_cultures(source, soldier_culture) ==
false) {
721 auto disarm = state.world.nation_get_disarmed_until(source);
722 if(disarm && state.current_date < disarm)
725 if(state.military_definitions.unit_base_definitions[type].is_land) {
731 return bool(soldier);
739 auto c = fatten(state.world, state.world.try_create_province_land_construction(soldier, source));
741 c.set_template_province(template_province);
746 memset(&p, 0,
sizeof(
payload));
755 return state.world.province_get_nation_from_province_ownership(location) == source;
759 dcon::province_naval_construction_id c;
760 for(
auto lc : state.world.province_get_province_naval_construction(location)) {
761 if(lc.get_type() == type) {
765 state.world.delete_province_naval_construction(c);
770 memset(&p, 0,
sizeof(
payload));
779 return state.world.province_get_nation_from_province_ownership(location) == source;
782 dcon::province_land_construction_id c;
783 for(
auto pop : state.world.province_get_pop_location(location)) {
784 for(
auto lc : pop.get_pop().get_province_land_construction()) {
785 if(lc.get_type() == type) {
790 state.world.delete_province_land_construction(c);
795 memset(&p, 0,
sizeof(
payload));
803 auto loc = state.world.factory_get_province_from_factory_location(f);
804 if(state.world.province_get_nation_from_province_ownership(loc) != source)
806 auto rules = state.world.nation_get_combined_issue_rules(source);
812 if(state.world.province_get_nation_from_province_ownership(location) != source)
815 auto rules = state.world.nation_get_combined_issue_rules(source);
819 for(
auto sc : state.world.state_instance_get_state_building_construction(state.world.province_get_state_membership(location))) {
820 if(sc.get_type() == type) {
821 state.world.delete_state_building_construction(sc);
826 for(
auto f : state.world.province_get_factory_location(location)) {
827 if(f.get_factory().get_building_type() == type) {
828 state.world.delete_factory(f.get_factory());
836 memset(&p, 0,
sizeof(
payload));
846 auto loc = state.world.factory_get_province_from_factory_location(f);
847 if(state.world.province_get_nation_from_province_ownership(loc) != source)
850 auto rules = state.world.nation_get_combined_issue_rules(source);
856 if(current_priority != priority) {
869 if(state.world.province_get_nation_from_province_ownership(location) != source)
872 auto rules = state.world.nation_get_combined_issue_rules(source);
878 for(
auto f : state.world.province_get_factory_location(location)) {
879 if(f.get_factory().get_building_type() == type) {
881 if(current_priority != priority) {
886 if(subsidized && !f.get_factory().get_subsidized()) {
887 auto& scale = f.get_factory().get_primary_employment();
888 scale = std::max(scale, 0.5f);
890 f.get_factory().set_subsidized(subsidized);
898 memset(&p, 0,
sizeof(
payload));
909 auto holder = state.world.national_identity_get_nation_from_identity_holder(t);
910 state.world.force_create_overlord(holder, source);
911 if(state.world.nation_get_is_great_power(source)) {
912 auto sr = state.world.force_create_gp_relationship(holder, source);
913 auto& flags = state.world.gp_relationship_get_status(sr);
915 state.world.nation_set_in_sphere_of(holder, source);
918 auto& inf = state.world.nation_get_infamy(source);
919 inf = std::max(0.0f, inf + state.defines.release_nation_infamy);
925 memset(&p, 0,
sizeof(
payload));
936 auto holder = state.world.national_identity_get_nation_from_identity_holder(t);
939 if(state.world.nation_get_is_player_controlled(source)) {
941 }
else if(state.world.nation_get_is_player_controlled(holder)) {
945 auto old_controller = state.world.nation_get_is_player_controlled(holder);
946 state.world.nation_set_is_player_controlled(holder, state.world.nation_get_is_player_controlled(source));
947 state.world.nation_set_is_player_controlled(source, old_controller);
949 if(state.world.nation_get_is_player_controlled(holder))
951 if(state.world.nation_get_is_player_controlled(source))
954 if(state.local_player_nation == source) {
955 state.local_player_nation = holder;
956 }
else if(state.local_player_nation == holder) {
957 state.local_player_nation = source;
961 for(
auto p : state.world.nation_get_province_ownership(holder)) {
962 auto pid = p.get_province();
963 state.world.province_set_is_colonial(pid,
false);
973 memset(&p, 0,
sizeof(
payload));
981 state.world.nation_set_administrative_spending(source, std::clamp(values.
administrative_spending, int8_t(0), int8_t(100)));
984 state.world.nation_set_construction_spending(source, std::clamp(values.
construction_spending, int8_t(0), int8_t(100)));
987 state.world.nation_set_education_spending(source, std::clamp(values.
education_spending, int8_t(0), int8_t(100)));
990 state.world.nation_set_land_spending(source, std::clamp(values.
land_spending, int8_t(0), int8_t(100)));
993 state.world.nation_set_middle_tax(source, std::clamp(values.
middle_tax, int8_t(0), int8_t(100)));
995 if(values.
poor_tax != int8_t(-127)) {
996 state.world.nation_set_poor_tax(source, std::clamp(values.
poor_tax, int8_t(0), int8_t(100)));
998 if(values.
rich_tax != int8_t(-127)) {
999 state.world.nation_set_rich_tax(source, std::clamp(values.
rich_tax, int8_t(0), int8_t(100)));
1002 state.world.nation_set_military_spending(source, std::clamp(values.
military_spending, int8_t(0), int8_t(100)));
1005 state.world.nation_set_naval_spending(source, std::clamp(values.
naval_spending, int8_t(0), int8_t(100)));
1008 state.world.nation_set_social_spending(source, std::clamp(values.
social_spending, int8_t(0), int8_t(100)));
1011 state.world.nation_set_tariffs_import(source, std::clamp(values.
tariffs_import, int8_t(-100), int8_t(100)));
1014 state.world.nation_set_tariffs_export(source, std::clamp(values.
tariffs_export, int8_t(-100), int8_t(100)));
1017 state.world.nation_set_domestic_investment_spending(source, std::clamp(values.
domestic_investment, int8_t(0), int8_t(100)));
1019 if(values.
overseas != int8_t(-127)) {
1020 state.world.nation_set_overseas_spending(source, std::clamp(values.
overseas, int8_t(0), int8_t(100)));
1027 memset(&p, 0,
sizeof(
payload));
1033 auto type = state.world.nation_get_government_type(source);
1042 memset(&p, 0,
sizeof(
payload));
1051 return state.world.nation_get_is_great_power(source) && !state.world.nation_get_is_great_power(influence_target);
1054 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1056 rel = state.world.force_create_gp_relationship(influence_target, source);
1058 auto& flags = state.world.gp_relationship_get_status(rel);
1079 memset(&p, 0,
sizeof(
payload));
1094 if(!state.world.nation_get_is_great_power(source) || !state.world.nation_get_is_great_power(affected_gp) ||
1095 state.world.nation_get_is_great_power(influence_target))
1098 if(source == affected_gp)
1101 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1105 if(state.world.gp_relationship_get_influence(rel) < state.defines.discredit_influence_cost)
1118 auto orel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, affected_gp);
1131 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1132 auto orel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, affected_gp);
1134 orel = state.world.force_create_gp_relationship(influence_target, affected_gp);
1136 state.world.gp_relationship_get_influence(rel) -= state.defines.discredit_influence_cost;
1139 state.world.gp_relationship_set_penalty_expires_date(orel, state.current_date + int32_t(state.defines.discredit_days));
1142 [source, influence_target, affected_gp, enddate = state.current_date + int32_t(state.defines.discredit_days)](
sys::state& state,
text::layout_base& contents) {
1146 "msg_discredit_title",
1147 source, affected_gp, influence_target,
1154 memset(&p, 0,
sizeof(
payload));
1168 if(!state.world.nation_get_is_great_power(source) || !state.world.nation_get_is_great_power(affected_gp) ||
1169 state.world.nation_get_is_great_power(influence_target))
1172 if(source == affected_gp)
1175 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1179 if(state.world.gp_relationship_get_influence(rel) < state.defines.expeladvisors_influence_cost)
1201 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1202 auto orel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, affected_gp);
1204 state.world.gp_relationship_get_influence(rel) -= state.defines.expeladvisors_influence_cost;
1208 state.world.gp_relationship_set_influence(orel, 0.0f);
1209 state.world.gp_relationship_get_status(orel) &=
~nations::influence::is_discredited;
1217 source, affected_gp, influence_target,
1222void ban_embassy(
sys::state& state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp) {
1224 memset(&p, 0,
sizeof(
payload));
1239 if(!state.world.nation_get_is_great_power(source) || !state.world.nation_get_is_great_power(affected_gp) ||
1240 state.world.nation_get_is_great_power(influence_target))
1243 if(source == affected_gp)
1246 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1250 if(state.world.gp_relationship_get_influence(rel) < state.defines.banembassy_influence_cost)
1272 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1273 auto orel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, affected_gp);
1275 orel = state.world.force_create_gp_relationship(influence_target, affected_gp);
1277 state.world.gp_relationship_get_influence(rel) -= state.defines.banembassy_influence_cost;
1280 state.world.gp_relationship_set_influence(orel, 0.0f);
1281 state.world.gp_relationship_set_penalty_expires_date(orel, state.current_date + int32_t(state.defines.banembassy_days));
1284 [source, influence_target, affected_gp, enddate = state.current_date + int32_t(state.defines.banembassy_days)](
sys::state& state,
text::layout_base& contents) {
1289 source, affected_gp, influence_target,
1296 memset(&p, 0,
sizeof(
payload));
1308 if(!state.world.nation_get_is_great_power(source) || state.world.nation_get_is_great_power(influence_target))
1311 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1315 if(state.world.gp_relationship_get_influence(rel) < state.defines.increaseopinion_influence_cost)
1335 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1337 state.world.gp_relationship_get_influence(rel) -= state.defines.increaseopinion_influence_cost;
1338 auto& l = state.world.gp_relationship_get_status(rel);
1346 source, influence_target, dcon::nation_id{},
1353 memset(&p, 0,
sizeof(
payload));
1369 if(!state.world.nation_get_is_great_power(source) || !state.world.nation_get_is_great_power(affected_gp) ||
1370 state.world.nation_get_is_great_power(influence_target))
1373 if(source == affected_gp)
1376 if(state.world.nation_get_in_sphere_of(influence_target) == affected_gp)
1379 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1383 if(state.world.gp_relationship_get_influence(rel) < state.defines.decreaseopinion_influence_cost)
1397 state.world.gp_relationship_get_status(state.world.get_gp_relationship_by_gp_influence_pair(influence_target,
1410 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1411 auto orel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, affected_gp);
1413 orel = state.world.force_create_gp_relationship(influence_target, affected_gp);
1415 state.world.gp_relationship_get_influence(rel) -= state.defines.decreaseopinion_influence_cost;
1418 auto& l = state.world.gp_relationship_get_status(orel);
1426 source, affected_gp, influence_target,
1433 memset(&p, 0,
sizeof(
payload));
1446 if(!state.world.nation_get_is_great_power(source) || state.world.nation_get_is_great_power(influence_target))
1449 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1453 if(state.world.gp_relationship_get_influence(rel) < state.defines.addtosphere_influence_cost)
1466 if(state.world.nation_get_in_sphere_of(influence_target))
1472 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1474 state.world.gp_relationship_get_influence(rel) -= state.defines.addtosphere_influence_cost;
1475 auto& l = state.world.gp_relationship_get_status(rel);
1478 state.world.nation_set_in_sphere_of(influence_target, source);
1484 "msg_add_sphere_title",
1485 source, influence_target, dcon::nation_id{},
1492 memset(&p, 0,
sizeof(
payload));
1506 if(!state.world.nation_get_is_great_power(source) || !state.world.nation_get_is_great_power(affected_gp) ||
1507 state.world.nation_get_is_great_power(influence_target))
1510 if(state.world.nation_get_in_sphere_of(influence_target) != affected_gp)
1513 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1517 if(source != affected_gp && state.world.gp_relationship_get_influence(rel) < state.defines.removefromsphere_influence_cost)
1539 auto rel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, source);
1541 state.world.nation_set_in_sphere_of(influence_target, dcon::nation_id{});
1543 auto orel = state.world.get_gp_relationship_by_gp_influence_pair(influence_target, affected_gp);
1544 auto& l = state.world.gp_relationship_get_status(orel);
1547 if(source != affected_gp) {
1548 state.world.gp_relationship_get_influence(rel) -= state.defines.removefromsphere_influence_cost;
1551 state.world.nation_get_infamy(source) += state.defines.removefromsphere_infamy_cost;
1557 if(source == affected_gp)
1562 "msg_rem_sphere_title",
1563 source, affected_gp, influence_target,
1570 memset(&p, 0,
sizeof(
payload));
1585 memset(&p, 0,
sizeof(
payload));
1592 auto state_def = state.world.province_get_state_from_abstract_state_membership(p);
1599 auto state_def = state.world.province_get_state_from_abstract_state_membership(pr);
1603 bool adjacent = [&]() {
1604 for(
auto p : state.world.state_definition_get_abstract_state_membership(state_def)) {
1605 if(!p.get_province().get_nation_from_province_ownership()) {
1606 for(
auto adj : p.get_province().get_province_adjacency()) {
1607 auto indx = adj.get_connected_provinces(0) != p.get_province() ? 0 : 1;
1608 auto o = adj.get_connected_provinces(indx).get_nation_from_province_ownership();
1611 if(o.get_overlord_as_subject().get_ruler() == source)
1619 auto new_rel = fatten(state.world, state.world.force_create_colonization(state_def, source));
1620 new_rel.set_level(
uint8_t(1));
1621 new_rel.set_last_investment(state.current_date);
1622 new_rel.set_points_invested(uint16_t(state.defines.colonization_interest_cost_initial + (adjacent ? state.defines.colonization_interest_cost_neighbor_modifier : 0.0f)));
1624 state.world.state_definition_set_colonization_stage(state_def,
uint8_t(1));
1630 memset(&p, 0,
sizeof(
payload));
1638 auto state_def = state.world.province_get_state_from_abstract_state_membership(pr);
1643 auto state_def = state.world.province_get_state_from_abstract_state_membership(p);
1645 for(
auto rel : state.world.state_definition_get_colonization(state_def)) {
1646 if(rel.get_colonizer() == source) {
1647 state.world.delete_colonization(rel);
1654 memset(&p, 0,
sizeof(
payload));
1661 auto state_def = state.world.province_get_state_from_abstract_state_membership(p);
1662 if(state.world.state_definition_get_colonization_stage(state_def) != 3)
1664 auto rng = state.world.state_definition_get_colonization(state_def);
1665 if(
rng.begin() ==
rng.end())
1667 return (*
rng.begin()).get_colonizer() == source;
1670 auto state_def = state.world.province_get_state_from_abstract_state_membership(p);
1672 for(
auto pr : state.world.state_definition_get_abstract_state_membership(state_def)) {
1673 if(!pr.get_province().get_nation_from_province_ownership()) {
1678 state.world.state_definition_set_colonization_temperature(state_def, 0.0f);
1679 state.world.state_definition_set_colonization_stage(state_def,
uint8_t(0));
1681 auto rng = state.world.state_definition_get_colonization(state_def);
1683 while(
rng.begin() !=
rng.end()) {
1684 state.world.delete_colonization(*
rng.begin());
1690 memset(&p, 0,
sizeof(
payload));
1706 if(state.current_date < state.world.war_get_start_date(w) + int32_t(30.0f * state.defines.min_months_to_intervene))
1716 if(state.world.war_get_is_crisis_war(w) && !state.world.war_get_is_great(w))
1723 if(!state.world.war_get_is_great(w)) {
1735 auto defender = state.world.war_get_primary_defender(w);
1736 auto rel_w_defender = state.world.get_gp_relationship_by_gp_influence_pair(defender, source);
1752 if(state.world.nation_get_war_exhaustion(source) >= state.defines.gw_intervene_max_exhaustion)
1755 auto primary_on_side = for_attacker ? state.world.war_get_primary_attacker(w) : state.world.war_get_primary_defender(w);
1756 auto rel = state.world.get_diplomatic_relation_by_diplomatic_pair(primary_on_side, source);
1757 if(state.world.diplomatic_relation_get_value(rel) < state.defines.gw_intervene_min_relations)
1760 for(
auto p : state.world.war_get_war_participant(w)) {
1761 if(p.get_is_attacker() != for_attacker) {
1762 if(p.get_nation().get_in_sphere_of() == source)
1765 auto irel = state.world.get_diplomatic_relation_by_diplomatic_pair(p.get_nation(), source);
1766 if(state.world.diplomatic_relation_get_are_allied(irel))
1769 for(
auto prov : p.get_nation().get_province_ownership()) {
1770 for(
auto arm : prov.get_province().get_army_location()) {
1771 if(arm.get_army().get_controller_from_army_control() == source)
1781 if(!state.world.war_get_is_great(w)) {
1782 bool status_quo_added =
false;
1783 for(
auto wg : state.world.war_get_wargoals_attached(w)) {
1786 status_quo_added =
true;
1790 if(!status_quo_added) {
1791 military::add_wargoal(state, w, source, state.world.war_get_primary_attacker(w), state.military_definitions.standard_status_quo, dcon::state_definition_id{},
1792 dcon::national_identity_id{}, dcon::nation_id{});
1801 memset(&p, 0,
sizeof(
payload));
1804 p.
data.
movement.
iopt = state.world.movement_get_associated_issue_option(m);
1805 p.
data.
movement.
tag = state.world.movement_get_associated_independence(m);
1809 if(state.world.movement_get_nation_from_movement_within(m) != source)
1811 if(state.world.movement_get_pop_movement_membership(m).begin() == state.world.movement_get_pop_movement_membership(m).end())
1816 dcon::national_identity_id tag) {
1817 dcon::movement_id m;
1831 memset(&p, 0,
sizeof(
payload));
1837 return state.world.nation_get_modifier_values(source, sys::national_mod_offsets::civilization_progress_modifier) >= 1.0f && !state.world.nation_get_is_civilized(source);
1845 memset(&p, 0,
sizeof(
payload));
1857 if(state.world.nation_get_ruling_party(source) == p)
1864 auto last_change = state.world.nation_get_ruling_party_last_appointed(source);
1865 if(last_change && state.current_date < last_change + 365)
1871 auto gov = state.world.nation_get_government_type(source);
1872 auto new_ideology = state.world.political_party_get_ideology(p);
1873 if((state.world.government_type_get_ideologies_allowed(gov) &
::culture::to_bits(new_ideology)) == 0) {
1885 memset(&p, 0,
sizeof(
payload));
1892 if(source == state.local_player_nation && state.cheat_data.always_allow_reforms)
1895 bool is_military = state.world.reform_get_reform_type(state.world.reform_option_get_parent_reform(r)) ==
1909 memset(&p, 0,
sizeof(
payload));
1916 if(source == state.local_player_nation && state.cheat_data.always_allow_reforms)
1919 auto type = state.world.issue_get_issue_type(state.world.issue_option_get_parent_issue(i));
1934 memset(&p, 0,
sizeof(
payload));
1946 if(state.world.nation_get_is_at_war(source))
1949 if(state.world.nation_get_disarmed_until(source) && state.current_date < state.world.nation_get_disarmed_until(source))
1955 for(
auto& i : state.crisis_participants) {
1965 for(
auto& i : state.crisis_participants) {
1968 i.merely_interested =
true;
1976 memset(&p, 0,
sizeof(
payload));
1991 for(
auto& i : state.crisis_participants) {
1993 return i.merely_interested ==
true;
2000 for(
auto& i : state.crisis_participants) {
2001 if(i.id == source) {
2002 i.merely_interested =
false;
2003 i.supports_attacker = join_attacker;
2009 "msg_crisis_vol_join_title",
2010 source, dcon::nation_id{}, dcon::nation_id{},
2022 bool draw_on_stockpiles) {
2027 bool draw_on_stockpiles) {
2029 memset(&p, 0,
sizeof(
payload));
2039 bool draw_on_stockpiles) {
2040 state.world.nation_set_stockpile_targets(source, c, target_amount);
2041 state.world.nation_set_drawing_on_stockpiles(source, c, draw_on_stockpiles);
2046 memset(&p, 0,
sizeof(
payload));
2053 if(!(state.world.nation_get_is_player_controlled(source) && state.cheat_data.always_potential_decisions)) {
2054 auto condition = state.world.decision_get_potential(d);
2058 if(!(state.world.nation_get_is_player_controlled(source) && state.cheat_data.always_allow_decisions)) {
2059 auto condition = state.world.decision_get_allow(d);
2066 if(
auto e = state.world.decision_get_effect(d); e) {
2068 uint32_t(source.index() << 4 ^ d.index()));
2075 if(
auto e = state.world.decision_get_effect(d); e) {
2078 uint32_t(source.index() << 4 ^ d.index()));
2081 "msg_decision_title",
2082 source, dcon::nation_id{}, dcon::nation_id{},
2089 memset(&p, 0,
sizeof(
payload));
2105 memset(&p, 0,
sizeof(
payload));
2117 memset(&p, 0,
sizeof(
payload));
2119 p.
source = state.world.province_get_nation_from_province_ownership(e.
p);
2132 memset(&p, 0,
sizeof(
payload));
2134 p.
source = state.world.province_get_nation_from_province_ownership(e.
p);
2153 if(source != state.world.province_get_nation_from_province_ownership(e.
p))
2160 if(source != state.world.province_get_nation_from_province_ownership(e.
p))
2167void fabricate_cb(
sys::state& state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id type, dcon::state_definition_id target_state) {
2169 memset(&p, 0,
sizeof(
payload));
2180 auto actor = state.local_player_nation;
2181 dcon::cb_type_id cb = type;
2183 auto allowed_substate_regions = state.world.cb_type_get_allowed_substate_regions(cb);
2184 if(allowed_substate_regions) {
2185 for(
auto v : state.world.nation_get_overlord_as_ruler(target)) {
2186 if(v.get_subject().get_is_substate()) {
2187 for(
auto si : state.world.nation_get_state_ownership(target)) {
2189 auto def = si.get_state().get_definition().id;
2198 auto allowed_states = state.world.cb_type_get_allowed_states(cb);
2199 if(
auto ac = state.world.cb_type_get_allowed_countries(cb); ac) {
2200 auto in_nation = target;
2201 auto target_identity = state.world.nation_get_identity_from_identity_holder(target);
2202 for(
auto si : state.world.nation_get_state_ownership(target)) {
2204 auto def = si.get_state().get_definition().id;
2211 for(
auto si : state.world.nation_get_state_ownership(target)) {
2213 auto def = si.get_state().get_definition().id;
2224bool can_fabricate_cb(
sys::state& state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id type, dcon::state_definition_id target_state) {
2225 if(source == target)
2232 if(state.world.nation_get_constructing_cb_type(source))
2241 auto ol = state.world.nation_get_overlord_as_subject(source);
2242 if(state.defines.alice_allow_subjects_declare_wars < 1 && state.world.overlord_get_ruler(ol) && state.world.overlord_get_ruler(ol) != target)
2245 if(state.world.nation_get_in_sphere_of(target) == source)
2248 if(state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < state.defines.make_cb_diplomatic_cost)
2261 auto bits = state.world.cb_type_get_type_bits(type);
2275void execute_fabricate_cb(
sys::state& state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id type, dcon::state_definition_id target_state = dcon::state_definition_id{}) {
2276 state.world.nation_set_constructing_cb_target(source, target);
2277 state.world.nation_set_constructing_cb_type(source, type);
2278 state.world.nation_set_constructing_cb_target_state(source, target_state);
2279 state.world.nation_get_diplomatic_points(source) -= state.defines.make_cb_diplomatic_cost;
2288 memset(&p, 0,
sizeof(
payload));
2294 state.world.nation_set_constructing_cb_target(source, dcon::nation_id{});
2295 state.world.nation_set_constructing_cb_is_discovered(source,
false);
2296 state.world.nation_set_constructing_cb_progress(source, 0.0f);
2297 state.world.nation_set_constructing_cb_target_state(source, dcon::state_definition_id{});
2298 state.world.nation_set_constructing_cb_type(source, dcon::cb_type_id{});
2303 memset(&p, 0,
sizeof(
payload));
2317 if(!ignore_cost && state.world.nation_get_is_player_controlled(asker) && state.world.nation_get_diplomatic_points(asker) < state.defines.askmilaccess_diplomatic_cost)
2320 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(target, asker);
2321 if(state.world.unilateral_relationship_get_military_access(rel))
2330 state.world.nation_get_diplomatic_points(asker) -= state.defines.askmilaccess_diplomatic_cost;
2343 memset(&p, 0,
sizeof(
payload));
2353 if(!ignore_cost && state.world.nation_get_is_player_controlled(asker) && state.world.nation_get_diplomatic_points(asker) < state.defines.givemilaccess_diplomatic_cost)
2356 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(asker, target);
2357 if(state.world.unilateral_relationship_get_military_access(rel))
2366 state.world.nation_get_diplomatic_points(asker) -= state.defines.givemilaccess_diplomatic_cost;
2368 auto urel = state.world.get_unilateral_relationship_by_unilateral_pair(asker, target);
2370 urel = state.world.force_create_unilateral_relationship(asker, target);
2372 state.world.unilateral_relationship_set_military_access(urel,
true);
2378 memset(&p, 0,
sizeof(
payload));
2393 if(!ignore_cost && state.world.nation_get_is_player_controlled(asker) && state.world.nation_get_diplomatic_points(asker) < state.defines.alliance_diplomatic_cost)
2396 auto rel = state.world.get_diplomatic_relation_by_diplomatic_pair(target, asker);
2397 if(state.world.diplomatic_relation_get_are_allied(rel))
2400 if(state.world.nation_get_is_great_power(asker) && state.world.nation_get_is_great_power(target) &&
2405 auto ol = state.world.nation_get_overlord_as_subject(asker);
2406 if(state.world.overlord_get_ruler(ol) && state.defines.alice_allow_subjects_declare_wars == 0)
2408 auto ol2 = state.world.nation_get_overlord_as_subject(target);
2409 if(state.world.overlord_get_ruler(ol2) && state.defines.alice_allow_subjects_declare_wars == 0)
2420 state.world.nation_get_diplomatic_points(asker) -= state.defines.alliance_diplomatic_cost;
2433 memset(&p, 0,
sizeof(
payload));
2447 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(target, asker);
2449 rel = state.world.force_create_unilateral_relationship(target, asker);
2450 state.world.unilateral_relationship_set_interested_in_alliance(rel, !state.world.unilateral_relationship_get_interested_in_alliance(rel));
2455 memset(&p, 0,
sizeof(
payload));
2471 auto ol = state.world.nation_get_overlord_as_subject(asker);
2472 if(state.world.overlord_get_ruler(ol))
2477 if(state.world.nation_get_is_at_war(asker) || state.world.nation_get_is_at_war(target))
2483 for(
const auto ab : state.world.state_definition_get_abstract_state_membership(sid)) {
2484 if(ab.get_province().get_province_ownership().get_nation() == asker) {
2487 if(ab.get_province().get_province_control().get_nation() != asker)
2491 if(state.world.nation_get_owned_state_count(asker) == 1)
2510 memset(&p, 0,
sizeof(
payload));
2521 if(!ignore_cost && state.world.nation_get_is_player_controlled(asker) && state.world.nation_get_diplomatic_points(asker) < state.defines.callally_diplomatic_cost)
2524 if(!
nations::are_allied(state, asker, target) && !(state.world.war_get_primary_defender(w) == asker && state.world.nation_get_in_sphere_of(asker) == target))
2533 if(state.world.war_get_is_crisis_war(w) && !state.military_definitions.great_wars_enabled)
2539 state.world.nation_get_diplomatic_points(asker) -= state.defines.callally_diplomatic_cost;
2554 memset(&p, 0,
sizeof(
payload));
2564 for(
auto& m : state.pending_messages) {
2565 if(m.type == type && m.from == from && m.to == source) {
2581 memset(&p, 0,
sizeof(
payload));
2588 if(source == target)
2591 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(target, source);
2592 if(!ignore_cost && state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < state.defines.cancelaskmilaccess_diplomatic_cost)
2595 if(state.world.unilateral_relationship_get_military_access(rel))
2601 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(target, source);
2603 state.world.unilateral_relationship_set_military_access(rel,
false);
2605 state.world.nation_get_diplomatic_points(source) -= state.defines.cancelaskmilaccess_diplomatic_cost;
2612 "msg_access_canceled_a_title",
2613 source, target, dcon::nation_id{},
2620 memset(&p, 0,
sizeof(
payload));
2627 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(source, target);
2629 if(!ignore_cost && state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < state.defines.cancelgivemilaccess_diplomatic_cost)
2632 if(state.world.unilateral_relationship_get_military_access(rel))
2638 auto rel = state.world.get_unilateral_relationship_by_unilateral_pair(source, target);
2640 state.world.unilateral_relationship_set_military_access(rel,
false);
2642 state.world.nation_get_diplomatic_points(source) -= state.defines.cancelgivemilaccess_diplomatic_cost;
2645 if(source != state.local_player_nation) {
2650 "msg_access_canceled_b_title",
2651 source, target, dcon::nation_id{},
2659 memset(&p, 0,
sizeof(
payload));
2666 if(source == target)
2669 if(!ignore_cost && state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < state.defines.cancelalliance_diplomatic_cost)
2672 auto rel = state.world.get_diplomatic_relation_by_diplomatic_pair(target, source);
2673 if(!state.world.diplomatic_relation_get_are_allied(rel))
2679 auto ol = state.world.nation_get_overlord_as_subject(source);
2680 if(state.world.overlord_get_ruler(ol) == target)
2686 state.world.nation_get_diplomatic_points(source) -= state.defines.cancelalliance_diplomatic_cost;
2693 dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation,
bool call_attacker_allies,
bool run_conference) {
2696 memset(&p, 0,
sizeof(
payload));
2710 dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation) {
2711 dcon::nation_id real_target = target;
2713 auto target_ol_rel = state.world.nation_get_overlord_as_subject(target);
2714 if(state.world.overlord_get_ruler(target_ol_rel) && state.world.overlord_get_ruler(target_ol_rel) != source)
2715 real_target = state.world.overlord_get_ruler(target_ol_rel);
2717 if(source == target || source == real_target)
2720 if(state.world.nation_get_owned_province_count(target) == 0 || state.world.nation_get_owned_province_count(real_target) == 0)
2729 auto source_ol_rel = state.world.nation_get_overlord_as_subject(source);
2730 if(state.world.overlord_get_ruler(source_ol_rel) && state.world.overlord_get_ruler(source_ol_rel) != real_target)
2733 if(state.world.nation_get_in_sphere_of(real_target) == source)
2736 if(state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < state.defines.declarewar_diplomatic_cost)
2747 dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation,
bool call_attacker_allies,
bool run_conference) {
2748 state.world.nation_get_diplomatic_points(source) -= state.defines.declarewar_diplomatic_cost;
2751 dcon::nation_id real_target = target;
2753 auto target_ol_rel = state.world.nation_get_overlord_as_subject(target);
2754 if(state.world.overlord_get_ruler(target_ol_rel) && state.world.overlord_get_ruler(target_ol_rel) != source)
2755 real_target = state.world.overlord_get_ruler(target_ol_rel);
2762 state.world.nation_get_infamy(source) += cb_infamy;
2765 for(
auto prov : state.world.nation_get_province_ownership(source)) {
2766 for(
auto pop : prov.get_province().get_pop_location()) {
2774 auto current_cbs = state.world.nation_get_available_cbs(source);
2775 for(
uint32_t i = current_cbs.size(); i-- > 0;) {
2776 if(current_cbs[i].cb_type == primary_cb && current_cbs[i].target == target) {
2777 current_cbs.remove_at(i);
2788 cb_secondary_nation,
2794 state.crisis_defender = target;
2795 state.crisis_attacker = source;
2796 if(state.world.nation_get_is_great_power(target)) {
2797 state.primary_crisis_defender = target;
2799 if(state.world.nation_get_is_great_power(source)) {
2800 state.primary_crisis_attacker = source;
2807 "msg_new_crisis_title",
2808 state.local_player_nation, dcon::nation_id{}, dcon::nation_id{},
2812 state.last_crisis_end_date = state.current_date;
2816 auto war =
military::create_war(state, source, target, primary_cb, cb_state, cb_tag, cb_secondary_nation);
2818 if(call_attacker_allies) {
2824void add_war_goal(
sys::state& state, dcon::nation_id source, dcon::war_id w, dcon::nation_id target, dcon::cb_type_id cb_type,
2825 dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation) {
2827 memset(&p, 0,
sizeof(
payload));
2839 dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation) {
2846 if(source == target)
2849 if(state.world.nation_get_is_player_controlled(source) && state.cheat_data.always_allow_wargoals)
2852 if(state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < state.defines.addwargoal_diplomatic_cost)
2856 bool target_in_war =
false;
2858 for(
auto par : state.world.war_get_war_participant(w)) {
2859 if(par.get_nation() == target) {
2860 if(par.get_is_attacker() == is_attacker)
2862 target_in_war =
true;
2878 bool cb_fabbed =
false;
2879 for(
auto& fab_cb : state.world.nation_get_available_cbs(source)) {
2880 if(fab_cb.cb_type == cb_type && fab_cb.target == target) {
2890 auto jingoism_perc = totalpop > 0 ? state.world.nation_get_demographics(source,
demographics::to_key(state, state.culture_definitions.jingoism)) / totalpop : 0.0f;
2892 if(state.world.war_get_is_great(w)) {
2893 if(jingoism_perc < state.defines.wargoal_jingoism_requirement * state.defines.gw_wargoal_jingoism_requirement_mod)
2896 if(jingoism_perc < state.defines.wargoal_jingoism_requirement)
2907 dcon::cb_type_id cb_type, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag,
2908 dcon::nation_id cb_secondary_nation) {
2910 if(!
can_add_war_goal(state, source, w, target, cb_type, cb_state, cb_tag, cb_secondary_nation))
2913 state.world.nation_get_diplomatic_points(source) -= state.defines.addwargoal_diplomatic_cost;
2917 state.world.nation_get_infamy(source) += infamy;
2924 memset(&p, 0,
sizeof(
payload));
2936 auto ol = state.world.nation_get_overlord_as_subject(source);
2937 if(state.world.overlord_get_ruler(ol) && !(state.world.war_get_primary_attacker(war) == source || state.world.war_get_primary_defender(war) == source))
2941 auto ol = state.world.nation_get_overlord_as_subject(target);
2942 if(state.world.overlord_get_ruler(ol) && !(state.world.war_get_primary_attacker(war) == target || state.world.war_get_primary_defender(war) == target))
2946 if(state.world.war_get_primary_attacker(war) == source) {
2949 }
else if(state.world.war_get_primary_defender(war) == source) {
2952 }
else if(state.world.war_get_primary_attacker(war) == target) {
2955 }
else if(state.world.war_get_primary_defender(war) == target) {
2962 if(state.world.war_get_is_crisis_war(war)) {
2963 if((state.world.war_get_primary_attacker(war) != source || state.world.war_get_primary_defender(war) != target) &&
2964 (state.world.war_get_primary_attacker(war) != target || state.world.war_get_primary_defender(war) != source)) {
2970 auto pending = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
2974 auto offer = fatten(state.world, state.world.create_peace_offer());
2975 offer.set_target(target);
2976 offer.set_war_from_war_settlement(war);
2977 offer.set_is_concession(is_concession);
2978 offer.set_nation_from_pending_peace_offer(source);
2983 memset(&p, 0,
sizeof(
payload));
2990 if(source != state.primary_crisis_attacker && source != state.primary_crisis_defender)
2995 auto pending = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
2999 auto offer = fatten(state.world, state.world.create_peace_offer());
3000 offer.set_is_concession(is_concession);
3001 offer.set_nation_from_pending_peace_offer(source);
3002 offer.set_is_crisis_offer(
true);
3007 memset(&p, 0,
sizeof(
payload));
3014 auto pending = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
3018 auto war = state.world.peace_offer_get_war_from_war_settlement(pending);
3019 auto wg = fatten(state.world, goal);
3020 auto target = state.world.peace_offer_get_target(pending);
3025 if(wg.get_war_from_wargoals_attached() != war)
3034 if(state.world.war_get_primary_attacker(war) == source && state.world.war_get_primary_defender(war) == target) {
3037 if(state.world.war_get_primary_attacker(war) == target && state.world.war_get_primary_defender(war) == source) {
3041 if(state.world.peace_offer_get_is_concession(pending)) {
3042 if(state.world.war_get_primary_attacker(war) == source || state.world.war_get_primary_defender(war) == source) {
3043 if(wg.get_added_by() == target)
3045 if(wg.get_added_by().get_overlord_as_subject().get_ruler() == target)
3049 if(wg.get_target_nation() == source)
3051 if(wg.get_target_nation().get_overlord_as_subject().get_ruler() == source)
3056 if(state.world.war_get_primary_attacker(war) == source || state.world.war_get_primary_defender(war) == source) {
3057 if(wg.get_target_nation() == target)
3059 if(wg.get_target_nation().get_overlord_as_subject().get_ruler() == target)
3063 if(wg.get_added_by() == target)
3065 if(wg.get_added_by().get_overlord_as_subject().get_ruler() == target)
3072 auto pending = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
3073 state.world.force_create_peace_offer_item(pending, goal);
3077 dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag,
3078 dcon::nation_id cb_secondary_nation) {
3080 memset(&p, 0,
sizeof(
payload));
3092 dcon::nation_id target, dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag,
3093 dcon::nation_id cb_secondary_nation) {
3095 auto pending = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
3099 auto war = state.world.peace_offer_get_war_from_war_settlement(pending);
3103 bool found = [&]() {
3104 for(
auto wg : state.crisis_attacker_wargoals) {
3105 if(wg.added_by == wargoal_from && cb_state == wg.state && cb_tag == wg.wg_tag &&
3106 cb_secondary_nation == wg.secondary_nation && target == wg.target_nation &&
3107 primary_cb == wg.cb)
3110 for(
auto wg : state.crisis_defender_wargoals) {
3111 if(wg.added_by == wargoal_from && cb_state == wg.state && cb_tag == wg.wg_tag &&
3112 cb_secondary_nation == wg.secondary_nation && target == wg.target_nation &&
3113 primary_cb == wg.cb)
3123 for(
auto item : state.world.peace_offer_get_peace_offer_item(pending)) {
3124 auto wg = item.get_wargoal();
3125 if(wg.get_added_by() == wargoal_from && cb_state == wg.get_associated_state() && cb_tag == wg.get_associated_tag() &&
3126 cb_secondary_nation == wg.get_secondary_nation() && target == wg.get_target_nation() &&
3127 primary_cb == wg.get_type())
3134 auto pending = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
3136 auto wg = fatten(state.world, state.world.create_wargoal());
3137 wg.set_peace_offer_from_peace_offer_item(pending);
3138 wg.set_added_by(data.
invited);
3139 wg.set_associated_state(data.
cb_state);
3140 wg.set_associated_tag(data.
cb_tag);
3142 wg.set_target_nation(data.
target);
3148 memset(&p, 0,
sizeof(
payload));
3154 auto pending = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
3155 if(!pending || !state.world.peace_offer_get_war_from_war_settlement(pending))
3160 auto pending_offer = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
3161 auto in_war = state.world.peace_offer_get_war_from_war_settlement(pending_offer);
3167 auto target = state.world.peace_offer_get_target(pending_offer);
3170 if(
military::directed_warscore(state, in_war, source, target) < 0.0f && state.world.peace_offer_get_is_concession(pending_offer)) {
3176 auto containseverywargoal =
true;
3177 for(
auto poi : state.world.peace_offer_get_peace_offer_item(pending_offer)) {
3179 auto foundmatch =
false;
3180 for(
auto wg : state.world.war_get_wargoals_attached(in_war)) {
3181 if(wg.get_wargoal().id == poi.get_wargoal().id) {
3188 containseverywargoal =
false;
3193 if(containseverywargoal) {
3208 m.data.peace = pending_offer;
3217 memset(&p, 0,
sizeof(
payload));
3223 auto pending = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
3224 if(!pending || state.world.peace_offer_get_war_from_war_settlement(pending))
3226 if(source != state.primary_crisis_attacker && source != state.primary_crisis_defender)
3234 auto pending_offer = state.world.nation_get_peace_offer_from_pending_peace_offer(source);
3238 if(!state.world.peace_offer_get_war_from_war_settlement(pending_offer))
3241 state.world.delete_peace_offer(pending_offer);
3246 auto target = state.primary_crisis_attacker == source ? state.primary_crisis_defender : state.primary_crisis_attacker;
3252 m.data.peace = pending_offer;
3258void move_army(
sys::state& state, dcon::nation_id source, dcon::army_id a, dcon::province_id dest,
bool reset) {
3260 memset(&p, 0,
sizeof(
payload));
3285 if(source != state.world.army_get_controller_from_army_control(a))
3286 return std::vector<dcon::province_id>{};
3287 if(state.world.army_get_is_retreating(a))
3288 return std::vector<dcon::province_id>{};
3290 return std::vector<dcon::province_id>{};
3293 auto last_province = state.world.army_get_location_from_army_location(a);
3294 auto movement = state.world.army_get_path(a);
3295 if(movement.size() > 0) {
3296 last_province = movement.at(0);
3303std::vector<dcon::province_id>
calculate_army_path(
sys::state& state, dcon::nation_id source, dcon::army_id a, dcon::province_id last_province, dcon::province_id dest) {
3304 if(last_province == dest)
3305 return std::vector<dcon::province_id>{};
3308 return std::vector<dcon::province_id>{};
3310 if(dest.index() < state.province_definitions.first_sea_province.index()) {
3312 if(state.world.army_get_battle_from_army_battle_participation(a)) {
3327 if(
military::are_at_war(state, state.world.province_get_nation_from_province_control(dest), source)) {
3328 auto units = state.world.province_get_army_location_as_location(dest);
3330 for(
const auto unit : units) {
3331 if(unit.get_army().get_controller_from_army_control() == source)
3333 if(unit.get_army().get_controller_from_army_rebel_control()
3342 for(
const auto adj : state.world.province_get_province_adjacency(dest)) {
3343 auto other = adj.get_connected_provinces(adj.get_connected_provinces(0) == dest ? 1 : 0);
3344 if(other.id.index() < state.province_definitions.first_sea_province.index()) {
3345 auto units = state.world.province_get_army_location_as_location(dest);
3346 bool has_enemy_units =
false;
3347 for(
const auto unit : units) {
3348 if(unit.get_army().get_controller_from_army_rebel_control()
3350 has_enemy_units =
true;
3354 if(!has_enemy_units) {
3370 if(state.world.army_get_black_flag(a)) {
3377 return std::vector<dcon::province_id>{};
3380 if(state.world.army_get_black_flag(a)) {
3385 return std::vector<dcon::province_id>{};
3389 if(state.world.army_get_black_flag(a)) {
3394 return std::vector<dcon::province_id>{};
3399 return std::vector<dcon::province_id>{};
3401 if(state.world.army_get_black_flag(a)) {
3410 if(source != state.world.army_get_controller_from_army_control(a))
3412 if(state.world.army_get_is_retreating(a))
3415 auto battle = state.world.army_get_battle_from_army_battle_participation(a);
3416 if(dest.index() < state.province_definitions.first_sea_province.index()) {
3428 auto existing_path = state.world.army_get_path(a);
3431 existing_path.clear();
3432 state.world.army_set_arrival_time(a,
sys::date{});
3436 auto old_first_prov = existing_path.size() > 0 ? existing_path.at(existing_path.size() - 1) : dcon::province_id{};
3438 existing_path.clear();
3443 if(path.size() > 0) {
3444 auto append_size =
uint32_t(path.size());
3445 auto old_size = existing_path.size();
3446 auto new_size = old_size + append_size;
3447 existing_path.resize(new_size);
3449 for(
uint32_t i = old_size; i-- > 0; ) {
3450 existing_path.at(append_size + i) = existing_path.at(i);
3452 for(
uint32_t i = 0; i < append_size; ++i) {
3453 existing_path.at(i) = path[i];
3456 if(existing_path.at(new_size - 1) != old_first_prov) {
3459 state.world.army_set_dig_in(a, 0);
3460 state.world.army_set_is_rebel_hunter(a,
false);
3462 state.world.army_set_arrival_time(a,
sys::date{});
3464 state.world.army_set_moving_to_merge(a,
false);
3467 state.world.army_set_is_retreating(a,
true);
3468 state.world.army_set_battle_from_army_battle_participation(a, dcon::land_battle_id{});
3469 for(
auto reg : state.world.army_get_army_membership(a)) {
3471 auto& line = state.world.land_battle_get_attacker_front_line(battle);
3472 for(
auto& lr : line) {
3473 if(lr == reg.get_regiment())
3474 lr = dcon::regiment_id{};
3478 auto& line = state.world.land_battle_get_attacker_back_line(battle);
3479 for(
auto& lr : line) {
3480 if(lr == reg.get_regiment())
3481 lr = dcon::regiment_id{};
3485 auto& line = state.world.land_battle_get_defender_front_line(battle);
3486 for(
auto& lr : line) {
3487 if(lr == reg.get_regiment())
3488 lr = dcon::regiment_id{};
3492 auto& line = state.world.land_battle_get_defender_back_line(battle);
3493 for(
auto& lr : line) {
3494 if(lr == reg.get_regiment())
3495 lr = dcon::regiment_id{};
3498 auto res = state.world.land_battle_get_reserves(battle);
3499 for(
uint32_t i = res.size(); i-- > 0;) {
3500 if(res[i].regiment == reg.get_regiment()) {
3501 res[i] = res[res.size() - 1];
3512void move_navy(
sys::state& state, dcon::nation_id source, dcon::navy_id n, dcon::province_id dest,
bool reset) {
3514 memset(&p, 0,
sizeof(
payload));
3523 if(source != state.world.navy_get_controller_from_navy_control(n))
3524 return std::vector<dcon::province_id>{};
3525 if(state.world.navy_get_is_retreating(n))
3526 return std::vector<dcon::province_id>{};
3528 return std::vector<dcon::province_id>{};
3531 auto last_province = state.world.navy_get_location_from_navy_location(n);
3532 auto movement = state.world.navy_get_path(n);
3533 if(movement.size() > 0) {
3534 last_province = movement.at(0);
3541std::vector<dcon::province_id>
calculate_navy_path(
sys::state & state, dcon::nation_id source, dcon::navy_id n, dcon::province_id last_province, dcon::province_id dest) {
3543 if(last_province == dest)
3544 return std::vector<dcon::province_id>{};
3547 return std::vector<dcon::province_id>{};
3549 if(dest.index() >= state.province_definitions.first_sea_province.index()) {
3552 if(!state.world.province_get_is_coast(dest))
3553 return std::vector<dcon::province_id>{};
3556 return std::vector<dcon::province_id>{};
3562 if(source != state.world.navy_get_controller_from_navy_control(n))
3564 if(state.world.navy_get_is_retreating(n))
3567 auto battle = state.world.navy_get_battle_from_navy_battle_participation(n);
3572 auto existing_path = state.world.navy_get_path(n);
3575 existing_path.clear();
3576 state.world.navy_set_arrival_time(n,
sys::date{});
3580 auto old_first_prov = existing_path.size() > 0 ? existing_path.at(existing_path.size() - 1) : dcon::province_id{};
3582 existing_path.clear();
3586 if(path.size() > 0) {
3587 auto append_size =
uint32_t(path.size());
3588 auto old_size = existing_path.size();
3589 auto new_size = old_size + append_size;
3590 existing_path.resize(new_size);
3592 for(
uint32_t i = old_size; i-- > 0; ) {
3593 existing_path.at(append_size + i) = existing_path.at(i);
3595 for(
uint32_t i = 0; i < append_size; ++i) {
3596 existing_path.at(i) = path[i];
3599 if(existing_path.at(new_size - 1) != old_first_prov) {
3603 state.world.navy_set_arrival_time(n,
sys::date{});
3605 state.world.navy_set_moving_to_merge(n,
false);
3608 state.world.navy_set_is_retreating(n,
true);
3609 state.world.navy_set_battle_from_navy_battle_participation(n, dcon::naval_battle_id{});
3610 for(
auto shp : state.world.navy_get_navy_membership(n)) {
3611 for(
auto& s : state.world.naval_battle_get_slots(battle)) {
3612 if(s.ship == shp.get_ship()) {
3613 s.ship = dcon::ship_id{};
3614 s.flags &= ~s.mode_mask;
3615 s.flags |= s.mode_retreated;
3626 memset(&p, 0,
sizeof(
payload));
3634 if(source != state.world.army_get_controller_from_army_control(a))
3636 if(state.world.army_get_is_retreating(a))
3639 auto location = state.world.army_get_location_from_army_location(a);
3640 if(location.index() >= state.province_definitions.first_sea_province.index())
3643 if(state.world.army_get_battle_from_army_battle_participation(a))
3646 if(state.world.army_get_navy_from_army_transport(a)) {
3654 if(source != state.world.army_get_controller_from_army_control(a))
3656 if(state.world.army_get_is_retreating(a))
3659 if(state.world.army_get_battle_from_army_battle_participation(a))
3662 auto location = state.world.army_get_location_from_army_location(a);
3663 if(location.index() >= state.province_definitions.first_sea_province.index())
3666 if(state.world.army_get_navy_from_army_transport(a)) {
3667 state.world.army_set_navy_from_army_transport(a, dcon::navy_id{});
3672 state.world.army_set_navy_from_army_transport(a, to_navy);
3673 state.world.army_set_black_flag(a,
false);
3676 state.world.army_set_is_rebel_hunter(a,
false);
3677 state.world.army_set_dig_in(a, 0);
3682 memset(&p, 0,
sizeof(
payload));
3690 if(state.world.army_get_controller_from_army_control(a) != source)
3692 if(state.world.army_get_controller_from_army_control(b) != source)
3694 if(state.world.army_get_is_retreating(a) || state.world.army_get_is_retreating(b))
3696 if(state.world.army_get_navy_from_army_transport(a))
3698 if(state.world.army_get_navy_from_army_transport(b))
3701 if(state.world.army_get_location_from_army_location(a) != state.world.army_get_location_from_army_location(b))
3704 if(state.world.army_get_battle_from_army_battle_participation(a) ||
3705 state.world.army_get_battle_from_army_battle_participation(b))
3713 auto a_leader = state.world.army_get_general_from_army_leadership(a);
3714 auto b_leader = state.world.army_get_general_from_army_leadership(b);
3715 if(!a_leader && b_leader) {
3716 state.world.army_set_general_from_army_leadership(a, b_leader);
3720 state.world.army_get_path(a).clear();
3721 state.world.army_set_arrival_time(a,
sys::date{});
3723 auto regs = state.world.army_get_army_membership(b);
3724 while(regs.begin() != regs.end()) {
3725 auto reg = (*regs.begin()).get_regiment();
3726 reg.set_army_from_army_membership(a);
3729 if(source == state.local_player_nation) {
3737 memset(&p, 0,
sizeof(
payload));
3745 if(state.world.navy_get_controller_from_navy_control(a) != source)
3747 if(state.world.navy_get_controller_from_navy_control(b) != source)
3749 if(state.world.navy_get_is_retreating(a) || state.world.navy_get_is_retreating(b))
3752 if(state.world.navy_get_location_from_navy_location(a) != state.world.navy_get_location_from_navy_location(b))
3755 if(state.world.navy_get_battle_from_navy_battle_participation(a) ||
3756 state.world.navy_get_battle_from_navy_battle_participation(b))
3763 auto a_leader = state.world.navy_get_admiral_from_navy_leadership(a);
3764 auto b_leader = state.world.navy_get_admiral_from_navy_leadership(b);
3765 if(!a_leader && b_leader) {
3766 state.world.navy_set_admiral_from_navy_leadership(a, b_leader);
3770 state.world.navy_get_path(a).clear();
3771 state.world.navy_set_arrival_time(a,
sys::date{});
3773 auto regs = state.world.navy_get_navy_membership(b);
3774 while(regs.begin() != regs.end()) {
3775 auto reg = (*regs.begin()).get_ship();
3776 reg.set_navy_from_navy_membership(a);
3779 auto transported = state.world.navy_get_army_transport(b);
3780 while(transported.begin() != transported.end()) {
3781 auto arm = (*transported.begin()).get_army();
3782 arm.set_navy_from_army_transport(a);
3785 if(source == state.local_player_nation) {
3793 memset(&p, 0,
sizeof(
payload));
3800 return state.world.army_get_controller_from_army_control(a) == source && !state.world.army_get_is_retreating(a) &&
3801 !bool(state.world.army_get_battle_from_army_battle_participation(a));
3804 std::vector<dcon::regiment_id> regs;
3805 for(
auto r : state.world.army_get_army_membership(a)) {
3806 auto pop = r.get_regiment().get_pop_from_regiment_source();
3807 if(!pop || pop.get_size() < state.defines.pop_min_size_for_regiment)
3808 regs.push_back(r.get_regiment());
3811 state.world.delete_regiment(r);
3816 memset(&p, 0,
sizeof(
payload));
3823 auto owner = state.world.army_get_controller_from_army_control(a);
3827 auto current_state = state.world.army_get_is_rebel_hunter(a);
3829 state.world.army_set_is_rebel_hunter(a,
false);
3831 auto path = state.world.army_get_path(a);
3832 if(path.size() > 0) {
3833 state.world.army_set_ai_province(a, path.at(0));
3835 state.world.army_set_ai_province(a, state.world.army_get_location_from_army_location(a));
3836 if(!state.world.army_get_battle_from_army_battle_participation(a)
3837 && !state.world.army_get_navy_from_army_transport(a)) {
3842 state.world.army_set_is_rebel_hunter(a,
true);
3848 memset(&p, 0,
sizeof(
payload));
3855 auto owner = state.world.army_get_controller_from_army_control(a);
3858 auto current_state = state.world.army_get_is_ai_controlled(a);
3860 state.world.army_set_ai_activity(a, 0);
3861 state.world.army_set_is_ai_controlled(a,
false);
3864 state.world.army_set_is_rebel_hunter(a,
false);
3865 auto path = state.world.army_get_path(a);
3866 if(path.size() > 0) {
3867 state.world.army_set_ai_province(a, path.at(0));
3869 state.world.army_set_ai_province(a, state.world.army_get_location_from_army_location(a));
3870 if(!state.world.army_get_battle_from_army_battle_participation(a)
3871 && !state.world.army_get_navy_from_army_transport(a)) {
3876 state.world.army_set_ai_activity(a, 0);
3877 state.world.army_set_is_ai_controlled(a,
true);
3883 memset(&p, 0,
sizeof(
payload));
3889 state.world.nation_set_mobilized_is_ai_controlled(source, !state.world.nation_get_mobilized_is_ai_controlled(source));
3894 memset(&p, 0,
sizeof(
payload));
3910 if(regiments[0] && ships[0]) {
3915 auto const& ut = state.military_definitions.unit_base_definitions[new_type];
3917 if(ut.is_land && ships[0]) {
3920 else if(!ut.is_land && regiments[0]) {
3924 if(!ut.active && !state.world.nation_get_active_unit(state.local_player_nation, new_type)) {
3933 auto shiptype = state.world.ship_get_type(ships[i]);
3934 auto st = state.military_definitions.unit_base_definitions[shiptype];
3946 auto a = state.world.regiment_get_army_from_army_membership(regiments[i]);
3948 if(state.world.army_get_controller_from_army_control(a) != source || state.world.army_get_is_retreating(a) || state.world.army_get_navy_from_army_transport(a) ||
3949 bool(state.world.army_get_battle_from_army_battle_participation(a))) {
3958 auto n = state.world.ship_get_navy_from_navy_membership(ships[i]);
3959 auto embarked = state.world.navy_get_army_transport(n);
3960 if(state.world.navy_get_controller_from_navy_control(n) != source || state.world.navy_get_is_retreating(n) ||
3961 bool(state.world.navy_get_battle_from_navy_battle_participation(n)) || embarked.begin() != embarked.end()) {
3965 if(ut.min_port_level) {
3968 auto loc = fnid.get_location_from_navy_location();
3982 if(state.world.regiment_get_type(regiments[i]) != new_type) {
3983 state.world.regiment_set_type(regiments[i], new_type);
3984 state.world.regiment_set_strength(regiments[i], 0.01f);
3988 if(state.world.ship_get_type(ships[i]) != new_type) {
3989 state.world.ship_set_type(ships[i], new_type);
3990 state.world.ship_set_strength(ships[i], 0.01f);
3998 memset(&p, 0,
sizeof(
payload));
4005 if(state.world.province_get_nation_from_province_control(prov) != source)
4007 if(state.world.province_get_nation_from_province_ownership(prov) != source)
4017 memset(&p, 0,
sizeof(
payload));
4024 if(state.world.province_get_nation_from_province_control(prov) != source)
4026 if(state.world.province_get_nation_from_province_ownership(prov) != source)
4036 memset(&p, 0,
sizeof(
payload));
4043 return state.world.overlord_get_ruler(state.world.nation_get_overlord_as_subject(target)) == source;
4053 memset(&p, 0,
sizeof(
payload));
4055 p.
source = state.local_player_nation;
4062 std::lock_guard lg{ state.lock_console_strings };
4063 command = state.console_command_pending;
4064 state.console_command_pending.clear();
4072 std::lock_guard lg{ state.lock_console_strings };
4073 state.console_command_result += state.console_command_error;
4074 state.console_command_error.clear();
4076 std::string temp_result;
4082 state.fif_environment->source_stack.push_back(
"drop");
4083 state.fif_environment->compiler_stack.emplace_back(std::make_unique<fif::outer_interpreter>(*state.fif_environment));
4089 m->interpreted_link = o;
4095 state.fif_environment->source_stack.pop_back();
4096 restore_compiler_stack_mode(*state.fif_environment);
4098 state.fif_environment->compiler_stack.pop_back();
4100 temp_result +=
"?Gok.?W\\n";
4102 std::lock_guard lg{ state.lock_console_strings };
4103 state.console_command_result += temp_result;
4112 memset(&p, 0,
sizeof(
payload));
4122 bool inf_split =
false;
4123 bool cav_split =
false;
4124 bool art_split =
false;
4126 static std::vector<dcon::regiment_id> to_transfer;
4127 to_transfer.clear();
4129 for(
auto t : state.world.army_get_army_membership(a)) {
4130 auto type = state.military_definitions.unit_base_definitions[t.get_regiment().get_type()].type;
4133 to_transfer.push_back(t.get_regiment());
4135 inf_split = !inf_split;
4138 to_transfer.push_back(t.get_regiment());
4140 cav_split = !cav_split;
4143 to_transfer.push_back(t.get_regiment());
4145 art_split = !art_split;
4149 if(to_transfer.size() > 0) {
4150 auto new_u = fatten(state.world, state.world.create_army());
4151 new_u.set_controller_from_army_control(source);
4152 new_u.set_location_from_army_location(state.world.army_get_location_from_army_location(a));
4153 new_u.set_black_flag(state.world.army_get_black_flag(a));
4155 for(
auto t : to_transfer) {
4156 state.world.regiment_set_army_from_army_membership(t, new_u);
4159 if(source == state.local_player_nation && state.is_selected(a)) {
4161 state.select(new_u);
4168 memset(&p, 0,
sizeof(
payload));
4178 static std::vector<dcon::ship_id> to_transfer;
4179 to_transfer.clear();
4181 bool big_split =
false;
4182 bool sm_split =
false;
4183 bool tra_split =
false;
4185 for(
auto t : state.world.navy_get_navy_membership(a)) {
4186 auto type = state.military_definitions.unit_base_definitions[t.get_ship().get_type()].type;
4189 to_transfer.push_back(t.get_ship());
4191 big_split = !big_split;
4194 to_transfer.push_back(t.get_ship());
4196 sm_split = !sm_split;
4199 to_transfer.push_back(t.get_ship());
4201 tra_split = !tra_split;
4205 if(to_transfer.size() > 0) {
4206 auto new_u = fatten(state.world, state.world.create_navy());
4207 new_u.set_controller_from_navy_control(source);
4208 new_u.set_location_from_navy_location(state.world.navy_get_location_from_navy_location(a));
4210 for(
auto t : to_transfer) {
4211 state.world.ship_set_navy_from_navy_membership(t, new_u);
4214 if(source == state.local_player_nation && state.is_selected(a)) {
4216 state.select(new_u);
4223 memset(&p, 0,
sizeof(
payload));
4230 return state.world.army_get_controller_from_army_control(a) == source && !state.world.army_get_is_retreating(a) && !state.world.army_get_navy_from_army_transport(a) &&
4231 !bool(state.world.army_get_battle_from_army_battle_participation(a));
4234 static std::vector<dcon::regiment_id> to_transfer;
4235 to_transfer.clear();
4237 for(
auto t : state.world.army_get_army_membership(a)) {
4238 if(t.get_regiment().get_pending_split()) {
4239 t.get_regiment().set_pending_split(
false);
4240 to_transfer.push_back(t.get_regiment().id);
4244 if(to_transfer.size() > 0) {
4245 auto new_u = fatten(state.world, state.world.create_army());
4246 new_u.set_controller_from_army_control(source);
4247 new_u.set_location_from_army_location(state.world.army_get_location_from_army_location(a));
4248 new_u.set_black_flag(state.world.army_get_black_flag(a));
4250 for(
auto t : to_transfer) {
4251 state.world.regiment_set_army_from_army_membership(t, new_u);
4254 if(source == state.local_player_nation && state.is_selected(a))
4255 state.select(new_u);
4257 auto old_regs = state.world.army_get_army_membership(a);
4258 if(old_regs.begin() == old_regs.end()) {
4259 state.world.leader_set_army_from_army_leadership(state.world.army_get_general_from_army_leadership(a), new_u);
4261 if(source == state.local_player_nation) {
4271 memset(&p, 0,
sizeof(
payload));
4278 auto embarked = state.world.navy_get_army_transport(a);
4279 return state.world.navy_get_controller_from_navy_control(a) == source && !state.world.navy_get_is_retreating(a) &&
4280 !bool(state.world.navy_get_battle_from_navy_battle_participation(a)) && embarked.begin() == embarked.end();
4283 static std::vector<dcon::ship_id> to_transfer;
4284 to_transfer.clear();
4286 for(
auto t : state.world.navy_get_navy_membership(a)) {
4287 if(t.get_ship().get_pending_split()) {
4288 t.get_ship().set_pending_split(
false);
4289 to_transfer.push_back(t.get_ship().id);
4293 if(to_transfer.size() > 0) {
4294 auto new_u = fatten(state.world, state.world.create_navy());
4295 new_u.set_controller_from_navy_control(source);
4296 new_u.set_location_from_navy_location(state.world.navy_get_location_from_navy_location(a));
4298 for(
auto t : to_transfer) {
4299 state.world.ship_set_navy_from_navy_membership(t, new_u);
4302 if(source == state.local_player_nation && state.is_selected(a))
4303 state.select(new_u);
4305 auto old_regs = state.world.navy_get_navy_membership(a);
4306 if(old_regs.begin() == old_regs.end()) {
4307 state.world.leader_set_navy_from_navy_leadership(state.world.navy_get_admiral_from_navy_leadership(a), new_u);
4308 if(source == state.local_player_nation) {
4318 memset(&p, 0,
sizeof(
payload));
4325 return state.world.army_get_controller_from_army_control(a) == source && !state.world.army_get_is_retreating(a) &&
4326 !bool(state.world.army_get_battle_from_army_battle_participation(a)) &&
4330 if(source == state.local_player_nation) {
4338 memset(&p, 0,
sizeof(
payload));
4346 auto embarked = state.world.navy_get_army_transport(a);
4347 return state.world.navy_get_controller_from_navy_control(a) == source && !state.world.navy_get_is_retreating(a) &&
4348 embarked.begin() == embarked.end() && !bool(state.world.navy_get_battle_from_navy_battle_participation(a)) &&
4352 if(source == state.local_player_nation) {
4360 memset(&p, 0,
sizeof(
payload));
4368 return state.world.army_get_controller_from_army_control(a) == source && !state.world.army_get_is_retreating(a) &&
4369 !bool(state.world.army_get_battle_from_army_battle_participation(a)) &&
4371 (!l || state.world.leader_get_nation_from_leader_loyalty(l) == source);
4374 state.world.army_set_general_from_army_leadership(a, l);
4379 memset(&p, 0,
sizeof(
payload));
4387 return state.world.navy_get_controller_from_navy_control(a) == source && !state.world.navy_get_is_retreating(a) &&
4388 !bool(state.world.navy_get_battle_from_navy_battle_participation(a)) &&
4390 (!l || state.world.leader_get_nation_from_leader_loyalty(l) == source);
4393 state.world.navy_set_admiral_from_navy_leadership(a, l);
4397 std::array<dcon::regiment_id, num_packed_units>
const&
list) {
4400 memset(&p, 0,
sizeof(
payload));
4410 state.world.army_get_controller_from_army_control(state.world.regiment_get_army_from_army_membership(regs[i]))) {
4411 state.world.regiment_set_pending_split(regs[i], !state.world.regiment_get_pending_split(regs[i]));
4419 memset(&p, 0,
sizeof(
payload));
4429 if(source == state.world.navy_get_controller_from_navy_control(state.world.ship_get_navy_from_navy_membership(regs[i]))) {
4430 state.world.ship_set_pending_split(regs[i], !state.world.ship_get_pending_split(regs[i]));
4438 memset(&p, 0,
sizeof(
payload));
4465 memset(&p, 0,
sizeof(
payload));
4492 dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag,
4493 dcon::nation_id cb_secondary_nation) {
4495 memset(&p, 0,
sizeof(
payload));
4507 dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag,
4508 dcon::nation_id cb_secondary_nation) {
4510 if(state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < 1.0f)
4515 if(source != state.primary_crisis_attacker && source != state.primary_crisis_defender)
4518 if(invitation_to == target || source == target)
4522 for(
auto& par : state.crisis_participants) {
4526 if(par.id == invitation_to) {
4527 if(par.merely_interested ==
false)
4534 for(
auto& par : state.crisis_participants) {
4538 if(par.id == target) {
4539 if(par.merely_interested)
4541 if(par.supports_attacker && source == state.primary_crisis_attacker)
4543 if(!par.supports_attacker && source == state.primary_crisis_defender)
4551 auto wargoalslist = (source == state.primary_crisis_attacker) ? state.crisis_attacker_wargoals : state.crisis_defender_wargoals;
4552 for(
auto ewg : wargoalslist) {
4554 if (ewg.state == cb_state && ewg.wg_tag == cb_tag &&
4555 ewg.secondary_nation == cb_secondary_nation && ewg.target_nation == target)
4563 auto cb_type = state.world.cb_type_get_type_bits(primary_cb);
4574 if(state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < 1.0f)
4577 state.world.nation_get_diplomatic_points(source) -= 1.0f;
4583 m.data.crisis_offer.added_by = m.to;
4584 m.data.crisis_offer.target_nation = data.
target;
4586 m.data.crisis_offer.state = data.
cb_state;
4587 m.data.crisis_offer.wg_tag = data.
cb_tag;
4588 m.data.crisis_offer.cb = data.
cb_type;
4597 memset(&p, 0,
sizeof(
payload));
4609 if(state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < 1.0f)
4612 auto& wargoalslist = (source == state.primary_crisis_attacker) ? state.crisis_attacker_wargoals : state.crisis_defender_wargoals;
4622 state.world.nation_get_diplomatic_points(source) -= 1.0f;
4627 if(state.world.nation_get_is_player_controlled(source) && state.world.nation_get_diplomatic_points(source) < 1.0f)
4632 if(source != state.primary_crisis_attacker && source != state.primary_crisis_defender)
4636 for(
auto& par : state.crisis_participants) {
4641 if(par.merely_interested)
4643 if(par.supports_attacker && source == state.primary_crisis_attacker)
4645 if(!par.supports_attacker && source == state.primary_crisis_defender)
4652 auto cb_type = state.world.cb_type_get_type_bits(wg.
cb);
4661 auto wargoalslist = (source == state.primary_crisis_attacker) ? state.crisis_attacker_wargoals : state.crisis_defender_wargoals;
4662 for(
auto ewg : wargoalslist) {
4677 memset(&p, 0,
sizeof(
payload));
4678 p.
type = command_type::toggle_mobilization;
4684 if(state.world.nation_get_is_mobilized(source)) {
4693 memset(&p, 0,
sizeof(
payload));
4694 p.
type = command_type::enable_debt;
4701 state.world.nation_set_is_debt_spending(source, debt_is_enabled);
4706 memset(&p, 0,
sizeof(
payload));
4707 p.
type = command_type::move_capital;
4716 if(state.world.nation_get_is_at_war(source))
4718 if(state.world.nation_get_capital(source) == p)
4720 if(state.world.province_get_is_colonial(p))
4722 if(state.world.province_get_continent(state.world.nation_get_capital(source)) != state.world.province_get_continent(p))
4726 if(state.world.province_get_siege_progress(p) > 0.f)
4728 if(state.world.province_get_siege_progress(state.world.nation_get_capital(source)) > 0.f)
4730 if(state.world.province_get_nation_from_province_ownership(p) != source)
4732 if(state.world.province_get_nation_from_province_control(p) != source)
4734 if(state.world.province_get_is_owner_core(p) ==
false)
4740 state.world.nation_set_capital(source, p);
4745 memset(&p, 0,
sizeof(
payload));
4746 p.
type = command_type::take_province;
4754 auto owner = fid.get_nation_from_province_ownership();
4755 auto rel = state.world.nation_get_overlord_as_subject(owner);
4756 auto overlord = state.world.overlord_get_ruler(rel);
4758 if(state.defines.alice_allow_revoke_subject_states == 0.0f)
4761 if(overlord != source)
4765 if(state.world.nation_get_is_at_war(source))
4767 if(state.world.nation_get_is_at_war(owner))
4769 if(state.world.province_get_siege_progress(p) > 0.f)
4771 if(state.world.province_get_siege_progress(state.world.nation_get_capital(source)) > 0.f)
4774 if(state.world.province_get_nation_from_province_control(p) != owner)
4781 auto owner = fid.get_province_ownership_as_province().get_nation();
4786 state.world.province_set_nationalism(p, state.defines.years_of_nationalism);
4788 for(
auto n : state.world.in_nation) {
4794 auto rel = state.world.nation_get_overlord_as_subject(owner);
4795 auto overlord = state.world.overlord_get_ruler(rel);
4797 if(overlord == source) {
4803 fid.get_province_ownership_as_province().set_nation(source);
4804 fid.get_province_control_as_province().set_nation(source);
4809 memset(&p, 0,
sizeof(
payload));
4810 p.
type = command_type::pbutton_script;
4817 auto& def = state.ui_defs.gui[d];
4822 if(!def.data.button.scriptable_enable)
4827 auto & def = state.ui_defs.gui[d];
4828 if(def.data.button.scriptable_effect)
4834 memset(&p, 0,
sizeof(
payload));
4835 p.
type = command_type::nbutton_script;
4842 auto& def = state.ui_defs.gui[d];
4847 if(!def.data.button.scriptable_enable)
4852 auto& def = state.ui_defs.gui[d];
4853 if(def.data.button.scriptable_effect)
4859 bool can_see =
true;
4860 if(
bool(m.target)) {
4861 can_see = state.local_player_nation == m.source || state.local_player_nation == m.target;
4864 state.ui_state.chat_messages[state.ui_state.chat_messages_index++] = m;
4865 if(state.ui_state.chat_messages_index >= state.ui_state.chat_messages.size())
4866 state.ui_state.chat_messages_index = 0;
4872 "msg_chat_message_title",
4873 m.source, dcon::nation_id{}, dcon::nation_id{},
4881 memset(&p, 0,
sizeof(
payload));
4882 p.
type = command_type::chat_message;
4897 m.body = std::string(
body);
4903 memset(&p, 0,
sizeof(
payload));
4904 p.
type = command_type::notify_player_joins;
4915 state.console_log(
"client:receive:cmd | type:notify_player_joins | nation: " + std::to_string(source.index()) +
" | name: " + name.to_string());
4920 auto oldnation = state.world.mp_player_get_nation_from_player_nation(p);
4922 if (oldnation != source)
4923 state.world.nation_set_is_player_controlled(oldnation,
false);
4927 if(!password.
empty()) {
4934 state.world.nation_set_is_player_controlled(source,
true);
4935 state.world.force_create_player_nation(source, p);
4945 if(state.current_scene.game_in_progress)
4953 memset(&p, 0,
sizeof(
payload));
4954 p.
type = command_type::notify_player_leaves;
4960 return state.world.nation_get_is_player_controlled(source);
4964 state.world.nation_set_is_player_controlled(source,
false);
4968 for(
auto& client : state.network_state.clients) {
4969 if(client.is_active() && client.playing_as == source) {
4979 auto nickname = state.world.mp_player_get_nickname(p);
4987 memset(&p, 0,
sizeof(
payload));
4988 p.
type = command_type::notify_player_ban;
4994 if(source == target)
5000 for(
auto& client : state.network_state.clients) {
5001 if(client.is_active() && client.playing_as == target) {
5006 state.world.nation_set_is_player_controlled(target,
false);
5009 auto nickname = state.world.mp_player_get_nickname(p);
5021 memset(&p, 0,
sizeof(
payload));
5022 p.
type = command_type::notify_player_kick;
5028 if(source == target)
5034 for(
auto& client : state.network_state.clients) {
5035 if(client.is_active() && client.playing_as == target) {
5040 state.world.nation_set_is_player_controlled(target,
false);
5047 auto nickname = state.world.mp_player_get_nickname(p);
5055 memset(&p, 0,
sizeof(
payload));
5056 p.
type = command_type::notify_player_picks_nation;
5062 if(source == target)
5064 if(!
bool(target) || target == state.world.national_identity_get_nation_from_identity_holder(state.national_definitions.rebel_id))
5067 return state.world.nation_get_is_player_controlled(target) ==
false;
5070 assert(source && source != state.world.national_identity_get_nation_from_identity_holder(state.national_definitions.rebel_id));
5072 state.world.nation_set_is_player_controlled(source,
false);
5073 state.world.nation_set_is_player_controlled(target,
true);
5075 if(state.local_player_nation == source) {
5076 state.local_player_nation = target;
5079 for(
auto& msg : state.ui_state.chat_messages)
5080 if(
bool(msg.source) && msg.source == source)
5081 msg.source = target;
5086 memset(&p, 0,
sizeof(
payload));
5087 p.
type = command_type::notify_player_oos;
5094 state.actual_game_speed = 0;
5095 state.debug_save_oos_dump();
5103 auto nickname = state.world.mp_player_get_nickname(p);
5109 state.console_log(
"client:rcv:cmd | type=notify_player_oos from:" + std::to_string(source.index()));
5120 memset(&p, 0,
sizeof(
payload));
5132 if(!state.network_state.out_of_sync) {
5133 if(state.current_date.to_ymd(state.start_date).day == 1 || state.cheat_data.daily_oos_check) {
5135 if(!current.is_equal(k)) {
5136 state.network_state.out_of_sync =
true;
5137 state.debug_save_oos_dump();
5141 state.actual_game_speed = speed;
5143 state.single_game_tick();
5146 if(state.current_date.value % 7 == 0) {
5153 memset(&p, 0,
sizeof(
payload));
5160 state.session_host_checksum = k;
5164 state.network_state.is_new_game =
false;
5165 state.network_state.out_of_sync =
false;
5166 state.network_state.reported_oos =
false;
5171 memset(&p, 0,
sizeof(
payload));
5177 state.session_host_checksum = k;
5181 state.network_state.is_new_game =
false;
5182 state.network_state.out_of_sync =
false;
5183 state.network_state.reported_oos =
false;
5185 std::vector<dcon::nation_id> players;
5186 for(
const auto n : state.world.in_nation)
5187 if(state.world.nation_get_is_player_controlled(n))
5188 players.push_back(n);
5189 dcon::nation_id old_local_player_nation = state.local_player_nation;
5191 size_t length = sizeof_save_section(state);
5192 auto save_buffer = std::unique_ptr<uint8_t[]>(
new uint8_t[length]);
5197 state.local_player_nation = dcon::nation_id{ };
5198 for(
const auto n : players)
5199 state.world.nation_set_is_player_controlled(n,
true);
5200 state.local_player_nation = old_local_player_nation;
5201 assert(state.world.nation_get_is_player_controlled(state.local_player_nation));
5202 state.fill_unsaved_data();
5203 assert(state.session_host_checksum.is_equal(state.get_save_checksum()));
5206 auto encodedchecksum =
base64_encode(state.session_host_checksum.to_char(), state.session_host_checksum.key_size);
5207 state.console_log(
"client:exec:cmd | type=notify_reload from:" + std::to_string(source.index()) +
"| checksum: " + encodedchecksum);
5215 auto nickname = state.world.mp_player_get_nickname(p);
5222 assert(state.world.nation_get_is_player_controlled(state.local_player_nation));
5223 state.selected_armies.clear();
5224 state.selected_navies.clear();
5225 for(
auto& v : state.ctrl_armies) v.clear();
5226 for(
auto& v : state.ctrl_navies) v.clear();
5228 state.network_state.current_save_buffer.reset();
5229 state.network_state.current_save_length = 0;
5231 for(
const auto n : state.world.in_nation)
5232 if(state.world.nation_get_is_player_controlled(n))
5235 state.map_state.set_selected_province(dcon::province_id{});
5236 state.map_state.unhandled_province_selection =
true;
5241 memset(&p, 0,
sizeof(
payload));
5249 state.map_state.set_selected_province(dcon::province_id{});
5250 state.map_state.unhandled_province_selection =
true;
5255 memset(&p, 0,
sizeof(
payload));
5262 state.actual_game_speed = 0;
5267 memset(&p, 0,
sizeof(
payload));
5275 memset(&p, 0,
sizeof(
payload));
5284 for(
auto& client : state.network_state.clients) {
5285 if(client.playing_as == source) {
5286 client.last_seen = date;
5295 case command_type::invalid:
5299 case command_type::change_nat_focus:
5302 case command_type::start_research:
5305 case command_type::make_leader:
5308 case command_type::set_factory_type_priority:
5311 case command_type::begin_province_building_construction:
5315 case command_type::war_subsidies:
5318 case command_type::cancel_war_subsidies:
5321 case command_type::increase_relations:
5324 case command_type::decrease_relations:
5327 case command_type::begin_factory_building_construction:
5331 case command_type::begin_naval_unit_construction:
5335 case command_type::cancel_naval_unit_construction:
5339 case command_type::begin_land_unit_construction:
5343 case command_type::cancel_land_unit_construction:
5347 case command_type::delete_factory:
5350 case command_type::change_factory_settings:
5353 case command_type::make_vassal:
5356 case command_type::release_and_play_nation:
5359 case command_type::change_budget:
5362 case command_type::start_election:
5365 case command_type::change_influence_priority:
5369 case command_type::expel_advisors:
5372 case command_type::ban_embassy:
5375 case command_type::discredit_advisors:
5378 case command_type::decrease_opinion:
5381 case command_type::remove_from_sphere:
5384 case command_type::increase_opinion:
5387 case command_type::add_to_sphere:
5390 case command_type::upgrade_colony_to_state:
5393 case command_type::invest_in_colony:
5396 case command_type::abandon_colony:
5399 case command_type::finish_colonization:
5402 case command_type::intervene_in_war:
5405 case command_type::suppress_movement:
5408 case command_type::civilize_nation:
5411 case command_type::appoint_ruling_party:
5414 case command_type::change_issue_option:
5417 case command_type::change_reform_option:
5420 case command_type::become_interested_in_crisis:
5423 case command_type::take_sides_in_crisis:
5426 case command_type::change_stockpile_settings:
5430 case command_type::take_decision:
5433 case command_type::make_n_event_choice:
5436 case command_type::make_f_n_event_choice:
5439 case command_type::make_p_event_choice:
5442 case command_type::make_f_p_event_choice:
5445 case command_type::cancel_cb_fabrication:
5448 case command_type::fabricate_cb:
5451 case command_type::ask_for_military_access:
5454 case command_type::ask_for_alliance:
5457 case command_type::call_to_arms:
5460 case command_type::respond_to_diplomatic_message:
5463 case command_type::cancel_military_access:
5466 case command_type::cancel_alliance:
5469 case command_type::cancel_given_military_access:
5472 case command_type::declare_war:
5476 case command_type::add_war_goal:
5480 case command_type::start_peace_offer:
5484 case command_type::add_peace_offer_term:
5487 case command_type::send_peace_offer:
5490 case command_type::move_army:
5493 case command_type::move_navy:
5496 case command_type::embark_army:
5499 case command_type::merge_armies:
5502 case command_type::merge_navies:
5505 case command_type::split_army:
5508 case command_type::split_navy:
5511 case command_type::change_unit_type:
5514 case command_type::delete_army:
5517 case command_type::delete_navy:
5520 case command_type::designate_split_regiments:
5523 case command_type::designate_split_ships:
5526 case command_type::naval_retreat:
5529 case command_type::land_retreat:
5532 case command_type::start_crisis_peace_offer:
5535 case command_type::invite_to_crisis:
5538 case command_type::add_wargoal_to_crisis_offer:
5541 case command_type::crisis_add_wargoal:
5544 c.data.new_war_goal.target,
5545 c.data.new_war_goal.cb_secondary_nation,
5546 c.data.new_war_goal.cb_tag,
5547 c.data.new_war_goal.cb_state,
5548 c.data.new_war_goal.cb_type
5551 case command_type::send_crisis_peace_offer:
5554 case command_type::change_admiral:
5557 case command_type::change_general:
5560 case command_type::toggle_mobilization:
5563 case command_type::give_military_access:
5566 case command_type::set_rally_point:
5569 case command_type::save_game:
5572 case command_type::cancel_factory_building_construction:
5575 case command_type::disband_undermanned:
5578 case command_type::even_split_army:
5581 case command_type::even_split_navy:
5584 case command_type::toggle_hunt_rebels:
5587 case command_type::toggle_select_province:
5590 case command_type::toggle_immigrator_province:
5593 case command_type::state_transfer:
5596 case command_type::enable_debt:
5599 case command_type::move_capital:
5602 case command_type::take_province:
5605 case command_type::toggle_unit_ai_control:
5607 case command_type::toggle_mobilized_is_ai_controlled:
5609 case command_type::toggle_interested_in_alliance:
5611 case command_type::pbutton_script:
5613 case command_type::nbutton_script:
5617 case command_type::chat_message:
5627 case command_type::notify_player_ban:
5630 case command_type::notify_player_kick:
5633 case command_type::notify_player_joins:
5636 case command_type::notify_player_leaves:
5639 case command_type::notify_player_picks_nation:
5642 case command_type::notify_player_oos:
5644 case command_type::advance_tick:
5646 case command_type::notify_save_loaded:
5648 case command_type::notify_reload:
5650 case command_type::notify_start_game:
5652 case command_type::notify_stop_game:
5654 case command_type::notify_pause_game:
5656 case command_type::release_subject:
5658 case command_type::network_inactivity_ping:
5660 case command_type::console_command:
5670 case command_type::invalid:
5673 case command_type::change_nat_focus:
5676 case command_type::start_research:
5679 case command_type::make_leader:
5682 case command_type::set_factory_type_priority:
5685 case command_type::begin_province_building_construction:
5689 case command_type::war_subsidies:
5692 case command_type::cancel_war_subsidies:
5695 case command_type::increase_relations:
5698 case command_type::decrease_relations:
5701 case command_type::begin_factory_building_construction:
5705 case command_type::begin_naval_unit_construction:
5709 case command_type::cancel_naval_unit_construction:
5713 case command_type::begin_land_unit_construction:
5717 case command_type::cancel_land_unit_construction:
5721 case command_type::delete_factory:
5724 case command_type::change_factory_settings:
5728 case command_type::make_vassal:
5731 case command_type::release_and_play_nation:
5734 case command_type::change_budget:
5737 case command_type::start_election:
5740 case command_type::change_influence_priority:
5744 case command_type::expel_advisors:
5747 case command_type::ban_embassy:
5750 case command_type::discredit_advisors:
5753 case command_type::decrease_opinion:
5756 case command_type::remove_from_sphere:
5759 case command_type::increase_opinion:
5762 case command_type::add_to_sphere:
5765 case command_type::upgrade_colony_to_state:
5768 case command_type::invest_in_colony:
5771 case command_type::abandon_colony:
5774 case command_type::finish_colonization:
5777 case command_type::intervene_in_war:
5780 case command_type::suppress_movement:
5783 case command_type::civilize_nation:
5786 case command_type::appoint_ruling_party:
5789 case command_type::change_issue_option:
5792 case command_type::change_reform_option:
5795 case command_type::become_interested_in_crisis:
5798 case command_type::take_sides_in_crisis:
5801 case command_type::change_stockpile_settings:
5805 case command_type::take_decision:
5808 case command_type::make_n_event_choice:
5811 case command_type::make_f_n_event_choice:
5814 case command_type::make_p_event_choice:
5817 case command_type::make_f_p_event_choice:
5820 case command_type::cancel_cb_fabrication:
5823 case command_type::fabricate_cb:
5826 case command_type::ask_for_military_access:
5829 case command_type::ask_for_alliance:
5832 case command_type::call_to_arms:
5835 case command_type::respond_to_diplomatic_message:
5838 case command_type::cancel_military_access:
5841 case command_type::cancel_alliance:
5844 case command_type::cancel_given_military_access:
5847 case command_type::declare_war:
5851 case command_type::add_war_goal:
5855 case command_type::start_peace_offer:
5859 case command_type::add_peace_offer_term:
5862 case command_type::send_peace_offer:
5865 case command_type::move_army:
5868 case command_type::move_navy:
5871 case command_type::embark_army:
5874 case command_type::merge_armies:
5877 case command_type::merge_navies:
5880 case command_type::split_army:
5883 case command_type::split_navy:
5886 case command_type::change_unit_type:
5889 case command_type::delete_army:
5892 case command_type::delete_navy:
5895 case command_type::designate_split_regiments:
5898 case command_type::designate_split_ships:
5901 case command_type::naval_retreat:
5904 case command_type::land_retreat:
5907 case command_type::start_crisis_peace_offer:
5910 case command_type::invite_to_crisis:
5913 case command_type::add_wargoal_to_crisis_offer:
5916 case command_type::crisis_add_wargoal:
5919 case command_type::send_crisis_peace_offer:
5922 case command_type::change_admiral:
5925 case command_type::change_general:
5928 case command_type::toggle_mobilization:
5931 case command_type::give_military_access:
5934 case command_type::set_rally_point:
5937 case command_type::save_game:
5940 case command_type::cancel_factory_building_construction:
5943 case command_type::disband_undermanned:
5946 case command_type::even_split_army:
5949 case command_type::even_split_navy:
5952 case command_type::toggle_hunt_rebels:
5955 case command_type::toggle_select_province:
5958 case command_type::toggle_immigrator_province:
5961 case command_type::state_transfer:
5964 case command_type::release_subject:
5967 case command_type::enable_debt:
5970 case command_type::move_capital:
5973 case command_type::take_province:
5976 case command_type::toggle_unit_ai_control:
5979 case command_type::toggle_mobilized_is_ai_controlled:
5982 case command_type::toggle_interested_in_alliance:
5985 case command_type::pbutton_script:
5988 case command_type::nbutton_script:
5992 case command_type::chat_message:
6002 case command_type::notify_player_ban:
6005 case command_type::notify_player_kick:
6008 case command_type::notify_player_joins:
6011 case command_type::notify_player_leaves:
6014 case command_type::notify_player_picks_nation:
6017 case command_type::notify_player_oos:
6020 case command_type::advance_tick:
6023 case command_type::notify_save_loaded:
6026 case command_type::notify_reload:
6029 case command_type::notify_start_game:
6032 case command_type::notify_stop_game:
6035 case command_type::notify_pause_game:
6038 case command_type::network_inactivity_ping:
6041 case command_type::console_command:
6048 auto* c = state.incoming_commands.front();
6049 bool command_executed =
false;
6051 command_executed =
true;
6053 state.incoming_commands.pop();
6054 c = state.incoming_commands.front();
6057 if(command_executed) {
6061 state.game_state_updated.store(
true, std::memory_order::release);
std::string base64_encode(const char *src, size_t len)
virtual int64_t main_data(size_t index) const override
std::unique_ptr< state_stack > interpreter_state
int32_t main_type(size_t index) const
#define assert(condition)
void remove_ai_data(sys::state &state, dcon::nation_id n)
bool can_state_transfer(sys::state &state, dcon::nation_id asker, dcon::nation_id target, dcon::state_definition_id sid)
void execute_abandon_colony(sys::state &state, dcon::nation_id source, dcon::province_id p)
void notify_stop_game(sys::state &state, dcon::nation_id source)
bool can_increase_opinion(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target)
void execute_send_peace_offer(sys::state &state, dcon::nation_id source)
void execute_delete_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_release_and_play_as(sys::state &state, dcon::nation_id source, dcon::national_identity_id t)
bool can_cancel_military_access(sys::state &state, dcon::nation_id source, dcon::nation_id target, bool ignore_cost)
void mark_ships_to_split(sys::state &state, dcon::nation_id source, std::array< dcon::ship_id, num_packed_units > const &list)
constexpr size_t num_packed_units
void execute_notify_player_oos(sys::state &state, dcon::nation_id source)
void execute_retreat_from_naval_battle(sys::state &state, dcon::nation_id source, dcon::naval_battle_id b)
void execute_network_inactivity_ping(sys::state &state, dcon::nation_id source, sys::date date)
void execute_toggle_mobilization(sys::state &state, dcon::nation_id source)
bool can_start_research(sys::state &state, dcon::nation_id source, dcon::technology_id tech)
bool can_release_subject(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_send_crisis_peace_offer(sys::state &state, dcon::nation_id source)
void execute_notify_player_kick(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_expel_advisors(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
void execute_decrease_relations(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void execute_use_nation_button(sys::state &state, dcon::nation_id source, dcon::gui_def_id d, dcon::nation_id n)
void execute_add_war_goal(sys::state &state, dcon::nation_id source, dcon::war_id w, dcon::nation_id target, dcon::cb_type_id cb_type, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
void start_land_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::culture_id soldier_culture, dcon::unit_type_id type, dcon::province_id template_province)
void execute_take_sides_in_crisis(sys::state &state, dcon::nation_id source, bool join_attacker)
void enact_issue(sys::state &state, dcon::nation_id source, dcon::issue_option_id i)
bool can_change_unit_type(sys::state &state, dcon::nation_id source, dcon::regiment_id regiments[num_packed_units], dcon::ship_id ships[num_packed_units], dcon::unit_type_id new_type)
void execute_expel_advisors(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
bool can_add_to_sphere(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target)
bool can_invite_to_crisis(sys::state &state, dcon::nation_id source, dcon::nation_id invitation_to, dcon::nation_id target, dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
void execute_set_factory_type_priority(sys::state &state, dcon::nation_id source, dcon::factory_type_id ftid, float value)
bool can_give_war_subsidies(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_add_war_goal(sys::state &state, dcon::nation_id source, dcon::war_id w, dcon::nation_id target, dcon::cb_type_id cb_type, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
void advance_tick(sys::state &state, dcon::nation_id source)
bool can_change_admiral(sys::state &state, dcon::nation_id source, dcon::navy_id a, dcon::leader_id l)
void execute_cancel_factory_building_construction(sys::state &state, dcon::nation_id source, dcon::state_instance_id location, dcon::factory_type_id type)
bool is_console_command(command_type t)
void execute_toggle_unit_ai_control(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_start_crisis_peace_offer(sys::state &state, dcon::nation_id source, bool is_concession)
void take_province(sys::state &state, dcon::nation_id source, dcon::province_id prov)
bool can_give_military_access(sys::state &state, dcon::nation_id asker, dcon::nation_id target, bool ignore_cost)
void execute_ask_for_access(sys::state &state, dcon::nation_id asker, dcon::nation_id target)
void execute_make_leader(sys::state &state, dcon::nation_id source, bool general)
void execute_call_to_arms(sys::state &state, dcon::nation_id asker, dcon::nation_id target, dcon::war_id w)
void execute_split_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
void chat_message(sys::state &state, dcon::nation_id source, std::string_view body, dcon::nation_id target)
void toggle_rebel_hunting(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_state_transfer(sys::state &state, dcon::nation_id asker, dcon::nation_id target, dcon::state_definition_id sid)
void execute_take_province(sys::state &state, dcon::nation_id source, dcon::province_id p)
void move_capital(sys::state &state, dcon::nation_id source, dcon::province_id prov)
void execute_change_general(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::leader_id l)
bool can_cancel_war_subsidies(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void execute_toggle_interested_in_alliance(sys::state &state, dcon::nation_id asker, dcon::nation_id target)
void execute_change_stockpile_settings(sys::state &state, dcon::nation_id source, dcon::commodity_id c, float target_amount, bool draw_on_stockpiles)
bool can_cancel_factory_building_construction(sys::state &state, dcon::nation_id source, dcon::state_instance_id location, dcon::factory_type_id type)
void notify_reload(sys::state &state, dcon::nation_id source)
bool can_notify_player_joins(sys::state &state, dcon::nation_id source, sys::player_name &name)
bool can_change_general(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::leader_id l)
bool can_intervene_in_war(sys::state &state, dcon::nation_id source, dcon::war_id w, bool for_attacker)
bool can_release_and_play_as(sys::state &state, dcon::nation_id source, dcon::national_identity_id t)
void execute_declare_war(sys::state &state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation, bool call_attacker_allies, bool run_conference)
void execute_enable_debt(sys::state &state, dcon::nation_id source, bool debt_is_enabled)
bool can_delete_factory(sys::state &state, dcon::nation_id source, dcon::factory_id f)
void enable_debt(sys::state &state, dcon::nation_id source, bool debt_is_enabled)
bool can_begin_factory_building_construction(sys::state &state, dcon::nation_id source, dcon::state_instance_id location, dcon::factory_type_id type, bool is_upgrade)
void execute_toggle_immigrator_province(sys::state &state, dcon::nation_id source, dcon::province_id prov)
void give_war_subsidies(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_call_to_arms(sys::state &state, dcon::nation_id asker, dcon::nation_id target, dcon::war_id w, bool ignore_cost)
bool can_appoint_ruling_party(sys::state &state, dcon::nation_id source, dcon::political_party_id p)
std::vector< dcon::province_id > calculate_navy_path(sys::state &state, dcon::nation_id source, dcon::navy_id n, dcon::province_id last_province, dcon::province_id dest)
void execute_begin_province_building_construction(sys::state &state, dcon::nation_id source, dcon::province_id p, economy::province_building_type type)
bool can_begin_province_building_construction(sys::state &state, dcon::nation_id source, dcon::province_id p, economy::province_building_type type)
void notify_player_oos(sys::state &state, dcon::nation_id source)
bool can_start_election(sys::state &state, dcon::nation_id source)
bool can_delete_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
void change_budget_settings(sys::state &state, dcon::nation_id source, budget_settings_data const &values)
bool can_start_crisis_peace_offer(sys::state &state, dcon::nation_id source, bool is_concession)
bool can_fabricate_cb(sys::state &state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id type, dcon::state_definition_id target_state)
void execute_crisis_add_wargoal(sys::state &state, dcon::nation_id source, new_war_goal_data const &data)
void execute_start_land_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::culture_id soldier_culture, dcon::unit_type_id type, dcon::province_id template_province)
bool can_notify_player_leaves(sys::state &state, dcon::nation_id source, bool make_ai)
void execute_chat_message(sys::state &state, dcon::nation_id source, std::string_view body, dcon::nation_id target)
bool can_add_to_peace_offer(sys::state &state, dcon::nation_id source, dcon::wargoal_id goal)
void notify_pause_game(sys::state &state, dcon::nation_id source)
bool can_ask_for_access(sys::state &state, dcon::nation_id asker, dcon::nation_id target, bool ignore_cost)
void notify_save_loaded(sys::state &state, dcon::nation_id source)
void execute_advance_tick(sys::state &state, dcon::nation_id source, sys::checksum_key &k, int32_t speed)
void execute_cancel_land_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::culture_id soldier_culture, dcon::unit_type_id type)
void execute_appoint_ruling_party(sys::state &state, dcon::nation_id source, dcon::political_party_id p)
bool can_change_factory_settings(sys::state &state, dcon::nation_id source, dcon::factory_id f, uint8_t priority, bool subsidized)
void execute_make_vassal(sys::state &state, dcon::nation_id source, dcon::national_identity_id t)
void start_naval_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::unit_type_id type, dcon::province_id template_province)
void execute_fabricate_cb(sys::state &state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id type, dcon::state_definition_id target_state=dcon::state_definition_id{})
void use_nation_button(sys::state &state, dcon::nation_id source, dcon::gui_def_id d, dcon::nation_id n)
void execute_mark_regiments_to_split(sys::state &state, dcon::nation_id source, dcon::regiment_id const *regs)
void execute_add_to_sphere(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target)
void execute_intervene_in_war(sys::state &state, dcon::nation_id source, dcon::war_id w, bool for_attacker)
bool can_increase_relations(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_cancel_cb_fabrication(sys::state &state, dcon::nation_id source)
void retreat_from_land_battle(sys::state &state, dcon::nation_id source, dcon::land_battle_id b)
void mark_regiments_to_split(sys::state &state, dcon::nation_id source, std::array< dcon::regiment_id, num_packed_units > const &list)
bool can_upgrade_colony_to_state(sys::state &state, dcon::nation_id source, dcon::state_instance_id si)
bool can_civilize_nation(sys::state &state, dcon::nation_id source)
bool can_set_national_focus(sys::state &state, dcon::nation_id source, dcon::state_instance_id target_state, dcon::national_focus_id focus)
void evenly_split_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
bool can_retreat_from_land_battle(sys::state &state, dcon::nation_id source, dcon::land_battle_id b)
void execute_notify_player_picks_nation(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_use_province_button(sys::state &state, dcon::nation_id source, dcon::gui_def_id d, dcon::province_id p)
void release_and_play_as(sys::state &state, dcon::nation_id source, dcon::national_identity_id t)
void execute_upgrade_colony_to_state(sys::state &state, dcon::nation_id source, dcon::state_instance_id si)
void execute_cancel_military_access(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_enact_reform(sys::state &state, dcon::nation_id source, dcon::reform_option_id r)
void execute_change_factory_settings(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::factory_type_id type, uint8_t priority, bool subsidized)
void execute_release_subject(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void execute_set_rally_point(sys::state &state, dcon::nation_id source, dcon::province_id location, bool naval, bool enable)
std::vector< dcon::province_id > calculate_army_path(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::province_id last_province, dcon::province_id dest)
void notify_start_game(sys::state &state, dcon::nation_id source)
void execute_make_event_choice(sys::state &state, dcon::nation_id source, pending_human_n_event_data const &e)
void execute_notify_player_leaves(sys::state &state, dcon::nation_id source, bool make_ai)
bool can_set_factory_type_priority(sys::state &state, dcon::nation_id source, dcon::factory_type_id ftid, float value)
void execute_notify_player_ban(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_evenly_split_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_civilize_nation(sys::state &state, dcon::nation_id source)
bool can_abandon_colony(sys::state &state, dcon::nation_id source, dcon::province_id pr)
bool can_ban_embassy(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
void execute_invite_to_crisis(sys::state &state, dcon::nation_id source, crisis_invitation_data const &data)
void execute_retreat_from_land_battle(sys::state &state, dcon::nation_id source, dcon::land_battle_id b)
void execute_start_peace_offer(sys::state &state, dcon::nation_id source, dcon::nation_id target, dcon::war_id war, bool is_concession)
bool can_decrease_relations(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_move_capital(sys::state &state, dcon::nation_id source, dcon::province_id p)
void set_national_focus(sys::state &state, dcon::nation_id source, dcon::state_instance_id target_state, dcon::national_focus_id focus)
void execute_give_war_subsidies(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_start_peace_offer(sys::state &state, dcon::nation_id source, dcon::nation_id target, dcon::war_id war, bool is_concession)
bool can_notify_player_kick(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void execute_begin_factory_building_construction(sys::state &state, dcon::nation_id source, dcon::state_instance_id location, dcon::factory_type_id type, bool is_upgrade)
bool can_toggle_select_province(sys::state &state, dcon::nation_id source, dcon::province_id prov)
void queue_crisis_add_wargoal(sys::state &state, dcon::nation_id source, sys::full_wg wg)
bool can_start_land_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::culture_id soldier_culture, dcon::unit_type_id type, dcon::province_id template_province)
void execute_finish_colonization(sys::state &state, dcon::nation_id source, dcon::province_id p)
void execute_console_command(sys::state &state)
void execute_change_admiral(sys::state &state, dcon::nation_id source, dcon::navy_id a, dcon::leader_id l)
void execute_remove_from_sphere(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
void notify_player_leaves(sys::state &state, dcon::nation_id source, bool make_ai)
bool can_evenly_split_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
void execute_evenly_split_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
void notify_player_ban(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void execute_respond_to_diplomatic_message(sys::state &state, dcon::nation_id source, dcon::nation_id from, diplomatic_message::type type, bool accept)
void execute_take_decision(sys::state &state, dcon::nation_id source, dcon::decision_id d)
void execute_notify_stop_game(sys::state &state, dcon::nation_id source)
void execute_send_crisis_peace_offer(sys::state &state, dcon::nation_id source)
void add_to_crisis_peace_offer(sys::state &state, dcon::nation_id source, dcon::nation_id wargoal_from, dcon::nation_id target, dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
void execute_start_research(sys::state &state, dcon::nation_id source, dcon::technology_id tech)
void execute_enact_reform(sys::state &state, dcon::nation_id source, dcon::reform_option_id r)
void retreat_from_naval_battle(sys::state &state, dcon::nation_id source, dcon::naval_battle_id b)
void execute_embark_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_give_military_access(sys::state &state, dcon::nation_id asker, dcon::nation_id target)
void execute_increase_opinion(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target)
void execute_notify_player_joins(sys::state &state, dcon::nation_id source, sys::player_name &name, sys::player_password_raw &password)
bool can_partial_retreat_from(sys::state &state, dcon::land_battle_id b)
bool can_disband_undermanned_regiments(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_set_national_focus(sys::state &state, dcon::nation_id source, dcon::state_instance_id target_state, dcon::national_focus_id focus)
void execute_move_army(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::province_id dest, bool reset)
bool can_take_sides_in_crisis(sys::state &state, dcon::nation_id source, bool join_attacker)
bool crisis_can_add_wargoal(sys::state &state, dcon::nation_id source, sys::full_wg wg)
void execute_evenly_split_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_mark_ships_to_split(sys::state &state, dcon::nation_id source, dcon::ship_id const *regs)
bool can_change_stockpile_settings(sys::state &state, dcon::nation_id source, dcon::commodity_id c, float target_amount, bool draw_on_stockpiles)
void disband_undermanned_regiments(sys::state &state, dcon::nation_id source, dcon::army_id a)
bool can_take_decision(sys::state &state, dcon::nation_id source, dcon::decision_id d)
void enact_reform(sys::state &state, dcon::nation_id source, dcon::reform_option_id r)
bool can_make_leader(sys::state &state, dcon::nation_id source, bool general)
void execute_change_budget_settings(sys::state &state, dcon::nation_id source, budget_settings_data const &values)
bool can_send_peace_offer(sys::state &state, dcon::nation_id source)
void execute_invest_in_colony(sys::state &state, dcon::nation_id source, dcon::province_id pr)
void execute_start_election(sys::state &state, dcon::nation_id source)
bool can_cancel_land_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::culture_id soldier_culture, dcon::unit_type_id type)
void execute_merge_navies(sys::state &state, dcon::nation_id source, dcon::navy_id a, dcon::navy_id b)
void execute_add_to_peace_offer(sys::state &state, dcon::nation_id source, dcon::wargoal_id goal)
bool can_make_vassal(sys::state &state, dcon::nation_id source, dcon::national_identity_id t)
bool can_merge_navies(sys::state &state, dcon::nation_id source, dcon::navy_id a, dcon::navy_id b)
void notify_console_command(sys::state &state)
void execute_ban_embassy(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
bool can_discredit_advisors(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
void execute_notify_start_game(sys::state &state, dcon::nation_id source)
void execute_change_influence_priority(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, uint8_t priority)
bool can_add_to_crisis_peace_offer(sys::state &state, dcon::nation_id source, dcon::nation_id wargoal_from, dcon::nation_id target, dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
bool can_cancel_naval_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::unit_type_id type)
void add_to_command_queue(sys::state &state, payload &p)
void execute_merge_armies(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::army_id b)
void execute_increase_relations(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void execute_enact_issue(sys::state &state, dcon::nation_id source, dcon::issue_option_id i)
bool can_remove_from_sphere(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
void execute_notify_reload(sys::state &state, dcon::nation_id source, sys::checksum_key &k)
void execute_cancel_alliance(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void execute_notify_pause_game(sys::state &state, dcon::nation_id source)
bool can_retreat_from_naval_battle(sys::state &state, dcon::nation_id source, dcon::naval_battle_id b)
bool can_change_budget_settings(sys::state &state, dcon::nation_id source, budget_settings_data const &values)
void execute_split_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
void execute_toggle_mobilized_is_ai_controlled(sys::state &state, dcon::nation_id source)
bool valid_target_state_for_cb(sys::state &state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id type, dcon::state_definition_id target_state)
void execute_save_game(sys::state &state, dcon::nation_id source, bool and_quit)
void execute_become_interested_in_crisis(sys::state &state, dcon::nation_id source)
void execute_cancel_cb_fabrication(sys::state &state, dcon::nation_id source)
bool can_become_interested_in_crisis(sys::state &state, dcon::nation_id source)
bool can_split_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
void execute_discredit_advisors(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
bool can_decrease_opinion(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
@ ask_for_military_access
@ network_inactivity_ping
@ change_factory_settings
@ cancel_land_unit_construction
@ respond_to_diplomatic_message
@ cancel_given_military_access
@ add_wargoal_to_crisis_offer
@ toggle_immigrator_province
@ change_influence_priority
@ notify_player_picks_nation
@ designate_split_regiments
@ begin_naval_unit_construction
@ send_crisis_peace_offer
@ upgrade_colony_to_state
@ begin_province_building_construction
@ set_factory_type_priority
@ change_stockpile_settings
@ toggle_interested_in_alliance
@ toggle_mobilized_is_ai_controlled
@ cancel_naval_unit_construction
@ start_crisis_peace_offer
@ cancel_factory_building_construction
@ release_and_play_nation
@ become_interested_in_crisis
@ begin_land_unit_construction
@ begin_factory_building_construction
bool can_suppress_movement(sys::state &state, dcon::nation_id source, dcon::movement_id m)
void execute_use_province_button(sys::state &state, dcon::nation_id source, dcon::gui_def_id d, dcon::province_id p)
void post_chat_message(sys::state &state, ui::chat_message &m)
bool can_delete_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
void use_province_button(sys::state &state, dcon::nation_id source, dcon::gui_def_id d, dcon::province_id i)
void notify_player_kick(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_split_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
bool can_invest_in_colony(sys::state &state, dcon::nation_id source, dcon::province_id p)
void toggle_mobilization(sys::state &state, dcon::nation_id source)
bool can_chat_message(sys::state &state, dcon::nation_id source, std::string_view body, dcon::nation_id target)
void execute_move_navy(sys::state &state, dcon::nation_id source, dcon::navy_id n, dcon::province_id dest, bool reset)
void execute_cancel_naval_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::unit_type_id type)
bool can_cancel_alliance(sys::state &state, dcon::nation_id source, dcon::nation_id target, bool ignore_cost)
bool can_notify_player_ban(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void evenly_split_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
bool can_declare_war(sys::state &state, dcon::nation_id source, dcon::nation_id target, dcon::cb_type_id primary_cb, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
void execute_add_to_crisis_peace_offer(sys::state &state, dcon::nation_id source, crisis_invitation_data const &data)
void execute_notify_save_loaded(sys::state &state, dcon::nation_id source, sys::checksum_key &k)
bool can_take_province(sys::state &state, dcon::nation_id source, dcon::province_id p)
bool can_embark_army(sys::state &state, dcon::nation_id source, dcon::army_id a)
bool can_toggle_interested_in_alliance(sys::state &state, dcon::nation_id asker, dcon::nation_id target)
void execute_move_capital(sys::state &state, dcon::nation_id source, dcon::province_id p)
void execute_toggle_select_province(sys::state &state, dcon::nation_id source, dcon::province_id prov)
void add_to_peace_offer(sys::state &state, dcon::nation_id source, dcon::wargoal_id goal)
bool can_use_nation_button(sys::state &state, dcon::nation_id source, dcon::gui_def_id d, dcon::nation_id n)
void execute_cancel_war_subsidies(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_merge_armies(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::army_id b)
void execute_suppress_movement(sys::state &state, dcon::nation_id source, dcon::issue_option_id iopt, dcon::national_identity_id tag)
void notify_player_joins(sys::state &state, dcon::nation_id source, sys::player_name &name)
void execute_delete_factory(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::factory_type_id type)
void execute_cancel_given_military_access(sys::state &state, dcon::nation_id source, dcon::nation_id target)
void network_inactivity_ping(sys::state &state, dcon::nation_id source, sys::date date)
void notify_player_picks_nation(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_finish_colonization(sys::state &state, dcon::nation_id source, dcon::province_id p)
std::vector< dcon::province_id > can_move_navy(sys::state &state, dcon::nation_id source, dcon::navy_id n, dcon::province_id dest)
void make_event_choice(sys::state &state, event::pending_human_n_event const &e, uint8_t option_id)
bool can_notify_player_picks_nation(sys::state &state, dcon::nation_id source, dcon::nation_id target)
bool can_perform_command(sys::state &state, payload &c)
bool can_enact_issue(sys::state &state, dcon::nation_id source, dcon::issue_option_id i)
bool can_change_influence_priority(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, uint8_t priority)
bool can_cancel_given_military_access(sys::state &state, dcon::nation_id source, dcon::nation_id target, bool ignore_cost)
bool can_toggle_immigrator_province(sys::state &state, dcon::nation_id source, dcon::province_id prov)
void execute_disband_undermanned_regiments(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_pending_commands(sys::state &state)
void execute_decrease_opinion(sys::state &state, dcon::nation_id source, dcon::nation_id influence_target, dcon::nation_id affected_gp)
void execute_start_naval_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::unit_type_id type, dcon::province_id template_province)
bool can_ask_for_alliance(sys::state &state, dcon::nation_id asker, dcon::nation_id target, bool ignore_cost)
void execute_command(sys::state &state, payload &c)
void execute_change_unit_type(sys::state &state, dcon::nation_id source, dcon::regiment_id regiments[num_packed_units], dcon::ship_id ships[num_packed_units], dcon::unit_type_id new_type)
void execute_delete_navy(sys::state &state, dcon::nation_id source, dcon::navy_id a)
bool can_start_naval_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::unit_type_id type, dcon::province_id template_province)
void execute_toggle_rebel_hunting(sys::state &state, dcon::nation_id source, dcon::army_id a)
void execute_ask_for_alliance(sys::state &state, dcon::nation_id asker, dcon::nation_id target)
std::vector< dcon::province_id > can_move_army(sys::state &state, dcon::nation_id source, dcon::army_id a, dcon::province_id dest)
constexpr uint64_t to_bits(dcon::ideology_id id)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
void modify_militancy(sys::state &state, dcon::nation_id n, float v)
constexpr dcon::demographics_key total(0)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
void decline(sys::state &state, message const &m)
void accept(sys::state &state, message const &m)
void post(sys::state &state, message const &m)
Pushes a diplomatic message to the list of pending diplomatic requests for the specified recipient (m...
void for_each_new_factory(sys::state &state, dcon::state_instance_id s, F &&func)
int32_t state_factory_count(sys::state &state, dcon::state_instance_id sid, dcon::nation_id n)
int32_t factory_priority(sys::state const &state, dcon::factory_id f)
void bound_budget_settings(sys::state &state, dcon::nation_id n)
void set_factory_priority(sys::state &state, dcon::factory_id f, int32_t priority)
void execute(sys::state &state, dcon::effect_key key, int32_t primary, int32_t this_slot, int32_t from_slot, uint32_t r_lo, uint32_t r_hi)
void take_option(sys::state &state, pending_human_n_event const &e, uint8_t opt)
void update_future_events(sys::state &state)
void execute_fif_word(interpreted_word_instance &wi, state_stack &ss, environment &env)
void run_fif_interpreter(environment &env, std::string_view on_text)
void switch_scene(sys::state &state, scene_id ui_scene)
constexpr uint32_t build_factory
constexpr uint32_t can_subsidise
constexpr uint32_t destroy_factory
constexpr uint32_t allow_foreign_investment
constexpr uint32_t factory_priority
constexpr uint32_t expand_factory
constexpr uint32_t po_status_quo
constexpr uint32_t is_not_constructing_cb
constexpr uint32_t always
bool are_allied_in_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
float truce_break_cb_prestige_cost(sys::state &state, dcon::cb_type_id t)
bool cb_conditions_satisfied(sys::state &state, dcon::nation_id actor, dcon::nation_id target, dcon::cb_type_id cb)
float primary_warscore(sys::state &state, dcon::war_id w)
void send_rebel_hunter_to_next_province(sys::state &state, dcon::army_id ar, dcon::province_id prov)
void army_arrives_in_province(sys::state &state, dcon::army_id a, dcon::province_id p, crossing_type crossing, dcon::land_battle_id from)
void add_to_war(sys::state &state, dcon::war_id w, dcon::nation_id n, bool as_attacker, bool on_war_creation)
float directed_warscore(sys::state &state, dcon::war_id w, dcon::nation_id primary, dcon::nation_id secondary)
void end_battle(sys::state &state, dcon::land_battle_id b, battle_result result)
dcon::pop_id find_available_soldier(sys::state &state, dcon::province_id p, dcon::culture_id pop_culture)
bool has_truce_with(sys::state &state, dcon::nation_id attacker, dcon::nation_id target)
float cb_addition_infamy_cost(sys::state &state, dcon::war_id war, dcon::cb_type_id type, dcon::nation_id from, dcon::nation_id target, dcon::state_definition_id cb_state)
bool standard_war_joining_is_possible(sys::state &state, dcon::war_id wfor, dcon::nation_id n, bool as_attacker)
dcon::nation_id get_naval_battle_lead_defender(sys::state &state, dcon::naval_battle_id b)
war_role get_role(sys::state const &state, dcon::war_id w, dcon::nation_id n)
bool can_retreat_from_battle(sys::state &state, dcon::naval_battle_id battle)
void update_battle_leaders(sys::state &state, dcon::land_battle_id b)
bool is_attacker(sys::state &state, dcon::war_id w, dcon::nation_id n)
float truce_break_cb_infamy(sys::state &state, dcon::cb_type_id t, dcon::nation_id target, dcon::state_definition_id cb_state)
void cleanup_navy(sys::state &state, dcon::navy_id n)
bool joining_as_attacker_would_break_truce(sys::state &state, dcon::nation_id a, dcon::war_id w)
bool is_defender_wargoal(sys::state const &state, dcon::war_id w, dcon::wargoal_id wg)
dcon::nation_id get_land_battle_lead_attacker(sys::state &state, dcon::land_battle_id b)
void add_wargoal(sys::state &state, dcon::war_id wfor, dcon::nation_id added_by, dcon::nation_id target, dcon::cb_type_id type, dcon::state_definition_id sd, dcon::national_identity_id tag, dcon::nation_id secondary_nation)
bool can_embark_onto_sea_tile(sys::state &state, dcon::nation_id from, dcon::province_id p, dcon::army_id a)
sys::date arrival_time_to(sys::state &state, dcon::army_id a, dcon::province_id p)
dcon::war_id find_war_between(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
dcon::war_id create_war(sys::state &state, dcon::nation_id primary_attacker, dcon::nation_id primary_defender, dcon::cb_type_id primary_wargoal, dcon::state_definition_id primary_wargoal_state, dcon::national_identity_id primary_wargoal_tag, dcon::nation_id primary_wargoal_secondary)
dcon::nation_id get_naval_battle_lead_attacker(sys::state &state, dcon::naval_battle_id b)
bool cb_instance_conditions_satisfied(sys::state &state, dcon::nation_id actor, dcon::nation_id target, dcon::cb_type_id cb, dcon::state_definition_id st, dcon::national_identity_id tag, dcon::nation_id secondary)
float truce_break_cb_militancy(sys::state &state, dcon::cb_type_id t)
void start_mobilization(sys::state &state, dcon::nation_id n)
void call_attacker_allies(sys::state &state, dcon::war_id wfor)
bool are_at_war(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
bool defenders_have_non_status_quo_wargoal(sys::state const &state, dcon::war_id w)
void end_mobilization(sys::state &state, dcon::nation_id n)
dcon::leader_id make_new_leader(sys::state &state, dcon::nation_id n, bool is_general)
void cleanup_army(sys::state &state, dcon::army_id n)
bool joining_war_does_not_violate_constraints(sys::state const &state, dcon::nation_id a, dcon::war_id w, bool as_attacker)
void implement_peace_offer(sys::state &state, dcon::peace_offer_id offer)
void call_defender_allies(sys::state &state, dcon::war_id wfor)
bool is_civil_war(sys::state const &state, dcon::war_id w)
dcon::nation_id get_land_battle_lead_defender(sys::state &state, dcon::land_battle_id b)
bool defenders_have_status_quo_wargoal(sys::state const &state, dcon::war_id w)
bool war_goal_would_be_duplicate(sys::state &state, dcon::nation_id source, dcon::war_id w, dcon::nation_id target, dcon::cb_type_id cb_type, dcon::state_definition_id cb_state, dcon::national_identity_id cb_tag, dcon::nation_id cb_secondary_nation)
int32_t cost_of_peace_offer(sys::state &state, dcon::peace_offer_id offer)
bool cb_requires_selection_of_a_state(sys::state const &state, dcon::cb_type_id t)
dcon::navy_id find_embark_target(sys::state &state, dcon::nation_id from, dcon::province_id p, dcon::army_id a)
constexpr uint8_t is_banned
constexpr uint8_t level_friendly
uint8_t decrease_level(uint8_t v)
constexpr uint8_t is_discredited
constexpr uint8_t priority_zero
constexpr uint8_t level_opposed
constexpr uint8_t level_hostile
constexpr uint8_t priority_three
uint8_t increase_level(uint8_t v)
constexpr uint8_t priority_one
constexpr uint8_t level_in_sphere
constexpr uint8_t level_mask
int32_t get_level(sys::state &state, dcon::nation_id gp, dcon::nation_id target)
constexpr uint8_t priority_two
bool is_influence_level_greater_or_equal(int32_t l, int32_t r)
void remove_cores_from_owned(sys::state &state, dcon::nation_id n, dcon::national_identity_id tag)
void cleanup_crisis_peace_offer(sys::state &state, dcon::peace_offer_id peace)
bool is_great_power(sys::state const &state, dcon::nation_id id)
void enact_reform(sys::state &state, dcon::nation_id source, dcon::reform_option_id r)
void break_alliance(sys::state &state, dcon::diplomatic_relation_id rel)
bool can_release_as_vassal(sys::state const &state, dcon::nation_id n, dcon::national_identity_id releasable)
void adjust_prestige(sys::state &state, dcon::nation_id n, float delta)
void crisis_state_transition(sys::state &state, sys::crisis_state new_state)
bool is_involved_in_crisis(sys::state const &state, dcon::nation_id n)
void release_vassal(sys::state &state, dcon::overlord_id rel)
bool are_allied(sys::state &state, dcon::nation_id a, dcon::nation_id b)
void crisis_add_wargoal(std::vector< sys::full_wg > &list, sys::full_wg wg)
void adjust_foreign_investment(sys::state &state, dcon::nation_id great_power, dcon::nation_id target, float delta)
void liberate_nation_from(sys::state &state, dcon::national_identity_id liberated, dcon::nation_id from)
void enact_issue(sys::state &state, dcon::nation_id source, dcon::issue_option_id i)
void update_cached_values(sys::state &state)
void make_civilized(sys::state &state, dcon::nation_id n)
void adjust_relationship(sys::state &state, dcon::nation_id a, dcon::nation_id b, float delta)
int32_t national_focuses_in_use(sys::state &state, dcon::nation_id n)
void cleanup_crisis(sys::state &state)
dcon::technology_id current_research(sys::state const &state, dcon::nation_id n)
int32_t max_national_focuses(sys::state &state, dcon::nation_id n)
auto nation_accepts_culture(sys::state const &state, T ids, U cul_ids)
dcon::mp_player_id find_country_player(sys::state &state, dcon::nation_id nation)
void update_mp_player_password(sys::state &state, dcon::mp_player_id player_id, sys::player_password_raw &password)
dcon::mp_player_id find_mp_player(sys::state &state, sys::player_name name)
void clear_socket(sys::state &state, client_data &client)
dcon::mp_player_id create_mp_player(sys::state &state, sys::player_name &name, sys::player_password_raw &password)
void kick_player(sys::state &state, client_data &client)
void switch_player(sys::state &state, dcon::nation_id new_n, dcon::nation_id old_n)
void ban_player(sys::state &state, client_data &client)
void full_reset_after_oos(sys::state &state)
void log_player_nations(sys::state &state)
void post(sys::state &state, message &&m)
bool can_enact_social_reform(sys::state &state, dcon::nation_id n, dcon::issue_option_id o)
bool can_enact_political_reform(sys::state &state, dcon::nation_id nation, dcon::issue_option_id issue_option)
bool can_appoint_ruling_party(sys::state &state, dcon::nation_id nation)
bool political_party_is_active(sys::state &state, dcon::nation_id n, dcon::political_party_id p)
bool can_enact_military_reform(sys::state &state, dcon::nation_id n, dcon::reform_option_id o)
void appoint_ruling_party(sys::state &state, dcon::nation_id n, dcon::political_party_id p)
void start_election(sys::state &state, dcon::nation_id n)
bool is_election_ongoing(sys::state &state, dcon::nation_id nation)
bool can_enact_economic_reform(sys::state &state, dcon::nation_id n, dcon::reform_option_id o)
void set_militancy(sys::state &state, dcon::pop_id p, float v)
float get_militancy(sys::state const &state, dcon::pop_id p)
std::vector< dcon::province_id > make_land_path(sys::state &state, dcon::province_id start, dcon::province_id end, dcon::nation_id nation_as, dcon::army_id a)
void upgrade_colonial_state(sys::state &state, dcon::nation_id source, dcon::state_instance_id si)
bool can_build_railroads(sys::state &state, dcon::province_id id, dcon::nation_id n)
void update_connected_regions(sys::state &state)
bool has_access_to_province(sys::state &state, dcon::nation_id nation_as, dcon::province_id prov)
bool is_overseas(sys::state const &state, dcon::province_id ids)
bool is_colonizing(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
void for_each_province_in_state_instance(sys::state &state, dcon::state_instance_id s, F const &func)
bool can_build_province_building(sys::state &state, dcon::province_id id, dcon::nation_id n, economy::province_building_type t)
bool can_integrate_colony(sys::state &state, dcon::state_instance_id id)
bool state_is_coastal(sys::state &state, dcon::state_instance_id s)
bool can_build_fort(sys::state &state, dcon::province_id id, dcon::nation_id n)
bool can_start_colony(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
void update_cached_values(sys::state &state)
std::vector< dcon::province_id > make_naval_path(sys::state &state, dcon::province_id start, dcon::province_id end)
std::vector< dcon::province_id > make_unowned_land_path(sys::state &state, dcon::province_id start, dcon::province_id end)
bool can_invest_in_colony(sys::state &state, dcon::nation_id n, dcon::state_definition_id d)
bool has_naval_access_to_province(sys::state &state, dcon::nation_id nation_as, dcon::province_id prov)
bool can_build_naval_base(sys::state &state, dcon::province_id id, dcon::nation_id n)
void change_province_owner(sys::state &state, dcon::province_id id, dcon::nation_id new_owner)
void increase_colonial_investment(sys::state &state, dcon::nation_id source, dcon::state_definition_id state_def)
void suppress_movement(sys::state &state, dcon::nation_id n, dcon::movement_id m)
dcon::movement_id get_movement_by_independence(sys::state &state, dcon::nation_id n, dcon::national_identity_id i)
float get_suppression_point_cost(sys::state &state, dcon::movement_id m)
dcon::movement_id get_movement_by_position(sys::state &state, dcon::nation_id n, dcon::issue_option_id o)
void toggle_modifier_from_province(sys::state &state, dcon::province_id target_prov, dcon::modifier_id mod_id, sys::date expiration)
uint8_t * write_save_section(uint8_t *ptr_in, sys::state &state)
uint8_t const * read_save_section(uint8_t const *ptr_in, uint8_t const *section_end, sys::state &state)
void write_save_file(sys::state &state, save_type type, std::string const &name)
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
int32_t to_generic(dcon::province_id v)
bool evaluate(sys::state &state, dcon::trigger_key key, int32_t primary, int32_t this_slot, int32_t from_slot)
std::string format_fif_value(sys::state &state, int64_t data, int32_t type)
void effect_description(sys::state &state, text::layout_base &layout, dcon::effect_key k, int32_t primary_slot, int32_t this_slot, int32_t from_slot, uint32_t r_lo, uint32_t r_hi)
constexpr uint32_t max_chat_message_len
void initialize_console_fif_environment(sys::state &state)
void close_window(sys::state &game_state)
sys::checksum_key checksum
int8_t domestic_investment
int8_t administrative_spending
int8_t construction_spending
int8_t education_spending
dcon::state_definition_id target_state
dcon::regiment_id regs[num_packed_units]
dcon::ship_id ships[num_packed_units]
dcon::unit_type_id new_type
char body[ui::max_chat_message_len]
dcon::national_identity_id cb_tag
dcon::state_definition_id cb_state
dcon::nation_id cb_secondary_nation
dcon::state_instance_id location
dcon::factory_type_id type
dcon::province_id location
dcon::factory_type_id type
dcon::nation_id influence_target
dcon::nation_id gp_target
dcon::nation_id influence_target
dcon::culture_id pop_culture
dcon::province_id template_province
dcon::province_id location
diplomatic_message::type type
dcon::national_identity_id tag
dcon::issue_option_id iopt
dcon::national_focus_id focus
dcon::state_instance_id target_state
dcon::province_id template_province
dcon::province_id location
dcon::cb_type_id primary_cb
dcon::state_definition_id cb_state
dcon::national_identity_id cb_tag
bool call_attacker_allies
dcon::nation_id cb_secondary_nation
dcon::state_definition_id cb_state
dcon::nation_id cb_secondary_nation
dcon::national_identity_id cb_tag
sys::player_name player_name
sys::player_password_raw player_password
sys::checksum_key checksum
sys::checksum_key checksum
union command::payload::dtype data
dcon::free_national_event_id e
dcon::free_provincial_event_id e
dcon::national_event_id e
dcon::provincial_event_id e
dcon::political_party_id p
dcon::province_id location
economy::province_building_type type
dcon::province_id location
dcon::factory_type_id factory
dcon::regiment_id regs[num_packed_units]
dcon::ship_id ships[num_packed_units]
dcon::state_definition_id state
dcon::national_identity_id ident
Holds data regarding a diplomatic message between two specified nations at a certain date,...
static constexpr uint32_t set_size
dcon::free_national_event_id e
dcon::free_provincial_event_id e
dcon::national_event_id e
dcon::provincial_event_id e
dcon::nation_id target_nation
dcon::nation_id secondary_nation
dcon::national_identity_id wg_tag
dcon::state_definition_id state
Holds important data about the game world, state, and other data regarding windowing,...
war_target_data war_target
influence_priority_data influence_priority
rally_point_data rally_point
new_general_data new_general
pending_human_p_event_data pending_human_p_event
call_to_arms_data call_to_arms
set_factory_priority_data set_factory_priority_data
naval_battle_data naval_battle
pending_human_f_p_event_data pending_human_f_p_event
army_movement_data army_movement
generic_location_data generic_location
budget_settings_data budget_data
split_regiments_data split_regiments
new_admiral_data new_admiral
split_ships_data split_ships
land_battle_data land_battle
change_unit_type_data change_unit_type
nation_pick_data nation_pick
state_transfer_data state_transfer
national_focus_data nat_focus
influence_action_data influence_action
crisis_invitation_data crisis_invitation
pending_human_f_n_event_data pending_human_f_n_event
naval_unit_construction_data naval_unit_construction
new_war_goal_data new_war_goal
province_building_data start_province_building
crisis_join_data crisis_join
chat_message_data chat_message
political_party_data political_party
pending_human_n_event_data pending_human_n_event
diplo_action_data diplo_action
stockpile_settings_data stockpile_settings
notify_reload_data notify_reload
advance_tick_data advance_tick
navy_movement_data navy_movement
factory_building_data start_factory_building
land_unit_construction_data land_unit_construction
make_leader_data make_leader
notify_save_loaded_data notify_save_loaded
offer_wargoal_data offer_wargoal
tag_target_data tag_target
start_research_data start_research
cb_fabrication_data cb_fabrication
notify_leaves_data notify_leave
notify_joins_data notify_join
merge_navy_data merge_navy
reform_selection_data reform_selection
merge_army_data merge_army
issue_selection_data issue_selection