Skip to content

Updated to Godot HashMap, HashSet, and Pair types#901

Draft
rpgshooter wants to merge 1 commit intoTokisanGames:mainfrom
rpgshooter:updated-Hash-Pair-redefs
Draft

Updated to Godot HashMap, HashSet, and Pair types#901
rpgshooter wants to merge 1 commit intoTokisanGames:mainfrom
rpgshooter:updated-Hash-Pair-redefs

Conversation

@rpgshooter
Copy link
Contributor

Replace std::unordered_set/map with Godot containers:

Addition to #880

Summary

Replace std::unordered_map and std::unordered_set with Godot's HashMap and HashSet in Terrain3DInstancer
Remove custom hash structs that are no longer needed (Godot's HashMapHasherDefault provides built-in hashing for Vector2i, Vector3, and Pair<F, S>)
This change prepares the codebase for C++20 compatibility

Changes

constants.h
Removed Vector2iHash, PairVector2iIntHash, and Vector3Hash structs
terrain_3d_instancer.h
Replaced <unordered_map> and <unordered_set> includes with Godot templates
Changed type aliases to use HashMap<Vector2i, Pair<RID, RID>> and HashSet<Pair<Vector2i, int>>
terrain_3d_instancer.cpp
Updated API calls: .empty() → .is_empty(), .count() → .has(), .emplace() → .insert()
Changed std::make_pair to Pair<Vector2i, int>
Updated iteration patterns to use KeyValue<K, V> for HashMap and explicit Pair access for HashSet

@TokisanGames TokisanGames added the enhancement New feature or request label Dec 13, 2025
@TokisanGames TokisanGames added this to the 1.2 milestone Dec 13, 2025
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

Successfully merging this pull request may close these issues.

2 participants