Users can now resee the lobby after exit and reentering, and fixed concurrent alteration issue which was stopping players from exiting the lobby.
This commit is contained in:
@@ -143,7 +143,9 @@ public class InGameLobbyController extends Controller {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
for (VisualiserBoat boat :visualiserRaceEvent.getVisualiserRaceState().getBoats()) {
|
ArrayList<VisualiserBoat> copy = new ArrayList<>(visualiserRaceEvent.getVisualiserRaceState().getBoats());
|
||||||
|
|
||||||
|
for (VisualiserBoat boat : copy) {
|
||||||
View3D playerBoatToSet = new View3D();
|
View3D playerBoatToSet = new View3D();
|
||||||
playerBoatToSet.setItems(subjects);
|
playerBoatToSet.setItems(subjects);
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,6 @@ public class LobbyController extends Controller {
|
|||||||
* Adds the games received from the server
|
* Adds the games received from the server
|
||||||
*/
|
*/
|
||||||
private void addServerGames() {
|
private void addServerGames() {
|
||||||
httpMatchBrowserClient.connections.clear();
|
|
||||||
httpMatchBrowserClient.connections.addAll(customConnections);
|
httpMatchBrowserClient.connections.addAll(customConnections);
|
||||||
httpMatchBrowserClient.connections.addListener(new ListChangeListener<RaceConnection>() {
|
httpMatchBrowserClient.connections.addListener(new ListChangeListener<RaceConnection>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ public class VisualiserRaceEvent {
|
|||||||
this.visualiserRaceServiceThread.interrupt();
|
this.visualiserRaceServiceThread.interrupt();
|
||||||
this.serverConnectionThread.interrupt();
|
this.serverConnectionThread.interrupt();
|
||||||
serverConnection.terminate();
|
serverConnection.terminate();
|
||||||
HttpMatchBrowserHost.httpMatchBrowserHost.interrupt();
|
if (HttpMatchBrowserHost.httpMatchBrowserHost != null) {
|
||||||
|
HttpMatchBrowserHost.httpMatchBrowserHost.interrupt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public class HttpMatchBrowserClient extends Thread {
|
|||||||
while(!Thread.interrupted()) {
|
while(!Thread.interrupted()) {
|
||||||
try {
|
try {
|
||||||
JSONArray cons = JsonReader.readJsonFromUrlArray("http://api.umbrasheep.com/seng/get_matches/");
|
JSONArray cons = JsonReader.readJsonFromUrlArray("http://api.umbrasheep.com/seng/get_matches/");
|
||||||
|
connections.clear();
|
||||||
|
|
||||||
for (int i = 0; i < cons.length(); i++) {
|
for (int i = 0; i < cons.length(); i++) {
|
||||||
JSONObject con = (JSONObject) cons.get(i);
|
JSONObject con = (JSONObject) cons.get(i);
|
||||||
connections.add(new RaceConnection((String) con.get("ip_address"), con.getInt("port"), "Boat Game"));
|
connections.add(new RaceConnection((String) con.get("ip_address"), con.getInt("port"), "Boat Game"));
|
||||||
|
|||||||
Reference in New Issue
Block a user