2#include "dcon_generated.hpp"
15 if(
name ==
"country_flag") {
16 return make_element_by_type<flag_button>(
state,
id);
17 }
else if(
name ==
"country_flag_overlay") {
18 return make_element_by_type<nation_flag_frame>(
state,
id);
19 }
else if(
name ==
"score") {
20 return make_element_by_type<nation_total_score_text>(
state,
id);
21 }
else if(
name ==
"country_name") {
22 return make_element_by_type<generic_name_text<dcon::nation_id>>(
state, id);
28 if(payload.holds_type<dcon::nation_id>()) {
29 payload.emplace<dcon::nation_id>(
n);
47 int32_t total =
state.world.nation_get_owned_province_count(n);
56 for(
auto p :
state.world.nation_get_province_ownership(n)) {
57 auto frange = p.get_province().get_factory_location();
58 total += int32_t(frange.end() - frange.begin());
68 for(
auto p :
state.world.nation_get_army_control(n)) {
69 auto frange = p.get_army().get_army_membership();
70 total += int32_t(frange.end() - frange.begin());
80 for(
auto p :
state.world.nation_get_navy_control(n)) {
81 auto frange = p.get_navy().get_navy_membership();
82 total += int32_t(frange.end() - frange.begin());
92 for(
auto t :
state.world.in_technology) {
93 if(
state.world.nation_get_active_technologies(n, t))
104 for(
auto t :
state.world.in_invention) {
105 if(
state.world.nation_get_active_inventions(n, t))
119 for(
auto pt :
state.world.in_ideology) {
131 dcon::gfx_object_id gid;
138 auto& gfx_def =
state.ui_defs.gfx[gid];
140 auto& mask_tex =
state.open_gl.asset_textures[dcon::texture_id(gfx_def.type_dependent - 1)];
143 gfx_def.is_vertically_flipped(),
157 return state.world.nation_get_identity_from_identity_holder(n);
168 dcon::gfx_object_id gid;
175 auto& gfx_def =
state.ui_defs.gfx[gid];
177 auto& mask_tex =
state.open_gl.asset_textures[dcon::texture_id(gfx_def.type_dependent - 1)];
196 return state.world.nation_get_identity_from_identity_holder(n);
207 auto window = make_element_by_type<ledger_window>(
state,
"ledger");
232 if(
name ==
"country_flag1") {
233 return make_element_by_type<end_left_flag>(
state,
id);
234 }
else if(
name ==
"country_flag2") {
235 return make_element_by_type<end_right_flag>(
state,
id);
236 }
else if(
name ==
"country_name") {
237 return make_element_by_type<generic_name_text<dcon::nation_id>>(
state, id);
238 }
else if(
name ==
"country_class") {
239 return make_element_by_type<nation_status_text>(
state,
id);
240 }
else if(
name ==
"total_score") {
241 return make_element_by_type<nation_total_score_text>(
state,
id);
242 }
else if(
name ==
"country_rank") {
243 return make_element_by_type<nation_rank_text>(
state,
id);
244 }
else if(
name ==
"country_prestige") {
245 return make_element_by_type<nation_prestige_text>(
state,
id);
246 }
else if(
name ==
"country_economic") {
247 return make_element_by_type<nation_industry_score_text>(
state,
id);
248 }
else if(
name ==
"country_military") {
249 return make_element_by_type<nation_military_score_text>(
state,
id);
250 }
else if(
name ==
"country_money") {
251 return make_element_by_type<national_treasury_text>(
state,
id);
252 }
else if(
name ==
"population_value") {
253 return make_element_by_type<nation_population_text>(
state,
id);
254 }
else if(
name ==
"provinces_value") {
255 return make_element_by_type<national_province_count>(
state,
id);
256 }
else if(
name ==
"factories_value") {
257 return make_element_by_type<national_factory_count>(
state,
id);
258 }
else if(
name ==
"literacy_value") {
259 return make_element_by_type<nation_literacy_text>(
state,
id);
260 }
else if(
name ==
"army_value") {
261 return make_element_by_type<national_regiment_count>(
state,
id);
262 }
else if(
name ==
"navy_value") {
263 return make_element_by_type<national_ship_count>(
state,
id);
264 }
else if(
name ==
"gov_type_value") {
265 return make_element_by_type<nation_government_type_text>(
state,
id);
266 }
else if(
name ==
"politics_party_icon") {
267 return make_element_by_type<nation_ruling_party_ideology_plupp>(
state,
id);
268 }
else if(
name ==
"party_value") {
269 return make_element_by_type<nation_ruling_party_text>(
state,
id);
270 }
else if(
name ==
"technologies_value") {
271 return make_element_by_type<national_tech_count>(
state,
id);
272 }
else if(
name ==
"inventions_value") {
273 return make_element_by_type<national_invention_count>(
state,
id);
274 }
else if(
name ==
"ideology_chart") {
275 return make_element_by_type<end_window_ideologies>(
state,
id);
276 }
else if(
name ==
"workforce_chart") {
277 return make_element_by_type<nation_picker_poptypes_chart>(
state,
id);
278 }
else if(
name ==
"ledger_button") {
279 return make_element_by_type<invisible_element>(
state,
id);
288 return "great_power_entry";
291 subwindow.
n = content;
297 if(i <
state.great_nations.size())
307 return "great_power_entry";
310 subwindow.
n = content;
316 if(i <
state.great_nations.size())
326 return "second_rank_entry";
329 subwindow.
n = content;
334 auto total_num = int32_t(
state.defines.colonial_rank -
state.defines.great_nations_count);
336 for(int32_t i = 0; i < int32_t(
state.defines.colonial_rank); ++i) {
337 auto n =
state.nations_by_rank[i];
350 if(
name ==
"year_text") {
351 return make_element_by_type<date_label>(
state,
id);
352 }
else if(
name ==
"great_powers_list") {
353 return make_element_by_type<end_top_four_gp>(
state,
id);
354 }
else if(
name ==
"great_powers_list2") {
355 return make_element_by_type<end_bottom_four_gp>(
state,
id);
356 }
else if(
name ==
"second_rank_list") {
357 return make_element_by_type<end_secondary_powers>(
state,
id);
358 }
else if(
name ==
"exit") {
359 return make_element_by_type<quit_game_button>(
state,
id);
360 }
else if(
name ==
"player_window") {
361 return make_element_by_type<end_window_player>(
state,
id);
367 if(payload.holds_type<dcon::nation_id>()) {
368 payload.emplace<dcon::nation_id>(
state.local_player_nation);
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
void set_visible(sys::state &state, bool vis)
void update_subwindow(sys::state &state, end_nation_window &subwindow, dcon::nation_id content) override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_create(sys::state &state) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void update_subwindow(sys::state &state, end_nation_window &subwindow, dcon::nation_id content) override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void update_subwindow(sys::state &state, end_nation_window &subwindow, dcon::nation_id content) override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
std::vector< dcon::nation_id > row_contents
void update(sys::state &state)
void update_chart(sys::state &state)
std::vector< entry > distribution
void set_text(sys::state &state, std::string const &new_text)
dcon::demographics_key to_key(sys::state const &state, dcon::pop_type_id v)
constexpr dcon::commodity_id money(0)
bool is_great_power(sys::state const &state, dcon::nation_id id)
void render_masked_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, GLuint mask_texture_handle, ui::rotation r, bool flipped, bool rtl)
void render_textured_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
std::string format_money(float num)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
void close_layout_box(columnar_layout &dest, layout_box &box)
ogl::color_modification get_color_modification(bool is_under_mouse, bool is_disabled, bool is_interactable)
element_type get_element_type() const
rotation get_rotation() const
union ui::element_data::internal_data data
dcon::gfx_object_id gfx_object
element_base * r_ledger_window
std::unique_ptr< element_base > end_screen
element_base * under_mouse