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

Fixed type of probability slot of tiled-tileset-tile to (or null real… #11

Merged

Conversation

nobody-significant
Copy link
Contributor

…) to reconcile type with the ttileset-tile struct.

At the present time, the probability slot of the struct ttileset-tile is just copied over when making instances of tiled-tileset-tile and animated-tile (see lines

:probability probability
and
:probability probability
), but the types of the slots are incompatible.

tiled-tileset-tile`` and animated-tileusereal``` (

:type real
)

but ttileset-tile uses (or null real) (

(probability nil :type (or null real))
).

This PR reconciles to two by changing the type of the slot for tiled-tileset-tile (animated-tile inherits from it) to (or null real). It could of course be reconciled the other way, though that seemed like it required more changes (I could be wrong on this).

…) to reconcile type with the ttileset-tile struct.
@Zulu-Inuoe
Copy link
Owner

Ah I remember this.
I ran into a similar issue with the background color property. The main problem is that the Tiled standard doesn't really specify defaults, and I wasn't sure where to 'cleanup' the data, so I ended up just not doing it because I forgot.

Ideally I'd rather have the user-facing data structures be easier to work with, so just like I did with the color, I think it makes sense to have a reasonable value filled in when it's missing from the underlying json/xml (meaning when it's nil).

I don't have time right now, but tomorrow I'll try and look at what the Tiled editor does with a missing probability (whether it treats it as 0, 1, or something else) and copy their behaviour.

@Zulu-Inuoe Zulu-Inuoe merged commit 14d27dd into Zulu-Inuoe:master Jan 14, 2019
@Zulu-Inuoe
Copy link
Owner

This is incredibly delayed. I apologize. But after looking at #14 , I think whatever comes out of #15 will be a better way to get 'equivalent to the Tiled editor' behaviour. So this fix makes perfect sense.

Thanks

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

Successfully merging this pull request may close these issues.

2 participants