public static bool[,] MakeSewers(int intFarmSize, int intMapSize, int intPlotSize) { int intPlots = 1 + ((intMapSize - ((intFarmSize + 16) * 2)) / intPlotSize); bool[,] booNewSewerEntrances = MakeSewerEntrances(intPlots, false); Maze maze = new Maze(); // 51, 43, 35, 27, 19, 11, 3 for (int y = 3; y <= 51; y += 8) { bool[,] booOldSewerEntrances = booNewSewerEntrances; booNewSewerEntrances = MakeSewerEntrances(intPlots, y == 51); bool[,] booMaze = maze.GenerateMaze((intPlots * 2) + 1, (intPlots * 2) + 1); booMaze = maze.CreateLoops(booMaze, booMaze.GetLength(0) / 4); if (y == 3) { booMaze = maze.DeleteDeadEnds(booMaze, booNewSewerEntrances); } else { booMaze = maze.DeleteDeadEnds(booMaze, MergeBooleanArrays(booNewSewerEntrances, booOldSewerEntrances)); } for (int x = 0; x < booMaze.GetUpperBound(0); x++) { for (int z = 0; z < booMaze.GetUpperBound(1); z++) { if (booMaze[x, z]) { MakeSewerSection(booMaze, x, z, intFarmSize + 18 + (x * intPlotSize / 2), intFarmSize + 18 + (z * intPlotSize / 2), y, intPlotSize); } } } for (int x = 0; x < booMaze.GetUpperBound(0); x++) { for (int z = 0; z < booMaze.GetUpperBound(1); z++) { if (booMaze[x, z]) { if (y > 3 && x % 2 == 1 && z % 2 == 1 && booOldSewerEntrances[(x - 1) / 2, (z - 1) / 2]) { BlockShapes.MakeSolidBox(intFarmSize + 18 + (x * intPlotSize / 2) - 1, intFarmSize + 18 + (x * intPlotSize / 2) + 1, y - 7, y + 1, intFarmSize + 18 + (z * intPlotSize / 2) - 1, intFarmSize + 18 + (z * intPlotSize / 2) + 1, (int)BlockType.AIR); BlockShapes.MakeHollowLayers(intFarmSize + 18 + (x * intPlotSize / 2) - 1, intFarmSize + 18 + (x * intPlotSize / 2) + 1, y, y, intFarmSize + 18 + (z * intPlotSize / 2) - 1, intFarmSize + 18 + (z * intPlotSize / 2) + 1, (int)BlockType.STONE); BlockShapes.MakeSolidBox(intFarmSize + 18 + (x * intPlotSize / 2), intFarmSize + 18 + (x * intPlotSize / 2), y - 7, y + 1, intFarmSize + 18 + (z * intPlotSize / 2) + 1, intFarmSize + 18 + (z * intPlotSize / 2) + 1, (int)BlockType.STONE); BlockHelper.MakeLadder(intFarmSize + 18 + (x * intPlotSize / 2), y - 7, y + 1, intFarmSize + 18 + (z * intPlotSize / 2)); } } } } } return booNewSewerEntrances; }
public static bool[,] MakeSewers(int intFarmSize, int intMapSize, int intPlotSize) { int intPlots = 1 + ((intMapSize - ((intFarmSize + 16) * 2)) / intPlotSize); bool[,] booNewSewerEntrances = MakeSewerEntrances(intPlots, false); Maze maze = new Maze(); // 51, 43, 35, 27, 19, 11, 3 for (int y = 3; y <= 51; y += 8) { bool[,] booOldSewerEntrances = booNewSewerEntrances; booNewSewerEntrances = MakeSewerEntrances(intPlots, y == 51); bool[,] booMaze = maze.GenerateMaze((intPlots * 2) + 1, (intPlots * 2) + 1); booMaze = maze.CreateLoops(booMaze, booMaze.GetLength(0) / 4); if (y == 3) { booMaze = maze.DeleteDeadEnds(booMaze, booNewSewerEntrances, booNewSewerEntrances); } else { booMaze = maze.DeleteDeadEnds(booMaze, booNewSewerEntrances, booOldSewerEntrances); } for (int x = 0; x < booMaze.GetUpperBound(0); x++) { for (int z = 0; z < booMaze.GetUpperBound(1); z++) { if (booMaze[x, z]) { MakeSewerSection(booMaze, x, z, intFarmSize + 18 + (x * intPlotSize / 2), intFarmSize + 18 + (z * intPlotSize / 2), y, intPlotSize); } } } for (int x = 0; x < booMaze.GetUpperBound(0); x++) { for (int z = 0; z < booMaze.GetUpperBound(1); z++) { if (booMaze[x, z]) { if (y > 3 && x % 2 == 1 && z % 2 == 1 && booOldSewerEntrances[(x - 1) / 2, (z - 1) / 2]) { BlockShapes.MakeSolidBox(intFarmSize + 18 + (x * intPlotSize / 2) - 1, intFarmSize + 18 + (x * intPlotSize / 2) + 1, y - 7, y + 1, intFarmSize + 18 + (z * intPlotSize / 2) - 1, intFarmSize + 18 + (z * intPlotSize / 2) + 1, (int)BlockType.AIR); BlockShapes.MakeHollowLayers(intFarmSize + 18 + (x * intPlotSize / 2) - 1, intFarmSize + 18 + (x * intPlotSize / 2) + 1, y, y, intFarmSize + 18 + (z * intPlotSize / 2) - 1, intFarmSize + 18 + (z * intPlotSize / 2) + 1, (int)BlockType.STONE); BlockShapes.MakeSolidBox(intFarmSize + 18 + (x * intPlotSize / 2), intFarmSize + 18 + (x * intPlotSize / 2), y - 7, y + 1, intFarmSize + 18 + (z * intPlotSize / 2) + 1, intFarmSize + 18 + (z * intPlotSize / 2) + 1, (int)BlockType.STONE); BlockHelper.MakeLadder(intFarmSize + 18 + (x * intPlotSize / 2), y - 7, y + 1, intFarmSize + 18 + (z * intPlotSize / 2)); } } } } } return(booNewSewerEntrances); }