I'm not really sure how to proceed with this refactoring, so I'm posting what I've done here for now (zipped since the patch was too large to attach otherwise). If anyone wants to look at it, it starts with changing KoLConstants to use three enums instead of a single bitmask. From there, lots of things were changed in ConcoctionDatabase to work with those. After that was done, everything else was changed in a way that was meant to be equivalent.
To even get mafia running, I had to comment out the check for duplicate recipes in ConcoctionDatabase, since everything was being flagged as a duplicate and no concoctions were added. It doesn't recognize when you can't make something due to a lack of skills, but a lack of ingredients or an inability to use a crafting method is recognized.
You are not sure how to proceed because you couldn't debug the two issues you mentioned? I looked at it and have figured them out, I believe.
- when checking for duplicates, don't compare existing.getMixingMethod() to null. Compare it to CraftingType.NOCREATE
- when reading concoctions, you do this before reading each concoction:
ConcoctionDatabase.mixingMethod = null;
ConcoctionDatabase.requirements.clear();
ConcoctionDatabase.info.clear();
You then create each concoction like this:
Concoction concoction = new Concoction( item, ConcoctionDatabase.mixingMethod, ConcoctionDatabase.requirements, ConcoctionDatabase.info );
You need to do this:
Concoction concoction = new Concoction( item, ConcoctionDatabase.mixingMethod, ConcoctionDatabase.requirements.clone(), ConcoctionDatabase.info.clone() );
in order to make a copy of the EnumSets to store in the Concoction, rather than keeping the ones which you keep clearing.
With those things fixed, it seems to work for me. I checked it in as Revision 11912.
If you want to do the new Jarlsberg concoctions, please proceed.