if (!getWhosTurn().equals(email) || this.getStatus() == FINISHED) {
return new Integer[] {};
}
int p = getPlayerIndex(email);
final IPlayer player = this.players.get(p);
int[] result = map.getPossibleMoves(player.getPosition());
final Integer[] copy = new Integer[result.length];
// used for bitwise comparison, as tickets are encoded in binary
// BUS : 0001
// player has : 0110
// result : 0000
final boolean no_bus = player.getTickets(IBMap.BUS) < 1;
final boolean no_taxi = player.getTickets(IBMap.TAXI) < 1;
final boolean no_water = player.getTickets(IBMap.WATER) < 1;
final boolean no_ug = player.getTickets(IBMap.UG) < 1;
final boolean no_double = player.getTickets(IBMap.DOUBLE) < 1;
// first get all possible moves
// then filter them according to the number of tickets remaining
for (int i = 0; i < result.length; i++) {
// if the position is empty, or occupied by Mr X, then its OK
copy[i] = 0;
if (map.positions[i] == null
|| this.getMrX().getEmail().equals(map.positions[i])) {
copy[i] = result[i];
int temp = copy[i]; // need temp variable to stop transport
// types matching incorrectly
// double
if (temp >= 16) { // this condition is not required
temp -= 16;
if (no_double) {
copy[i] -= 16;// but maybe used later, so will leave it
// now
}
}
// UG
if (temp >= 8) {
temp -= 8;
if (no_ug) {
copy[i] -= 8;
}
}
// water
if (temp >= 4) {
temp -= 4;
if (no_water) {
copy[i] -= 4;
}
}
// taxi
if (temp >= 2) {
temp -= 2;
if (no_taxi) {
copy[i] -= 2;
}
}
// bus
if (temp >= 1) {
temp -= 1;
if (no_bus) {
copy[i] -= 1;
}
}
}
}
if (player.isMrx() && !no_double) {
for (int i = 0; i < result.length; i++) {
if (result[i] != 0) // meaning that there is a connection
{
int[] resultTwo = map.getPossibleMoves(i);
for (int j = 0; j < resultTwo.length; j++) {