v0.6.1: fixed various issues with levelgen
This commit is contained in:
parent
54749a5eb5
commit
46ba333af1
|
@ -57,12 +57,13 @@ public abstract class Builder {
|
||||||
ArrayList<Room> colliding = new ArrayList<>(collision);
|
ArrayList<Room> colliding = new ArrayList<>(collision);
|
||||||
do{
|
do{
|
||||||
|
|
||||||
//remove any rooms we aren't currently overlapping
|
//remove empty rooms and any rooms we aren't currently overlapping
|
||||||
Iterator<Room> it = colliding.iterator();
|
Iterator<Room> it = colliding.iterator();
|
||||||
while (it.hasNext()){
|
while (it.hasNext()){
|
||||||
Room room = it.next();
|
Room room = it.next();
|
||||||
//if not colliding
|
//if not colliding
|
||||||
if ( Math.max(space.left, room.left) >= Math.min(space.right, room.right)
|
if ( room.isEmpty()
|
||||||
|
|| Math.max(space.left, room.left) >= Math.min(space.right, room.right)
|
||||||
|| Math.max(space.top, room.top) >= Math.min(space.bottom, room.bottom) ){
|
|| Math.max(space.top, room.top) >= Math.min(space.bottom, room.bottom) ){
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,10 @@ public abstract class RegularBuilder extends Builder {
|
||||||
protected ArrayList<Room> singleConnections = new ArrayList<>();
|
protected ArrayList<Room> singleConnections = new ArrayList<>();
|
||||||
|
|
||||||
protected void setupRooms(ArrayList<Room> rooms){
|
protected void setupRooms(ArrayList<Room> rooms){
|
||||||
|
for(Room r : rooms){
|
||||||
|
r.setEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
entrance = exit = shop = null;
|
entrance = exit = shop = null;
|
||||||
singleConnections.clear();
|
singleConnections.clear();
|
||||||
multiConnections.clear();
|
multiConnections.clear();
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class SewerPipeRoom extends StandardRoom {
|
||||||
|
|
||||||
Rect c = getConnectionSpace();
|
Rect c = getConnectionSpace();
|
||||||
|
|
||||||
if (connected.size() <= 3) {
|
if (connected.size() <= 2) {
|
||||||
for (Door door : connected.values()) {
|
for (Door door : connected.values()) {
|
||||||
|
|
||||||
Point start;
|
Point start;
|
||||||
|
@ -248,22 +248,22 @@ public class SewerPipeRoom extends StandardRoom {
|
||||||
|
|
||||||
//doors on opposite sides
|
//doors on opposite sides
|
||||||
Point side;
|
Point side;
|
||||||
if (from.y == top+1 || from.y == bottom-1){
|
if (from.y == top+2 || from.y == bottom-2){
|
||||||
//connect along the left, or right side
|
//connect along the left, or right side
|
||||||
if (spaceBetween(left, from.x) + spaceBetween(left, to.x) <=
|
if (spaceBetween(left, from.x) + spaceBetween(left, to.x) <=
|
||||||
spaceBetween(right, from.x) + spaceBetween(right, to.x)){
|
spaceBetween(right, from.x) + spaceBetween(right, to.x)){
|
||||||
side = new Point(left+1, top + height()/2);
|
side = new Point(left+2, top + height()/2);
|
||||||
} else {
|
} else {
|
||||||
side = new Point(right-1, top + height()/2);
|
side = new Point(right-2, top + height()/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//connect along the top, or bottom side
|
//connect along the top, or bottom side
|
||||||
if (spaceBetween(top, from.y) + spaceBetween(top, to.y) <=
|
if (spaceBetween(top, from.y) + spaceBetween(top, to.y) <=
|
||||||
spaceBetween(bottom, from.y) + spaceBetween(bottom, to.y)){
|
spaceBetween(bottom, from.y) + spaceBetween(bottom, to.y)){
|
||||||
side = new Point(left + width()/2, top+1);
|
side = new Point(left + width()/2, top+2);
|
||||||
} else {
|
} else {
|
||||||
side = new Point(left + width()/2, bottom-1);
|
side = new Point(left + width()/2, bottom-2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//treat this as two connections with adjacent sides
|
//treat this as two connections with adjacent sides
|
||||||
|
|
Loading…
Reference in New Issue
Block a user