private void BuildInternal()
    {
//#if DEBUG
//        DebugLogs.Clear();
//#endif

        _isTraversingSea           = false;
        _currentEndRoutePreference = 0;
        _currentDirectionOffset    = 0;
        _currentCoastPreference    = CoastPreferenceIncrement;
        Length = 0;

        //CellPositions.Clear();
        Cells.Clear();

        AddCell(FirstCell);
        LastCell = FirstCell;

        TerrainCell nextCell = FirstCell;
        Direction   nextDirection;

        int rngOffset = 0;

        while (true)
        {
            //#if DEBUG
            //            TerrainCell prevCell = nextCell;
            //#endif

            nextCell = ChooseNextSeaCell(nextCell, rngOffset++, out nextDirection);

            //#if DEBUG
            //            if ((Manager.RegisterDebugEvent != null) && (Manager.TracingData.Priority <= 0))
            //            {
            //                if ((FirstCell.Longitude == Manager.TracingData.Longitude) && (FirstCell.Latitude == Manager.TracingData.Latitude))
            //                {

            //                    string cellPos = "Position: Long:" + FirstCell.Longitude + "|Lat:" + FirstCell.Latitude;
            //                    string prevCellDesc = "Position: Long:" + prevCell.Longitude + "|Lat:" + prevCell.Latitude;

            //                    string nextCellDesc = "Null";

            //                    if (nextCell != null)
            //                    {
            //                        nextCellDesc = "Position: Long:" + nextCell.Longitude + "|Lat:" + nextCell.Latitude;
            //                    }

            //                    SaveLoadTest.DebugMessage debugMessage = new SaveLoadTest.DebugMessage(
            //                        "ChooseNextSeaCell - FirstCell:" + cellPos,
            //                        "CurrentDate: " + World.CurrentDate +
            //                        ", prevCell: " + prevCellDesc +
            //                        ", nextCell: " + nextCellDesc +
            //                        "");

            //                    Manager.RegisterDebugEvent("DebugMessage", debugMessage);
            //                }
            //            }
            //#endif

            if (nextCell == null)
            {
                LastCell = nextCell;
                break;
            }

            Length += LastCell.NeighborDistances[nextDirection];

            AddCell(nextCell);

            if (nextCell.WaterBiomePresence <= 0)
            {
                break;
            }

            LastCell = nextCell;
        }

        if (nextCell != null)
        {
            MigrationDirectionInt = (int)LastCell.GetDirection(nextCell);
        }

        LastCell = nextCell;
    }