Project Alice
Loading...
Searching...
No Matches
culture.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "dcon_generated.hpp"
4#include <vector>
5
6namespace issue_rule {
7
8constexpr inline uint32_t build_factory = 0x00000001;
9constexpr inline uint32_t expand_factory = 0x00000002;
10constexpr inline uint32_t open_factory = 0x00000004;
11constexpr inline uint32_t destroy_factory = 0x00000008;
12constexpr inline uint32_t factory_priority = 0x00000010;
13constexpr inline uint32_t can_subsidise = 0x00000020;
14constexpr inline uint32_t pop_build_factory = 0x00000040;
15constexpr inline uint32_t pop_expand_factory = 0x00000080;
16constexpr inline uint32_t pop_open_factory = 0x00000100;
17constexpr inline uint32_t delete_factory_if_no_input = 0x00000200;
18constexpr inline uint32_t build_factory_invest = 0x00000400;
19constexpr inline uint32_t expand_factory_invest = 0x00000800;
20constexpr inline uint32_t open_factory_invest = 0x00001000;
21constexpr inline uint32_t build_railway_invest = 0x00002000;
22constexpr inline uint32_t can_invest_in_pop_projects = 0x00004000;
23constexpr inline uint32_t pop_build_factory_invest = 0x00008000;
24constexpr inline uint32_t pop_expand_factory_invest = 0x00010000;
25constexpr inline uint32_t pop_open_factory_invest = 0x00020000;
26constexpr inline uint32_t allow_foreign_investment = 0x00040000;
27constexpr inline uint32_t slavery_allowed = 0x00080000;
28constexpr inline uint32_t primary_culture_voting = 0x00100000;
29constexpr inline uint32_t culture_voting = 0x00200000;
30constexpr inline uint32_t all_voting = 0x00400000;
31constexpr inline uint32_t largest_share = 0x00800000;
32constexpr inline uint32_t dhont = 0x01000000;
33constexpr inline uint32_t sainte_laque = 0x02000000;
34constexpr inline uint32_t same_as_ruling_party = 0x04000000;
35constexpr inline uint32_t rich_only = 0x08000000;
36constexpr inline uint32_t state_vote = 0x10000000;
37constexpr inline uint32_t population_vote = 0x20000000;
38constexpr inline uint32_t build_railway = 0x40000000;
39// TODO: Add more bits to issue rules so we can accomodate both banks and universities SEPARATEDLY
40// "Well the idea we had in mind is that universities are more of a state thing that you can build regardless of party, while banks of course are more tied to party policies"
41constexpr inline uint32_t build_bank = 0x40000000; // tied to building railroads
42constexpr inline uint32_t build_university = 0x80000000; // independent
43
44} // namespace issue_rule
45
46namespace culture {
47
48enum class flag_type : uint8_t {
49 default_flag = 0,
52 fascist,
54 // Non-vanilla flags
56 special,
57 spare,
59 realm,
60 other,
81 slot1,
82 slot2,
83 slot3,
84 slot4,
86 green,
89 count
90};
91
92constexpr inline uint64_t to_bits(dcon::ideology_id id) {
93 if(id)
94 return uint64_t(uint64_t(1) << uint64_t(id.index()));
95 else
96 return 0;
97}
98
99struct crime_info {
100 dcon::text_key name;
101 dcon::modifier_id modifier;
102 dcon::trigger_key trigger;
104};
105
107
109
111 dcon::text_key name;
113};
114
115enum class pop_strata : uint8_t { poor = 0, middle = 1, rich = 2 };
116enum class income_type : uint8_t {
117 none = 0,
118 administration = 1,
119 military = 2,
120 education = 3,
121 reforms = 4,
122};
123enum class issue_type : uint8_t { party = 0, political = 1, social = 2, military = 3, economic = 4 };
125 std::vector<dcon::issue_id> party_issues;
126 std::vector<dcon::issue_id> political_issues;
127 std::vector<dcon::issue_id> social_issues;
128 std::vector<dcon::reform_id> military_issues;
129 std::vector<dcon::reform_id> economic_issues;
130
131 std::vector<folder_info> tech_folders; // contains *all* the folder names; techs index into this by an integer index
132 std::vector<dcon::pop_type_id> rgo_workers;
133
135
136 // these are not intended to be a complete list of *all* poptypes, just those with special rules
137 dcon::pop_type_id artisans;
138 dcon::pop_type_id capitalists;
139 dcon::pop_type_id farmers;
140 dcon::pop_type_id laborers;
141 dcon::pop_type_id clergy;
142 dcon::pop_type_id soldiers;
143 dcon::pop_type_id officers;
144 dcon::pop_type_id slaves;
145 dcon::pop_type_id bureaucrat;
146 dcon::pop_type_id aristocrat;
147
148 dcon::pop_type_id primary_factory_worker;
149 dcon::pop_type_id secondary_factory_worker;
150
153
154 // special ideology
155 dcon::ideology_id conservative;
156 // special issue
157 dcon::issue_option_id jingoism;
158
159 // from pop_types.txt
160 dcon::value_modifier_key promotion_chance;
161 dcon::value_modifier_key demotion_chance;
162 dcon::value_modifier_key migration_chance;
163 dcon::value_modifier_key colonialmigration_chance;
164 dcon::value_modifier_key emigration_chance;
165 dcon::value_modifier_key assimilation_chance;
166 dcon::value_modifier_key conversion_chance;
167
175};
176
178
182
183// these functions are to be called only after loading a save
187
188
189void apply_technology(sys::state& state, dcon::nation_id target_nation, dcon::technology_id tech_id);
190void apply_invention(sys::state& state, dcon::nation_id target_nation, dcon::invention_id inv_id);
191void remove_technology(sys::state& state, dcon::nation_id target_nation, dcon::technology_id tech_id);
192void remove_invention(sys::state& state, dcon::nation_id target_nation, dcon::invention_id inv_id);
194flag_type get_current_flag_type(sys::state const& state, dcon::nation_id target_nation);
195flag_type get_current_flag_type(sys::state const& state, dcon::national_identity_id identity);
196void update_nation_issue_rules(sys::state& state, dcon::nation_id n_id); // note: does react to changes in slavery rule
197void update_all_nations_issue_rules(sys::state& state); // note: doesn't react to changes in slavery rule
198
202
203float effective_technology_cost(sys::state& state, uint32_t current_year, dcon::nation_id target_nation, dcon::technology_id tech_id);
204void update_research(sys::state& state, uint32_t current_year);
206void fix_slaves_in_province(sys::state& state, dcon::nation_id owner, dcon::province_id p);
207
208void replace_cores(sys::state& state, dcon::national_identity_id old_tag, dcon::national_identity_id new_tag);
209
210} // namespace culture
uint32_t get_remapped_flag_type(sys::state const &state, flag_type type)
Definition: culture.cpp:713
void discover_inventions(sys::state &state)
Definition: culture.cpp:975
void apply_invention(sys::state &state, dcon::nation_id target_nation, dcon::invention_id i_id)
Definition: culture.cpp:500
float effective_technology_cost(sys::state &state, uint32_t current_year, dcon::nation_id target_nation, dcon::technology_id tech_id)
Definition: culture.cpp:904
rebel_defection
Definition: culture.hpp:180
void fix_slaves_in_province(sys::state &state, dcon::nation_id owner, dcon::province_id p)
Definition: culture.cpp:740
void replace_cores(sys::state &state, dcon::national_identity_id old_tag, dcon::national_identity_id new_tag)
Definition: culture.cpp:1047
void clear_existing_tech_effects(sys::state &state)
Definition: culture.cpp:55
void repopulate_technology_effects(sys::state &state)
Definition: culture.cpp:114
void update_all_nations_issue_rules(sys::state &state)
Definition: culture.cpp:801
void set_default_issue_and_reform_options(sys::state &state)
Definition: culture.cpp:39
void remove_invention(sys::state &state, dcon::nation_id target_nation, dcon::invention_id i_id)
Definition: culture.cpp:606
void repopulate_invention_effects(sys::state &state)
Definition: culture.cpp:212
void update_research(sys::state &state, uint32_t current_year)
Definition: culture.cpp:947
flag_type get_current_flag_type(sys::state const &state, dcon::nation_id target_nation)
Definition: culture.cpp:717
void restore_unsaved_values(sys::state &state)
Definition: culture.cpp:818
rebel_independence
Definition: culture.hpp:181
void remove_technology(sys::state &state, dcon::nation_id target_nation, dcon::technology_id t_id)
Definition: culture.cpp:430
issue_category
Definition: culture.hpp:177
void create_initial_ideology_and_issues_distribution(sys::state &state)
Definition: culture.cpp:841
constexpr uint64_t to_bits(dcon::ideology_id id)
Definition: culture.hpp:92
void apply_technology(sys::state &state, dcon::nation_id target_nation, dcon::technology_id t_id)
Definition: culture.cpp:360
std::string get_tech_category_name(tech_category t)
Definition: culture.cpp:12
void update_nation_issue_rules(sys::state &state, dcon::nation_id n_id)
Definition: culture.cpp:766
tech_category
Definition: culture.hpp:106
constexpr uint32_t pop_open_factory_invest
Definition: culture.hpp:25
constexpr uint32_t pop_expand_factory_invest
Definition: culture.hpp:24
constexpr uint32_t open_factory_invest
Definition: culture.hpp:20
constexpr uint32_t pop_open_factory
Definition: culture.hpp:16
constexpr uint32_t build_railway
Definition: culture.hpp:38
constexpr uint32_t pop_build_factory_invest
Definition: culture.hpp:23
constexpr uint32_t open_factory
Definition: culture.hpp:10
constexpr uint32_t same_as_ruling_party
Definition: culture.hpp:34
constexpr uint32_t state_vote
Definition: culture.hpp:36
constexpr uint32_t can_invest_in_pop_projects
Definition: culture.hpp:22
constexpr uint32_t build_factory
Definition: culture.hpp:8
constexpr uint32_t build_railway_invest
Definition: culture.hpp:21
constexpr uint32_t can_subsidise
Definition: culture.hpp:13
constexpr uint32_t pop_expand_factory
Definition: culture.hpp:15
constexpr uint32_t delete_factory_if_no_input
Definition: culture.hpp:17
constexpr uint32_t culture_voting
Definition: culture.hpp:29
constexpr uint32_t destroy_factory
Definition: culture.hpp:11
constexpr uint32_t slavery_allowed
Definition: culture.hpp:27
constexpr uint32_t build_bank
Definition: culture.hpp:41
constexpr uint32_t rich_only
Definition: culture.hpp:35
constexpr uint32_t build_university
Definition: culture.hpp:42
constexpr uint32_t all_voting
Definition: culture.hpp:30
constexpr uint32_t allow_foreign_investment
Definition: culture.hpp:26
constexpr uint32_t dhont
Definition: culture.hpp:32
constexpr uint32_t pop_build_factory
Definition: culture.hpp:14
constexpr uint32_t largest_share
Definition: culture.hpp:31
constexpr uint32_t primary_culture_voting
Definition: culture.hpp:28
constexpr uint32_t build_factory_invest
Definition: culture.hpp:18
constexpr uint32_t factory_priority
Definition: culture.hpp:12
constexpr uint32_t sainte_laque
Definition: culture.hpp:33
constexpr uint32_t expand_factory_invest
Definition: culture.hpp:19
constexpr uint32_t population_vote
Definition: culture.hpp:37
constexpr uint32_t expand_factory
Definition: culture.hpp:9
uint uint32_t
ulong uint64_t
uchar uint8_t
dcon::trigger_key trigger
Definition: culture.hpp:102
dcon::modifier_id modifier
Definition: culture.hpp:101
dcon::text_key name
Definition: culture.hpp:100
dcon::text_key name
Definition: culture.hpp:111
tech_category category
Definition: culture.hpp:112
std::vector< dcon::issue_id > political_issues
Definition: culture.hpp:126
dcon::value_modifier_key conversion_chance
Definition: culture.hpp:166
std::vector< dcon::reform_id > military_issues
Definition: culture.hpp:128
dcon::pop_type_id farmers
Definition: culture.hpp:139
dcon::value_modifier_key migration_chance
Definition: culture.hpp:162
dcon::pop_type_id clergy
Definition: culture.hpp:141
dcon::value_modifier_key colonialmigration_chance
Definition: culture.hpp:163
std::vector< dcon::pop_type_id > rgo_workers
Definition: culture.hpp:132
tagged_vector< crime_info, dcon::crime_id > crimes
Definition: culture.hpp:134
dcon::value_modifier_key demotion_chance
Definition: culture.hpp:161
std::vector< dcon::reform_id > economic_issues
Definition: culture.hpp:129
dcon::pop_type_id secondary_factory_worker
Definition: culture.hpp:149
dcon::pop_type_id bureaucrat
Definition: culture.hpp:145
dcon::pop_type_id artisans
Definition: culture.hpp:137
std::vector< folder_info > tech_folders
Definition: culture.hpp:131
std::vector< dcon::issue_id > party_issues
Definition: culture.hpp:125
std::vector< dcon::issue_id > social_issues
Definition: culture.hpp:127
dcon::pop_type_id soldiers
Definition: culture.hpp:142
dcon::pop_type_id primary_factory_worker
Definition: culture.hpp:148
dcon::value_modifier_key assimilation_chance
Definition: culture.hpp:165
dcon::pop_type_id officers
Definition: culture.hpp:143
dcon::pop_type_id aristocrat
Definition: culture.hpp:146
dcon::issue_option_id jingoism
Definition: culture.hpp:157
dcon::pop_type_id capitalists
Definition: culture.hpp:138
dcon::ideology_id conservative
Definition: culture.hpp:155
dcon::value_modifier_key promotion_chance
Definition: culture.hpp:160
dcon::pop_type_id laborers
Definition: culture.hpp:140
dcon::pop_type_id slaves
Definition: culture.hpp:144
dcon::value_modifier_key emigration_chance
Definition: culture.hpp:164