-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
World File Parsing #320
World File Parsing #320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I've got a few comments. Also please don't forget to update the CHANGELOG.md
.
Seems like some of the README examples broke, maybe because of some compiler update that changes how paths are handled with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some further feedback from my side. Also I think this PR should target next
instead of current
(but that can be changed without opening a new PR).
Thanks for taking the time to provide thoughtful review. I haven't contributed much to open source yet but I would like to change that so I really appreciate it. I think the last couple of things I'm not certain on.
I went with Result instead of Option since regular expressions can be really frustrating to work with. That way the user doesn't provide a list of files and just get None back. This has fallen a bit short with testing a filename against every pattern in the world file since it's to be expected that some of the patterns won't fit so it doesn't make sense to return why. I still think it's OK as we can return an error if the arithmetic overflows instead of panicking. The world file patterns are hand edited by the user so they are more prone to errors. |
I'll look into rebasing to next. |
I've changed the target branch to About the latest version:
I hope you're not growing tired of the back and forth with the reviews! I have a feeling these will be my last concerns, but let's see what @aleokdev will say. :-) |
I think that's a good suggestion. I've added it back to the
I added a single conversion before the iterative call. ` pub fn match_path(&self, path: impl AsRef) -> Result<WorldMap, Error> {
I don't mind at all. I don't have a lot of experience writing generalized public libraries so this is very educational for me and I appreciate you making the effort for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great now! Just left a few small comments.
- name: Build library | ||
run: cargo build --lib --verbose | ||
run: cargo build --lib --all-features --verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably also have a build check without all features. However this could be improved later on using cargo hack
to check with the powerset of features instead. So all good here for now.
Added the match_path_impl pub(crate) function and updated the public interfaces to use that internally. |
Ok, I think that's everything. There's some oddities with the readme include_bytes paths. On Mac and on the automated build the paths work as "assets/" but on my Linux machine it wants them back as "../assets". I run the tests from CLI so nothing like vscode would interfere with that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No further comments from my side. Thanks for this nice addition!
Thank you! |
Adds feature to parse Tiled World format.
Includes the ability to parse patterns as well (I think this will cause oddities with the
ResourceReader
though if the other files aren't preloaded into the reader).serde and serde_json have been added as dependencies.
I tried adding an option to pre-parse all of the TMX files referenced in the world file, but I ran into the same issue which I think the patterns might have as well, the files won't exist in the "folder" if they weren't already loaded into the ResourceReader.
I think loading all the TMX files might make sense to expect it to happen downstream.
The
ResourceReader
concept is a bit new to me, so I'm going to open this PR and hopefully someone will have advice on which direction to take it. I'm also not using the cache in the World parse_xml, I'm not sure if it's needed?