fix finding issue
parent
10da34999b
commit
92f2c9f309
|
@ -205,12 +205,20 @@ public class Server implements Runnable {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int pos = rand.nextInt(clients);
|
int pos = rand.nextInt(clients);
|
||||||
while (pos == clientID)
|
long findingClientID = clientID;
|
||||||
|
ConnectedClient foundClient = null;
|
||||||
|
int searchCount = 0;
|
||||||
|
while (findingClientID == clientID) {
|
||||||
pos = rand.nextInt(clients);
|
pos = rand.nextInt(clients);
|
||||||
Iterator<java.util.Map.Entry<Long, ConnectedClient>> entries = server.clients.entrySet().iterator();
|
Iterator<java.util.Map.Entry<Long, ConnectedClient>> entries = server.clients.entrySet().iterator();
|
||||||
for (int i = 0; i < pos; i++)
|
for (int i = 0; i < pos; i++)
|
||||||
entries.next();
|
entries.next();
|
||||||
exploringMap = entries.next().getValue().clientMap;
|
foundClient = entries.next().getValue();
|
||||||
|
findingClientID = foundClient.clientID;
|
||||||
|
if(searchCount++ > 50)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
exploringMap = foundClient.clientMap;
|
||||||
sendMapData(usingEngine.view.getVillageStateTable(exploringMap, "Other Village"));
|
sendMapData(usingEngine.view.getVillageStateTable(exploringMap, "Other Village"));
|
||||||
break;
|
break;
|
||||||
case PacketTable.GENERATE:
|
case PacketTable.GENERATE:
|
||||||
|
|
Loading…
Reference in New Issue