src/Train.cpp
/**
 * forceSpeed is the same as the setSpeed
 * but sets immediately the new speed and direction.
 */
forceSpeed is the same as the setSpeed
but sets immediately the new speed and direction.
forceSpeed is the same as the setSpeed but sets immediately the new speed and direction .
void Train::forceSpeed(int16_t speed) {
  if (speed < 0) {
    this->targetDirection = BACKWARD;
  } else {
    this->targetDirection = FORWARD;
  }
  this->currentDirection = this->targetDirection;
  this->currentSpeed = abs(speed);
  this->targetSpeed = abs(speed);
}
void Train :: forceSpeed ( int16_t speed ) { if ( speed < 0 ) { this -> targetDirection = BACKWARD ; } else { this -> targetDirection = FORWARD ; } this -> currentDirection = this -> targetDirection ; this -> currentSpeed = abs ( speed ) ; this -> targetSpeed = abs ( speed ) ; }
forceSpeed is the same as the setSpeed
 but sets immediately the new speed and direction.
forceSpeed is the same as the setSpeed but sets immediately the new speed and direction .