From 746dddc0673d7261f19b1e056e90e6e3a49ef33a Mon Sep 17 00:00:00 2001 From: reduz Date: Fri, 13 May 2022 15:04:37 +0200 Subject: Replace most uses of Map by HashMap * Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated! --- editor/animation_bezier_editor.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'editor/animation_bezier_editor.cpp') diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 9c8fec26a7..ff8b72274c 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -62,7 +62,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) { int right_limit = get_size().width; //selection may have altered the order of keys - Map key_order; + RBMap key_order; for (int i = 0; i < animation->track_get_key_count(p_track); i++) { float ofs = animation->track_get_key_time(p_track, i); @@ -73,7 +73,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) { key_order[ofs] = i; } - for (Map::Element *E = key_order.front(); E; E = E->next()) { + for (RBMap::Element *E = key_order.front(); E; E = E->next()) { int i = E->get(); if (!E->next()) { @@ -262,12 +262,12 @@ void AnimationBezierTrackEdit::_notification(int p_what) { int vofs = vsep; int margin = 0; - Map subtrack_colors; + RBMap subtrack_colors; Color selected_track_color; subtracks.clear(); subtrack_icons.clear(); - Map> track_indices; + RBMap> track_indices; int track_count = animation->get_track_count(); for (int i = 0; i < track_count; ++i) { if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER) { @@ -432,7 +432,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { Rect2 solo_rect = Rect2(solo_hpos, icon_start_height - solo->get_height() / 2, solo->get_width(), solo->get_height()); draw_texture(solo, solo_rect.position); - Map track_icons; + RBMap track_icons; track_icons[REMOVE_ICON] = remove_rect; track_icons[LOCK_ICON] = lock_rect; track_icons[VISIBILITY_ICON] = visible_rect; @@ -747,7 +747,7 @@ void AnimationBezierTrackEdit::_update_locked_tracks_after(int p_track) { } Vector updated_locked_tracks; - for (Set::Element *E = locked_tracks.front(); E; E = E->next()) { + for (RBSet::Element *E = locked_tracks.front(); E; E = E->next()) { updated_locked_tracks.push_back(E->get()); } locked_tracks.clear(); @@ -766,7 +766,7 @@ void AnimationBezierTrackEdit::_update_hidden_tracks_after(int p_track) { } Vector updated_hidden_tracks; - for (Set::Element *E = hidden_tracks.front(); E; E = E->next()) { + for (RBSet::Element *E = hidden_tracks.front(); E; E = E->next()) { updated_hidden_tracks.push_back(E->get()); } hidden_tracks.clear(); @@ -963,9 +963,9 @@ void AnimationBezierTrackEdit::gui_input(const Ref &p_event) { } } - for (const KeyValue> &E : subtrack_icons) { + for (const KeyValue> &E : subtrack_icons) { int track = E.key; - Map track_icons = E.value; + RBMap track_icons = E.value; for (const KeyValue &I : track_icons) { if (I.value.has_point(mb->get_position())) { if (I.key == REMOVE_ICON) { -- cgit v1.2.3