Track feature #25
			
				
			
		
		
		
	| 
						 | 
					@ -231,7 +231,7 @@ public class Track implements TrackSpecification {
 | 
				
			||||||
     * @return true if car would crash. Else false.
 | 
					     * @return true if car would crash. Else false.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public boolean willCrashAtPosition(int carIndex, PositionVector positionVector) throws PositionVectorNotValid {
 | 
					    public boolean willCrashAtPosition(int carIndex, PositionVector positionVector) throws PositionVectorNotValid {
 | 
				
			||||||
        isPositionVectorOnTrack(positionVector);
 | 
					        isPositionVectorOnTrack(positionVector); //TODO: remove this line? Or Method?
 | 
				
			||||||
        char charAtPosition = track.get(positionVector.getY()).charAt(positionVector.getX());
 | 
					        char charAtPosition = track.get(positionVector.getY()).charAt(positionVector.getX());
 | 
				
			||||||
        if (getCarId(carIndex) == charAtPosition) return false;
 | 
					        if (getCarId(carIndex) == charAtPosition) return false;
 | 
				
			||||||
        return !(charAtPosition == ConfigSpecification.SpaceType.TRACK.value ||
 | 
					        return !(charAtPosition == ConfigSpecification.SpaceType.TRACK.value ||
 | 
				
			||||||
| 
						 | 
					@ -245,14 +245,16 @@ public class Track implements TrackSpecification {
 | 
				
			||||||
     * This Method will make the Car Crash. In Track and in the Car Object
 | 
					     * This Method will make the Car Crash. In Track and in the Car Object
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param carIndex       representing current Car
 | 
					     * @param carIndex       representing current Car
 | 
				
			||||||
     * @param positionVector where the Crash did happen
 | 
					     * @param crashPositionVector where the Crash did happen
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public void carDoesCrash(int carIndex, PositionVector positionVector) throws PositionVectorNotValid{
 | 
					    public void carDoesCrash(int carIndex, PositionVector crashPositionVector) throws PositionVectorNotValid{
 | 
				
			||||||
        isPositionVectorOnTrack(positionVector);
 | 
					        isPositionVectorOnTrack(crashPositionVector); //TODO: remove this line? and Method?
 | 
				
			||||||
 | 
					        PositionVector currentCarPosition = getCarPos(carIndex);
 | 
				
			||||||
 | 
					        drawCharOnTrackIndicator(new PositionVector(currentCarPosition.getX(), currentCarPosition.getY()), ConfigSpecification.SpaceType.TRACK.getValue());
 | 
				
			||||||
        Car car = cars.get(carIndex);
 | 
					        Car car = cars.get(carIndex);
 | 
				
			||||||
        car.crash();
 | 
					        car.crash();
 | 
				
			||||||
        car.setPosition(positionVector);
 | 
					        car.setPosition(crashPositionVector);
 | 
				
			||||||
        drawCharOnTrackIndicator(new PositionVector(positionVector.getX(), positionVector.getY()), CRASH_INDICATOR);
 | 
					        drawCharOnTrackIndicator(new PositionVector(crashPositionVector.getX(), crashPositionVector.getY()), CRASH_INDICATOR);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue