I wanted to restructure the parsing of capacity/damage/shots because it helps me with the targetting feature and makes also sense.
The difference is between weapons (damage -> capacity, shots -> capacity2) and the hangar/other parts (capacity -> capacity, damage -> capacity2).
So it would make sense that the subparser creates a pair<optional<double>,optional<double>> which gets used from the outer parser. But actually i do not know how to do so.
here is what i managed until now: commit
Any hints how to proceed?
Need help restructuring ShipPartsParser
Moderator: Committer
Need help restructuring ShipPartsParser
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
Re: Need help restructuring ShipPartsParser
Your general idea of making this particular pair sub-parser sounds fine to me.
It's been a long while since I've done any serious work with the parsers, and I won't be able to do anything with this for at least a few more days, but if you don't get it sorted out in the meantime I'll try taking a look at it when I can.
For all these cases where you are running into trouble with the parser, keeping in mind the idea I think Geoff suggested that you might be running into complications from the overall complexity of the parsing rule you are trying, for things like your double values you could think of starting with just the simple double parser rather than the full blown flexible double parser, for example (if I am remembering the namings and their order of complexity correctly).
It's been a long while since I've done any serious work with the parsers, and I won't be able to do anything with this for at least a few more days, but if you don't get it sorted out in the meantime I'll try taking a look at it when I can.
For all these cases where you are running into trouble with the parser, keeping in mind the idea I think Geoff suggested that you might be running into complications from the overall complexity of the parsing rule you are trying, for things like your double values you could think of starting with just the simple double parser rather than the full blown flexible double parser, for example (if I am remembering the namings and their order of complexity correctly).
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0