|
||
|
|||||||
| Server Support on Windows Get (and give) support on general questions related to the RunUO server itself. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) | |
|
Join Date: Mar 2004
Posts: 3
|
Hi,
After saving the program doesnt compile anymore this is the error I get: Quote:
Thank you |
|
|
|
|
|
|
#3 (permalink) |
|
Master of the Internet
Join Date: Aug 2003
Posts: 5,688
|
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:
{
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 );
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 );
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|