}
}
private void checkFinish(Client client)
{
Car car = cars.get(client);
List<Vector2i> path = car.getPath();
List<Vector2i> pointPath = new ArrayList<Vector2i>();
for (int i = 0; i < (path.size() - 1); i++)
pointPath.addAll(drawLine(path.get(i), path.get(i + 1)));
int checkpointCount = 0;
int totalCheckpoints = map.getCheckpoints();
for (Vector2i v : pointPath) {
//System.out.println(v.toString());
char block = map.getBlockType(v.x(), v.y());
switch (block)
{
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
int n = block - '0';
if ((checkpointCount + 1) == n)
checkpointCount = n;
break;
case 'E':
if (checkpointCount == totalCheckpoints) {
deactivateClient(client);
car.setFinished(true);
for (Client c : clients)
c.carFinished(client.getId());
}
return;
}