mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Added method to check if a boat is finished the race or not.
- updated server if all boats finish the race, then start sending race finished message. - race simulator will terminate if all boats finish the race, and prints log. #story[715]
This commit is contained in:
@@ -65,6 +65,8 @@ public class Simulator extends Observable implements Runnable {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[SERVER] Race simulator has been terminated");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +91,10 @@ public class Simulator extends Observable implements Runnable {
|
||||
boat.setHeadingCorner(boat.getLastPassedCorner().getNextCorner());
|
||||
|
||||
// heading corner == null means boat has reached the final mark
|
||||
if (boat.getHeadingCorner() == null) return 1;
|
||||
if (boat.getHeadingCorner() == null) {
|
||||
boat.setFinished(true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// move compensate distance for the mark just passed
|
||||
Position pos = GeoUtility.getGeoCoordinate(
|
||||
|
||||
Reference in New Issue
Block a user