@@ -1123,20 +1123,20 @@ void update_ai_ruling_party(sys::state& state) {
1123
1123
}
1124
1124
}
1125
1125
1126
- void get_craved_factory_types (sys::state& state, dcon::nation_id nid, dcon::market_id mid, dcon::province_id pid, std::vector<dcon::factory_type_id>& desired_types) {
1126
+ void get_craved_factory_types (sys::state& state, dcon::nation_id nid, dcon::market_id mid, dcon::province_id pid, std::vector<dcon::factory_type_id>& desired_types, bool pop_project ) {
1127
1127
assert (desired_types.empty ());
1128
1128
auto n = dcon::fatten (state.world , nid);
1129
1129
auto m = dcon::fatten (state.world , mid);
1130
1130
auto sid = m.get_zone_from_local_market ();
1131
1131
1132
- auto const tax_eff = nations::tax_efficiency (state, n );
1132
+ auto const tax_eff = economy::tax_collection_rate (state, nid, pid );
1133
1133
auto const rich_effect = (1 .0f - tax_eff * float (state.world .nation_get_rich_tax (n)) / 100 .0f );
1134
1134
auto wage = state.world .province_get_labor_price (pid, economy::labor::basic_education) * 2 .f ;
1135
1135
1136
1136
if (desired_types.empty ()) {
1137
1137
for (auto type : state.world .in_factory_type ) {
1138
1138
if (n.get_active_building (type) || type.get_is_available_from_start ()) {
1139
- float cost = economy::factory_type_build_cost (state, n, m , type);
1139
+ float cost = economy::factory_type_build_cost (state, n, pid , type, pop_project );
1140
1140
float output = economy::factory_type_output_cost (state, n, m, type);
1141
1141
float input = economy::factory_type_input_cost (state, n, m, type);
1142
1142
@@ -1150,13 +1150,13 @@ void get_craved_factory_types(sys::state& state, dcon::nation_id nid, dcon::mark
1150
1150
}
1151
1151
}
1152
1152
1153
- void get_desired_factory_types (sys::state& state, dcon::nation_id nid, dcon::market_id mid, dcon::province_id pid, std::vector<dcon::factory_type_id>& desired_types) {
1153
+ void get_desired_factory_types (sys::state& state, dcon::nation_id nid, dcon::market_id mid, dcon::province_id pid, std::vector<dcon::factory_type_id>& desired_types, bool pop_project ) {
1154
1154
assert (desired_types.empty ());
1155
1155
auto n = dcon::fatten (state.world , nid);
1156
1156
auto m = dcon::fatten (state.world , mid);
1157
1157
auto sid = m.get_zone_from_local_market ();
1158
1158
1159
- auto const tax_eff = nations::tax_efficiency (state, n );
1159
+ auto const tax_eff = economy::tax_collection_rate (state, nid, pid );
1160
1160
auto const rich_effect = (1 .0f - tax_eff * float (state.world .nation_get_rich_tax (n)) / 100 .0f );
1161
1161
auto wage = state.world .province_get_labor_price (pid, economy::labor::basic_education) * 2 .f ;
1162
1162
@@ -1191,7 +1191,7 @@ void get_desired_factory_types(sys::state& state, dcon::nation_id nid, dcon::mar
1191
1191
}
1192
1192
}
1193
1193
1194
- float cost = economy::factory_type_build_cost (state, n, m , type) + 0 .1f ;
1194
+ float cost = economy::factory_type_build_cost (state, n, pid , type, pop_project ) + 0 .1f ;
1195
1195
float output = economy::factory_type_output_cost (state, n, m, type);
1196
1196
float input = economy::factory_type_input_cost (state, n, m, type) + 0 .1f ;
1197
1197
@@ -1234,7 +1234,7 @@ void get_desired_factory_types(sys::state& state, dcon::nation_id nid, dcon::mar
1234
1234
}
1235
1235
}
1236
1236
1237
- float cost = economy::factory_type_build_cost (state, n, m , type) + 0 .1f ;
1237
+ float cost = economy::factory_type_build_cost (state, n, pid , type, pop_project ) + 0 .1f ;
1238
1238
float output = economy::factory_type_output_cost (state, n, m, type);
1239
1239
float input = economy::factory_type_input_cost (state, n, m, type) + 0 .1f ;
1240
1240
auto profit = (output - input - wage * type.get_base_workforce ()) * (1 .0f - rich_effect);
@@ -1275,7 +1275,7 @@ void get_desired_factory_types(sys::state& state, dcon::nation_id nid, dcon::mar
1275
1275
}
1276
1276
}
1277
1277
1278
- float cost = economy::factory_type_build_cost (state, n, m , type) + 0 .1f ;
1278
+ float cost = economy::factory_type_build_cost (state, n, pid , type, pop_project ) + 0 .1f ;
1279
1279
float output = economy::factory_type_output_cost (state, n, m, type);
1280
1280
float input = economy::factory_type_input_cost (state, n, m, type) + 0 .1f ;
1281
1281
auto profit = (output - input - wage * type.get_base_workforce ()) * (1 .0f - rich_effect);
@@ -1301,7 +1301,7 @@ void get_state_craved_factory_types(sys::state& state, dcon::nation_id nid, dcon
1301
1301
for (auto type : state.world .in_factory_type ) {
1302
1302
if (n.get_active_building (type) || type.get_is_available_from_start ()) {
1303
1303
1304
- float cost = economy::factory_type_build_cost (state, n, m , type) + 0 .1f ;
1304
+ float cost = economy::factory_type_build_cost (state, n, pid , type, false ) + 0 .1f ;
1305
1305
float output = economy::factory_type_output_cost (state, n, m, type);
1306
1306
float input = economy::factory_type_input_cost (state, n, m, type) + 0 .1f ;
1307
1307
@@ -1337,7 +1337,7 @@ void get_state_desired_factory_types(sys::state& state, dcon::nation_id nid, dco
1337
1337
}
1338
1338
}
1339
1339
1340
- float cost = economy::factory_type_build_cost (state, n, m , type) + 0 .1f ;
1340
+ float cost = economy::factory_type_build_cost (state, n, pid , type, false ) + 0 .1f ;
1341
1341
float output = economy::factory_type_output_cost (state, n, m, type);
1342
1342
float input = economy::factory_type_input_cost (state, n, m, type) + 0 .1f ;
1343
1343
@@ -1364,7 +1364,7 @@ void get_state_desired_factory_types(sys::state& state, dcon::nation_id nid, dco
1364
1364
}
1365
1365
}
1366
1366
1367
- float cost = economy::factory_type_build_cost (state, n, m , type) + 0 .1f ;
1367
+ float cost = economy::factory_type_build_cost (state, n, pid , type, false ) + 0 .1f ;
1368
1368
float output = economy::factory_type_output_cost (state, n, m, type);
1369
1369
float input = economy::factory_type_input_cost (state, n, m, type) + 0 .1f ;
1370
1370
auto profitabilitymark = std::max (0 .01f , cost * 10 .f / treasury);
@@ -4010,11 +4010,7 @@ void update_budget(sys::state& state) {
4010
4010
// If State can build factories - why subsidize capitalists
4011
4011
auto rules = n.get_combined_issue_rules ();
4012
4012
if (n.get_is_civilized () && (rules & issue_rule::build_factory) == 0 ) {
4013
- float investment_budget = investments_budget_ratio * base_income;
4014
- float max_investment_budget = 1 .f + economy::estimate_max_domestic_investment (state, n);
4015
- float investment_ratio = 100 .f * math::sqrt (investment_budget / max_investment_budget);
4016
- investment_ratio = std::clamp (investment_ratio, 0 .f , 100 .f );
4017
- n.set_domestic_investment_spending (int8_t (investment_ratio));
4013
+ n.set_domestic_investment_spending (int8_t (investments_budget_ratio * 100 .f ));
4018
4014
} else {
4019
4015
n.set_domestic_investment_spending (int8_t (0 ));
4020
4016
}
@@ -4051,7 +4047,7 @@ void update_budget(sys::state& state) {
4051
4047
if (!n.get_ai_is_threatened ()) {
4052
4048
n.set_military_spending (int8_t (std::max (50 , n.get_military_spending () - 5 )));
4053
4049
}
4054
- n.set_social_spending (int8_t ( std::max ( 0 , n. get_social_spending () - 2 )) );
4050
+ n.set_social_spending (1 );
4055
4051
4056
4052
n.set_poor_tax (int8_t (std::clamp (n.get_poor_tax () + 2 , 10 , std::max (10 , max_poor_tax))));
4057
4053
n.set_middle_tax (int8_t (std::clamp (n.get_middle_tax () + 3 , 10 , std::max (10 , max_mid_tax))));
@@ -4062,7 +4058,7 @@ void update_budget(sys::state& state) {
4062
4058
} else {
4063
4059
n.set_military_spending (int8_t (std::min (75 , n.get_military_spending () + 10 )));
4064
4060
}
4065
- n.set_social_spending (int8_t ( std::min (max_social, n. get_social_spending () + 2 )) );
4061
+ n.set_social_spending (3 );
4066
4062
4067
4063
if (enough_tax) {
4068
4064
n.set_poor_tax (int8_t (std::clamp (n.get_poor_tax () - 2 , 10 , std::max (10 , max_poor_tax))));
@@ -4074,7 +4070,7 @@ void update_budget(sys::state& state) {
4074
4070
int max_poor_tax = int (10 .f + 90 .f * (1 .f - poor_militancy));
4075
4071
int max_mid_tax = int (10 .f + 90 .f * (1 .f - mid_militancy));
4076
4072
int max_rich_tax = int (10 .f + 40 .f * (1 .f - rich_militancy));
4077
- int max_social = int (100 .f * poor_militancy);
4073
+ int max_social = int (20 .f * poor_militancy);
4078
4074
4079
4075
// enough tax?
4080
4076
bool enough_tax = true ;
@@ -4090,7 +4086,7 @@ void update_budget(sys::state& state) {
4090
4086
if (!n.get_ai_is_threatened ()) {
4091
4087
n.set_military_spending (int8_t (std::max (50 , n.get_military_spending () - 5 )));
4092
4088
}
4093
- n.set_social_spending (int8_t (std::max ( 0 , n. get_social_spending () - 2 ) ));
4089
+ n.set_social_spending (int8_t (max_social / 2 ));
4094
4090
4095
4091
n.set_poor_tax (int8_t (std::clamp (n.get_poor_tax () + 5 , 10 , std::max (10 , max_poor_tax))));
4096
4092
n.set_middle_tax (int8_t (std::clamp (n.get_middle_tax () + 3 , 10 , std::max (10 , max_mid_tax))));
@@ -4101,7 +4097,7 @@ void update_budget(sys::state& state) {
4101
4097
} else {
4102
4098
n.set_military_spending (int8_t (std::min (75 , n.get_military_spending () + 10 )));
4103
4099
}
4104
- n.set_social_spending (int8_t (std::min ( max_social, n. get_social_spending () + 2 ) ));
4100
+ n.set_social_spending (int8_t (max_social));
4105
4101
4106
4102
if (enough_tax) {
4107
4103
n.set_poor_tax (int8_t (std::clamp (n.get_poor_tax () - 5 , 10 , std::max (10 , max_poor_tax))));
0 commit comments