23 auto sm =
state.world.nation_get_in_sphere_of(n);
26 auto smpc =
state.world.nation_get_primary_culture(sm);
55 auto pc =
state.world.nation_get_primary_culture(n);
61 auto first_names =
state.world.culture_get_first_names(
state.world.nation_get_primary_culture(n));
62 if(first_names.size() > 0) {
63 auto first_name = first_names.at(
rng::reduce(
uint32_t(names_pair.high), first_names.size()));
64 auto last_names =
state.world.culture_get_last_names(
state.world.nation_get_primary_culture(n));
65 if(last_names.size() > 0) {
73 if(
auto plist =
state.world.nation_get_province_ownership(n); plist.begin() != plist.end()) {
74 auto plist_size =
uint32_t(plist.end() - plist.begin());
87 auto id = retrieve<dcon::decision_id>(
state,
parent);
88 auto condition =
state.world.decision_get_allow(
id);
101 auto id = retrieve<dcon::decision_id>(
state,
parent);
103 auto mkey =
state.world.decision_get_ai_will_do(
id);
116 auto id = retrieve<dcon::decision_id>(
state,
parent);
117 auto potential =
state.world.decision_get_potential(
id);
130 auto content = retrieve<dcon::decision_id>(
state,
parent);
135 auto content = retrieve<dcon::decision_id>(
state,
parent);
144 auto id = retrieve<dcon::decision_id>(
state,
parent);
153 auto ef = fat_id.get_effect();
157 uint32_t(
state.local_player_nation.index() << 4 ^
id.index()));
169 auto id = retrieve<dcon::decision_id>(
state,
parent);
170 auto contents =
text::create_endless_layout(
state,
internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(
base_data.
size.
x),
static_cast<int16_t
>(
base_data.
size.
y),
base_data.
data.
text.
font_handle, 0,
text::alignment::left,
text::text_color::white,
true });
183 auto const id = retrieve<dcon::decision_id>(
state,
parent);
184 if(
state.cheat_data.show_province_id_tooltip) {
191 auto const desc =
state.world.decision_get_description(
id);
192 if(
state.key_is_localized(desc)) {
212 auto id = retrieve<dcon::decision_id>(
state,
parent);
224 dcon::text_key description;
240 auto id = retrieve<dcon::decision_id>(
state,
parent);
242 description = fat_id.get_description();
245 base_data.data.text.font_handle, 0, text::alignment::left,
246 text::is_black_from_font_id(base_data.data.text.font_handle) ? text::text_color::black : text::text_color::white,
248 populate_layout(
state, container);
266 auto id = retrieve<dcon::decision_id>(
state,
parent);
268 state.world.decision_set_hide_notification(
id, !
state.world.decision_get_hide_notification(
id));
269 state.game_state_updated.store(
true, std::memory_order_release);
274 auto id = retrieve<dcon::decision_id>(
state,
parent);
275 return !
state.world.decision_get_hide_notification(
id);
294 if(
name ==
"decision_name") {
295 return make_element_by_type<decision_name>(
state,
id);
296 }
else if(
name ==
"decision_image") {
297 return make_element_by_type<decision_image>(
state,
id);
298 }
else if(
name ==
"decision_desc") {
299 return make_element_by_type<decision_desc>(
state,
id);
300 }
else if(
name ==
"requirements") {
302 auto btn1 = make_element_by_type<decision_ai_will_do>(
state,
id);
303 btn1->base_data.position.x -= btn1->base_data.size.x * 2;
305 auto btn2 = make_element_by_type<decision_potential>(
state,
id);
306 btn2->base_data.position.x -= btn2->base_data.size.x;
308 return make_element_by_type<decision_requirements>(
state,
id);
309 }
else if(
name ==
"ignore_checkbox") {
310 return make_element_by_type<ignore_checkbox>(
state,
id);
311 }
else if(
name ==
"make_decision") {
312 return make_element_by_type<make_decision>(
state,
id);
319 if(payload.holds_type<dcon::decision_id>()) {
320 payload.emplace<dcon::decision_id>(
content);
337 return "decision_entry";
341 std::vector<dcon::decision_id> list;
342 auto n =
state.local_player_nation;
344 dcon::decision_id did{ dcon::decision_id::value_base_t(i) };
345 if(!state.cheat_data.always_potential_decisions) {
346 auto lim = state.world.decision_get_potential(did);
355 std::sort(
list.begin(),
list.end(), [&](dcon::decision_id a, dcon::decision_id b) {
356 auto allow_a = state.world.decision_get_allow(a);
357 auto allow_b = state.world.decision_get_allow(b);
358 auto a_res = !allow_a || trigger::evaluate(state, allow_a, trigger::to_generic(n), trigger::to_generic(n), 0);
359 auto b_res = !allow_b || trigger::evaluate(state, allow_b, trigger::to_generic(n), trigger::to_generic(n), 0);
363 return a.index() < b.index();
387 if(
name ==
"decision_listbox") {
388 return make_element_by_type<decision_listbox>(
state,
id);
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
bool get_horizontal_flip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
std::unique_ptr< ui::element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void on_create(sys::state &state) noexcept override
void set_visible(sys::state &state, bool vis)
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
std::vector< dcon::decision_id > row_contents
void update(sys::state &state)
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
dcon::decision_id content
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
sound::audio_instance & get_click_sound(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
text::layout internal_layout
void calibrate_scrollbar(sys::state &state) noexcept
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
multiline_text_element_base * delegate
void on_create(sys::state &state) noexcept override
bool can_take_decision(sys::state &state, dcon::nation_id source, dcon::decision_id d)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
random_pair get_random_pair(sys::state const &state, uint32_t value_in)
uint32_t reduce(uint32_t value_in, uint32_t upper_bound)
audio_instance & get_decision_sound(sys::state &state)
@ crisisdefender_continent
@ crisisattacker_continent
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
layout_box open_layout_box(layout_base &dest, int32_t indent)
endless_layout create_endless_layout(sys::state &state, layout &dest, layout_parameters const ¶ms)
dcon::text_key get_ruler_title(sys::state &state, dcon::nation_id n)
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)
dcon::text_key get_adjective(sys::state &state, dcon::nation_id id)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
void close_layout_box(columnar_layout &dest, layout_box &box)
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)
void multiplicative_value_modifier_description(sys::state &state, text::layout_base &layout, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot)
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)
void produce_decision_substitutions(sys::state &state, text::substitution_map &m, dcon::nation_id n)
void trigger_description(sys::state &state, text::layout_base &layout, dcon::trigger_key k, int32_t primary_slot=-1, int32_t this_slot=-1, int32_t from_slot=-1)
union ui::element_data::internal_data data
dcon::gfx_object_id gfx_object