View Single Post
Old 09-18-2008, 12:16 AM   #21 (permalink)
Soteric
Forum Expert
 
Soteric's Avatar
 
Join Date: Aug 2006
Location: Russia, Rostov-on-Don
Posts: 1,658
Send a message via ICQ to Soteric
Default

To deserialize:
Code:
public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();

			switch ( version )
			{
                case 29: // Uncomment this section
                    {
                        m_Wins = reader.ReadInt();
                        m_Loses = reader.ReadInt();
                        goto case 28;
                    }
                case 28:
                    {
                        isinchal = reader.ReadBool();
                        canbechal = reader.ReadBool();
                        m_TempMount = (BaseMount)reader.ReadMobile();
                        reader.ReadInt(); // just reading integer because you've serialized m_Loses 
                        reader.ReadInt(); // and m_Wins here
                        goto case 27;
                    }
...
In Serialization:
Code:
...
writer.Write( (int) 29 ); // version // new version is 29 to start loading from case 29 section

writer.Write((int)m_Wins); // m_Wins and m_Loses now here
writer.Write((int)m_Loses); // because we want to load them before isinchal field
            //Begin Challenge Game Edits
            
            writer.Write((bool)isinchal);
            writer.Write((bool)canbechal);
            writer.Write(m_TempMount);
            
// We have removed serialization of m_Wins and m_Loses from here
            
            //End Challenge Game Edits
...
After you load server and save it, try to restart. It should give you the same error. Then remove both reader.ReadInt(); from Deserialization and try to start server again. Should work
Soteric is online now   Reply With Quote