Skip to content

Commit 93badfa

Browse files
fix crime check
1 parent ac1e088 commit 93badfa

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/provinces/province.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -569,12 +569,8 @@ float crime_fighting_efficiency(sys::state& state, dcon::province_id id) {
569569
auto si = state.world.province_get_state_membership(id);
570570
auto owner = state.world.province_get_nation_from_province_ownership(id);
571571
if(si && owner)
572-
return (
573-
state.world.province_get_control_ratio(id)
574-
* state.defines.admin_efficiency_crimefight_percent
575-
+
576-
(1 - state.defines.admin_efficiency_crimefight_percent)
577-
* state.world.nation_get_administrative_efficiency(owner))
572+
return state.world.province_get_control_ratio(id)
573+
* (1.f + state.world.nation_get_administrative_efficiency(owner))
578574
* (
579575
state.defines.max_crimefight_percent
580576
- state.defines.min_crimefight_percent
@@ -1168,7 +1164,7 @@ void update_crimes(sys::state& state) {
11681164

11691165
auto chance = uint32_t(province::crime_fighting_efficiency(state, p) * 256.0f);
11701166
auto rvalues = rng::get_random_pair(state, uint32_t((p.index() << 2) + 1));
1171-
if((rvalues.high & 0xFF) >= chance) {
1167+
if((rvalues.high & 0xFF) <= chance) {
11721168
if(state.world.province_get_crime(p)) {
11731169
if(!province::is_overseas(state, p))
11741170
state.world.nation_get_central_crime_count(owner) -= uint16_t(1);

0 commit comments

Comments
 (0)