Remove redundant "== true" code

If it can be compared to a boolean, it can be evaluated as one in-place.
This commit is contained in:
Aaron Franke 2018-10-03 13:40:37 -04:00
parent ffe94ef4e2
commit 37386f112b
19 changed files with 27 additions and 27 deletions

View File

@ -2487,7 +2487,7 @@ _Thread::~_Thread() {
if (active) {
ERR_EXPLAIN("Reference to a Thread object object was lost while the thread is still running...");
}
ERR_FAIL_COND(active == true);
ERR_FAIL_COND(active);
}
/////////////////////////////////////

View File

@ -149,7 +149,7 @@ class PoolVector {
}
}
if (old_alloc->refcount.unref() == true) {
if (old_alloc->refcount.unref()) {
//this should never happen but..
#ifdef DEBUG_ENABLED

View File

@ -578,7 +578,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
network_peer->set_target_peer(E->get()); // To this one specifically.
if (F->get() == true) {
if (F->get()) {
// This one confirmed path, so use id.
encode_uint32(psc->id, &(packet_cache.write[1]));
network_peer->put_packet(packet_cache.ptr(), ofs);

View File

@ -858,7 +858,7 @@ bool Variant::is_one() const {
// atomic types
case BOOL: {
return _data._bool == true;
return _data._bool;
} break;
case INT: {

View File

@ -808,7 +808,7 @@ Error AudioDriverWASAPI::capture_start() {
Error AudioDriverWASAPI::capture_stop() {
if (audio_input.active == true) {
if (audio_input.active) {
audio_input.audio_client->Stop();
audio_input.active = false;

View File

@ -2124,7 +2124,7 @@ void SpatialEditorViewport::_notification(int p_what) {
_update_freelook(delta);
Node *scene_root = editor->get_scene_tree_dock()->get_editor_data()->get_edited_scene_root();
if (previewing_cinema == true && scene_root != NULL) {
if (previewing_cinema && scene_root != NULL) {
Camera *cam = scene_root->get_viewport()->get_camera();
if (cam != NULL && cam != previewing) {
//then switch the viewport's camera to the scene's viewport camera

View File

@ -805,7 +805,7 @@ void CSGBrushOperation::_merge_poly(MeshMerge &mesh, int p_face_idx, const Build
//process points that were not processed
for (int i = 0; i < edge_process.size(); i++) {
if (edge_process[i] == true)
if (edge_process[i])
continue; //already processed
int intersect_poly = -1;

View File

@ -1194,7 +1194,7 @@ bool CSharpInstance::set(const StringName &p_name, const Variant &p_value) {
MonoObject *ret = method->invoke(mono_object, args);
if (ret && GDMonoMarshal::unbox<MonoBoolean>(ret) == true)
if (ret && GDMonoMarshal::unbox<MonoBoolean>(ret))
return true;
break;
@ -1459,7 +1459,7 @@ MonoObject *CSharpInstance::_internal_new_managed() {
void CSharpInstance::mono_object_disposed(MonoObject *p_obj) {
#ifdef DEBUG_ENABLED
CRASH_COND(base_ref == true);
CRASH_COND(base_ref);
CRASH_COND(gchandle.is_null());
#endif
CSharpLanguage::get_singleton()->release_script_gchandle(p_obj, gchandle);

View File

@ -2639,7 +2639,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
}
undo_redo->create_action(TTR("Add Node"));
undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode_new, ofs);
if (vnode_old.is_valid() && p_connecting == true) {
if (vnode_old.is_valid() && p_connecting) {
connect_seq(vnode_old, vnode_new, new_id);
connect_data(vnode_old, vnode_new, new_id);
}
@ -2806,7 +2806,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
}
}
Ref<VisualScriptNode> vnode_old = script->get_node(edited_func, port_action_node);
if (vnode_old.is_valid() && p_connecting == true) {
if (vnode_old.is_valid() && p_connecting) {
connect_seq(vnode_old, vnode, port_action_new_node);
connect_data(vnode_old, vnode, port_action_new_node);
}

View File

@ -228,7 +228,7 @@ void VisualScriptPropertySelector::_update_search() {
}
}
if (seq_connect == true && visual_script_generic == false) {
if (seq_connect && visual_script_generic == false) {
String text = search_box->get_text();
create_visualscript_item(String("VisualScriptCondition"), root, text, String("Condition"));
create_visualscript_item(String("VisualScriptSwitch"), root, text, String("Switch"));
@ -392,7 +392,7 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt
break;
}
}
if (is_filter == true) {
if (is_filter) {
continue;
}

View File

@ -408,7 +408,7 @@ static void engine_draw_frame(struct engine *engine) {
// Just fill the screen with a color.
//glClearColor(0,1,0,1);
//glClear(GL_COLOR_BUFFER_BIT);
if (engine->os && engine->os->main_loop_iterate() == true) {
if (engine->os && engine->os->main_loop_iterate()) {
engine->requested_quit = true;
return; //should exit instead

View File

@ -974,7 +974,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
os_android->process_gyroscope(gyroscope);
if (os_android->main_loop_iterate() == true) {
if (os_android->main_loop_iterate()) {
jclass cls = env->FindClass("org/godotengine/godot/Godot");
jmethodID _finish = env->GetMethodID(cls, "forceQuit", "()V");

View File

@ -86,7 +86,7 @@ void HaikuDirectWindow::DirectConnected(direct_buffer_info *info) {
void HaikuDirectWindow::MessageReceived(BMessage *message) {
switch (message->what) {
case REDRAW_MSG:
if (Main::iteration() == true) {
if (Main::iteration()) {
view->EnableDirectMode(false);
Quit();
}

View File

@ -221,7 +221,7 @@ void OS_Server::run() {
while (!force_quit) {
if (Main::iteration() == true)
if (Main::iteration())
break;
};

View File

@ -864,7 +864,7 @@ void OSUWP::run() {
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
if (managed_object->alert_close_handle) continue;
process_events(); // get rid of pending events
if (Main::iteration() == true)
if (Main::iteration())
break;
};

View File

@ -2737,7 +2737,7 @@ void OS_Windows::run() {
while (!force_quit) {
process_events(); // get rid of pending events
if (Main::iteration() == true)
if (Main::iteration())
break;
};

View File

@ -2814,7 +2814,7 @@ void OS_X11::run() {
#ifdef JOYDEV_ENABLED
joypad->process_joypads();
#endif
if (Main::iteration() == true)
if (Main::iteration())
break;
};

View File

@ -1079,7 +1079,7 @@ bool Control::has_constant_override(const StringName &p_name) const {
bool Control::has_icon(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == "") {
if (has_icon_override(p_name) == true)
if (has_icon_override(p_name))
return true;
}
@ -1113,7 +1113,7 @@ bool Control::has_icon(const StringName &p_name, const StringName &p_type) const
bool Control::has_shader(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == "") {
if (has_shader_override(p_name) == true)
if (has_shader_override(p_name))
return true;
}
@ -1146,7 +1146,7 @@ bool Control::has_shader(const StringName &p_name, const StringName &p_type) con
bool Control::has_stylebox(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == "") {
if (has_stylebox_override(p_name) == true)
if (has_stylebox_override(p_name))
return true;
}
@ -1179,7 +1179,7 @@ bool Control::has_stylebox(const StringName &p_name, const StringName &p_type) c
bool Control::has_font(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == "") {
if (has_font_override(p_name) == true)
if (has_font_override(p_name))
return true;
}
@ -1213,7 +1213,7 @@ bool Control::has_font(const StringName &p_name, const StringName &p_type) const
bool Control::has_color(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == "") {
if (has_color_override(p_name) == true)
if (has_color_override(p_name))
return true;
}
@ -1247,7 +1247,7 @@ bool Control::has_color(const StringName &p_name, const StringName &p_type) cons
bool Control::has_constant(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == "") {
if (has_constant_override(p_name) == true)
if (has_constant_override(p_name))
return true;
}

View File

@ -222,7 +222,7 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
Constraint2DSW *prev_ci = NULL;
while (ci) {
if (_setup_island(ci, p_delta) == true) {
if (_setup_island(ci, p_delta)) {
//removed the root from the island graph because it is not to be processed