Fixed bug where entrance lines on the left and right would start too far down.
This commit is contained in:
parent
024e0ae514
commit
d091a7f745
6 changed files with 131 additions and 3 deletions
|
|
@ -165,7 +165,7 @@ namespace DungeonGenerator
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
int startOfLine = GetStartOfCenteredLine(xLengthOfDungeon, roomsPerLine, SIDE_LENGTH_OF_NORMAL);
|
||||
int startOfLine = GetStartOfCenteredLine(yLengthOfDungeon, roomsPerLine, SIDE_LENGTH_OF_NORMAL);
|
||||
for (var i = 0; i < roomsPerLine * SIDE_LENGTH_OF_NORMAL; i += SIDE_LENGTH_OF_NORMAL)
|
||||
{
|
||||
entranceRooms.Add(new Room(RoomType.Entrance, SIDE_LENGTH_OF_NORMAL, SIDE_LENGTH_OF_NORMAL, new Point(right, startOfLine + i)));
|
||||
|
|
@ -213,7 +213,7 @@ namespace DungeonGenerator
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
int startOfLine = GetStartOfCenteredLine(xLengthOfDungeon, roomsPerLine, SIDE_LENGTH_OF_NORMAL);
|
||||
int startOfLine = GetStartOfCenteredLine(yLengthOfDungeon, roomsPerLine, SIDE_LENGTH_OF_NORMAL);
|
||||
for (var i = 0; i < roomsPerLine * SIDE_LENGTH_OF_NORMAL; i += SIDE_LENGTH_OF_NORMAL)
|
||||
{
|
||||
entranceRooms.Add(new Room(RoomType.Entrance, SIDE_LENGTH_OF_NORMAL, SIDE_LENGTH_OF_NORMAL, new Point(0, startOfLine + i)));
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace DungeonGenerator
|
|||
// Can place point so that the x lengt hand y length go out of bounds to the right and down.
|
||||
public Point GetPoint(int xLength, int yLength)
|
||||
{
|
||||
int numCandidates = 50; // Increasing improves results but greatly effects performance.
|
||||
int numCandidates = 100; // Increasing improves results but greatly effects performance.
|
||||
Random rnd = new Random();
|
||||
int randomIndex = rnd.Next(0, _availablePoints.Count);
|
||||
Point bestCandidate = new Point(Int32.MaxValue, Int32.MaxValue);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue