PyrO

Moderator
Well this may be an odd question but as it is currently in the publish 54 things like the sturdy shovel are redefined instead of being a child class of shovels, pickaxes (all if I am not wrong) and creatures like the ore elementals.

I personally prefer to have proper inheritance in these cases but I wonder if there is / was a reason to why they were compley redefined?

Also for running shards would there be a way to get changes up and running for items that would require to be deleted cause of the class structure changes?
 
ServUO is based on code that is nearly ten years old in some places. There's be a lot of maintainers over the years, and some of them did a lot of copy-and-pasting. As for changing the inheritance chain, there are ways of doing that while retaining compatibility with old saves, but it usually gets fairly hacky.
 
Well I didnt mean to sounds bad mouthing but I was wondering.

What ways would you think of? Only things I can think of is either
- keeping the baseclass and add an deserialization to the new class (and for preference after the load replacing the old base class with the current and doing the same witht he deserialization so that the temp class could be removed (very hacky indeed)
- Having a persistant system to save all props and class names from the incompatible classes so they could be reloaded into the new class(es) afterwards.
 
What I've had to do in the past is go ahead and make the change. Then in the new parent class I increased the version number to 1000. I read the version number with the reader.PeekInt() method. If it is below 1000 then you compare this.GetType() to the list of known types that have had their inheritance messed with, then you do whatever retains compatibility with the old save.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back