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!
This commit is contained in:
@@ -125,7 +125,7 @@ class AudioStreamMicrophone : public AudioStream {
|
||||
GDCLASS(AudioStreamMicrophone, AudioStream);
|
||||
friend class AudioStreamPlaybackMicrophone;
|
||||
|
||||
Set<AudioStreamPlaybackMicrophone *> playbacks;
|
||||
RBSet<AudioStreamPlaybackMicrophone *> playbacks;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
@@ -192,7 +192,7 @@ private:
|
||||
float weight;
|
||||
};
|
||||
|
||||
Set<AudioStreamPlaybackRandomizer *> playbacks;
|
||||
RBSet<AudioStreamPlaybackRandomizer *> playbacks;
|
||||
Vector<PoolEntry> audio_stream_pool;
|
||||
float random_pitch_scale = 1.1f;
|
||||
float random_volume_offset_db = 5.0f;
|
||||
|
||||
@@ -90,9 +90,9 @@ int AudioEffectEQ::get_band_count() const {
|
||||
}
|
||||
|
||||
bool AudioEffectEQ::_set(const StringName &p_name, const Variant &p_value) {
|
||||
const Map<StringName, int>::Element *E = prop_band_map.find(p_name);
|
||||
HashMap<StringName, int>::ConstIterator E = prop_band_map.find(p_name);
|
||||
if (E) {
|
||||
set_band_gain_db(E->get(), p_value);
|
||||
set_band_gain_db(E->value, p_value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -100,9 +100,9 @@ bool AudioEffectEQ::_set(const StringName &p_name, const Variant &p_value) {
|
||||
}
|
||||
|
||||
bool AudioEffectEQ::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
const Map<StringName, int>::Element *E = prop_band_map.find(p_name);
|
||||
HashMap<StringName, int>::ConstIterator E = prop_band_map.find(p_name);
|
||||
if (E) {
|
||||
r_ret = get_band_gain_db(E->get());
|
||||
r_ret = get_band_gain_db(E->value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class AudioEffectEQ : public AudioEffect {
|
||||
|
||||
EQ eq;
|
||||
Vector<float> gain;
|
||||
Map<StringName, int> prop_band_map;
|
||||
HashMap<StringName, int> prop_band_map;
|
||||
Vector<String> band_names;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user