Skip to content
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

Idea: Standard attributes for "variable" size arrays determined by known field(s) #404

Open
PatrikLundell opened this issue May 14, 2020 · 4 comments

Comments

@PatrikLundell
Copy link
Contributor

One important example would be df.global.world.world_data.region_map, where the size of the array is based on the width of the world, a value that can be found in world_width in the parent struct, with the elements themselves being (pointers to) arrays of a size determined by the world height element.

A trickier case would be the very next element, currently called unk_1c4, which is a 2D matrix with dimensions controlled by the same parameters.

The immediate purpose of the suggestion would be to provide writers/readers of the XML with a standardized method for describing these relations, while the longer term objective would be to allow code and scripts to access the info (imagine gui/gm-editor being able to show the region_map elements for all the world tiles, for instance).

Possible names for such attributes might be ref-count, ref-count1, ref-count2, ref_count3 (taking cues from "ref-target", and "count" for static arrays, for the respective parts). ref-count and ref-count1 would be identical in function, with the difference being that the "1" version would imply to a reader that there are more than 1 dimensions.

The presence of one or more ref-count attributes implies the "is-array='true'" attribute functionality, and thus ought to be mutually exclusive in the .xsd file.

@cvuchener
Copy link
Contributor

Please don't use "ref-count" if this is not about reference counting. This abbreviation is too common to be misused.

@PatrikLundell
Copy link
Contributor Author

Good point. What about "ref-size"?

@PatrikLundell PatrikLundell mentioned this issue May 14, 2020
Merged
@BenLubar
Copy link
Member

I feel like we only need one ref-size attribute, and we can just put ref-size on the inner pointer if we need to specify multiple dimensions

@PatrikLundell
Copy link
Contributor Author

Hm, so the second example would be split into an array of arrays (there's no pointer available)? That ought to work.

BenLubar added a commit to BenLubar/df-structures that referenced this issue May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants