v2.4.0: fixed new entrance and exit rooms being able to connect
This commit is contained in:
@@ -263,6 +263,11 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable {
|
||||
}
|
||||
|
||||
public boolean connect( Room room ) {
|
||||
if (isExit() && room.isEntrance() || isEntrance() && room.isExit()){
|
||||
//entrance and exit rooms cannot directly connect
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((neigbours.contains(room) || addNeigbour(room))
|
||||
&& !connected.containsKey( room ) && canConnect(room)) {
|
||||
connected.put( room, null );
|
||||
|
||||
@@ -127,13 +127,6 @@ public class EntranceRoom extends StandardRoom {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connect(Room room) {
|
||||
//cannot connect to exit, otherwise works normally
|
||||
if (room.isExit()) return false;
|
||||
else return super.connect(room);
|
||||
}
|
||||
|
||||
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
|
||||
static {
|
||||
rooms.add(EntranceRoom.class);
|
||||
|
||||
@@ -70,13 +70,6 @@ public class ExitRoom extends StandardRoom {
|
||||
return super.canPlaceCharacter(p, l) && l.pointToCell(p) != l.exit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connect(Room room) {
|
||||
//cannot connect to entrance, otherwise works normally
|
||||
if (room.isEntrance()) return false;
|
||||
else return super.connect(room);
|
||||
}
|
||||
|
||||
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
|
||||
static {
|
||||
rooms.add(ExitRoom.class);
|
||||
|
||||
Reference in New Issue
Block a user