added wildcard state
This commit is contained in:
parent
ec6723af75
commit
b8e8f45222
3 changed files with 24 additions and 4 deletions
|
@ -86,6 +86,7 @@ public:
|
||||||
WON, /*!< Timer has won */
|
WON, /*!< Timer has won */
|
||||||
LOST, /*!< Timer has lost */
|
LOST, /*!< Timer has lost */
|
||||||
FAILED, /*!< A false start occured */
|
FAILED, /*!< A false start occured */
|
||||||
|
WILDCARD, /*!< The opponent has done a false start */
|
||||||
CANCELLED, /*!< Timer was cancelled */
|
CANCELLED, /*!< Timer was cancelled */
|
||||||
INCIDENT, /*!< There was a technical incident (most likely a disconnected extension) */
|
INCIDENT, /*!< There was a technical incident (most likely a disconnected extension) */
|
||||||
DISABLED /*!< Timer is disabled */
|
DISABLED /*!< Timer is disabled */
|
||||||
|
@ -332,6 +333,15 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void technicalIncident();
|
void technicalIncident();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Function to set the timer into WILDCARD state
|
||||||
|
*
|
||||||
|
* Only works when the timer is in STARTING state.
|
||||||
|
*
|
||||||
|
* \return false if not in STARTING state
|
||||||
|
*/
|
||||||
|
bool wildcard();
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -248,10 +248,11 @@ int ScStwRace::handleFalseStart() {
|
||||||
|
|
||||||
int returnCode = ScStw::Success;
|
int returnCode = ScStw::Success;
|
||||||
|
|
||||||
// cancel all running timers
|
// set all running timers to wildcard
|
||||||
foreach(ScStwTimer *timer, this->timers) {
|
foreach(ScStwTimer *timer, this->timers) {
|
||||||
if(timer->getState() != ScStwTimer::FAILED && !timer->cancel() && timer->getState() != ScStwTimer::DISABLED)
|
if(timer->getState() != ScStwTimer::FAILED && timer->getState() != ScStwTimer::DISABLED)
|
||||||
returnCode = ScStw::InternalErrorTimerOperationFailed;
|
if(!timer->wildcard())
|
||||||
|
returnCode = ScStw::InternalErrorTimerOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setState(STOPPED);
|
this->setState(STOPPED);
|
||||||
|
|
|
@ -71,6 +71,15 @@ void ScStwTimer::technicalIncident() {
|
||||||
this->setState(INCIDENT);
|
this->setState(INCIDENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScStwTimer::wildcard() {
|
||||||
|
if(this->state != STARTING)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
this->setState(WILDCARD);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ScStwTimer::handleClimberStart(double timeOfStart) {
|
void ScStwTimer::handleClimberStart(double timeOfStart) {
|
||||||
this->reactionTime = timeOfStart - this->startTime;
|
this->reactionTime = timeOfStart - this->startTime;
|
||||||
qDebug() << "+ [INFO][TIMER] reaction time: " << this->reactionTime;
|
qDebug() << "+ [INFO][TIMER] reaction time: " << this->reactionTime;
|
||||||
|
@ -109,7 +118,7 @@ bool ScStwTimer::stop(StopReason reason) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScStwTimer::stop(StopReason reason, double timeOfStop) {
|
bool ScStwTimer::stop(StopReason reason, double timeOfStop) {
|
||||||
if(this->state != STARTING && this->state != RUNNING && this->state != WAITING){
|
if(this->state != STARTING && this->state != WILDCARD && this->state != RUNNING && this->state != WAITING){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue