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

Add: show an error if a required property is not set for objects (feature 0F) #236

Merged
merged 2 commits into from Oct 10, 2021

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented Sep 1, 2021

Other features may use this, but I only checked ttdpatch source for objects.

Closes #191.

@FLHerne
Copy link
Contributor

FLHerne commented Sep 1, 2021

I think this should be an error and not a warning, since there's no question it's incorrect and will fail.

"size": {"custom_function": object_size}, # = prop 0C
"name": {"size": 2, "num": 0x0A, "string": 0xD0, "required": None},
"climates_available": {"size": 1, "num": 0x0B, "required": None},
"size": {"custom_function": object_size, "required": None}, # = prop 0C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use True here to be clearer, even though the value doesn't actually matter

@planetmaker
Copy link
Contributor

I'd second the comments by FLHerne and LordAro. Both make it clearer and better readable.

…ture 0F)

Other features may use this, but I only checked ttdpatch source for objects.
@glx22 glx22 changed the title Add: warn if a required property is not set for objects (feature 0F) Add: show an error if a required property is not set for objects (feature 0F) Sep 1, 2021
@glx22
Copy link
Contributor Author

glx22 commented Sep 1, 2021

Maybe I should also consider "first" as "required".

And I guess nmlc should be smart enough to move a "first" property on first place in the list (and still warn of course).

@glx22 glx22 merged commit 8565776 into OpenTTD:master Oct 10, 2021
@glx22 glx22 deleted the properties branch October 10, 2021 17:52
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.

Does not error when defining an object without a size
4 participants