Skip to content

Add missing UGC maps without early exit#636

Merged
AngeloTadeucci merged 1 commit intomasterfrom
dev
Feb 12, 2026
Merged

Add missing UGC maps without early exit#636
AngeloTadeucci merged 1 commit intomasterfrom
dev

Conversation

@AngeloTadeucci
Copy link
Collaborator

@AngeloTadeucci AngeloTadeucci commented Feb 12, 2026

Previously InitUgcMap returned early if any UgcMap rows existed, preventing new maps from being added later. This change builds a HashSet of existing (MapId, Number) pairs and skips inserts for those pairs, allowing the method to insert only missing map entries while avoiding duplicates. The DefaultHomeMapId check is preserved; AsEnumerable/ToHashSet is used to materialize the existing pairs for comparison.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where duplicate map entries could be stored in the game database during initialization, improving data integrity and preventing potential conflicts.

Previously InitUgcMap returned early if any UgcMap rows existed, preventing new maps from being added later. This change builds a HashSet of existing (MapId, Number) pairs and skips inserts for those pairs, allowing the method to insert only missing map entries while avoiding duplicates. The DefaultHomeMapId check is preserved; AsEnumerable/ToHashSet is used to materialize the existing pairs for comparison.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Modified the InitUgcMap method to build a set of existing (MapId, Number) pairs from current UgcMap entries and validate new records against this set before insertion, preventing duplicate entries. No changes to exported/public entity signatures.

Changes

Cohort / File(s) Summary
UGC Map Initialization
Maple2.Database/Storage/Game/GameStorage.Map.cs
Updated InitUgcMap to deduplicate new UgcMap records by checking against a set of existing (MapId, Number) pairs before insertion, preventing duplicate entries during initialization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Duplicates beware, we've got a set!
No more doubles in our map alphabet,
Each pair is checked before it lands,
Clean data now, by rabbit's hands! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: replacing an early exit with deduplication logic to allow adding missing UGC maps.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

No actionable comments were generated in the recent review. 🎉

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AngeloTadeucci AngeloTadeucci merged commit 95108ec into master Feb 12, 2026
4 checks passed
@AngeloTadeucci AngeloTadeucci deleted the dev branch February 13, 2026 19:07
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