}
int drivingSteps = locomotive.getDrivingSteps();
if (speed < 0 || speed > drivingSteps) {
return;
}
GL gl = locomotive.getGL();
switch (locomotive.direction) {
case FORWARD:
gl.set(SRCPLocomotive.FORWARD_DIRECTION, speed, drivingSteps,
functions);
break;
case REVERSE:
gl.set(SRCPLocomotive.REVERSE_DIRECTION, speed, drivingSteps,
functions);
break;
case UNDEF:
gl.set(SRCPLocomotive.FORWARD_DIRECTION, speed, drivingSteps,
functions);
locomotive.setDirection(SRCPLocomotiveDirection.FORWARD);
break;
}
locomotive.setCurrentSpeed(speed);