From a721eec118cbe645ef5a3a0ad7bc7e56ebd490fe Mon Sep 17 00:00:00 2001 From: Dominic Szablewski Date: Sat, 19 Aug 2023 21:30:15 +0200 Subject: [PATCH] Fix championship rank calculation --- src/wipeout/race.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wipeout/race.c b/src/wipeout/race.c index 0b3927b..6d85f1b 100755 --- a/src/wipeout/race.c +++ b/src/wipeout/race.c @@ -207,7 +207,14 @@ void race_end() { if (g.race_type == RACE_TYPE_CHAMPIONSHIP) { for (int i = 0; i < len(def.race_points_for_rank); i++) { g.race_ranks[i].points = def.race_points_for_rank[i]; - g.championship_ranks[g.race_ranks[i].pilot].points += def.race_points_for_rank[i]; + + // Find the pilot for this race rank in the championship table + for (int j = 0; j < len(g.championship_ranks); j++) { + if (g.race_ranks[i].pilot == g.championship_ranks[j].pilot) { + g.championship_ranks[j].points += def.race_points_for_rank[i]; + break; + } + } } sort(g.championship_ranks, len(g.championship_ranks), sort_points_compare); }