KhymChanur: Currently, if a item's sval has a contant defined for it, the constant has to be set to some value in a list of svals somewhere besides where the item kind is defined. This seems a bit klunky, and also means that if two different addons to the same module want to define svals contants for within the same tval, the value assigned to the contants might be the same.

A simbple way to solve this would be to add a "define_as" field to the item kind definiton. So instead of

[SV_RIBBED_PLATE_ARMOUR] = {
        name = "ribbed plate armour~"

like currently, you'd have

[13] = {
        name = "ribbed plate armour~"
        define_as = "SV_RIBBED_PLATE_ARMOUR"

Of course, this still leaves the problem of new_item_kinds() requiring hardcoded values for the svals, but that's another problem...

NeilStevens: Better would be to have an sval generator function, something like SV_RIBBED_PLATE_ARMOUR = create_sval(TV_HARD_ARMOR). Then you have no error-prone constant maintenance at all. The biggest issue left becomes the issue of script reordering causing breaks in save compaiability.

DarkGod: Great minds .. yesterday in my copy of the sources I removed all references to TV_* and SV_* from the C code. Next I'll add a way for the lua code to define it's own easily something like

define_objects_categories
{
    { HARD_ARMOR,
        { RIBBED_PLATE_ARMOUR, SOFT_CHILI_ARMOUR, ... }
    },
    ...
}

Developers Corner/Proposals/Make sval constants dynamicaly 'defined as' (last edited 2005-06-27 11:36:10 by DarkGod)