Replace find with contains/has where applicable
* Replaces `find(...) != -1` with `contains` for `String` * Replaces `find(...) == -1` with `!contains` for `String` * Replaces `find(...) != -1` with `has` for containers * Replaces `find(...) == -1` with `!has` for containers
This commit is contained in:
@ -59,7 +59,7 @@ void OpenXRActionMap::set_action_sets(Array p_action_sets) {
|
||||
|
||||
for (int i = 0; i < p_action_sets.size(); i++) {
|
||||
Ref<OpenXRActionSet> action_set = p_action_sets[i];
|
||||
if (action_set.is_valid() && action_sets.find(action_set) == -1) {
|
||||
if (action_set.is_valid() && !action_sets.has(action_set)) {
|
||||
action_sets.push_back(action_set);
|
||||
}
|
||||
}
|
||||
@ -93,7 +93,7 @@ Ref<OpenXRActionSet> OpenXRActionMap::get_action_set(int p_idx) const {
|
||||
void OpenXRActionMap::add_action_set(Ref<OpenXRActionSet> p_action_set) {
|
||||
ERR_FAIL_COND(p_action_set.is_null());
|
||||
|
||||
if (action_sets.find(p_action_set) == -1) {
|
||||
if (!action_sets.has(p_action_set)) {
|
||||
action_sets.push_back(p_action_set);
|
||||
emit_changed();
|
||||
}
|
||||
@ -112,7 +112,7 @@ void OpenXRActionMap::set_interaction_profiles(Array p_interaction_profiles) {
|
||||
|
||||
for (int i = 0; i < p_interaction_profiles.size(); i++) {
|
||||
Ref<OpenXRInteractionProfile> interaction_profile = p_interaction_profiles[i];
|
||||
if (interaction_profile.is_valid() && interaction_profiles.find(interaction_profile) == -1) {
|
||||
if (interaction_profile.is_valid() && !interaction_profiles.has(interaction_profile)) {
|
||||
interaction_profiles.push_back(interaction_profile);
|
||||
}
|
||||
}
|
||||
@ -146,7 +146,7 @@ Ref<OpenXRInteractionProfile> OpenXRActionMap::get_interaction_profile(int p_idx
|
||||
void OpenXRActionMap::add_interaction_profile(Ref<OpenXRInteractionProfile> p_interaction_profile) {
|
||||
ERR_FAIL_COND(p_interaction_profile.is_null());
|
||||
|
||||
if (interaction_profiles.find(p_interaction_profile) == -1) {
|
||||
if (!interaction_profiles.has(p_interaction_profile)) {
|
||||
interaction_profiles.push_back(p_interaction_profile);
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ Ref<OpenXRAction> OpenXRActionSet::get_action(const String p_name) const {
|
||||
void OpenXRActionSet::add_action(Ref<OpenXRAction> p_action) {
|
||||
ERR_FAIL_COND(p_action.is_null());
|
||||
|
||||
if (actions.find(p_action) == -1) {
|
||||
if (!actions.has(p_action)) {
|
||||
if (p_action->action_set && p_action->action_set != this) {
|
||||
// action should only relate to our action set
|
||||
p_action->action_set->remove_action(p_action);
|
||||
|
||||
@ -172,7 +172,7 @@ Ref<OpenXRIPBinding> OpenXRInteractionProfile::get_binding_for_action(const Ref<
|
||||
void OpenXRInteractionProfile::add_binding(Ref<OpenXRIPBinding> p_binding) {
|
||||
ERR_FAIL_COND(p_binding.is_null());
|
||||
|
||||
if (bindings.find(p_binding) == -1) {
|
||||
if (!bindings.has(p_binding)) {
|
||||
ERR_FAIL_COND_MSG(get_binding_for_action(p_binding->get_action()).is_valid(), "There is already a binding for this action in this interaction profile");
|
||||
|
||||
bindings.push_back(p_binding);
|
||||
|
||||
Reference in New Issue
Block a user