luizppa / top-gear

The SNES Top Gear game made in Allegro 5
GNU General Public License v3.0
10 stars 2 forks source link

Playing consecutive races causes the cars to be rendered incorrectly #1

Open luizppa opened 5 years ago

luizppa commented 5 years ago

When playing multiple consecutive races causes the cars to be incorrectly ordered on the **cars array (global variable in helpers/game.c) therefore, causing them to be rendered in an incorrect order and also affecting things like placements. Running a few tests i could realize that the cars array stays ordered like it has been at the end of the first race placed, which should not happen since the array goes through a quick sort each time the game is updated. To avoid this i started cleaning the cars array at the end of each race (on void clear_game() at helpers/game.c line 717) and refilling it at each race start (on void setup() at helpers/game.c lines 583 and 589) but it does not seem to be of any help.