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

Fix: Nicer error message when a station switch returns a SpriteLayout #360

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented Jan 23, 2025

Stations usage of SpriteLayouts is very different to other features, but it may happen an author write a switch returning a SpriteLayout (like it's done for other features).
This triggers this assert, which is not helpful for the author.

A check exist to prevent invalid use of SpriteLayout when following 1/2/3, but stations are allowed to have SpriteLayout with a special handling.

Detect the problem before asserting and output a more useful error message.

Doing the same kind of check for SpriteGroup is not necessary here because it's already handled here and here and all features follow 1/2/3 for SpriteGroups.

@@ -15,7 +15,7 @@

from nml import expression, generic, global_constants, nmlop
from nml.actions import action2, action2real, action2var_variables, action4, action6, actionD
from nml.ast import switch
from nml.ast import general, switch, spriteblock

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
nml.ast.spriteblock
begins an import cycle.
Import of module
nml.ast.switch
begins an import cycle.
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.

1 participant