Example #1
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			switch (version)
			{
				case 3:
					{
						m_ExtAttrib = (ExtAttrib)reader.ReadByte();
						goto case 2;
					}
				case 2:
					{
						if (version < 3)
							m_ExtAttrib = ExtAttrib.None;

						SaveFlag flags = (SaveFlag)reader.ReadByte();

						if (GetSaveFlag(flags, SaveFlag.MaxItems))
							m_MaxItems = reader.ReadEncodedInt();
						else
							m_MaxItems = -1;

						if (GetSaveFlag(flags, SaveFlag.GumpID))
							m_GumpID = reader.ReadEncodedInt();
						else
							m_GumpID = -1;

						if (GetSaveFlag(flags, SaveFlag.DropSound))
							m_DropSound = reader.ReadEncodedInt();
						else
							m_DropSound = -1;

						break;
					}
				case 1:
					{
						m_MaxItems = reader.ReadInt();
						goto case 0;
					}
				case 0:
					{
						if (version < 1)
							m_MaxItems = m_GlobalMaxItems;

						m_GumpID = reader.ReadInt();
						m_DropSound = reader.ReadInt();

						if (m_GumpID == DefaultGumpID)
							m_GumpID = -1;

						if (m_DropSound == DefaultDropSound)
							m_DropSound = -1;

						if (m_MaxItems == DefaultMaxItems)
							m_MaxItems = -1;

						//m_Bounds = new Rectangle2D( reader.ReadPoint2D(), reader.ReadPoint2D() );
						reader.ReadPoint2D();
						reader.ReadPoint2D();

						break;
					}
			}
		}
Example #2
0
		private static bool GetAttribFlag(ExtAttrib flags, ExtAttrib toGet)
		{
			return ((flags & toGet) != 0);
		}
Example #3
0
		private static void ClearAttribFlag(ref ExtAttrib flags, ExtAttrib toClear)
		{
			flags &= ~toClear;
		}
Example #4
0
		private static void SetAttribFlag(ref ExtAttrib flags, ExtAttrib toSet, bool setIf)
		{
			if (setIf)
				flags |= toSet;
			else
				ClearAttribFlag(ref flags, toSet);
		}