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

SerializationException on "parent" declared later in list #90

Closed
Grisgram opened this issue Dec 20, 2020 · 2 comments
Closed

SerializationException on "parent" declared later in list #90

Grisgram opened this issue Dec 20, 2020 · 2 comments

Comments

@Grisgram
Copy link
Contributor

Hi again,

I just stumbled over a bug:
image

When a style has a "parent" entry, that appears later in the list, the file can not be deserialized correctly when the game starts.

Solution would be to allow
a. either reordering styles
b. reordering your in-memory list so that styles that are parent of something else appear first (which can get complicated if parent-hierarchies get deeper)

in general, re-ordering (or at least: order by name) would be a great addition, as the drop down list gets harder to read if the styles are in any order.
With that we could create naming conventions for ourselves, as an example, that we declare our parent-styles as "_stylename" to have them on top of the list, whatever - I am sure you know what i mean :-)

Cheers!

@raeleus
Copy link
Owner

raeleus commented Jan 8, 2021

This was a very good find! I don't use parents very much, so I never encountered this myself. The way I currently have it is that I do data validation when building the parent SelectBox. I added a condition to prevent users from selecting a style from further down the list. Reordering styles is in my to do list and will be a very messy update unfortunately. Thanks for making these issues!

@Grisgram
Copy link
Contributor Author

Hey
yes this will at least prevent the deserialization bug, but unfortunately not solve the problem.

Example:
When I create my fifth style for ... something ... and I find that they are all very equal, I might decide to make a parent style (at the time, where four future-children already exist). With this fix, the parent would then be added at the bottom of the list and I could never select it, as long as i don't delete my existing styles and re-create them so they appear after the new created parent.

Maybe there's a way which is less scary than implementing a re-ordering mechanism:

  • What if your "+" and "copy" buttons for styles (that open that "enter name of the style" dialog) get an additional checkbox "[x] this will be a parent style" in that dialog? If this checkbox is set, you don't add it at the end, instead insert it as first item in the list. So, no re-ordering needs to be implemented.
    You could hint with a (?) tooltip what this checkbox means, so everybody understands it.

Is an "insert at index 0" possible with less effort?

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

2 participants