livesplit-core icon indicating copy to clipboard operation
livesplit-core copied to clipboard

Rework Run::current_split_index

Open CryZe opened this issue 6 years ago • 2 comments

It should either return None or a valid index into the Run. I don't think it's a good idea that we are returning out of bounds indices here. @wooferzfg thoughts?

CryZe avatar Nov 07 '19 14:11 CryZe

Yeah, using an out of bounds index for when the run is unstarted or ended is really hacky because we can get the same information from the timer phase. We just need to make sure that there isn't any code that's relying on the current split index being an out of bounds value.

wooferzfg avatar Nov 07 '19 14:11 wooferzfg

I think we might even want to turn TimerPhase into:

enum AttemptState {
    Unstarted,
    Active {
        index: usize,
        paused: bool,
    },
    Ended,
}

or something similar.

CryZe avatar Nov 07 '19 14:11 CryZe