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

Check for unit constructor validity #10543

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GlennFolker
Copy link
Contributor

Add sanity checks in UnitType's constructor:

  • If constructor == null, point them to common Vanilla unit classes.
  • If constructor != null but EntityMapping.map(name) returns null, register the unit type's name to nameMap.
  • If idMap[constructor.classId()] == null, throw an exception.
  • If constructor.classId() != idMap[constructor.classId()].get().classId(), throw an exception.
  • Otherwise, all behaviors are deemed correct and won't cause confusing bugs after IO.

PR preliminary checks

  • I have read the contribution guidelines.
  • I have ensured that my code compiles, if applicable.
  • I have ensured that any new features in this PR function correctly in-game, if applicable.

@nullotte
Copy link
Contributor

nullotte commented Mar 9, 2025

una empanada

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