13 parse_trigger_body(gen, err, context);
23 parse_trigger_body(gen, err, context);
32 parse_trigger_body(gen, err, context);
42 parse_trigger_body(gen, err, context);
50 parse_trigger_body(gen, err, context);
74 parse_trigger_body(gen, err, context);
93 parse_trigger_body(gen, err, context);
111 parse_trigger_body(gen, err, context);
121 parse_trigger_body(gen, err, context);
132 parse_trigger_body(gen, err, context);
143 parse_trigger_body(gen, err, context);
156 parse_trigger_body(gen, err, context);
169 parse_trigger_body(gen, err, context);
190 parse_trigger_body(gen, err, context);
212 parse_trigger_body(gen, err, context);
225 parse_trigger_body(gen, err, context);
241 parse_trigger_body(gen, err, context);
246 err.
accumulated_errors +=
"any_substate trigger scope used in an incorrect scope type " +
257 parse_trigger_body(gen, err, context);
262 err.
accumulated_errors +=
"any_sphere_member trigger scope used in an incorrect scope type " +
284 parse_trigger_body(gen, err, context);
296 parse_trigger_body(gen, err, context);
310 parse_trigger_body(gen, err, context);
323 parse_trigger_body(gen, err, context);
347 parse_trigger_body(gen, err, context);
357 parse_trigger_body(gen, err, context);
370 parse_trigger_body(gen, err, context);
384 parse_trigger_body(gen, err, context);
394 err.
accumulated_errors +=
"controller trigger scope used in an incorrect scope type " +
403 parse_trigger_body(gen, err, context);
416 parse_trigger_body(gen, err, context);
431 parse_trigger_body(gen, err, context);
456 parse_trigger_body(gen, err, context);
470 err.
accumulated_errors +=
"capital_scope trigger scope used in an incorrect scope type " +
479 parse_trigger_body(gen, err, context);
504 parse_trigger_body(gen, err, context);
529 parse_trigger_body(gen, err, context);
540 parse_trigger_body(gen, err, context);
557 err.
accumulated_errors +=
"cultural_union trigger scope used in an incorrect scope type " +
566 parse_trigger_body(gen, err, context);
577 parse_trigger_body(gen, err, context);
593 parse_trigger_body(gen, err, context);
598 err.
accumulated_errors +=
"sphere_owner trigger scope used in an incorrect scope type " +
611 parse_trigger_body(gen, err, context);
617 err.
accumulated_errors +=
"independence trigger scope used in an incorrect scope type " +
630 parse_trigger_body(gen, err, context);
636 err.
accumulated_errors +=
"flashpoint_tag_scope trigger scope used in an incorrect scope type " +
648 parse_trigger_body(gen, err, context);
659 parse_trigger_body(gen, err, context);
671 err.
accumulated_errors +=
"state_scope trigger scope used in an incorrect scope type " +
680 parse_trigger_body(gen, err, context);
686 std::string label_str{name};
697 parse_trigger_body(gen, err, context);
711 parse_trigger_body(gen, err, context);
715 }
else if(
is_integer(name.data(), name.data() + name.length())) {
716 auto int_value =
parse_int(name, 0, err);
725 parse_trigger_body(gen, err, context);
734 }
else if(name.length() == 3) {
744 parse_trigger_body(gen, err, context);
763 auto const neg_existence_bit =
767 source[0] = uint16_t(masked_source | neg_disjunctive_bit | neg_existence_bit);
801 auto sub_units_start = first_member;
802 while(sub_units_start < source + source_size) {
806 if(new_size != old_size) {
807 std::copy(sub_units_start + old_size, source + source_size, sub_units_start + new_size);
808 source_size -= (old_size - new_size);
810 sub_units_start += new_size;
814 source[1] = uint16_t(source_size - 1);
830 auto sub_units_start = first_member;
831 while(sub_units_start < source + source_size) {
833 if(sub_units_start[0] == source[0]) {
834 std::copy(sub_units_start + 2, source + source_size, sub_units_start);
837 sub_units_start += size;
840 source[1] = uint16_t(source_size - 1);
845 std::copy(source + 2, source + source_size, source);
853 std::copy(first_member + 2, source + source_size, first_member);
881 tcontext.compiled_trigger.push_back(uint16_t(1));
882 auto payload_size_offset = tcontext.compiled_trigger.size() - 1;
884 parse_stored_condition(gen, err, tcontext);
886 tcontext.compiled_trigger[payload_size_offset] = uint16_t(tcontext.compiled_trigger.size() - payload_size_offset);
889 tcontext.compiled_trigger.resize(
static_cast<size_t>(new_size));
896 auto& prev_stored = by_name->second;
897 for(
auto e : prev_stored) {
898 if(e.main_slot == tcontext.main_slot && e.from_slot == tcontext.from_slot && e.this_slot == tcontext.this_slot) {
899 err.
accumulated_errors +=
"two stored triggers with the name " + std::string(name) +
" defined for the same types of parameters (" + err.
file_name +
")\n";
909 auto stored_t_id = context.
state.
world.create_stored_trigger();
910 context.
state.
world.stored_trigger_set_function(stored_t_id, saved_trigger);
911 context.
state.
world.stored_trigger_set_name(stored_t_id, name_id);
922 auto old_factor = context.
factor;
927 auto new_factor = context.
factor;
928 context.
factor = old_factor;
943 auto multiplier = result.factor ? *result.factor : 1.0f;
944 auto overall_factor = result.base;
957 err.
accumulated_errors +=
"canal index " + std::to_string(value) +
" out of range (" + err.
file_name +
", line " + std::to_string(line) +
")\n";
991 "(" + err.
file_name +
", line " + std::to_string(line) +
")\n";
1000 opt_ = it->second.id;
1002 err.
accumulated_errors +=
"Invalid issue position " + std::string(v) +
" (" + err.
file_name +
" line " + std::to_string(line) +
")\n";
std::string accumulated_errors
#define assert(condition)
uint32_t tag_to_int(char first, char second, char third)
uint16_t association_to_trigger_code(association_type a)
bool is_integer(char const *start, char const *end)
void tr_scope_all_core(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_substate(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_owned_province(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_crisis_state_scope(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_core(token_generator &gen, error_handler &err, trigger_building_context &context)
dcon::trigger_key make_trigger(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_state(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_or(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_owner(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_every_country(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_sphere_member(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_pop(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_substate(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_country(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_sea_zone(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_cultural_union(token_generator &gen, error_handler &err, trigger_building_context &context)
constexpr bool scope_has_any_all(uint16_t code)
void tr_state_scope(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_not(token_generator &gen, error_handler &err, trigger_building_context &context)
void make_stored_trigger(std::string_view name, token_generator &gen, error_handler &err, scenario_building_context &context)
dcon::value_modifier_key make_value_modifier(token_generator &gen, error_handler &err, trigger_building_context &context)
int32_t simplify_trigger(uint16_t *source)
void tr_scope_variable(std::string_view name, token_generator &gen, error_handler &err, trigger_building_context &context)
bool scope_is_empty(uint16_t const *source)
void tr_scope_and(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_capital_scope(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_overlord(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_state(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_greater_power(token_generator &gen, error_handler &err, trigger_building_context &context)
uint16_t association_to_bool_code(association_type a)
void tr_scope_this(token_generator &gen, error_handler &err, trigger_building_context &context)
int32_t parse_int(std::string_view content, int32_t line, error_handler &err)
void tr_scope_country(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_controller(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_neighbor_province(token_generator &gen, error_handler &err, trigger_building_context &context)
uint16_t invert_association(uint16_t a)
void tr_scope_from(token_generator &gen, error_handler &err, trigger_building_context &context)
void invert_trigger_internal(uint16_t *source)
void tr_scope_sphere_owner(token_generator &gen, error_handler &err, trigger_building_context &context)
bool scope_has_single_member(uint16_t const *source)
void tr_scope_war_countries(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_pop(token_generator &gen, error_handler &err, trigger_building_context &context)
std::string slot_contents_to_string(trigger::slot_contents v)
void tr_flashpoint_tag_scope(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_war_countries(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_any_neighbor_country(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_sphere_member(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_independence(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_location(token_generator &gen, error_handler &err, trigger_building_context &context)
void tr_scope_all_greater_power(token_generator &gen, error_handler &err, trigger_building_context &context)
void invert_trigger(uint16_t *source)
void make_value_modifier_segment(token_generator &gen, error_handler &err, trigger_building_context &context)
dcon::text_key find_or_add_key(sys::state &state, std::string_view key, bool as_unicode)
constexpr uint16_t country_scope_province
constexpr uint16_t generic_scope
constexpr uint16_t owner_scope_province
constexpr uint16_t x_pop_scope_province
constexpr uint16_t code_mask
int32_t get_trigger_scope_payload_size(uint16_t const *data)
constexpr uint16_t state_scope_province
constexpr uint16_t is_disjunctive_scope
constexpr uint16_t sphere_owner_scope
constexpr uint16_t this_scope_province
constexpr uint16_t x_owned_province_scope_state
constexpr uint16_t x_substate_scope
constexpr uint16_t x_country_scope
constexpr uint16_t cultural_union_scope
constexpr uint16_t country_scope_nation
constexpr uint16_t from_scope_province
constexpr uint16_t location_scope
constexpr uint16_t country_scope_pop
constexpr uint16_t integer_scope
constexpr uint16_t x_provinces_in_variable_region
constexpr uint16_t x_neighbor_country_scope_pop
constexpr uint16_t country_scope_state
constexpr uint16_t crisis_state_scope
constexpr uint16_t capital_scope_province
constexpr uint16_t state_scope_pop
constexpr uint16_t from_scope_nation
constexpr uint16_t x_state_scope
constexpr uint16_t this_scope_nation
constexpr uint16_t x_owned_province_scope_nation
constexpr uint16_t x_war_countries_scope_pop
constexpr uint16_t this_scope_pop
constexpr uint16_t owner_scope_state
constexpr uint16_t from_scope_pop
constexpr uint16_t x_pop_scope_state
constexpr uint16_t x_core_scope_nation
int32_t get_trigger_non_scope_payload_size(uint16_t const *data)
constexpr uint16_t x_neighbor_province_scope_state
constexpr uint16_t flashpoint_tag_scope
constexpr uint16_t this_scope_state
constexpr uint16_t association_mask
constexpr uint16_t x_neighbor_country_scope_nation
TRIGGER_BYTECODE_LIST constexpr uint16_t first_scope_code
constexpr uint16_t independence_scope
constexpr uint16_t cultural_union_scope_pop
constexpr uint16_t first_invalid_code
constexpr uint16_t x_pop_scope_nation
constexpr uint16_t capital_scope_pop
constexpr uint16_t placeholder_not_scope
constexpr uint16_t x_greater_power_scope
constexpr uint16_t sea_zone_scope
constexpr uint16_t x_neighbor_province_scope
constexpr uint16_t x_core_scope_province
constexpr uint16_t tag_scope
constexpr uint16_t is_existence_scope
int32_t trigger_scope_data_payload(uint16_t code)
int32_t get_trigger_payload_size(uint16_t const *data)
constexpr uint16_t capital_scope
constexpr uint16_t x_war_countries_scope_nation
uint16_t * recurse_over_triggers(uint16_t *source, T const &f)
constexpr uint16_t controller_scope
constexpr uint16_t overlord_scope
constexpr uint16_t from_scope_state
constexpr uint16_t x_provinces_in_variable_region_proper
constexpr uint16_t x_sphere_member_scope
trigger::slot_contents main_slot
ankerl::unordered_dense::map< std::string, dcon::state_definition_id > map_of_state_names
std::vector< dcon::province_id > original_id_to_prov_id_map
ankerl::unordered_dense::map< std::string, pending_option_content > map_of_ioptions
ankerl::unordered_dense::map< std::string, dcon::region_id > map_of_region_names
ankerl::unordered_dense::map< std::string, std::vector< saved_stored_condition > > map_of_stored_triggers
ankerl::unordered_dense::map< uint32_t, dcon::national_identity_id > map_of_ident_names
void position(association_type t, std::string_view v, error_handler &err, int32_t line, trigger_building_context &context)
dcon::issue_option_id opt_
void badboy(association_type a, float value, error_handler &err, int32_t line, trigger_building_context &context)
void has_leader(association_type a, std::string_view value, error_handler &err, int32_t line, trigger_building_context &context)
void ruling_party(association_type a, std::string_view value, error_handler &err, int32_t line, trigger_building_context &context)
void is_canal_enabled(association_type a, int32_t value, error_handler &err, int32_t line, trigger_building_context &context)
trigger::slot_contents this_slot
trigger::slot_contents from_slot
std::vector< uint16_t > compiled_trigger
trigger::slot_contents main_slot
scenario_building_context & outer_context
void add_float_to_payload(float f)
void add_int32_t_to_payload(int32_t i)
std::vector< dcon::province_adjacency_id > canals
dcon::trigger_key commit_trigger_data(std::vector< uint16_t > data)
std::vector< value_modifier_segment > value_modifier_segments
dcon::data_container world
tagged_vector< value_modifier_description, dcon::value_modifier_key > value_modifiers
dcon::unit_name_id add_unit_name(std::string_view text)
province::global_provincial_state province_definitions