#779 Archetype file parser is too intolerant


I was testing out some formulae I intend to add to Crossfire. One recipe was giving me some issues. It takes two leather strips (a custom arch I was going to add, but haven't yet) and an iron bar and is supposed to make a small shield at the forge. Instead, it makes a water of emerald.
I'm guessing this may have something to do with how the index is stored in the recipe list, but I'm not fully sure.


  • SilverNexus

    SilverNexus - 2014-06-03

    Hmm... I suppose a diff of the formula file and the extra arches I created would be helpful.

  • SilverNexus

    SilverNexus - 2014-06-03

    And the formulae -- I'm not sure SF allows multiple attachments in one post.

  • Kevin Zheng

    Kevin Zheng - 2014-06-04

    I'm not very familiar with the archetype magic, but I'm guessing you've tried the non-obvious make do-collect to rebuild the archetypes file?

  • SilverNexus

    SilverNexus - 2014-06-04

    Yes, I did run make do-collect. Without that, it would be complaining about the leather archetypes not existing. They did exist in-game, so I don't think that was the issue.

    I was poking around in the code and read something about the ASCII codes of the ingredients being added together to make an index by which the formula would be searched later. Since I was not getting any error messages from the game, I am assuming I ended up with an index that inadvertently matched that of the ingredients for water of emerald.

    A hack-ish fix might be to also add the ASCII codes of the cauldron of the recipe (forge, tanning bench, etc.). It would allow the same ingredients to make different items at different places (which could add an interesting element to the crafting portion of the game).

  • Nicolas Weeger

    Nicolas Weeger - 2014-06-04


    Thanks for your contribution :)

    Two things to fix to make it work:

    • your leather strip archetype doesn't have a "name" field, you should put "name leather strip", else the name will be "leather_strip"

    • second, the formulae file is kind of easy to break with its format, and the ingredients should really be "ingred iron bar,2 leather strip" - no space after comma, and singular form of the ingredients.

    After changing those things, it as expected worked here.

    Obviously you need to change your other recipes too...


  • Kevin Zheng

    Kevin Zheng - 2014-06-05
    • status: open --> feedback-needed
  • SilverNexus

    SilverNexus - 2014-06-05

    Yeah, it fixed the issue. It just feels like doing that skirts around the underlying issue -- the fragile state of the formulae file.

    I'll have to look into that code further to see if there's an easy way make it automatically ignore a space after the comma in the ingredient list. That really seems frustratingly finicky to not be able to put a space after the comma in the ingredient list; the space should be allowed, if even just for readability purposes.

  • Kevin Zheng

    Kevin Zheng - 2014-06-05

    Agreed, the parser/lexer (or maybe the collect script?) should tolerate a little more. Maybe even come up with a more friendly file format?

  • Kevin Zheng

    Kevin Zheng - 2014-07-24
    • summary: Odd behavior with new formulae --> Archetype file parser is too intolerant
    • assigned_to: Kevin Zheng
  • Nicolas Weeger

    Nicolas Weeger - 2014-09-21

    I've changed (r19659) the recipe parser to trim the ingredients, so spaces aren't significant anymore.

    You still need to use singular names though...

  • Nicolas Weeger

    Nicolas Weeger - 2014-09-21
    • status: feedback-needed --> closed

Log in to post a comment.