Page 1 of 1

Dynamic ID enumerator

PostPosted: 15 Dec 2011, 13:57
by Gargaroz
Here's what I currently made. Obviosuly, actual values are just for show.
Is this correct, Snacko ?
If yes, Mok please arrange csv2dat to produce a file like this, it's named "card_id.h".

Code: Select all
#ifndef CARD_ID_H
#define CARD_ID_H

typedef enum
{
 CARD_ID_RULES_ENGINE    = 1,
 CARD_ID_DEADBOX    = 2,
} card_id_t;

#endif
For name like "Ashnod's Altar", I'd like to follow this rule : CARD_ID_ASHNODS_ALTAR.
Also, the automatic parse must ignore all entries named "Empty" or "None".
I'm not sure about entries that start with "*" : we put that there so they would be the first displayed on the Deck Builder, but for IDs probably it's better to just ignore that special character.
As for special accented characters and like, probably the best thing to do is just annihilate them and replace with the normal characters ( CARD_ID_FROZEN_AETHER ).

Re: Dynamic ID enumerator

PostPosted: 15 Dec 2011, 16:45
by Snacko
Yes, it's correct and I suppose this is what everyone had in mind Mok including what should be autogenerated.

Re: Dynamic ID enumerator

PostPosted: 15 Dec 2011, 16:50
by Mok
Gargaroz wrote:Here's what I currently made. Obviosuly, actual values are just for show.
Is this correct, Snacko ?
If yes, Mok please arrange csv2dat to produce a file like this, it's named "card_id.h".

Code: Select all
#ifndef CARD_ID_H
#define CARD_ID_H

typedef enum
{
 CARD_ID_RULES_ENGINE    = 1,
 CARD_ID_DEADBOX    = 2,
} card_id_t;

#endif
For name like "Ashnod's Altar", I'd like to follow this rule : CARD_ID_ASHNODS_ALTAR.
Also, the automatic parse must ignore all entries named "Empty" or "None".
I'm not sure about entries that start with "*" : we put that there so they would be the first displayed on the Deck Builder, but for IDs probably it's better to just ignore that special character.
As for special accented characters and like, probably the best thing to do is just annihilate them and replace with the normal characters ( CARD_ID_FROZEN_AETHER ).
lol, you really like to type... but as you wish, it will be CARD_ID_ instead of CID_ :)
I'll skip "*" and other non-compilable characters in names so CARD_ID_AVATAR_blablah etc., accented names will be replaced, but with a crude 1:1 replacement so it'll be probably end as AE->E, so CARD_ID_FROZEN_ETHER (I'm lazy I know).

Re: Dynamic ID enumerator

PostPosted: 15 Dec 2011, 18:02
by Mok
Here you go. It doesn't check for duplicates so it'll likely produce useless files for now, until we create a first really combined csv, but at least you can do some testing.

Re: Dynamic ID enumerator

PostPosted: 16 Dec 2011, 02:41
by Gargaroz
Thanx Mok, it's also very useful to find duplicates cards in the CSV : you only have to try to compile with the generated file and then use the error list as guide ;)

Re: Dynamic ID enumerator

PostPosted: 16 Dec 2011, 14:34
by Mok
Gargaroz wrote:Thanx Mok, it's also very useful to find duplicates cards in the CSV : you only have to try to compile with the generated file and then use the error list as guide ;)
A few days ago I replaced some of the magic numbers in the C code (the version you posted as 4mok_fixed) part automatically, part by hand - for my testing here. It's only a small part though as I lost interest being unable to decide if some numbers are cids or not and the amount I have done was enough to get the game to not crash as often as before. I'm posting a diff here (that will likely not apply anymore though) so you may verify if you got all these places after you do it yourself :) btw: subtype 44 should be creature and not artifact creature. Dunno why it was defined like that. But subtypes should be also fixed to not use magic numbers otherwise we'll have problems later on.

Re: Dynamic ID enumerator

PostPosted: 16 Dec 2011, 19:33
by Gargaroz
About the "44" code, was our accomodation to sort out the non-creature artifact when using a customized deck builder Jatill made.
For the rest, I'm in the process of replacing as many "magic numbers" as I could find. It will be a long work, but I'll do my best.