public ConnectionInfo(GridConnections connections, MapCoordinates location, Dir dir, bool isConnected) : this() { Location = location; _dir = dir; IsConnected = isConnected; _connections = connections; }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Add random connections to the rooms. </summary> /// /// <remarks> Darrellp, 9/20/2011. </remarks> /// /// <param name="connectionCount"> Number of random connections to add. </param> /// <param name="connections"> The room connections. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// private void AddRandomConnections(int connectionCount, GridConnections connections) { // For the number of random connections to be added for (int iConnection = 0; iConnection < connectionCount; iConnection++) { // Add a random connection... connections.MakeRandomConnection(_rnd); } }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Excavate rooms into the map by grid. </summary> /// /// <remarks> Darrellp, 9/18/2011. </remarks> /// /// <exception cref="RogueException"> Thrown when the map is too small. </exception> /// /// <param name="map"> The map to be excavated. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// public void Excavate(IRoomsMap map) { // Seed the random number generator properly _rnd = new Rnd(_seed); // Are we too small to make a map?); if (map.Width < _baseCellWidth || map.Height < _baseCellHeight) { // Throw an exception throw new RogueException("Attempting to excavate with too small a map"); } // Locate the rooms in the map LocateRooms(map); // Create our connections objects _connections = new GridConnections(_rooms.Length, _rooms[0].Length); _merges = new GridConnections(_rooms.Length, _rooms[0].Length); // Determine which rooms should be connected DetermineRoomConnections(); // Determine which rooms should be merged and resize those rooms DetermineRoomMerges(); // For each column in the grid foreach (var room in _rooms.SelectMany(roomRow => roomRow)) { // Excavate the room ExcavateRoom(map, room); } // Excavate between the rooms ExcavateRoomConnections(map); // Do any cleanup PostProcess(map); }