2#include "dcon_generated.hpp"
25#define MOD_LIST_ELEMENT(num, name, green_is_negative, display_type, locale_name) \
26 modifier_display_info{green_is_negative, display_type, locale_name},
28#undef MOD_LIST_ELEMENT
31#define MOD_LIST_ELEMENT(num, name, green_is_negative, display_type, locale_name) \
32 modifier_display_info{green_is_negative, display_type, locale_name},
34#undef MOD_LIST_ELEMENT
54 auto const& prov_def = fat_id.get_province_values();
55 for(
uint32_t i = 0; i < prov_def.modifier_definition_size; ++i) {
56 if(!
bool(prov_def.offsets[i]))
58 auto data = province_modifier_names[prov_def.offsets[i].index()];
69 auto const& nat_def = fat_id.get_national_values();
70 for(
uint32_t i = 0; i < nat_def.modifier_definition_size; ++i) {
71 if(!
bool(nat_def.offsets[i]))
73 auto data = national_modifier_names[nat_def.offsets[i].index()];
86 bool& header, dcon::national_modifier_value nmid,
float scaled) {
90 auto const& def = fat_id.get_national_values();
91 for(
uint32_t i = 0; i < def.modifier_definition_size; ++i) {
92 if(!
bool(def.offsets[i]))
94 if(def.offsets[i] != nmid)
106 auto data = national_modifier_names[nmid.index()];
111 auto value = def.values[i] * scaled;
119 bool& header, dcon::provincial_modifier_value pmid,
float scaled) {
123 auto const& def = fat_id.get_province_values();
124 for(
uint32_t i = 0; i < def.modifier_definition_size; ++i) {
125 if(!
bool(def.offsets[i]))
127 if(def.offsets[i] != pmid)
139 auto data = province_modifier_names[pmid.index()];
144 auto value = def.values[i] * scaled;
154 bool& header, T nmid) {
155 if(
state.national_definitions.land_province)
157 for(
auto mpr :
state.world.province_get_current_modifiers(p))
159 if(
auto m =
state.world.province_get_terrain(p); m)
161 if(
auto m =
state.world.province_get_climate(p); m)
163 if(
auto m =
state.world.province_get_continent(p); m)
165 if(
auto c =
state.world.province_get_crime(p); c) {
166 if(
auto m =
state.culture_definitions.crimes[c].modifier; m)
170 if(
state.economy_definitions.building_definitions[int32_t(t)].province_modifier) {
172 header, nmid,
state.world.province_get_building_level(p,
uint8_t(t)));
175 if(
state.national_definitions.infrastructure) {
179 if(
state.national_definitions.nationalism) {
181 (
state.world.province_get_is_owner_core(p) ? 1.f : 0.f) *
state.world.province_get_nationalism(p));
183 if(
state.national_definitions.non_coastal) {
185 !
state.world.province_get_is_coast(p) ? 1.f : 0.f);
187 if(
state.national_definitions.coastal) {
189 state.world.province_get_is_coast(p) ? 1.f : 0.f);
191 if(
state.national_definitions.overseas) {
195 if(
state.national_definitions.core) {
197 state.world.province_get_is_owner_core(p) ? 1.f : 0.f);
199 if(
state.national_definitions.has_siege) {
203 if(
state.national_definitions.blockaded) {
210 dcon::provincial_modifier_value nmid,
bool have_header) {
211 bool header = !have_header;
216 dcon::national_modifier_value nmid,
bool have_header) {
217 bool header = !have_header;
218 if(
auto ts =
state.world.nation_get_tech_school(n); ts)
220 if(
auto nv =
state.world.nation_get_national_value(n); nv)
222 for(
auto mpr :
state.world.nation_get_current_modifiers(n))
224 state.world.for_each_technology([&](dcon::technology_id t) {
225 auto tmod =
state.world.technology_get_modifier(t);
226 if(tmod &&
state.world.nation_get_active_technologies(n, t))
229 state.world.for_each_invention([&](dcon::invention_id i) {
230 auto tmod =
state.world.invention_get_modifier(i);
231 if(tmod &&
state.world.nation_get_active_inventions(n, i))
234 state.world.for_each_issue([&](dcon::issue_id i) {
235 auto iopt =
state.world.nation_get_issues(n, i);
236 auto imod =
state.world.issue_option_get_modifier(iopt);
241 if(!
state.world.nation_get_is_civilized(n)) {
242 state.world.for_each_reform([&](dcon::reform_id i) {
243 auto iopt =
state.world.nation_get_reforms(n, i);
244 auto imod =
state.world.reform_option_get_modifier(iopt);
250 auto in_wars =
state.world.nation_get_war_participant(n);
251 if(in_wars.begin() != in_wars.end()) {
252 if(
state.national_definitions.war)
255 if(
state.national_definitions.peace)
259 if(
state.national_definitions.badboy) {
261 state.world.nation_get_infamy(n));
263 if(
state.national_definitions.plurality) {
265 state.world.nation_get_plurality(n));
267 if(
state.national_definitions.war_exhaustion) {
269 state.world.nation_get_war_exhaustion(n));
271 if(
state.national_definitions.average_literacy) {
276 if(
state.national_definitions.total_blockaded) {
280 c > 0.0f ? bc / c : 0.0f);
282 if(
state.national_definitions.total_occupation) {
283 auto nid = fatten(
state.world, n);
284 auto cap_continent = nid.get_capital().get_continent();
286 float occupied = 0.0f;
287 for(
auto owned : nid.get_province_ownership()) {
288 if(owned.get_province().get_continent() == cap_continent) {
290 if(
auto c = owned.get_province().get_nation_from_province_control().id; c && c != n) {
296 total > 0.0f ? occupied / total : 0.0f);
299 if(
state.world.nation_get_is_civilized(n) ==
false) {
300 if(
state.national_definitions.unciv_nation)
303 if(
state.national_definitions.great_power)
305 }
else if(
state.world.nation_get_rank(n) <= uint16_t(
state.defines.colonial_rank)) {
306 if(
state.national_definitions.second_power)
309 if(
state.national_definitions.civ_nation)
313 if(
state.national_definitions.disarming) {
314 if(
bool(
state.world.nation_get_disarmed_until(n)) &&
state.world.nation_get_disarmed_until(n) >
state.current_date)
317 if(
state.national_definitions.in_bankrupcy) {
318 if(
bool(
state.world.nation_get_is_bankrupt(n)))
323 for(
auto tm :
state.national_definitions.triggered_modifiers) {
324 if(tm.trigger_condition && tm.linked_modifier) {
325 auto trigger_condition_satisfied =
327 if(trigger_condition_satisfied)
333 for(
auto pc :
state.world.nation_get_province_ownership_as_nation(n)) {
334 auto p = pc.get_province().id;
335 acting_modifiers_description_province<dcon::national_modifier_value>(
state, layout, p, identation, header, nmid);
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
constexpr dcon::demographics_key total(0)
constexpr dcon::demographics_key literacy(5)
bool province_is_under_siege(sys::state const &state, dcon::province_id ids)
bool province_is_blockaded(sys::state const &state, dcon::province_id ids)
bool is_great_power(sys::state const &state, dcon::nation_id id)
bool is_overseas(sys::state const &state, dcon::province_id ids)
MOD_NAT_LIST constexpr uint32_t count
MOD_PROV_LIST constexpr uint32_t count
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)
std::string prettify(int64_t num)
std::string format_float(float num, size_t digits)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
std::string format_percentage(float num, size_t digits)
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 active_single_modifier_description(sys::state &state, text::layout_base &layout, dcon::modifier_id mid, int32_t indentation, bool &header, dcon::national_modifier_value nmid, float scaled)
void modifier_description(sys::state &state, text::layout_base &layout, dcon::modifier_id mid, int32_t indentation=0)
void acting_modifiers_description_province(sys::state &state, text::layout_base &layout, dcon::province_id p, int32_t identation, bool &header, T nmid)
std::string format_modifier_value(sys::state &state, float value, modifier_display_type type)
void active_modifiers_description(sys::state &state, text::layout_base &layout, dcon::nation_id n, int32_t identation, dcon::national_modifier_value nmid, bool header)
float to_float(int32_t a)
modifier_display_type type