patchFreeciv - Patches: patch #1652, define bitvector in specenum

 
 
Show feedback again

patch #1652: define bitvector in specenum

Submitted by:  Matthias Pfafferodt <syntron>
Submitted on:  Sun Apr 25 16:42:20 2010  
 
Category: generalPriority: 5 - Normal
Status: DuplicatePrivacy: Public
Assigned to: Matthias Pfafferodt <syntron>Open/Closed: Closed
Planned Release: 2.3.0Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Wed Sep 22 17:04:49 2010, comment #8:

superseded by patch #1973

Matthias Pfafferodt <syntron>
Project MemberIn charge of this item.
Sun May 2 21:39:06 2010, comment #7:

You are right; after some thinking I got another idea how to save/load all the different flags (simply use the names). But first I will check all the enums.

Matthias Pfafferodt <syntron>
Project MemberIn charge of this item.
Fri Apr 30 18:13:06 2010, comment #6:

This patch is a bit (hah! bonus pun) confusing, since _bv_to_str will not work together with SPECENUM_BITWISE. (A max value of 128 needs is only a 7-bit bitfield, not 128 bits).

Engla <englabenny>
Project Member
Sun Apr 25 17:22:42 2010, comment #5:

> ... Again a comment: doesn't this duplicate SPECENUM_BITWISE?


Could be. As I'm not familiar with this concept (bitwise operations on variables) I do not touch these. I will check this then I have free time.

Matthias Pfafferodt <syntron>
Project MemberIn charge of this item.
Sun Apr 25 17:11:31 2010, comment #4:

... Again a comment: doesn't this duplicate SPECENUM_BITWISE?

pepeto <pepeto>
Project Member
Sun Apr 25 17:07:52 2010, comment #3:

Ok, why not... It is quite complicate, but if it is well documented, it should be ok.

pepeto <pepeto>
Project Member
Sun Apr 25 17:03:56 2010, comment #2:

My idea is to use it for the ruleset file as:

Thus, the files are small but still human readable

Matthias Pfafferodt <syntron>
Project MemberIn charge of this item.
Sun Apr 25 16:54:37 2010, comment #1:

> This will be needed for the ruleset/savegame.


For me, it isn't a right way to use specenum. To original is to removes enum hard-coded dependence. Converting magic numbers to a string with 0 and 1 is not an improvement. Bitwise enumerators should be saved into a string vector like:
You can see such examples in warclient, saving and restoring the filter options.

Probably a macro secfile_insert_enum() is the solution to connect all the specenum functions that a secfile_insert_enum_full() would use.

pepeto <pepeto>
Project Member
Sun Apr 25 16:42:20 2010, original submission:

we have the specnum_gen.h file to define enums which in turn are often uses as indices for bitvectors.

This patch defines a bitvector type (BV_DEFINE) for each enum and two functions to convert the bitvector into a string and to read the string. This will be needed for the ruleset/savegame.

Matthias Pfafferodt <syntron>
Project MemberIn charge of this item.

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

 

Depends on the following items: None found

Digest:
   patch dependencies.

 

Carbon-Copy List
  • -unavailable- added by englabenny (Posted a comment)
  • -unavailable- added by pepeto (Posted a comment)
  • -unavailable- added by syntron (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Error: not logged in

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Sep 22 17:04:49 2010syntronStatusIn Progress=>Duplicate
      Open/ClosedOpen=>Closed
    Sun Apr 25 16:43:05 2010syntronDependencies-=>patch #1446 is dependent
    Sun Apr 25 16:42:20 2010syntronAttached File-=>Added 20100418-07-trunk-define-bitvector-in-specenum.patch, #9072
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup