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 25 Apr 2010 04:42:20 PM UTC  
 
Category: generalPriority: 5 - Normal
Status: DuplicatePrivacy: Public
Assigned to: Matthias Pfafferodt <syntron>Open/Closed: Closed
Planned Release: 2.3.0

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 22 Sep 2010 05:04:49 PM UTC, comment #8:

superseded by patch #1973

Matthias Pfafferodt <syntron>
Project MemberIn charge of this item.
Sun 02 May 2010 09:39:06 PM UTC, 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 30 Apr 2010 06:13:06 PM UTC, 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 25 Apr 2010 05:22:42 PM UTC, 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 25 Apr 2010 05:11:31 PM UTC, comment #4:

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

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

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

pepeto <pepeto>
Project Member
Sun 25 Apr 2010 05:03:56 PM UTC, 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 25 Apr 2010 04:54:37 PM UTC, 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 25 Apr 2010 04:42:20 PM UTC, 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.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

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

    Back to the top


    Powered by Savane 3.1-cleanup