Update of patch #3394 (project freeciv):

                Category:                    None => general                
                  Status:                    None => Ready For Test         
         Planned Release:                         => 2.5.0                  

    _______________________________________________________

Follow-up Comment #1:

Attached patch adds some specenum side support for this.

> I think we can only define user flags (with no hardcoded
> meaning) as:
> #define SPECENUM_VALUE5 FLAG_USER1
> #define SPECENUM_VALUE5NAME "User1"
> #define SPECENUM_VALUE6 FLAG_USER2
> #define SPECENUM_VALUE6NAME "User2"

Giving VALUExNAME is not necessary. 

> and then either accept that user flags are named "User1",
> "User2"... or to use manually written flag name access
> functions instead of automatically generated xxx_name() &
> xxx_by_name().

User flag name access function must be written separately, but with this patch
access API stays as it is. This is big win in consistency between those
specenums that use user flags and those that don't - no need to remember
what's the right calling convention for each separate type. Instead of being
parallel to specenum xxx_name() and xxx_by_name() functions, manually written
function is called from those automatically generated functions. It's also
enough to handle just user flags in that function, by returning NULL for other
flags it gives responsibility back to automatically generated function.

This call to callback function foo_name_cb(enum type) is added if macro
SPECENUM_NAMEOVERRIDE is defined.

(file #16288)
    _______________________________________________________

Additional Item Attachment:

File name: SpecenumNameCB.patch           Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?3394>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to