mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 10:22:48 +01:00
- fix insertion sort implementation in gamesnd
This commit is contained in:
parent
0a3574bc5c
commit
ecf5b527e6
@ -1005,20 +1005,19 @@ void DoDopplerSFX(void)
|
||||
}
|
||||
}
|
||||
|
||||
// sort cars by distance distance
|
||||
for (i = 0; i < num_noisy_cars - 1; i++)
|
||||
// sort cars by distance
|
||||
for (i = 1; i < num_noisy_cars; i++)
|
||||
{
|
||||
for (j = i + 1; j < num_noisy_cars; j++)
|
||||
{
|
||||
int tmpi;
|
||||
tmpi = indexlist[i];
|
||||
int tmpi;
|
||||
tmpi = indexlist[i];
|
||||
|
||||
if (car_dist[indexlist[j]] < car_dist[tmpi])
|
||||
{
|
||||
indexlist[i] = indexlist[j];
|
||||
indexlist[j] = tmpi;
|
||||
}
|
||||
j = i - 1;
|
||||
while (j >= 0 && car_dist[indexlist[j]] > car_dist[tmpi])
|
||||
{
|
||||
indexlist[j + 1] = indexlist[j];
|
||||
j = j - 1;
|
||||
}
|
||||
indexlist[j + 1] = tmpi;
|
||||
}
|
||||
|
||||
car_flags = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user