1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 16:24:35 +01:00

Added checks to prevent underflow

This commit is contained in:
Duncan Frost
2015-04-15 19:04:02 +01:00
parent 3e5ba44663
commit 1d7ab54ab8
2 changed files with 5 additions and 8 deletions

View File

@@ -197,8 +197,8 @@ void peep_check_if_lost(rct_peep* peep){
peep->var_F4 = 230;
}
peep_insert_new_thought(peep, PEEP_THOUGHT_TYPE_LOST, 0xFF);
if (peep->happiness_growth_rate < 30) peep->happiness_growth_rate = 0;
else peep->happiness_growth_rate -= 30;
peep->happiness_growth_rate = max(peep->happiness_growth_rate - 30, 0);
}
/* rct2: 0x69C26B
@@ -210,8 +210,7 @@ void peep_check_cant_find_ride(rct_peep* peep){
if (peep->var_C6 == 30 || peep->var_C6 == 60){
peep_insert_new_thought(peep, PEEP_THOUGHT_TYPE_CANT_FIND, peep->guest_heading_to_ride_id);
if (peep->happiness_growth_rate < 30) peep->happiness_growth_rate = 0;
else peep->happiness_growth_rate -= 30;
peep->happiness_growth_rate = max(peep->happiness_growth_rate - 30, 0);
}
peep->var_C6--;
@@ -236,8 +235,7 @@ void peep_check_cant_find_exit(rct_peep* peep){
if (peep->var_C6 == 1){
peep_insert_new_thought(peep, PEEP_THOUGHT_TYPE_CANT_FIND_EXIT, 0xFF);
if (peep->happiness_growth_rate < 30) peep->happiness_growth_rate = 0;
else peep->happiness_growth_rate -= 30;
peep->happiness_growth_rate = max(peep->happiness_growth_rate - 30, 0);
}
if (--peep->var_C6 == 0) peep->var_C6 = 90;

View File

@@ -1237,8 +1237,7 @@ void window_guest_overview_tool_down(){
peep->action_sprite_type = 0xFF;
peep->var_C4 = 0;
peep->happiness_growth_rate -= 10;
if (peep->happiness_growth_rate < 0)peep->happiness_growth_rate = 0;
peep->happiness_growth_rate = max(peep->happiness_growth_rate - 10, 0);
sub_693B58(peep);
tool_cancel();