diff --git a/src/peep/peep.c b/src/peep/peep.c index d4e98dc93d..697dd5d51b 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -1521,13 +1521,13 @@ void remove_peep_from_queue(rct_peep* peep) uint8 cur_station = peep->current_ride_station; ride->queue_length[cur_station]--; - if (peep->sprite_index == ride->first_peep_in_queue[cur_station]) + if (peep->sprite_index == ride->last_peep_in_queue[cur_station]) { - ride->first_peep_in_queue[cur_station] = peep->next_in_queue; + ride->last_peep_in_queue[cur_station] = peep->next_in_queue; return; } - for (rct_peep* other_peep = GET_PEEP(ride->first_peep_in_queue[cur_station]);; + for (rct_peep* other_peep = GET_PEEP(ride->last_peep_in_queue[cur_station]);; other_peep = GET_PEEP(other_peep->next_in_queue)){ if (peep->sprite_index == other_peep->next_in_queue){ other_peep->next_in_queue = peep->next_in_queue; @@ -2104,14 +2104,14 @@ static void peep_update_ride_sub_state_2_rejoin_queue(rct_peep* peep, rct_ride* ride->queue_length[peep->current_ride_station]++; - uint16 current_first = ride->first_peep_in_queue[peep->current_ride_station]; - if (current_first == 0xFFFF){ - ride->first_peep_in_queue[peep->current_ride_station] = peep->sprite_index; + uint16 current_last = ride->last_peep_in_queue[peep->current_ride_station]; + if (current_last == 0xFFFF){ + ride->last_peep_in_queue[peep->current_ride_station] = peep->sprite_index; return; } rct_peep* queue_peep; - for (queue_peep = GET_PEEP(current_first); + for (queue_peep = GET_PEEP(current_last); queue_peep->next_in_queue != 0xFFFF; queue_peep = GET_PEEP(queue_peep->next_in_queue)); @@ -6104,9 +6104,9 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m peep->var_79 = rideIndex; rct_ride* ride = GET_RIDE(rideIndex); - uint16 previous_first = ride->first_peep_in_queue[stationNum]; - ride->first_peep_in_queue[stationNum] = peep->sprite_index; - peep->next_in_queue = previous_first; + uint16 previous_last = ride->last_peep_in_queue[stationNum]; + ride->last_peep_in_queue[stationNum] = peep->sprite_index; + peep->next_in_queue = previous_last; ride->queue_length[stationNum]++; peep_decrement_num_riders(peep); @@ -6473,9 +6473,9 @@ static int peep_interact_with_path(rct_peep* peep, sint16 x, sint16 y, rct_map_e peep->var_79 = rideIndex; rct_ride* ride = GET_RIDE(rideIndex); - uint16 old_first_peep = ride->first_peep_in_queue[stationNum]; - ride->first_peep_in_queue[stationNum] = peep->sprite_index; - peep->next_in_queue = old_first_peep; + uint16 old_last_peep = ride->last_peep_in_queue[stationNum]; + ride->last_peep_in_queue[stationNum] = peep->sprite_index; + peep->next_in_queue = old_last_peep; ride->queue_length[stationNum]++; peep_decrement_num_riders(peep); @@ -7926,18 +7926,18 @@ static bool peep_should_go_on_ride(rct_peep *peep, int rideIndex, int entranceNu // Rides without queues can only have one peep waiting at a time. if (!peepAtQueue) { - if (ride->first_peep_in_queue[entranceNum] != 0xFFFF) { + if (ride->last_peep_in_queue[entranceNum] != 0xFFFF) { peep_tried_to_enter_full_queue(peep, rideIndex); return false; } } else { // Check if there's room in the queue for the peep to enter. - if (ride->first_peep_in_queue[entranceNum] != 0xFFFF) { - rct_peep *firstPeepInQueue = GET_PEEP(ride->first_peep_in_queue[entranceNum]); - if (abs(firstPeepInQueue->z - peep->z) <= 6) { - int dx = abs(firstPeepInQueue->x - peep->x); - int dy = abs(firstPeepInQueue->y - peep->y); + if (ride->last_peep_in_queue[entranceNum] != 0xFFFF) { + rct_peep *lastPeepInQueue = GET_PEEP(ride->last_peep_in_queue[entranceNum]); + if (abs(lastPeepInQueue->z - peep->z) <= 6) { + int dx = abs(lastPeepInQueue->x - peep->x); + int dy = abs(lastPeepInQueue->y - peep->y); int maxD = max(dx, dy); // Unlike normal paths, peeps cannot overlap when queueing for a ride. @@ -7949,7 +7949,7 @@ static bool peep_should_go_on_ride(rct_peep *peep, int rideIndex, int entranceNu // This checks if there's a peep standing still at the very end of the queue. if (maxD <= 13 - && firstPeepInQueue->time_in_queue > 10) { + && lastPeepInQueue->time_in_queue > 10) { peep_tried_to_enter_full_queue(peep, rideIndex); return false; } diff --git a/src/rct1.h b/src/rct1.h index 07acdc4b95..159d1ce984 100644 --- a/src/rct1.h +++ b/src/rct1.h @@ -63,7 +63,7 @@ typedef struct { uint8 station_depart[4]; uint16 entrance[4]; uint16 exit[4]; - uint16 first_peep_in_queue[4]; + uint16 last_peep_in_queue[4]; uint8 num_peeps_in_queue[4]; uint16 vehicles[12]; uint8 depart_flags; diff --git a/src/ride/ride.c b/src/ride/ride.c index 516df6ead1..062f904d96 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -6835,7 +6835,7 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio ride->exits[station_num] = (x / 32) | (y / 32 << 8); } else { ride->entrances[station_num] = (x / 32) | (y / 32 << 8); - ride->first_peep_in_queue[station_num] = 0xFFFF; + ride->last_peep_in_queue[station_num] = 0xFFFF; ride->queue_length[station_num] = 0; map_animation_create(MAP_ANIMATION_TYPE_RIDE_ENTRANCE, x, y, z / 8); diff --git a/src/ride/ride.h b/src/ride/ride.h index a1981d825d..cd69c37099 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -187,7 +187,7 @@ typedef struct { uint8 var_066[4]; uint16 entrances[4]; // 0x06A uint16 exits[4]; // 0x072 - uint16 first_peep_in_queue[4]; // 0x07A + uint16 last_peep_in_queue[4]; // 0x07A uint8 pad_082[4]; uint16 vehicles[32]; // 0x086 Points to the first car in the train uint8 depart_flags; // 0x0C6 diff --git a/src/windows/cheats.c b/src/windows/cheats.c index f0aa95a46b..950c129b78 100644 --- a/src/windows/cheats.c +++ b/src/windows/cheats.c @@ -708,7 +708,8 @@ static void cheat_remove_all_guests() ride_set_status(i, RIDE_STATUS_CLOSED); for(int i=0;i<4;i++) { - ride->first_peep_in_queue[i]=0xFFFF; + ride->queue_length[i] = 0; + ride->last_peep_in_queue[i]=0xFFFF; } } window_invalidate_by_class(WC_RIDE);