Reorder the logic of cake wars islands.

This commit is contained in:
Sam 2018-03-30 20:23:53 +01:00 committed by Alexander Meech
parent 2d51daaa63
commit 155fabb9e9

View File

@ -240,15 +240,14 @@ public class CakeIslandModule extends CakeModule
private Location getRandomLocation()
{
Location location = null;
int attempts = 0;
List<Player> alive = _game.GetPlayers(true);
attemptsLoop:
while (location == null)
while (attempts < MAX_ATTEMPTS)
{
attempts++;
location = UtilAlg.getRandomLocation(_center, MAX_XZ, 0, MAX_XZ);
Location location = UtilAlg.getRandomLocation(_center, MAX_XZ, 0, MAX_XZ);
Chunk chunk = location.getChunk();
// Prevent islands spawning inside other blocks
@ -269,15 +268,10 @@ public class CakeIslandModule extends CakeModule
}
}
if (attempts >= MAX_ATTEMPTS)
{
return null;
}
break;
return location;
}
return location;
return null;
}
}