From 62090cd936abf268fd370acd683e00ea0c31ec87 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Sat, 2 Apr 2016 23:32:56 +0200 Subject: [PATCH] fixes #1860 Litter bins fill up too fast --- src/peep/peep.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/peep/peep.c b/src/peep/peep.c index cd728c2dea..dac8c2af68 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -4891,17 +4891,17 @@ static void peep_update_using_bin(rct_peep* peep){ uint8 selected_bin = peep->var_37 * 2; // This counts down 2 = No rubbish, 0 = full - uint8 rubbish_in_bin = 0x3 & (map_element->properties.path.addition_status >> selected_bin); + uint8 space_left_in_bin = 0x3 & (map_element->properties.path.addition_status >> selected_bin); uint32 empty_containers = peep_empty_container_standard_flag(peep); for (uint8 cur_container = 0; cur_container < 32; cur_container++){ if (!(empty_containers & (1u << cur_container))) continue; - if (rubbish_in_bin != 0){ + if (space_left_in_bin != 0){ // OpenRCT2 modification: This previously used // the tick count as a simple random function // switched to scenario_rand as it is more reliable - if (scenario_rand() & 7) rubbish_in_bin--; + if ((scenario_rand() & 7) == 0) space_left_in_bin--; peep->item_standard_flags &= ~(1 << cur_container); peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; peep_update_sprite_type(peep); @@ -4927,11 +4927,11 @@ static void peep_update_using_bin(rct_peep* peep){ for (uint8 cur_container = 0; cur_container < 32; cur_container++){ if (!(empty_containers & (1u << cur_container))) continue; - if (rubbish_in_bin != 0){ + if (space_left_in_bin != 0){ // OpenRCT2 modification: This previously used // the tick count as a simple random function // switched to scenario_rand as it is more reliable - if (scenario_rand() & 7) rubbish_in_bin--; + if ((scenario_rand() & 7) == 0) space_left_in_bin--; peep->item_extra_flags &= ~(1 << cur_container); peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; @@ -4954,7 +4954,7 @@ static void peep_update_using_bin(rct_peep* peep){ // Place new amount in bin by first clearing the value map_element->properties.path.addition_status &= ~(3 << selected_bin); // Then placeing the new value. - map_element->properties.path.addition_status |= rubbish_in_bin << selected_bin; + map_element->properties.path.addition_status |= space_left_in_bin << selected_bin; map_invalidate_tile_zoom0(peep->next_x, peep->next_y, map_element->base_height << 3, map_element->clearance_height << 3); peep_state_reset(peep);