コード例 #1
0
ファイル: Tile.cs プロジェクト: ShadoMagi/MornaMapEditor
 public override int GetHashCode()
 {
     unchecked
     {
         int result = TileNumber;
         result = (result * 397) ^ Passable.GetHashCode();
         result = (result * 397) ^ ObjectNumber;
         return(result);
     }
 }
コード例 #2
0
 public int GetGamestateHash()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hash = (int)2166136261;
         // Suitable nullity checks etc, of course :)
         hash = (hash * 16777619) ^ Name.GetHashCode();
         hash = (hash * 16777619) ^ Passable.GetHashCode();
         hash = (hash * 16777619) ^ MoveCost.GetHashCode();
         foreach (var prop in Properties)
         {
             hash = (hash * 16777619) ^ prop.GetHashCode();
         }
         return(hash);
     }
 }
コード例 #3
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked             // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + Subject.GetHashCode();

                hashCode = hashCode * 59 + EndTime.GetHashCode();

                hashCode = hashCode * 59 + Duration.GetHashCode();

                hashCode = hashCode * 59 + Passable.GetHashCode();
                if (RobotsActive != null)
                {
                    hashCode = hashCode * 59 + RobotsActive.GetHashCode();
                }
                return(hashCode);
            }
        }