1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

Fixed inconsistent use of peep->rides_been_on

This commit is contained in:
Sam Horn
2015-10-18 02:32:26 +10:00
parent 8850d1153f
commit 05f6ea96a0
3 changed files with 6 additions and 6 deletions

View File

@@ -7535,24 +7535,24 @@ static void peep_spend_money(rct_peep *peep, money16 *peep_expend_type, money32
static void peep_set_has_ridden(rct_peep *peep, int rideIndex)
{
peep->rides_been_on[rideIndex / 32] |= 1 << (rideIndex % 32);
peep->rides_been_on[rideIndex / 8] |= 1 << (rideIndex % 8);
rct_ride *ride = GET_RIDE(rideIndex);
peep_set_has_ridden_ride_type(peep, ride->type);
}
static bool peep_has_ridden(rct_peep *peep, int rideIndex)
{
return peep->rides_been_on[rideIndex / 32] & (1 << (rideIndex % 32));
return peep->rides_been_on[rideIndex / 8] & (1 << (rideIndex % 8));
}
static void peep_set_has_ridden_ride_type(rct_peep *peep, int rideType)
{
peep->ride_types_been_on[rideType / 32] |= 1 << (rideType % 32);
peep->ride_types_been_on[rideType / 8] |= 1 << (rideType % 8);
}
static bool peep_has_ridden_ride_type(rct_peep *peep, int rideType)
{
return peep->ride_types_been_on[rideType / 32] & (1 << (rideType % 32));
return peep->ride_types_been_on[rideType / 8] & (1 << (rideType % 8));
}
/**

View File

@@ -5441,7 +5441,7 @@ void game_command_demolish_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi
uint16 spriteIndex;
rct_peep *peep;
FOR_ALL_GUESTS(spriteIndex, peep){
uint8 ride_id_bit = ride_id & 0x3;
uint8 ride_id_bit = ride_id % 8;
uint8 ride_id_offset = ride_id / 8;
peep->rides_been_on[ride_id_offset] &= ~(1 << ride_id_bit); // clear ride from potentially being in rides_been_on
if(peep->state == PEEP_STATE_WATCHING){

View File

@@ -1514,7 +1514,7 @@ void window_guest_rides_update(rct_window *w)
uint8 curr_list_position = 0;
for (uint8 ride_id = 0; ride_id < 255; ++ride_id){
// Offset to the ride_id bit in peep_rides_been_on
uint8 ride_id_bit = ride_id & 0x7;
uint8 ride_id_bit = ride_id % 8;
uint8 ride_id_offset = ride_id / 8;
if (peep->rides_been_on[ride_id_offset] & (1 << ride_id_bit)){
rct_ride* ride = GET_RIDE(ride_id);