fixed getCUrrentStartDelay returning crap

This commit is contained in:
Dorian Zedler 2020-10-03 13:49:56 +02:00
parent e873503dfa
commit 46c62ba187
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
3 changed files with 11 additions and 3 deletions

View file

@ -112,6 +112,8 @@ public slots:
*/ */
bool cancel(); bool cancel();
bool isPlaying();
private slots: private slots:
signals: signals:

View file

@ -556,6 +556,7 @@ QVariantMap ScStwRace::getCurrentStartDelay() {
currentStartDelay["progress"] = 0; currentStartDelay["progress"] = 0;
return currentStartDelay; return currentStartDelay;
} }
break;
case PREPAIRING: { case PREPAIRING: {
if(!this->startSoundSettings[ScStwSoundPlayer::AtYourMarks]["Enabled"].toBool()) if(!this->startSoundSettings[ScStwSoundPlayer::AtYourMarks]["Enabled"].toBool())
return currentStartDelay; return currentStartDelay;
@ -571,10 +572,11 @@ QVariantMap ScStwRace::getCurrentStartDelay() {
// get the total delay and the delay progress of the next action timer // get the total delay and the delay progress of the next action timer
double remaining = this->startDelayTimer->remainingTime(); double remaining = this->startDelayTimer->remainingTime();
if(remaining < 0)
return currentStartDelay;
currentStartDelay["total"] = this->startDelayTimer->interval(); currentStartDelay["total"] = this->startDelayTimer->interval();
if(remaining < 0) {
remaining = currentStartDelay["total"].toDouble();
}
currentStartDelay["progress"] = 1 - (remaining / currentStartDelay["total"].toDouble()); currentStartDelay["progress"] = 1 - (remaining / currentStartDelay["total"].toDouble());
if(currentStartDelay["progress"].toDouble() < 0) if(currentStartDelay["progress"].toDouble() < 0)

View file

@ -115,3 +115,7 @@ bool ScStwSoundPlayer::waitForSoundFinish(double *timeOfStop) {
return true; return true;
} }
bool ScStwSoundPlayer::isPlaying() {
return this->soundEffect->isPlaying();
}