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/)
|
### [Splits.io](https://splits.io/)
|
||||||
|
|
||||||
[X] Import game, category and segment names from generic format
|
- [X] Import game, category and segment names from generic format
|
||||||
[] Import all information the generic format support i.e. run histories
|
- [ ] Import all information the generic format support i.e. run histories
|
||||||
[] Export runs in the generic format
|
- [ ] Export runs in the generic format
|
||||||
|
|
||||||
### [Speedrun.com](https://www.speedrun.com/)
|
### [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)
|
if (attempts == 0)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < segCount; i++) {
|
for (int i = 0; i < segCount; i++) {
|
||||||
int bms = INT_MAX;
|
int bestDuration = INT_MAX;
|
||||||
for (int j = 0; j < attempts; j++) {
|
for (int j = 0; j < attempts; j++) {
|
||||||
int cms = pastRuns[(j * segCount) + i].ms;
|
int duration = pastRuns[(j * segCount) + i].ms;
|
||||||
if (cms != 0 && cms < bms)
|
if (i != 0)
|
||||||
bms = cms;
|
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