I think I fixed a logic error in the bestsegs run calculator
This commit is contained in:
parent
aab5682965
commit
f0dc3bde84
@ -37,10 +37,10 @@ yet and may not ever be
|
||||
|
||||
### [Splits.io](https://splits.io/)
|
||||
|
||||
[X] Import game, category and segment names from generic format
|
||||
[] Import all information the generic format support i.e. run histories
|
||||
[] Export runs in the generic format
|
||||
- [X] Import game, category and segment names from generic format
|
||||
- [ ] Import all information the generic format support i.e. run histories
|
||||
- [ ] Export runs in the generic format
|
||||
|
||||
### [Speedrun.com](https://www.speedrun.com/)
|
||||
|
||||
[] Submit runs
|
||||
- [ ] Submit runs
|
||||
|
14
src/timer.c
14
src/timer.c
@ -436,13 +436,17 @@ void calculateBestSegs()
|
||||
if (attempts == 0)
|
||||
return;
|
||||
for (int i = 0; i < segCount; i++) {
|
||||
int bms = INT_MAX;
|
||||
int bestDuration = INT_MAX;
|
||||
for (int j = 0; j < attempts; j++) {
|
||||
int cms = pastRuns[(j * segCount) + i].ms;
|
||||
if (cms != 0 && cms < bms)
|
||||
bms = cms;
|
||||
int duration = pastRuns[(j * segCount) + i].ms;
|
||||
if (i != 0)
|
||||
duration -= bestsegs[i-1].ms;
|
||||
if (duration != 0 && duration < bestDuration)
|
||||
bestDuration = duration;
|
||||
}
|
||||
bestsegs[i].ms = bms;
|
||||
bestsegs[i].ms = bestDuration;
|
||||
if (i != 0)
|
||||
bestsegs[i].ms += bestsegs[i-1].ms;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user