8#include "fif_dcon_generated.hpp"
11#define STB_IMAGE_WRITE_IMPLEMENTATION 1
12#include "stb_image_write.h"
17 parent->impl_get(state, output);
31 std::string up = up_history();
33 this->set_text(
state, up);
34 auto index = int32_t(up.size());
35 this->edit_index_position(
state, index);
39 std::string down = down_history();
41 this->set_text(
state, down);
42 auto index = int32_t(down.size());
43 this->edit_index_position(
state, index);
51 auto buffer_position = func(buffer.get(), state);
52 size_t total_size_used =
reinterpret_cast<uint8_t*
>(buffer_position) - buffer.get();
63 if(state->ui_state.console_window) {
81 if(!state->ui_state.fps_counter) {
82 auto fps_counter = ui::make_element_by_type<ui::fps_counter_text_box>(*state,
"fps_counter");
83 state->ui_state.fps_counter = fps_counter.get();
84 state->ui_state.root->add_child_to_front(std::move(fps_counter));
88 state->ui_state.fps_counter->set_visible(*state,
true);
89 state->ui_state.root->move_child_to_front(state->ui_state.fps_counter);
91 state->ui_state.fps_counter->set_visible(*state,
false);
109 dcon::nation_id to_nation;
110 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
111 if(to_nation && to_nation != state->local_player_nation && to_nation != state->world.national_identity_get_nation_from_identity_holder(state->national_definitions.rebel_id)) {
112 if(state->local_player_nation)
113 state->world.nation_set_is_player_controlled(state->local_player_nation,
false);
115 state->local_player_nation = to_nation;
116 state->world.nation_set_is_player_controlled(to_nation,
true);
134 dcon::nation_id to_nation = state->world.national_identity_get_nation_from_identity_holder(state->national_definitions.rebel_id);
136 if(state->local_player_nation)
137 state->world.nation_set_is_player_controlled(state->local_player_nation,
false);
139 state->local_player_nation = to_nation;
159 dcon::nation_id to_nation;
160 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
163 if(westernize_status && state->world.nation_get_is_civilized(to_nation) ==
false)
165 else if(!westernize_status && state->world.nation_get_is_civilized(to_nation) ==
true)
182 state->last_crisis_end_date =
sys::date{};
185 float max_tension = 0.0f;
186 dcon::state_instance_id max_state;
187 for(
auto si : state->world.in_state_instance) {
188 if(si.get_flashpoint_tension() > max_tension && si.get_nation_from_state_ownership().get_is_at_war() ==
false && si.get_flashpoint_tag().get_nation_from_identity_holder().get_is_at_war() ==
false) {
189 max_tension = si.get_flashpoint_tension();
194 for(
auto si : state->world.in_state_instance) {
195 if(si.get_flashpoint_tag() && !si.get_nation_from_state_ownership().get_is_great_power() && si.get_nation_from_state_ownership().get_is_at_war() ==
false && si.get_flashpoint_tag().get_nation_from_identity_holder().get_is_at_war() ==
false) {
202 state->world.state_instance_set_flashpoint_tension(max_state, 10000.0f / state->defines.crisis_base_chance);
223 memcpy(&mvalue, &ivalue, 4);
226 dcon::nation_id to_nation;
227 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
230 for(
auto pr : state->world.nation_get_province_ownership(to_nation))
231 for(
auto pop : pr.get_province().get_pop_location())
250 memcpy(&mvalue, &ivalue, 4);
253 dcon::nation_id to_nation;
254 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
257 for(
auto pr : state->world.nation_get_province_ownership(to_nation))
258 for(
auto pop : pr.get_province().get_pop_location())
276 dcon::nation_id to_nation;
277 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
280 dcon::nation_id to_nation_b;
281 to_nation_b.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
316 state.debug_save_oos_dump();
317 state.debug_scenario_oos_dump();
322 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.river_vertices);
323 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.river_starts);
324 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.river_counts);
325 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.coastal_vertices);
326 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.coastal_starts);
327 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.coastal_counts);
328 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.border_vertices);
329 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.borders);
330 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.terrain_id_map);
331 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.province_id_map);
332 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.province_area);
333 ptr_in =
sys::serialize(ptr_in, state.map_state.map_data.diagonal_borders);
347 ptr_in =
sys::serialize(ptr_in, state.culture_definitions.party_issues);
351 ptr_in =
sys::serialize(ptr_in, state.culture_definitions.political_issues);
355 ptr_in =
sys::serialize(ptr_in, state.culture_definitions.social_issues);
359 ptr_in =
sys::serialize(ptr_in, state.culture_definitions.military_issues);
363 ptr_in =
sys::serialize(ptr_in, state.culture_definitions.economic_issues);
367 ptr_in =
sys::serialize(ptr_in, state.culture_definitions.tech_folders);
371 ptr_in =
sys::serialize(ptr_in, state.culture_definitions.crimes);
401 ptr_in =
sys::serialize(ptr_in, state.military_definitions.unit_base_definitions);
422 ptr_in =
sys::serialize(ptr_in, state.national_definitions.flag_variable_names);
423 ptr_in =
sys::serialize(ptr_in, state.national_definitions.global_flag_variable_names);
424 ptr_in =
sys::serialize(ptr_in, state.national_definitions.variable_names);
425 ptr_in =
sys::serialize(ptr_in, state.national_definitions.triggered_modifiers);
471 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_yearly_pulse);
472 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_quarterly_pulse);
473 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_battle_won);
474 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_battle_lost);
475 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_surrender);
476 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_new_great_nation);
477 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_lost_great_nation);
478 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_election_tick);
479 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_colony_to_state);
480 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_state_conquest);
481 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_colony_to_state_free_slaves);
482 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_debtor_default);
483 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_debtor_default_small);
484 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_debtor_default_second);
485 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_civilize);
486 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_my_factories_nationalized);
487 ptr_in =
sys::serialize(ptr_in, state.national_definitions.on_crisis_declare_interest);
491 ptr_in =
sys::serialize(ptr_in, state.province_definitions.canals);
492 ptr_in =
sys::serialize(ptr_in, state.province_definitions.terrain_to_gfx_map);
548 ptr_in =
sys::serialize(ptr_in, state.font_collection.font_names);
551 log_to_console(state, state.ui_state.console_window,
"Check \"My Documents\\Project Alice\\oos\" for the OOS dump");
571 state->cheat_data.always_allow_wargoals = toggle_state;
588 state->cheat_data.always_allow_reforms = toggle_state;
605 state->cheat_data.always_accept_deals = toggle_state;
622 state->cheat_data.always_allow_decisions = toggle_state;
639 state->cheat_data.daily_oos_check = toggle_state;
656 state->cheat_data.always_potential_decisions = toggle_state;
674 for(
const auto e : state->world.in_national_event) {
675 e.set_auto_choice(1);
677 for(
const auto e : state->world.in_free_national_event) {
678 e.set_auto_choice(1);
680 for(
const auto e : state->world.in_provincial_event) {
681 e.set_auto_choice(1);
683 for(
const auto e : state->world.in_free_provincial_event) {
684 e.set_auto_choice(1);
687 for(
const auto e : state->world.in_national_event) {
688 e.set_auto_choice(0);
690 for(
const auto e : state->world.in_free_national_event) {
691 e.set_auto_choice(0);
693 for(
const auto e : state->world.in_provincial_event) {
694 e.set_auto_choice(0);
696 for(
const auto e : state->world.in_free_provincial_event) {
697 e.set_auto_choice(0);
713 dcon::nation_id to_nation;
714 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
717 for(
uint32_t i = state->world.province_building_construction_size(); i-- > 0;) {
718 dcon::province_building_construction_id c{ dcon::province_building_construction_id::value_base_t(i) };
720 if(state->world.province_building_construction_get_nation(c) != to_nation)
724 auto const& base_cost = state->economy_definitions.building_definitions[int32_t(t)].cost;
725 auto& current_purchased = state->world.province_building_construction_get_purchased_goods(c);
727 current_purchased.commodity_amounts[j] = base_cost.commodity_amounts[j] * 2.f;
747 dcon::nation_id to_nation;
748 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
751 auto pos = std::find(
752 state->cheat_data.instant_research_nations.begin(),
753 state->cheat_data.instant_research_nations.end(),
756 if(toggle_state && pos == state->cheat_data.instant_research_nations.end()) {
757 state->cheat_data.instant_research_nations.push_back(to_nation);
758 }
else if(!toggle_state && pos != state->cheat_data.instant_research_nations.end()) {
759 state->cheat_data.instant_research_nations.erase(pos);
777 dcon::nation_id to_nation;
778 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
781 dcon::nation_id to_nation_b;
782 to_nation_b.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
785 auto target_owns = state->world.nation_get_province_ownership(to_nation);
787 while(target_owns.begin() != target_owns.end()) {
788 auto prov = (*target_owns.begin()).get_province();
807 dcon::nation_id to_nation;
808 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
811 dcon::province_id prov;
812 prov.value = dcon::province_id::value_base_t(s.
main_data_back(0));
815 province::add_core(*state, prov, state->world.nation_get_identity_from_identity_holder(to_nation));
831 dcon::nation_id to_nation;
832 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
835 dcon::province_id prov;
836 prov.value = dcon::province_id::value_base_t(s.
main_data_back(0));
839 province::remove_core(*state, prov, state->world.nation_get_identity_from_identity_holder(to_nation));
855 dcon::nation_id to_nation;
856 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
859 dcon::province_id prov;
860 prov.value = dcon::province_id::value_base_t(s.
main_data_back(0));
879 dcon::nation_id to_nation;
880 to_nation.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
883 dcon::province_id prov;
884 prov.value = dcon::province_id::value_base_t(s.
main_data_back(0));
905 state->cheat_data.instant_army = toggle_state;
922 state->cheat_data.instant_navy = toggle_state;
939 state->cheat_data.instant_industry = toggle_state;
956 state->current_date += int32_t(days);
973 bool opt_sea_lines =
true;
974 bool opt_province_lines =
true;
975 bool opt_blend =
true;
978 opt_sea_lines =
false;
979 opt_province_lines =
false;
980 }
else if(type ==1) {
982 }
else if(type == 2) {
983 opt_sea_lines =
false;
984 }
else if(type == 3) {
985 opt_sea_lines =
false;
987 }
else if(type == 4) {
988 opt_sea_lines =
false;
989 opt_province_lines =
false;
993 auto total_px = state->map_state.map_data.size_x * state->map_state.map_data.size_y;
994 auto buffer = std::unique_ptr<uint8_t[]>(
new uint8_t[total_px * 3]);
995 auto blend_fn = [&](
uint32_t idx,
bool sea_a,
bool sea_b, dcon::province_id pa, dcon::province_id pb) {
997 buffer[idx * 3 + 0] = 0;
998 buffer[idx * 3 + 1] = 0;
999 buffer[idx * 3 + 2] = 0;
1002 if(((sea_a || sea_b) && opt_sea_lines)
1004 || (opt_province_lines && !sea_a && !sea_b)) {
1006 buffer[idx * 3 + 0] &= 0x7f;
1007 buffer[idx * 3 + 1] &= 0x7f;
1008 buffer[idx * 3 + 2] &= 0x7f;
1010 buffer[idx * 3 + 0] = 0;
1011 buffer[idx * 3 + 1] = 0;
1012 buffer[idx * 3 + 2] = 0;
1019 auto idx = y *
uint32_t(state->map_state.map_data.size_x) + x;
1021 bool p_is_sea = state->map_state.map_data.province_id_map[idx] >=
province::to_map_id(state->province_definitions.first_sea_province);
1023 buffer[idx * 3 + 0] = 128;
1024 buffer[idx * 3 + 1] = 128;
1025 buffer[idx * 3 + 2] = 255;
1027 auto owner = state->world.province_get_nation_from_province_ownership(p);
1029 auto owner_color = state->world.nation_get_color(owner);
1030 buffer[idx * 3 + 0] =
uint8_t(owner_color & 0xff);
1031 buffer[idx * 3 + 1] =
uint8_t((owner_color >> 8) & 0xff) & 0xff;
1032 buffer[idx * 3 + 2] =
uint8_t((owner_color >> 16) & 0xff) & 0xff;
1034 buffer[idx * 3 + 0] = 170;
1035 buffer[idx * 3 + 1] = 170;
1036 buffer[idx * 3 + 2] = 170;
1039 if(x <
uint32_t(state->map_state.map_data.size_x - 1)) {
1040 auto br_idx = idx +
uint32_t(state->map_state.map_data.size_x);
1041 if(br_idx < total_px) {
1043 bool br_is_sea = state->map_state.map_data.province_id_map[br_idx] >=
province::to_map_id(state->province_definitions.first_sea_province);
1044 blend_fn(idx, br_is_sea, p_is_sea, br_p, p);
1046 auto rs_idx = idx + 1;
1047 if(rs_idx < total_px) {
1049 bool br_is_sea = state->map_state.map_data.province_id_map[rs_idx] >=
province::to_map_id(state->province_definitions.first_sea_province);
1050 blend_fn(idx, br_is_sea, p_is_sea, br_p, p);
1055 stbi_flip_vertically_on_write(
true);
1056 auto func = [](
void*,
void* ptr_in,
int size) ->
void {
1060 stbi_write_png_to_func(func,
nullptr,
int(state->map_state.map_data.size_x),
int(state->map_state.map_data.size_y), 3, buffer.get(), 0);
1074 if(state->cheat_data.ecodump) {
1075 state->cheat_data.ecodump =
false;
1077 state->cheat_data.ecodump =
true;
1079 state->world.for_each_commodity([&](dcon::commodity_id c) {
1085 state->cheat_data.prices_dump_buffer +=
"\n";
1086 state->cheat_data.demand_dump_buffer +=
"\n";
1087 state->cheat_data.supply_dump_buffer +=
"\n";
1089 log_to_console(*state, state->ui_state.console_window, state->cheat_data.ecodump ?
"✔" :
"✘");
1108 dcon::nation_id to_nation_b;
1109 to_nation_b.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
1112 dcon::free_national_event_id ev;
1113 for(
auto v : state->world.in_free_national_event) {
1114 if(v.get_legacy_id() ==
uint32_t(
id)) {
1120 e->
report_error(
"no free national event found with that id");
1142 dcon::nation_id to_nation_b;
1143 to_nation_b.value = dcon::nation_id::value_base_t(s.
main_data_back(0));
1148 s.
push_back_main(state->type_text_key, int64_t(name.value),
nullptr);
1162 e->
report_error(
"attempted to compile a definition inside a definition");
1173 dcon::value_modifier_key mkey{ dcon::value_modifier_key::value_base_t(index) };
1175 std::string name_str =
"ttest";
1192 e->
report_error(
"attempted to load a file inside a definition");
1216 if(
state.fif_environment)
1219 std::lock_guard lg{
state.lock_console_strings };
1221 state.fif_environment = std::make_unique<fif::environment>();
1223 int32_t error_count = 0;
1224 std::string error_list;
1225 state.fif_environment->report_error = [&](std::string_view s) {
1226 state.console_command_error += std::string(
"?R ERROR: ") + std::string(s) +
"?W\\n";
1234 " :struct localized i32 value ; "
1235 " :s localize text_key s: >index make localized .value! ; ",
1239 state.type_text_key =
state.fif_environment->dict.types.find(
"text_key")->second;
1240 state.type_localized_key =
state.fif_environment->dict.types.find(
"localized")->second;
1245 auto return_to_string = [&](dcon::text_key k) {
1246 std::string rvalue{
state.to_string_view(k) };
1247 for(
auto& c : rvalue) {
1253 for(
auto n :
state.world.in_national_identity) {
1256 std::string(
" : ") + tag_str +
" " + std::to_string(n.id.index()) +
" >national_identity_id identity_holder-identity nation @ ; ",
1260 for(
auto r :
state.world.in_religion) {
1262 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >religion_id ; ",
1266 for(
auto r :
state.world.in_culture) {
1268 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >culture_id ; ",
1272 for(
auto r :
state.world.in_commodity) {
1274 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >commodity_id ; ",
1278 for(
auto r :
state.world.in_ideology) {
1280 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >ideology_id ; ",
1284 for(
auto r :
state.world.in_issue) {
1286 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >issue_id ; ",
1290 for(
auto r :
state.world.in_issue_option) {
1292 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >issue_option_id ; ",
1296 for(
auto r :
state.world.in_reform) {
1298 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >reform_id ; ",
1302 for(
auto r :
state.world.in_reform_option) {
1304 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >reform_option_id ; ",
1308 for(
auto r :
state.world.in_cb_type) {
1310 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >cb_type_id ; ",
1314 for(
auto r :
state.world.in_pop_type) {
1316 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >pop_type_id ; ",
1320 for(
auto r :
state.world.in_rebel_type) {
1322 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >rebel_type_id ; ",
1326 for(
auto r :
state.world.in_government_type) {
1328 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >government_type_id ; ",
1332 for(
auto r :
state.world.in_province) {
1334 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >province_id ; ",
1338 for(
auto r :
state.world.in_state_definition) {
1340 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >state_definition_id ; ",
1344 for(
auto r :
state.world.in_technology) {
1346 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >technology_id ; ",
1350 for(
auto r :
state.world.in_invention) {
1352 std::string(
" : ") + return_to_string(r.get_name()) +
" " + std::to_string(r.id.index()) +
" >invention_id ; ",
1361 auto nation_id_type =
state.fif_environment->dict.types.find(
"nation_id")->second;
1362 auto prov_id_type =
state.fif_environment->dict.types.find(
"province_id")->second;
1402 " : no-sea-line 0 ; : no-blend 1 ; : no-sea-line-2 2 ; : blend-no-sea 3 ; : vanilla 4 ; ",
1405 " :s name nation_id s: nation-name ; ",
1409 " : player " + std::to_string(offsetof(
sys::state, local_player_nation)) +
" state-ptr @ buf-add ptr-cast ptr(nation_id) ; ",
1417 return std::to_string(data);
1419 return std::to_string(
uint64_t(data));
1422 memcpy(&v, &data, 4);
1423 return std::to_string(v);
1426 memcpy(&v, &data, 8);
1427 return std::to_string(v);
1434 }
else if(type ==
state.type_text_key) {
1436 k.value = dcon::text_key::value_base_t(data);
1437 return std::string(
"\"") + std::string(
state.to_string_view(k)) +
"\"";
1438 }
else if(type ==
state.type_localized_key) {
1440 dcon::text_key k{ localized_index };
1444 std::string_view sv;
1445 if(
auto it =
state.locale_key_to_text_sequence.find(k); it !=
state.locale_key_to_text_sequence.end()) {
1446 return std::string(
"\"") + std::string{
state.locale_string_view(it->second) } +
"\"";
1448 return std::string(
"\"") + std::string{
state.to_string_view(k) } +
"\"";
1450 }
else if(type == -1) {
1455 if(
state.fif_environment->dict.type_array[type].decomposed_types_count >= 2) {
1456 auto main_type =
state.fif_environment->dict.all_stack_types[
state.fif_environment->dict.type_array[type].decomposed_types_start];
1458 return std::string(
"#ptr");
1460 return std::string(
"#struct");
1470 edit_box_update(
state, s);
1477 std::lock_guard lg{
state.lock_console_strings };
1478 state.console_command_pending += s;
1479 state.console_command_pending +=
" ";
1483 std::lock_guard lg{
state.lock_console_strings };
1484 state.console_command_pending += s;
1485 add_to_history(
state,
state.console_command_pending);
1488 edit_box_update(
state, s);
std::vector< word > word_array
ankerl::unordered_dense::map< std::string, int32_t > words
std::function< void(std::string_view)> report_error
std::vector< std::string_view > source_stack
virtual int64_t main_data_back(size_t index) const =0
virtual void pop_main()=0
virtual void push_back_main(int32_t type, int64_t data, LLVMValueRef expr)=0
void edit_box_update(sys::state &state, std::string_view s) noexcept override
void edit_box_tab(sys::state &state, std::string_view s) noexcept override
void edit_box_enter(sys::state &state, std::string_view s) noexcept override
void edit_box_down(sys::state &state) noexcept override
void edit_box_up(sys::state &state) noexcept override
void edit_box_back_slash(sys::state &state) noexcept override
void edit_box_esc(sys::state &state) noexcept override
void edit_box_backtick(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
static void show_toggle(sys::state &state)
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_visible(sys::state &state, bool vis)
#define assert(condition)
int32_t * f_cheat_factories(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_cheat_deals(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_set_controller(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * load_file(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_end_game(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_conquer(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_clear(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_spectate(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_fire_event(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_add_days(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_make_allied(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_change_tag(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_set_owner(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_dump_oos(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_cheat_navy(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_cheat_decisions(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_dump_econ(fif::state_stack &s, int32_t *p, fif::environment *e)
void write_single_component(sys::state &state, native_string_view filename, F &&func)
int32_t * f_set_westernized(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_make_core(fif::state_stack &s, int32_t *p, fif::environment *e)
void log_to_console(sys::state &state, ui::element_base *parent, std::string_view s) noexcept
int32_t * f_set_mil(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_nation_name(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_cheat_reforms(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * compile_modifier(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_cheat_army(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_save_map(fif::state_stack &s, int32_t *ptr, fif::environment *e)
int32_t * f_set_auto_choice(fif::state_stack &s, int32_t *p, fif::environment *env)
int32_t * f_fps(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_daily_oos(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_complete_construction(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_cheat_wargoals(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_instant_research(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_cheat_decision_potential(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_set_con(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_remove_core(fif::state_stack &s, int32_t *p, fif::environment *e)
int32_t * f_make_crisis(fif::state_stack &s, int32_t *p, fif::environment *e)
void remove_ai_data(sys::state &state, dcon::nation_id n)
void notify_console_command(sys::state &state)
void trigger_national_event(sys::state &state, dcon::national_event_id e, dcon::nation_id n, uint32_t r_lo, uint32_t r_hi, int32_t primary_slot, slot_type pt, int32_t from_slot, slot_type ft)
std::string multiplicative_modifier(sys::state &state, dcon::value_modifier_key modifier)
void run_fif_interpreter(environment &env, std::string_view on_text)
constexpr int32_t fif_ptr
constexpr int32_t fif_i32
constexpr int32_t fif_u16
parse_result read_token(std::string_view &source, environment &env)
constexpr int32_t fif_u32
constexpr int32_t fif_bool
void common_fif_environment(sys::state &state, fif::environment &env)
bool typechecking_mode(fif_mode m)
void add_import(std::string_view name, void *ptr, fif_call interpreter_implementation, std::vector< int32_t > const ¶ms, std::vector< int32_t > const &returns, environment &env)
var_data * get_global_var(environment &env, std::string const &name)
constexpr int32_t fif_type
bool typechecking_failed(fif_mode m)
constexpr int32_t fif_f32
constexpr int32_t fif_opaque_ptr
constexpr int32_t fif_i16
constexpr int32_t fif_u64
constexpr int32_t fif_i64
constexpr int32_t fif_f64
void switch_scene(sys::state &state, scene_id ui_scene)
void make_uncivilized(sys::state &state, dcon::nation_id n)
std::string int_to_tag(uint32_t v)
void daily_update_flashpoint_tension(sys::state &state)
void monthly_flashpoint_update(sys::state &state)
void make_alliance(sys::state &state, dcon::nation_id a, dcon::nation_id b)
void make_civilized(sys::state &state, dcon::nation_id n)
void update_crisis(sys::state &state)
void set_militancy(sys::state &state, dcon::pop_id p, float v)
void set_consciousness(sys::state &state, dcon::pop_id p, float v)
void add_core(sys::state &state, dcon::province_id prov, dcon::national_identity_id tag)
void remove_core(sys::state &state, dcon::province_id prov, dcon::national_identity_id tag)
constexpr dcon::province_id from_map_id(uint16_t id)
void set_province_controller(sys::state &state, dcon::province_id p, dcon::nation_id n)
void conquer_province(sys::state &state, dcon::province_id id, dcon::nation_id new_owner)
constexpr uint16_t to_map_id(dcon::province_id id)
native_string utf8_to_native(std::string_view data_in)
void write_file(directory const &dir, native_string_view file_name, char const *file_data, uint32_t file_size)
directory get_or_create_oos_directory()
std::optional< file > open_file(directory const &dir, native_string_view file_name)
directory get_or_create_root_documents()
file_contents view_contents(file const &f)
audio_instance & get_console_open_sound(sys::state &state)
audio_instance & get_console_close_sound(sys::state &state)
void play_interface_sound(sys::state &state, audio_instance &s, float volume)
scenario_size sizeof_scenario_section(sys::state &state)
uint8_t * memcpy_serialize(uint8_t *ptr_in, T const &obj)
uint8_t * serialize(uint8_t *ptr_in, std::vector< T > const &vec)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
std::string format_fif_value(sys::state &state, int64_t data, int32_t type)
void initialize_console_fif_environment(sys::state &state)
void change_cursor(sys::state &state, cursor_type type)
std::string_view native_string_view
static constexpr uint32_t set_size
std::unique_ptr< element_base > root
element_base * console_window