// Check to see if the simple room has one open door and one closed door. private static bool checkIfRoomCanHavePortTown(SimpleRoom_Output simpleRoom, PortTownReturnPacket portTownPacket, byte xCoord, byte yCoord, byte[] finalTreasureCoords) { // First, check if the space has water, and is not too close to another port town: if (simpleRoom.getIsNotEmpty() && !portTownPacket.checkIfCoordinateIsTooCloseToAnotherPortTown(xCoord, yCoord) && Mathf.Abs(xCoord - finalTreasureCoords[0]) > 1 && Mathf.Abs(yCoord - finalTreasureCoords[1]) > 1) { for (byte index = 0; index < 4; index++) { // If the room hasSomething (water), and has a wall that is closed... // then there is space to place a port town: if (!simpleRoom.getWallIsOpen(index)) { return(true); } } } return(false); }