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

Validate Item ID Uniqueness #18

Open
Hacktix opened this issue May 3, 2023 · 2 comments
Open

Validate Item ID Uniqueness #18

Hacktix opened this issue May 3, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Hacktix
Copy link
Owner

Hacktix commented May 3, 2023

When loading items, the item IDs should be validated to not cause interference with other mods or the base game. The simplest solution that does take performance into account would be to populate a HashSet with existing item IDs and throwing an exception when attempting to add an item with an ID that's already registered.

@Hacktix Hacktix added the enhancement New feature or request label May 3, 2023
@SloopyNoSleep
Copy link
Contributor

SloopyNoSleep commented May 3, 2023

Aren't string ids sufficient here? We already have a decent equals and GetHashCode implementation by default. Dictionary is already using hashes under the hood and associating it with entries.

Edit: This is based off of the assumption that we already populate a Winch AllItems Dictionary

@bdlm-dev
Copy link
Collaborator

bdlm-dev commented May 3, 2023

Don't think we've got a local AllItems dictionary, so would need to implement that but wouldn't be difficult.
Would probably be then a case of having an explicit 'Replace' directory which tries to replace loaded assets for replacing base items.
EDIT: Though a specific replace directory would then be a number of duplicate directories, so might be better to consider adding a 'doReplace' attribute or equivalent within items to indicate replacing originals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants