v0.6.0: fixed line builder generated dead end tunnel rooms
This commit is contained in:
parent
73aed6726c
commit
25b01c2e7d
|
@ -134,8 +134,10 @@ public class LineBuilder extends Builder {
|
||||||
int i = roomsOnPath;
|
int i = roomsOnPath;
|
||||||
float angle;
|
float angle;
|
||||||
int tries;
|
int tries;
|
||||||
|
ArrayList<Room> tunnelsThisBranch = new ArrayList<>();
|
||||||
while (i < multiConnections.size() + singleConnections.size()){
|
while (i < multiConnections.size() + singleConnections.size()){
|
||||||
|
|
||||||
|
tunnelsThisBranch.clear();
|
||||||
curr = Random.element(branchable);
|
curr = Random.element(branchable);
|
||||||
|
|
||||||
int tunnels = Random.chances(branchTunnelChances);
|
int tunnels = Random.chances(branchTunnelChances);
|
||||||
|
@ -148,14 +150,25 @@ public class LineBuilder extends Builder {
|
||||||
tries--;
|
tries--;
|
||||||
} while (angle == -1 && tries >= 0);
|
} while (angle == -1 && tries >= 0);
|
||||||
|
|
||||||
if (angle == -1)
|
if (angle == -1) {
|
||||||
continue;
|
for (Room r : tunnelsThisBranch){
|
||||||
else
|
r.clearConnections();
|
||||||
|
rooms.remove(r);
|
||||||
|
}
|
||||||
|
tunnelsThisBranch.clear();
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
tunnelsThisBranch.add(t);
|
||||||
rooms.add(t);
|
rooms.add(t);
|
||||||
|
}
|
||||||
|
|
||||||
curr = t;
|
curr = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tunnelsThisBranch.size() != tunnels){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Room r;
|
Room r;
|
||||||
if (i < multiConnections.size()) {
|
if (i < multiConnections.size()) {
|
||||||
r = multiConnections.get(i);
|
r = multiConnections.get(i);
|
||||||
|
@ -170,8 +183,15 @@ public class LineBuilder extends Builder {
|
||||||
tries--;
|
tries--;
|
||||||
} while (angle == -1 && tries >= 0);
|
} while (angle == -1 && tries >= 0);
|
||||||
|
|
||||||
if (angle == -1)
|
if (angle == -1){
|
||||||
|
for (Room t : tunnelsThisBranch){
|
||||||
|
t.clearConnections();
|
||||||
|
rooms.remove(t);
|
||||||
|
}
|
||||||
|
tunnelsThisBranch.clear();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (r.maxConnections(Room.ALL) > 1 && Random.Int(2) == 0)
|
if (r.maxConnections(Room.ALL) > 1 && Random.Int(2) == 0)
|
||||||
branchable.add(r);
|
branchable.add(r);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user