Move run finished trigger to upon immediate completion of run instead of after. Fix config filepath to use actual config path.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 36s
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 36s
This commit is contained in:
parent
179a73a9a7
commit
c750e423fd
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,3 +16,4 @@
|
||||
/x64/Debug/postproc-58.dll
|
||||
/x64/Debug/swresample-5.dll
|
||||
/x64/Debug/swscale-8.dll
|
||||
/EasternStar/config
|
||||
|
@ -40,14 +40,16 @@ const bool Timer::RunFinished()const{
|
||||
}
|
||||
void Timer::AdvanceSplit(){
|
||||
if(RunFinished()){
|
||||
OnRunFinished();
|
||||
Reset(); //If the run has finished BEFORE. This is a reset.
|
||||
return; //Return early because we let reset handle everything.
|
||||
}
|
||||
if(RunStarted())OnAdvanceSplit(); //Make sure we don't trigger this when the run hasn't started yet (entering first split)
|
||||
currentSplitInd++;
|
||||
Resume();
|
||||
if(RunFinished())paused=true; //If the run has finished AFTER, we pause the timer.
|
||||
if(RunFinished()){
|
||||
paused=true; //If the run has finished AFTER, we pause the timer.
|
||||
OnRunFinished();
|
||||
}
|
||||
}
|
||||
void Timer::Update(){
|
||||
if(!paused)elapsedTime+=engine.GetElapsedTime();
|
||||
@ -64,7 +66,7 @@ void Timer::Update(){
|
||||
}
|
||||
if(RunStarted()){
|
||||
if(engine.hotkeys.GetKey(HotkeyName::JUMP_BACK).bPressed&¤tSplitInd>0)OnAdvanceReverse();\
|
||||
if(engine.hotkeys.GetKey(HotkeyName::SKIP_AHEAD).bPressed&¤tSplitInd<splits.size())OnAdvanceSkip();
|
||||
if(engine.hotkeys.GetKey(HotkeyName::SKIP_AHEAD).bPressed&¤tSplitInd<splits.size()-1)OnAdvanceSkip();
|
||||
}
|
||||
}
|
||||
void Timer::Draw(vf2d drawPos){
|
||||
@ -194,7 +196,7 @@ void Timer::UpdateAndSaveSplits(Split::RunStatus finished){
|
||||
}
|
||||
totalAttempts++;
|
||||
EasternStar::DATA["TotalAttempts"].SetInt(totalAttempts);
|
||||
if(datafile::Write(EasternStar::DATA,"config"))std::cout<<"Config file successfully saved!"<<std::endl;
|
||||
if(datafile::Write(EasternStar::DATA,"assets/config"))std::cout<<"Config file successfully saved!"<<std::endl;
|
||||
else std::cerr<<"WARNING! Failed to write to config file!"<<std::endl;
|
||||
}
|
||||
void Timer::OnRunFinished(){
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user