Go Back   RunUO - Ultima Online Emulation > RunUO > Server Support on Windows

Server Support on Windows Get (and give) support on general questions related to the RunUO server itself.

Reply
 
Thread Tools Display Modes
Old 04-04-2005, 07:41 PM   #1 (permalink)
 
Join Date: Mar 2004
Posts: 3
Default Problem with saves

Hi,

After saving the program doesnt compile anymore this is the error I get:

Quote:
Scripts: Compiling C# scripts...done (0 errors, 0 warnings)
Scripts: Compiling VB.net scripts...no files found.
Scripts: Verifying...done (1503 items, 392 mobiles)
World: Loading...An error was encountered while loading a saved object
- Type: Server.Mobiles.PlayerMobile
- Serial: 0x00000002
Delete the object? (y/n)
y
Delete all objects of that type? (y/n)
y
After pressing return an exception will be thrown and the server will terminate

Error:
System.Exception: Load failed (items=False, mobiles=True, guilds=False, regions=
False, type=Server.Mobiles.PlayerMobile, serial=0x00000002) ---> System.Argument
OutOfRangeException: capacity was less than the current size.
Parameter name: capacity
at System.Collections.ArrayList..ctor(Int32 capacity)
at Server.BinaryFileReader.ReadMobileList()
at Server.Mobiles.PlayerMobile.Deserialize(GenericRea der reader)
at Server.World.Load()
--- End of inner exception stack trace ---
at Server.World.Load()
at Server.ScriptCompiler.Compile(Boolean debug)
at Server.Core.Main(String[] args)
This exception is fatal, press return to exit
Anyone an idea what could be the problem here with my PlayerMobile.cs

Thank you
Attached Files
File Type: cs PlayerMobile.cs (53.6 KB, 7 views)
Osiriske is offline   Reply With Quote
Old 04-05-2005, 01:33 AM   #2 (permalink)
Master of the Internet
 
Quantos's Avatar
 
Join Date: Apr 2003
Location: Edmonton, AB
Age: 41
Posts: 6,867
Send a message via ICQ to Quantos Send a message via AIM to Quantos Send a message via MSN to Quantos Send a message via Yahoo to Quantos
Default

Replace the files in your saves directory with a different one from your backup's directory.
__________________
Paranoia is what happens when you finally have all of the facts.
Quantos is offline   Reply With Quote
Old 04-05-2005, 05:19 AM   #3 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

Code:
					m_Profession = reader.ReadEncodedInt();
					goto case 15;
				}
				case 16:
				{
					m_LastCompassionLoss = reader.ReadDeltaTime();
					goto case 15;
				}
    //......changed serialization starting here
    case 15:
				{
					Onshow = reader.ReadBool();
					goto case 14;
				}
    //......changed serialization starting here
				case 14:
				{
note that this code will skip over case 16, which means that you will have written out the m_LastCompassionLoss variable but you wont read it in. That will cause problems.

In general you do not want to just drop new things into the middle of your Serialization. you need to use the version number system to allow you to add new things while still being able to load old saves.

When you add something new, add it to the beginning of the Serialization (after you write the version number) and increment the version number (dont write out another version number, change the one that is already written).

this is wrong.
Code:
			writer.WriteDeltaTime( m_LastCompassionLoss );
   //......changed deserialization starting here
                        writer.Write( (bool) Onshow );
   //......changed deserialization starting here
			writer.WriteEncodedInt( m_CompassionGains );
do it like this instead
Code:
writer.Write( (int) 19 ); // version

writer.Write( (bool) Onshow );

			QuestSerializer.Serialize( m_Quest, writer );

and then in your Deserialize, add a new case for your new version. Dont mess with the existing cases.

Code:
switch ( version )
			{
case 19:
{
Onshow = reader.ReadBool();
goto case 18;
}
				case 18: // changed how DoneQuests is serialized
				case 17:
				{
					m_Quest = QuestSerializer.DeserializeQuest( reader );
that way existing saves can be read in because they will have version 18 written to them, and your new saves will be able to be read because they will have version 19 written to them which indicates that an extra bool variable has been written to the save.

Serialize/Deserialize methods just write/read the stream in order. They dont have any way to know what variables have been written. That's why you need to use the version numbers to allow you to access both old and new saves and make sure that you write and read things out in exactly the same order.
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. "

For questions, information, and support for XmlSpawner and its addons, visit the
XmlSpawner Support Forum
ArteGordon is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5