|
21 | 21 | #include "openvic-simulation/research/Invention.hpp" |
22 | 22 | #include "openvic-simulation/research/Technology.hpp" |
23 | 23 | #include "openvic-simulation/types/fixed_point/FixedPoint.hpp" |
| 24 | +#include "openvic-simulation/types/IndexedMap.hpp" |
24 | 25 | #include "openvic-simulation/types/PopSize.hpp" |
25 | 26 | #include "openvic-simulation/types/SliderValue.hpp" |
26 | 27 |
|
@@ -1171,19 +1172,34 @@ void CountryInstance::_update_budget() { |
1171 | 1172 | OpenVic immediately updates both. |
1172 | 1173 | */ |
1173 | 1174 |
|
1174 | | - if (total_population == 0) { |
1175 | | - administrative_efficiency = 1; |
1176 | | - } else { |
1177 | | - pop_size_t administrators = 0; |
1178 | | - for (auto const& [pop_type, size] : pop_type_distribution) { |
| 1175 | + pop_size_t total_non_colonial_population = 0; |
| 1176 | + pop_size_t administrators = 0; |
| 1177 | + for (State const* const state_ptr : states) { |
| 1178 | + if (state_ptr == nullptr) { |
| 1179 | + continue; |
| 1180 | + } |
| 1181 | + |
| 1182 | + State const& state = *state_ptr; |
| 1183 | + if (state.is_colonial_state()) { |
| 1184 | + continue; |
| 1185 | + } |
| 1186 | + |
| 1187 | + IndexedMap<PopType, pop_size_t> const& state_pop_type_distribution = state.get_pop_type_distribution(); |
| 1188 | + |
| 1189 | + for (auto const& [pop_type, size] : state_pop_type_distribution) { |
1179 | 1190 | if (pop_type.get_is_administrator()) { |
1180 | 1191 | administrators += size; |
1181 | 1192 | } |
1182 | 1193 | } |
| 1194 | + total_non_colonial_population += state.get_total_population(); |
| 1195 | + } |
1183 | 1196 |
|
| 1197 | + if (total_non_colonial_population == 0) { |
| 1198 | + administrative_efficiency = fixed_point_t::_1; |
| 1199 | + } else { |
1184 | 1200 | const fixed_point_t desired_administrator_percentage = country_defines.get_max_bureaucracy_percentage() |
1185 | 1201 | + total_administrative_multiplier * country_defines.get_bureaucracy_percentage_increment(); |
1186 | | - const fixed_point_t desired_administrators = desired_administrator_percentage * total_population; |
| 1202 | + const fixed_point_t desired_administrators = desired_administrator_percentage * total_non_colonial_population; |
1187 | 1203 |
|
1188 | 1204 | administrative_efficiency = std::min( |
1189 | 1205 | fixed_point_t::mul_div( |
|
0 commit comments