fixed getCUrrentStartDelay returning crap
This commit is contained in:
parent
e873503dfa
commit
46c62ba187
3 changed files with 11 additions and 3 deletions
|
@ -112,6 +112,8 @@ public slots:
|
||||||
*/
|
*/
|
||||||
bool cancel();
|
bool cancel();
|
||||||
|
|
||||||
|
bool isPlaying();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -115,3 +115,7 @@ bool ScStwSoundPlayer::waitForSoundFinish(double *timeOfStop) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScStwSoundPlayer::isPlaying() {
|
||||||
|
return this->soundEffect->isPlaying();
|
||||||
|
}
|
||||||
|
|
Reference in a new issue