Question on Section inheritance

Want to discuss changes to the UOX3 source code? Got a code-snippet you'd like to post? Anything related to coding/programming goes here!
Post Reply
punt
VIP
Posts: 244
Joined: Wed Mar 24, 2004 7:46 pm
Has thanked: 0
Been thanked: 9 times

Question on Section inheritance

Post by punt »

Ok, this isn't necessarily a discussion on how things are today, but pros/cons how how sections could be for inheritance.
First, for this discussion, say sections are defined as [type:identifier:parent]

Say I have

Code: Select all

[item:a:b]
{
    name = howdy   
}
And I have

Code: Select all

[item:b]
{
   color =red
   name = base
 }
If item a inheritiated off item b,
would it be ok to effectively build section [item a] and then modify any duplicate value, and then append any additional? I think this order
is backwards from how UOX is today. Does anyone see any issues with that?

So effectively item a would look like

Code: Select all

[item a]
{
   name = howdy
   color = red
}

Note the order of item a key values.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Isn't that how it currently works too, though?

Example:

Code: Select all

[item_a]
{
get=item_b
name=howdy
}

[item_b]
{
name=base
color=red
}
item_a would first get all the properties of item_b, before setting its name property to "howdy" after.

Or did I misunderstand your example? 🤔
-= Ho Eyo He Hum =-
punt
VIP
Posts: 244
Joined: Wed Mar 24, 2004 7:46 pm
Has thanked: 0
Been thanked: 9 times

Post by punt »

You are looking how the data is interpreted I believe. One of the things I am looking at is how to do as muck lookup at reading the data versus doing it on object initialization. So I was showing what item a looked like data wise after loading all data. So it takes the item. And then appends all inherited keys that are not present and that becomes the data object for that item stored. Perhaps effectively this is what uox3 does but wanted to check
Post Reply