Narrowed variables scope.

This commit is contained in:
vraskulin 2017-02-15 16:05:18 +03:00
parent 09da478b38
commit f1ef3bf68b
20 changed files with 42 additions and 60 deletions

View file

@ -227,13 +227,13 @@ public class MageServerImpl implements MageServer {
// check AI players max
String maxAiOpponents = ConfigSettings.getInstance().getMaxAiOpponents();
if (maxAiOpponents != null) {
int max = Integer.parseInt(maxAiOpponents);
int aiPlayers = 0;
for (String playerType : options.getPlayerTypes()) {
if (!playerType.equals("Human")) {
aiPlayers++;
}
}
int max = Integer.parseInt(maxAiOpponents);
if (aiPlayers > max) {
user.showUserMessage("Create tournament", "It's only allowed to use a maximum of " + max + " AI players.");
throw new MageException("No message");