fCraft.Life2d.Replace C# (CSharp) Method

Replace() private method

private Replace ( byte from, byte to, bool computeHash ) : bool
from byte
to byte
computeHash bool
return bool
        private bool Replace( byte from, byte to, bool computeHash )
        {
            bool changed = false;
            if ( computeHash )
                Hash = ( int )216713671;
            for ( int i = 0; i < _a.GetLength( 0 ); ++i )
                for ( int j = 0; j < _a.GetLength( 1 ); ++j ) {
                    if ( _a[i, j] == from ) {
                        _a[i, j] = to;
                        changed = true;
                    }
                    if ( computeHash && _a[i, j] == Normal ) {
                        const int p = 16777619;
                        int h = i | ( j << 16 );
                        Hash ^= h * p;
                    }
                }
            return changed;
        }