diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 99ee6d64d9e..491d59bd7b1 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -1887,7 +1887,7 @@ Error VulkanContext::_update_swap_chain(Window *window) { err = fpGetPhysicalDeviceSurfacePresentModesKHR(gpu, window->surface, &presentModeCount, nullptr); ERR_FAIL_COND_V(err, ERR_CANT_CREATE); VkPresentModeKHR *presentModes = (VkPresentModeKHR *)malloc(presentModeCount * sizeof(VkPresentModeKHR)); - ERR_FAIL_COND_V(!presentModes, ERR_CANT_CREATE); + ERR_FAIL_NULL_V(presentModes, ERR_CANT_CREATE); err = fpGetPhysicalDeviceSurfacePresentModesKHR(gpu, window->surface, &presentModeCount, presentModes); if (err) { free(presentModes); @@ -2062,7 +2062,7 @@ Error VulkanContext::_update_swap_chain(Window *window) { } VkImage *swapchainImages = (VkImage *)malloc(swapchainImageCount * sizeof(VkImage)); - ERR_FAIL_COND_V(!swapchainImages, ERR_CANT_CREATE); + ERR_FAIL_NULL_V(swapchainImages, ERR_CANT_CREATE); err = fpGetSwapchainImagesKHR(device, window->swapchain, &swapchainImageCount, swapchainImages); if (err) { free(swapchainImages); diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index 86f3385ae33..7c0bc4ac82a 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -162,7 +162,7 @@ static Ref basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size const uint8_t *ptr = p_data; int size = p_size; - ERR_FAIL_COND_V_MSG(p_data == nullptr, image, "Cannot unpack invalid basis universal data."); + ERR_FAIL_NULL_V_MSG(p_data, image, "Cannot unpack invalid basis universal data."); basist::transcoder_texture_format format = basist::transcoder_texture_format::cTFTotalTextureFormats; Image::Format imgfmt = Image::FORMAT_MAX; diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 7cafccfdcb2..0656f8224c6 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -300,7 +300,7 @@ void CSGShape3D::_update_shape() { root_mesh.unref(); //byebye root mesh CSGBrush *n = _get_brush(); - ERR_FAIL_COND_MSG(!n, "Cannot get CSGBrush."); + ERR_FAIL_NULL_MSG(n, "Cannot get CSGBrush."); OAHashMap vec_map; @@ -458,7 +458,7 @@ void CSGShape3D::_update_shape() { void CSGShape3D::_update_collision_faces() { if (use_collision && is_root_shape() && root_collision_shape.is_valid()) { CSGBrush *n = _get_brush(); - ERR_FAIL_COND_MSG(!n, "Cannot get CSGBrush."); + ERR_FAIL_NULL_MSG(n, "Cannot get CSGBrush."); Vector physics_faces; physics_faces.resize(n->faces.size() * 3); Vector3 *physicsw = physics_faces.ptrw(); diff --git a/modules/enet/enet_connection.cpp b/modules/enet/enet_connection.cpp index 88aaa006b5b..94473c76c02 100644 --- a/modules/enet/enet_connection.cpp +++ b/modules/enet/enet_connection.cpp @@ -37,7 +37,7 @@ #include "core/variant/typed_array.h" void ENetConnection::broadcast(enet_uint8 p_channel, ENetPacket *p_packet) { - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_MSG(p_channel >= host->channelLimit, vformat("Unable to send packet on channel %d, max channels: %d", p_channel, (int)host->channelLimit)); enet_host_broadcast(host, p_channel, p_packet); } @@ -71,7 +71,7 @@ Error ENetConnection::create_host(int p_max_peers, int p_max_channels, int p_in_ } void ENetConnection::destroy() { - ERR_FAIL_COND_MSG(!host, "Host already destroyed"); + ERR_FAIL_NULL_MSG(host, "Host already destroyed."); for (List>::Element *E = peers.front(); E; E = E->next()) { E->get()->_on_disconnect(); } @@ -82,7 +82,7 @@ void ENetConnection::destroy() { Ref ENetConnection::connect_to_host(const String &p_address, int p_port, int p_channels, int p_data) { Ref out; - ERR_FAIL_COND_V_MSG(!host, out, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, out, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_V_MSG(peers.size(), out, "The ENetConnection is already connected to a peer."); ERR_FAIL_COND_V_MSG(p_port < 1 || p_port > 65535, out, "The remote port number must be between 1 and 65535 (inclusive)."); @@ -160,7 +160,7 @@ ENetConnection::EventType ENetConnection::_parse_event(const ENetEvent &p_event, } ENetConnection::EventType ENetConnection::service(int p_timeout, Event &r_event) { - ERR_FAIL_COND_V_MSG(!host, EVENT_ERROR, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, EVENT_ERROR, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_V(r_event.peer.is_valid(), EVENT_ERROR); // Drop peers that have already been disconnected. @@ -186,7 +186,7 @@ ENetConnection::EventType ENetConnection::service(int p_timeout, Event &r_event) } int ENetConnection::check_events(EventType &r_type, Event &r_event) { - ERR_FAIL_COND_V_MSG(!host, -1, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, -1, "The ENetConnection instance isn't currently active."); ENetEvent event; int ret = enet_host_check_events(host, &event); if (ret < 0) { @@ -198,32 +198,32 @@ int ENetConnection::check_events(EventType &r_type, Event &r_event) { } void ENetConnection::flush() { - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); enet_host_flush(host); } void ENetConnection::bandwidth_limit(int p_in_bandwidth, int p_out_bandwidth) { - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); enet_host_bandwidth_limit(host, p_in_bandwidth, p_out_bandwidth); } void ENetConnection::channel_limit(int p_max_channels) { - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); enet_host_channel_limit(host, p_max_channels); } void ENetConnection::bandwidth_throttle() { - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); enet_host_bandwidth_throttle(host); } void ENetConnection::compress(CompressionMode p_mode) { - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); Compressor::setup(host, p_mode); } double ENetConnection::pop_statistic(HostStatistic p_stat) { - ERR_FAIL_COND_V_MSG(!host, 0, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, 0, "The ENetConnection instance isn't currently active."); uint32_t *ptr = nullptr; switch (p_stat) { case HOST_TOTAL_SENT_DATA: @@ -239,19 +239,19 @@ double ENetConnection::pop_statistic(HostStatistic p_stat) { ptr = &(host->totalReceivedPackets); break; } - ERR_FAIL_COND_V_MSG(ptr == nullptr, 0, "Invalid statistic: " + itos(p_stat)); + ERR_FAIL_NULL_V_MSG(ptr, 0, "Invalid statistic: " + itos(p_stat) + "."); uint32_t ret = *ptr; *ptr = 0; return ret; } int ENetConnection::get_max_channels() const { - ERR_FAIL_COND_V_MSG(!host, 0, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, 0, "The ENetConnection instance isn't currently active."); return host->channelLimit; } int ENetConnection::get_local_port() const { - ERR_FAIL_COND_V_MSG(!host, 0, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, 0, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_V_MSG(!(host->socket), 0, "The ENetConnection instance isn't currently bound"); ENetAddress address; ERR_FAIL_COND_V_MSG(enet_socket_get_address(host->socket, &address), 0, "Unable to get socket address"); @@ -265,7 +265,7 @@ void ENetConnection::get_peers(List> &r_peers) { } TypedArray ENetConnection::_get_peers() { - ERR_FAIL_COND_V_MSG(!host, Array(), "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, Array(), "The ENetConnection instance isn't currently active."); TypedArray out; for (const Ref &I : peers) { out.push_back(I); @@ -275,7 +275,7 @@ TypedArray ENetConnection::_get_peers() { Error ENetConnection::dtls_server_setup(const Ref &p_options) { #ifdef GODOT_ENET - ERR_FAIL_COND_V_MSG(!host, ERR_UNCONFIGURED, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, ERR_UNCONFIGURED, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_V(p_options.is_null() || !p_options->is_server(), ERR_INVALID_PARAMETER); return enet_host_dtls_server_setup(host, const_cast(p_options.ptr())) ? FAILED : OK; #else @@ -285,7 +285,7 @@ Error ENetConnection::dtls_server_setup(const Ref &p_options) { void ENetConnection::refuse_new_connections(bool p_refuse) { #ifdef GODOT_ENET - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); enet_host_refuse_new_connections(host, p_refuse); #else ERR_FAIL_MSG("ENet DTLS support not available in this build."); @@ -294,7 +294,7 @@ void ENetConnection::refuse_new_connections(bool p_refuse) { Error ENetConnection::dtls_client_setup(const String &p_hostname, const Ref &p_options) { #ifdef GODOT_ENET - ERR_FAIL_COND_V_MSG(!host, ERR_UNCONFIGURED, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(host, ERR_UNCONFIGURED, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_V(p_options.is_null() || p_options->is_server(), ERR_INVALID_PARAMETER); return enet_host_dtls_client_setup(host, p_hostname.utf8().get_data(), const_cast(p_options.ptr())) ? FAILED : OK; #else @@ -315,7 +315,7 @@ Error ENetConnection::_create(ENetAddress *p_address, int p_max_peers, int p_max p_in_bandwidth /* limit incoming bandwidth if > 0 */, p_out_bandwidth /* limit outgoing bandwidth if > 0 */); - ERR_FAIL_COND_V_MSG(!host, ERR_CANT_CREATE, "Couldn't create an ENet host."); + ERR_FAIL_NULL_V_MSG(host, ERR_CANT_CREATE, "Couldn't create an ENet host."); return OK; } @@ -335,7 +335,7 @@ Array ENetConnection::_service(int p_timeout) { } void ENetConnection::_broadcast(int p_channel, PackedByteArray p_packet, int p_flags) { - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_MSG(p_channel < 0 || p_channel > (int)host->channelLimit, "Invalid channel"); ERR_FAIL_COND_MSG(p_flags & ~ENetPacketPeer::FLAG_ALLOWED, "Invalid flags"); ENetPacket *pkt = enet_packet_create(p_packet.ptr(), p_packet.size(), p_flags); @@ -343,7 +343,7 @@ void ENetConnection::_broadcast(int p_channel, PackedByteArray p_packet, int p_f } void ENetConnection::socket_send(const String &p_address, int p_port, const PackedByteArray &p_packet) { - ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); ERR_FAIL_COND_MSG(!(host->socket), "The ENetConnection instance isn't currently bound"); ERR_FAIL_COND_MSG(p_port < 1 || p_port > 65535, "The remote port number must be between 1 and 65535 (inclusive)."); @@ -497,7 +497,7 @@ size_t ENetConnection::Compressor::enet_decompress(void *context, const enet_uin } void ENetConnection::Compressor::setup(ENetHost *p_host, CompressionMode p_mode) { - ERR_FAIL_COND(!p_host); + ERR_FAIL_NULL(p_host); switch (p_mode) { case COMPRESS_NONE: { enet_host_compress(p_host, nullptr); diff --git a/modules/enet/enet_packet_peer.cpp b/modules/enet/enet_packet_peer.cpp index a131841a07c..f2bf5337eef 100644 --- a/modules/enet/enet_packet_peer.cpp +++ b/modules/enet/enet_packet_peer.cpp @@ -31,51 +31,51 @@ #include "enet_packet_peer.h" void ENetPacketPeer::peer_disconnect(int p_data) { - ERR_FAIL_COND(!peer); + ERR_FAIL_NULL(peer); enet_peer_disconnect(peer, p_data); } void ENetPacketPeer::peer_disconnect_later(int p_data) { - ERR_FAIL_COND(!peer); + ERR_FAIL_NULL(peer); enet_peer_disconnect_later(peer, p_data); } void ENetPacketPeer::peer_disconnect_now(int p_data) { - ERR_FAIL_COND(!peer); + ERR_FAIL_NULL(peer); enet_peer_disconnect_now(peer, p_data); _on_disconnect(); } void ENetPacketPeer::ping() { - ERR_FAIL_COND(!peer); + ERR_FAIL_NULL(peer); enet_peer_ping(peer); } void ENetPacketPeer::ping_interval(int p_interval) { - ERR_FAIL_COND(!peer); + ERR_FAIL_NULL(peer); enet_peer_ping_interval(peer, p_interval); } int ENetPacketPeer::send(uint8_t p_channel, ENetPacket *p_packet) { - ERR_FAIL_COND_V(peer == nullptr, -1); - ERR_FAIL_COND_V(p_packet == nullptr, -1); + ERR_FAIL_NULL_V(peer, -1); + ERR_FAIL_NULL_V(p_packet, -1); ERR_FAIL_COND_V_MSG(p_channel >= peer->channelCount, -1, vformat("Unable to send packet on channel %d, max channels: %d", p_channel, (int)peer->channelCount)); return enet_peer_send(peer, p_channel, p_packet); } void ENetPacketPeer::reset() { - ERR_FAIL_COND_MSG(peer == nullptr, "Peer not connected"); + ERR_FAIL_NULL_MSG(peer, "Peer not connected."); enet_peer_reset(peer); _on_disconnect(); } void ENetPacketPeer::throttle_configure(int p_interval, int p_acceleration, int p_deceleration) { - ERR_FAIL_COND_MSG(peer == nullptr, "Peer not connected"); + ERR_FAIL_NULL_MSG(peer, "Peer not connected."); enet_peer_throttle_configure(peer, p_interval, p_acceleration, p_deceleration); } void ENetPacketPeer::set_timeout(int p_timeout, int p_timeout_min, int p_timeout_max) { - ERR_FAIL_COND_MSG(peer == nullptr, "Peer not connected"); + ERR_FAIL_NULL_MSG(peer, "Peer not connected."); ERR_FAIL_COND_MSG(p_timeout > p_timeout_min || p_timeout_min > p_timeout_max, "Timeout limit must be less than minimum timeout, which itself must be less than maximum timeout"); enet_peer_timeout(peer, p_timeout, p_timeout_min, p_timeout_max); } @@ -89,7 +89,7 @@ int ENetPacketPeer::get_available_packet_count() const { } Error ENetPacketPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { - ERR_FAIL_COND_V(!peer, ERR_UNCONFIGURED); + ERR_FAIL_NULL_V(peer, ERR_UNCONFIGURED); ERR_FAIL_COND_V(!packet_queue.size(), ERR_UNAVAILABLE); if (last_packet) { enet_packet_destroy(last_packet); @@ -103,13 +103,13 @@ Error ENetPacketPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { } Error ENetPacketPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size) { - ERR_FAIL_COND_V(!peer, ERR_UNCONFIGURED); + ERR_FAIL_NULL_V(peer, ERR_UNCONFIGURED); ENetPacket *packet = enet_packet_create(p_buffer, p_buffer_size, ENET_PACKET_FLAG_RELIABLE); return send(0, packet) < 0 ? FAILED : OK; } IPAddress ENetPacketPeer::get_remote_address() const { - ERR_FAIL_COND_V(!peer, IPAddress()); + ERR_FAIL_NULL_V(peer, IPAddress()); IPAddress out; #ifdef GODOT_ENET out.set_ipv6((uint8_t *)&(peer->address.host)); @@ -120,7 +120,7 @@ IPAddress ENetPacketPeer::get_remote_address() const { } int ENetPacketPeer::get_remote_port() const { - ERR_FAIL_COND_V(!peer, 0); + ERR_FAIL_NULL_V(peer, 0); return peer->address.port; } @@ -129,7 +129,7 @@ bool ENetPacketPeer::is_active() const { } double ENetPacketPeer::get_statistic(PeerStatistic p_stat) { - ERR_FAIL_COND_V(!peer, 0); + ERR_FAIL_NULL_V(peer, 0); switch (p_stat) { case PEER_PACKET_LOSS: return peer->packetLoss; @@ -171,7 +171,7 @@ ENetPacketPeer::PeerState ENetPacketPeer::get_state() const { } int ENetPacketPeer::get_channels() const { - ERR_FAIL_COND_V_MSG(!peer, 0, "The ENetConnection instance isn't currently active."); + ERR_FAIL_NULL_V_MSG(peer, 0, "The ENetConnection instance isn't currently active."); return peer->channelCount; } @@ -183,12 +183,12 @@ void ENetPacketPeer::_on_disconnect() { } void ENetPacketPeer::_queue_packet(ENetPacket *p_packet) { - ERR_FAIL_COND(!peer); + ERR_FAIL_NULL(peer); packet_queue.push_back(p_packet); } Error ENetPacketPeer::_send(int p_channel, PackedByteArray p_packet, int p_flags) { - ERR_FAIL_COND_V_MSG(peer == nullptr, ERR_UNCONFIGURED, "Peer not connected"); + ERR_FAIL_NULL_V_MSG(peer, ERR_UNCONFIGURED, "Peer not connected."); ERR_FAIL_COND_V_MSG(p_channel < 0 || p_channel > (int)peer->channelCount, ERR_INVALID_PARAMETER, "Invalid channel"); ERR_FAIL_COND_V_MSG(p_flags & ~FLAG_ALLOWED, ERR_INVALID_PARAMETER, "Invalid flags"); ENetPacket *packet = enet_packet_create(p_packet.ptr(), p_packet.size(), p_flags); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 62d2c14c171..22be26fdc11 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -83,7 +83,7 @@ void GDScriptNativeClass::_bind_methods() { Variant GDScriptNativeClass::_new() { Object *o = instantiate(); - ERR_FAIL_COND_V_MSG(!o, Variant(), "Class type: '" + String(name) + "' is not instantiable."); + ERR_FAIL_NULL_V_MSG(o, Variant(), "Class type: '" + String(name) + "' is not instantiable."); RefCounted *rc = Object::cast_to(o); if (rc) { @@ -215,7 +215,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr } else { owner = memnew(RefCounted); //by default, no base means use reference } - ERR_FAIL_COND_V_MSG(!owner, Variant(), "Can't inherit from a virtual class."); + ERR_FAIL_NULL_V_MSG(owner, Variant(), "Can't inherit from a virtual class."); RefCounted *r = Object::cast_to(owner); if (r) { diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 5b47ed1a465..55bb99133a2 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1419,7 +1419,7 @@ void GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode *p_class, bo } void GDScriptAnalyzer::resolve_node(GDScriptParser::Node *p_node, bool p_is_root) { - ERR_FAIL_COND_MSG(p_node == nullptr, "Trying to resolve type of a null node."); + ERR_FAIL_NULL_MSG(p_node, "Trying to resolve type of a null node."); switch (p_node->type) { case GDScriptParser::Node::NONE: diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index d191bd02247..18609d0b807 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -59,7 +59,7 @@ GDScriptAnalyzer *GDScriptParserRef::get_analyzer() { } Error GDScriptParserRef::raise_status(Status p_new_status) { - ERR_FAIL_COND_V(parser == nullptr, ERR_INVALID_DATA); + ERR_FAIL_NULL_V(parser, ERR_INVALID_DATA); if (result != OK) { return result; diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 9a9e96b8e84..97e02ac7160 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -60,7 +60,7 @@ bool GDScriptCompiler::_is_class_member_property(GDScript *owner, const StringNa scr = scr->_base; } - ERR_FAIL_COND_V(!nc, false); + ERR_FAIL_NULL_V(nc, false); return ClassDB::has_property(nc->get_name(), p_name); } diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 4f5a65a7096..3e13d1525d3 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -188,7 +188,7 @@ bool GDScriptFunctionState::is_valid(bool p_extended_check) const { } Variant GDScriptFunctionState::resume(const Variant &p_arg) { - ERR_FAIL_COND_V(!function, Variant()); + ERR_FAIL_NULL_V(function, Variant()); { MutexLock lock(GDScriptLanguage::singleton->mutex); diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index 31da70f9ae0..e984d971495 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -152,7 +152,7 @@ public: } GDScriptDataType get_container_element_type() const { - ERR_FAIL_COND_V(container_element_type == nullptr, GDScriptDataType()); + ERR_FAIL_NULL_V(container_element_type, GDScriptDataType()); return *container_element_type; } diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 1202e7e235d..0801582dbd8 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -170,7 +170,7 @@ void GDScriptParser::push_error(const String &p_message, const Node *p_origin) { #ifdef DEBUG_ENABLED void GDScriptParser::push_warning(const Node *p_source, GDScriptWarning::Code p_code, const Vector &p_symbols) { - ERR_FAIL_COND(p_source == nullptr); + ERR_FAIL_NULL(p_source); if (is_ignoring_warnings) { return; } diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index 988524d0588..3bd3696e99d 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -156,7 +156,7 @@ public: } _FORCE_INLINE_ DataType get_container_element_type() const { - ERR_FAIL_COND_V(container_element_type == nullptr, DataType()); + ERR_FAIL_NULL_V(container_element_type, DataType()); return *container_element_type; } diff --git a/modules/gdscript/gdscript_rpc_callable.cpp b/modules/gdscript/gdscript_rpc_callable.cpp index 199ea813304..a6d2388a913 100644 --- a/modules/gdscript/gdscript_rpc_callable.cpp +++ b/modules/gdscript/gdscript_rpc_callable.cpp @@ -78,7 +78,7 @@ GDScriptRPCCallable::GDScriptRPCCallable(Object *p_object, const StringName &p_m h = method.hash(); h = hash_murmur3_one_64(object->get_instance_id(), h); node = Object::cast_to(object); - ERR_FAIL_COND_MSG(!node, "RPC can only be defined on class that extends Node."); + ERR_FAIL_NULL_MSG(node, "RPC can only be defined on class that extends Node."); } Error GDScriptRPCCallable::rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const { diff --git a/modules/gdscript/gdscript_utility_functions.cpp b/modules/gdscript/gdscript_utility_functions.cpp index 39cf9d79c8c..d85b12b7fef 100644 --- a/modules/gdscript/gdscript_utility_functions.cpp +++ b/modules/gdscript/gdscript_utility_functions.cpp @@ -729,50 +729,50 @@ void GDScriptUtilityFunctions::unregister_functions() { GDScriptUtilityFunctions::FunctionPtr GDScriptUtilityFunctions::get_function(const StringName &p_function) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, nullptr); + ERR_FAIL_NULL_V(info, nullptr); return info->function; } bool GDScriptUtilityFunctions::has_function_return_value(const StringName &p_function) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, false); + ERR_FAIL_NULL_V(info, false); return info->info.return_val.type != Variant::NIL || bool(info->info.return_val.usage & PROPERTY_USAGE_NIL_IS_VARIANT); } Variant::Type GDScriptUtilityFunctions::get_function_return_type(const StringName &p_function) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, Variant::NIL); + ERR_FAIL_NULL_V(info, Variant::NIL); return info->info.return_val.type; } StringName GDScriptUtilityFunctions::get_function_return_class(const StringName &p_function) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, StringName()); + ERR_FAIL_NULL_V(info, StringName()); return info->info.return_val.class_name; } Variant::Type GDScriptUtilityFunctions::get_function_argument_type(const StringName &p_function, int p_arg) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, Variant::NIL); + ERR_FAIL_NULL_V(info, Variant::NIL); ERR_FAIL_COND_V(p_arg >= info->info.arguments.size(), Variant::NIL); return info->info.arguments[p_arg].type; } int GDScriptUtilityFunctions::get_function_argument_count(const StringName &p_function, int p_arg) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, 0); + ERR_FAIL_NULL_V(info, 0); return info->info.arguments.size(); } bool GDScriptUtilityFunctions::is_function_vararg(const StringName &p_function) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, false); + ERR_FAIL_NULL_V(info, false); return (bool)(info->info.flags & METHOD_FLAG_VARARG); } bool GDScriptUtilityFunctions::is_function_constant(const StringName &p_function) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, false); + ERR_FAIL_NULL_V(info, false); return info->is_constant; } @@ -788,6 +788,6 @@ void GDScriptUtilityFunctions::get_function_list(List *r_functions) MethodInfo GDScriptUtilityFunctions::get_function_info(const StringName &p_function) { GDScriptUtilityFunctionInfo *info = utility_function_table.lookup_ptr(p_function); - ERR_FAIL_COND_V(!info, MethodInfo()); + ERR_FAIL_NULL_V(info, MethodInfo()); return info->info; } diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp index 14fc21d7dc4..8489fc08c16 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.cpp +++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp @@ -290,7 +290,7 @@ void GDScriptLanguageProtocol::notify_client(const String &p_method, const Varia } ERR_FAIL_COND(!clients.has(p_client_id)); Ref peer = clients.get(p_client_id); - ERR_FAIL_COND(peer == nullptr); + ERR_FAIL_NULL(peer); Dictionary message = make_notification(p_method, p_params); String msg = Variant(message).to_json_string(); @@ -311,7 +311,7 @@ void GDScriptLanguageProtocol::request_client(const String &p_method, const Vari } ERR_FAIL_COND(!clients.has(p_client_id)); Ref peer = clients.get(p_client_id); - ERR_FAIL_COND(peer == nullptr); + ERR_FAIL_NULL(peer); Dictionary message = make_request(p_method, p_params, next_server_id); next_server_id++; diff --git a/modules/gltf/extensions/gltf_light.cpp b/modules/gltf/extensions/gltf_light.cpp index c60b522168f..435a1260ba1 100644 --- a/modules/gltf/extensions/gltf_light.cpp +++ b/modules/gltf/extensions/gltf_light.cpp @@ -111,7 +111,7 @@ void GLTFLight::set_outer_cone_angle(float p_outer_cone_angle) { Ref GLTFLight::from_node(const Light3D *p_light) { Ref l; l.instantiate(); - ERR_FAIL_COND_V_MSG(!p_light, l, "Tried to create a GLTFLight from a Light3D node, but the given node was null."); + ERR_FAIL_NULL_V_MSG(p_light, l, "Tried to create a GLTFLight from a Light3D node, but the given node was null."); l->color = p_light->get_color(); if (cast_to(p_light)) { l->light_type = "directional"; diff --git a/modules/gltf/extensions/physics/gltf_physics_body.cpp b/modules/gltf/extensions/physics/gltf_physics_body.cpp index 49a6edd2e32..b80f4348c26 100644 --- a/modules/gltf/extensions/physics/gltf_physics_body.cpp +++ b/modules/gltf/extensions/physics/gltf_physics_body.cpp @@ -112,7 +112,7 @@ void GLTFPhysicsBody::set_inertia_tensor(Basis p_inertia_tensor) { Ref GLTFPhysicsBody::from_node(const CollisionObject3D *p_body_node) { Ref physics_body; physics_body.instantiate(); - ERR_FAIL_COND_V_MSG(!p_body_node, physics_body, "Tried to create a GLTFPhysicsBody from a CollisionObject3D node, but the given node was null."); + ERR_FAIL_NULL_V_MSG(p_body_node, physics_body, "Tried to create a GLTFPhysicsBody from a CollisionObject3D node, but the given node was null."); if (cast_to(p_body_node)) { physics_body->body_type = "character"; } else if (cast_to(p_body_node)) { diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 7780fac3e0f..cf57cb2b73e 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -5594,7 +5594,7 @@ void GLTFDocument::_create_gltf_node(Ref p_state, Node *p_scene_paren } void GLTFDocument::_convert_animation_player_to_gltf(AnimationPlayer *p_animation_player, Ref p_state, GLTFNodeIndex p_gltf_current, GLTFNodeIndex p_gltf_root_index, Ref p_gltf_node, Node *p_scene_parent) { - ERR_FAIL_COND(!p_animation_player); + ERR_FAIL_NULL(p_animation_player); p_state->animation_players.push_back(p_animation_player); print_verbose(String("glTF: Converting animation player: ") + p_animation_player->get_name()); } @@ -5613,7 +5613,7 @@ void GLTFDocument::_check_visibility(Node *p_node, bool &r_retflag) { } void GLTFDocument::_convert_camera_to_gltf(Camera3D *camera, Ref p_state, Ref p_gltf_node) { - ERR_FAIL_COND(!camera); + ERR_FAIL_NULL(camera); GLTFCameraIndex camera_index = _convert_camera(p_state, camera); if (camera_index != -1) { p_gltf_node->camera = camera_index; @@ -5621,7 +5621,7 @@ void GLTFDocument::_convert_camera_to_gltf(Camera3D *camera, Ref p_st } void GLTFDocument::_convert_light_to_gltf(Light3D *light, Ref p_state, Ref p_gltf_node) { - ERR_FAIL_COND(!light); + ERR_FAIL_NULL(light); GLTFLightIndex light_index = _convert_light(p_state, light); if (light_index != -1) { p_gltf_node->light = light_index; @@ -5663,7 +5663,7 @@ void GLTFDocument::_convert_multi_mesh_instance_to_gltf( GLTFNodeIndex p_parent_node_index, GLTFNodeIndex p_root_node_index, Ref p_gltf_node, Ref p_state) { - ERR_FAIL_COND(!p_multi_mesh_instance); + ERR_FAIL_NULL(p_multi_mesh_instance); Ref multi_mesh = p_multi_mesh_instance->get_multimesh(); if (multi_mesh.is_null()) { return; @@ -6141,7 +6141,7 @@ void GLTFDocument::_import_animation(Ref p_state, AnimationPlayer *p_ const Ref gltf_node = p_state->nodes[track_i.key]; Node *root = p_animation_player->get_parent(); - ERR_FAIL_COND(root == nullptr); + ERR_FAIL_NULL(root); HashMap::Iterator node_element = p_state->scene_nodes.find(node_index); ERR_CONTINUE_MSG(!node_element, vformat("Unable to find node %d for animation.", node_index)); node_path = root->get_path_to(node_element->value); @@ -6154,7 +6154,7 @@ void GLTFDocument::_import_animation(Ref p_state, AnimationPlayer *p_ if (gltf_node->skeleton >= 0) { const Skeleton3D *sk = p_state->skeletons[gltf_node->skeleton]->godot_skeleton; - ERR_FAIL_COND(sk == nullptr); + ERR_FAIL_NULL(sk); const String path = p_animation_player->get_parent()->get_path_to(sk); const String bone = gltf_node->get_name(); diff --git a/modules/gltf/structures/gltf_camera.cpp b/modules/gltf/structures/gltf_camera.cpp index 630b34c270a..d56f67a092f 100644 --- a/modules/gltf/structures/gltf_camera.cpp +++ b/modules/gltf/structures/gltf_camera.cpp @@ -60,7 +60,7 @@ void GLTFCamera::_bind_methods() { Ref GLTFCamera::from_node(const Camera3D *p_camera) { Ref c; c.instantiate(); - ERR_FAIL_COND_V_MSG(!p_camera, c, "Tried to create a GLTFCamera from a Camera3D node, but the given node was null."); + ERR_FAIL_NULL_V_MSG(p_camera, c, "Tried to create a GLTFCamera from a Camera3D node, but the given node was null."); c->set_perspective(p_camera->get_projection() == Camera3D::ProjectionType::PROJECTION_PERSPECTIVE); // GLTF spec (yfov) is in radians, Godot's camera (fov) is in degrees. c->set_fov(Math::deg_to_rad(p_camera->get_fov())); diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp index de6dfbe0d26..381ed42fe19 100644 --- a/modules/mbedtls/crypto_mbedtls.cpp +++ b/modules/mbedtls/crypto_mbedtls.cpp @@ -256,7 +256,7 @@ Error HMACContextMbedTLS::start(HashingContext::HashType p_hash_type, PackedByte } Error HMACContextMbedTLS::update(PackedByteArray p_data) { - ERR_FAIL_COND_V_MSG(ctx == nullptr, ERR_INVALID_DATA, "Start must be called before update."); + ERR_FAIL_NULL_V_MSG(ctx, ERR_INVALID_DATA, "Start must be called before update."); ERR_FAIL_COND_V_MSG(p_data.is_empty(), ERR_INVALID_PARAMETER, "Src must not be empty."); @@ -265,7 +265,7 @@ Error HMACContextMbedTLS::update(PackedByteArray p_data) { } PackedByteArray HMACContextMbedTLS::finish() { - ERR_FAIL_COND_V_MSG(ctx == nullptr, PackedByteArray(), "Start must be called before finish."); + ERR_FAIL_NULL_V_MSG(ctx, PackedByteArray(), "Start must be called before finish."); ERR_FAIL_COND_V_MSG(hash_len == 0, PackedByteArray(), "Unsupported hash type."); PackedByteArray out; @@ -342,7 +342,7 @@ void CryptoMbedTLS::load_default_certificates(String p_path) { ERR_FAIL_COND(default_certs != nullptr); default_certs = memnew(X509CertificateMbedTLS); - ERR_FAIL_COND(default_certs == nullptr); + ERR_FAIL_NULL(default_certs); if (!p_path.is_empty()) { // Use certs defined in project settings. diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp index ed1a97cc2ce..c7373481ca0 100644 --- a/modules/mbedtls/packet_peer_mbed_dtls.cpp +++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp @@ -40,7 +40,7 @@ int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len PacketPeerMbedDTLS *sp = static_cast(ctx); - ERR_FAIL_COND_V(sp == nullptr, 0); + ERR_FAIL_NULL_V(sp, 0); Error err = sp->base->put_packet((const uint8_t *)buf, len); if (err == ERR_BUSY) { @@ -58,7 +58,7 @@ int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) { PacketPeerMbedDTLS *sp = static_cast(ctx); - ERR_FAIL_COND_V(sp == nullptr, 0); + ERR_FAIL_NULL_V(sp, 0); int pc = sp->base->get_available_packet_count(); if (pc == 0) { diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp index a9d187bd64a..a359b420411 100644 --- a/modules/mbedtls/stream_peer_mbedtls.cpp +++ b/modules/mbedtls/stream_peer_mbedtls.cpp @@ -40,7 +40,7 @@ int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) StreamPeerMbedTLS *sp = static_cast(ctx); - ERR_FAIL_COND_V(sp == nullptr, 0); + ERR_FAIL_NULL_V(sp, 0); int sent; Error err = sp->base->put_partial_data((const uint8_t *)buf, len, sent); @@ -60,7 +60,7 @@ int StreamPeerMbedTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) { StreamPeerMbedTLS *sp = static_cast(ctx); - ERR_FAIL_COND_V(sp == nullptr, 0); + ERR_FAIL_NULL_V(sp, 0); int got; Error err = sp->base->get_partial_data((uint8_t *)buf, len, got); diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp index 733f1dbe34d..c4aba577db6 100644 --- a/modules/mono/class_db_api_json.cpp +++ b/modules/mono/class_db_api_json.cpp @@ -47,7 +47,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) { for (const StringName &E : class_list) { ClassDB::ClassInfo *t = ClassDB::classes.getptr(E); - ERR_FAIL_COND(!t); + ERR_FAIL_NULL(t); if (t->api != p_api || !t->exposed) { continue; } diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp index 5a1f90fa1de..ef4e32e4a74 100644 --- a/modules/mono/mono_gd/gd_mono_cache.cpp +++ b/modules/mono/mono_gd/gd_mono_cache.cpp @@ -42,7 +42,7 @@ void update_godot_api_cache(const ManagedCallbacks &p_managed_callbacks) { #define CHECK_CALLBACK_NOT_NULL_IMPL(m_var, m_class, m_method) \ { \ - ERR_FAIL_COND_MSG(m_var == nullptr, \ + ERR_FAIL_NULL_MSG(m_var, \ "Mono Cache: Managed callback for '" #m_class "_" #m_method "' is null."); \ checked_count += 1; \ } diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp index 89249dd369e..eab1f5d51d7 100644 --- a/modules/multiplayer/editor/replication_editor.cpp +++ b/modules/multiplayer/editor/replication_editor.cpp @@ -112,9 +112,9 @@ void ReplicationEditor::_pick_node_filter_input(const Ref &p_ie) { void ReplicationEditor::_pick_node_selected(NodePath p_path) { Node *root = current->get_node(current->get_root_path()); - ERR_FAIL_COND(!root); + ERR_FAIL_NULL(root); Node *node = get_node(p_path); - ERR_FAIL_COND(!node); + ERR_FAIL_NULL(node); NodePath path_to = root->get_path_to(node); adding_node_path = path_to; prop_selector->select_property_from_instance(node); diff --git a/modules/multiplayer/multiplayer_debugger.cpp b/modules/multiplayer/multiplayer_debugger.cpp index ea52741601a..9b05fa884be 100644 --- a/modules/multiplayer/multiplayer_debugger.cpp +++ b/modules/multiplayer/multiplayer_debugger.cpp @@ -237,7 +237,7 @@ void MultiplayerDebugger::RPCProfiler::tick(double p_frame_time, double p_proces // ReplicationProfiler MultiplayerDebugger::SyncInfo::SyncInfo(MultiplayerSynchronizer *p_sync) { - ERR_FAIL_COND(!p_sync); + ERR_FAIL_NULL(p_sync); synchronizer = p_sync->get_instance_id(); if (p_sync->get_replication_config().is_valid()) { config = p_sync->get_replication_config()->get_instance_id(); @@ -305,7 +305,7 @@ void MultiplayerDebugger::ReplicationProfiler::add(const Array &p_data) { const ObjectID id = p_data[1]; const uint64_t size = p_data[2]; MultiplayerSynchronizer *sync = Object::cast_to(ObjectDB::get_instance(id)); - ERR_FAIL_COND(!sync); + ERR_FAIL_NULL(sync); if (!sync_data.has(id)) { sync_data[id] = SyncInfo(sync); } diff --git a/modules/multiplayer/multiplayer_spawner.cpp b/modules/multiplayer/multiplayer_spawner.cpp index 6c6aa283447..264a2e9c8e0 100644 --- a/modules/multiplayer/multiplayer_spawner.cpp +++ b/modules/multiplayer/multiplayer_spawner.cpp @@ -268,7 +268,7 @@ void MultiplayerSpawner::_spawn_notify(ObjectID p_id) { void MultiplayerSpawner::_node_exit(ObjectID p_id) { Node *node = Object::cast_to(ObjectDB::get_instance(p_id)); - ERR_FAIL_COND(!node); + ERR_FAIL_NULL(node); if (tracked_nodes.has(p_id)) { tracked_nodes.erase(p_id); get_multiplayer()->object_configuration_remove(node, this); @@ -323,10 +323,10 @@ Node *MultiplayerSpawner::spawn(const Variant &p_data) { ERR_FAIL_COND_V_MSG(!spawn_function.is_valid(), nullptr, "Custom spawn requires the 'spawn_function' property to be a valid callable."); Node *parent = get_spawn_node(); - ERR_FAIL_COND_V_MSG(!parent, nullptr, "Cannot find spawn node."); + ERR_FAIL_NULL_V_MSG(parent, nullptr, "Cannot find spawn node."); Node *node = instantiate_custom(p_data); - ERR_FAIL_COND_V_MSG(!node, nullptr, "The 'spawn_function' callable must return a valid node."); + ERR_FAIL_NULL_V_MSG(node, nullptr, "The 'spawn_function' callable must return a valid node."); _track(node, p_data); parent->add_child(node, true); diff --git a/modules/multiplayer/multiplayer_synchronizer.cpp b/modules/multiplayer/multiplayer_synchronizer.cpp index 9c2d281f720..233f15c3a4a 100644 --- a/modules/multiplayer/multiplayer_synchronizer.cpp +++ b/modules/multiplayer/multiplayer_synchronizer.cpp @@ -149,14 +149,14 @@ PackedStringArray MultiplayerSynchronizer::get_configuration_warnings() const { } Error MultiplayerSynchronizer::get_state(const List &p_properties, Object *p_obj, Vector &r_variant, Vector &r_variant_ptrs) { - ERR_FAIL_COND_V(!p_obj, ERR_INVALID_PARAMETER); + ERR_FAIL_NULL_V(p_obj, ERR_INVALID_PARAMETER); r_variant.resize(p_properties.size()); r_variant_ptrs.resize(r_variant.size()); int i = 0; for (const NodePath &prop : p_properties) { bool valid = false; const Object *obj = _get_prop_target(p_obj, prop); - ERR_FAIL_COND_V(!obj, FAILED); + ERR_FAIL_NULL_V(obj, FAILED); r_variant.write[i] = obj->get_indexed(prop.get_subnames(), &valid); r_variant_ptrs.write[i] = &r_variant[i]; ERR_FAIL_COND_V_MSG(!valid, ERR_INVALID_DATA, vformat("Property '%s' not found.", prop)); @@ -166,11 +166,11 @@ Error MultiplayerSynchronizer::get_state(const List &p_properties, Obj } Error MultiplayerSynchronizer::set_state(const List &p_properties, Object *p_obj, const Vector &p_state) { - ERR_FAIL_COND_V(!p_obj, ERR_INVALID_PARAMETER); + ERR_FAIL_NULL_V(p_obj, ERR_INVALID_PARAMETER); int i = 0; for (const NodePath &prop : p_properties) { Object *obj = _get_prop_target(p_obj, prop); - ERR_FAIL_COND_V(!obj, FAILED); + ERR_FAIL_NULL_V(obj, FAILED); obj->set_indexed(prop.get_subnames(), p_state[i]); i += 1; } @@ -374,7 +374,7 @@ Error MultiplayerSynchronizer::_watch_changes(uint64_t p_usec) { return OK; } Node *node = get_root_node(); - ERR_FAIL_COND_V(!node, FAILED); + ERR_FAIL_NULL_V(node, FAILED); int idx = -1; Watcher *ptr = watchers.ptrw(); for (const NodePath &prop : props) { diff --git a/modules/multiplayer/scene_cache_interface.cpp b/modules/multiplayer/scene_cache_interface.cpp index 90e6ac7c2c1..8d102ca9812 100644 --- a/modules/multiplayer/scene_cache_interface.cpp +++ b/modules/multiplayer/scene_cache_interface.cpp @@ -53,7 +53,7 @@ void SceneCacheInterface::on_peer_change(int p_id, bool p_connected) { void SceneCacheInterface::process_simplify_path(int p_from, const uint8_t *p_packet, int p_packet_len) { Node *root_node = SceneTree::get_singleton()->get_root()->get_node(multiplayer->get_root_path()); - ERR_FAIL_COND(!root_node); + ERR_FAIL_NULL(root_node); ERR_FAIL_COND_MSG(p_packet_len < 38, "Invalid packet received. Size too small."); int ofs = 1; @@ -74,7 +74,7 @@ void SceneCacheInterface::process_simplify_path(int p_from, const uint8_t *p_pac } Node *node = root_node->get_node(path); - ERR_FAIL_COND(node == nullptr); + ERR_FAIL_NULL(node); const bool valid_rpc_checksum = multiplayer->get_rpc_md5(node) == methods_md5; if (valid_rpc_checksum == false) { ERR_PRINT("The rpc node checksum failed. Make sure to have the same methods on both nodes. Node path: " + path); @@ -119,7 +119,7 @@ void SceneCacheInterface::process_confirm_path(int p_from, const uint8_t *p_pack } PathSentCache *psc = path_send_cache.getptr(path); - ERR_FAIL_COND_MSG(!psc, "Invalid packet received. Tries to confirm a path which was not found in cache."); + ERR_FAIL_NULL_MSG(psc, "Invalid packet received. Tries to confirm a path which was not found in cache."); HashMap::Iterator E = psc->confirmed_peers.find(p_from); ERR_FAIL_COND_MSG(!E, "Invalid packet received. Source peer was not found in cache for the given path."); @@ -165,7 +165,7 @@ Error SceneCacheInterface::_send_confirm_path(Node *p_node, NodePath p_path, Pat bool SceneCacheInterface::is_cache_confirmed(NodePath p_path, int p_peer) { const PathSentCache *psc = path_send_cache.getptr(p_path); - ERR_FAIL_COND_V(!psc, false); + ERR_FAIL_NULL_V(psc, false); HashMap::ConstIterator F = psc->confirmed_peers.find(p_peer); ERR_FAIL_COND_V(!F, false); // Should never happen. return F->value; @@ -173,7 +173,7 @@ bool SceneCacheInterface::is_cache_confirmed(NodePath p_path, int p_peer) { int SceneCacheInterface::make_object_cache(Object *p_obj) { Node *node = Object::cast_to(p_obj); - ERR_FAIL_COND_V(!node, -1); + ERR_FAIL_NULL_V(node, -1); NodePath for_path = multiplayer->get_root_path().rel_path_to(node->get_path()); // See if the path is cached. PathSentCache *psc = path_send_cache.getptr(for_path); @@ -188,7 +188,7 @@ int SceneCacheInterface::make_object_cache(Object *p_obj) { bool SceneCacheInterface::send_object_cache(Object *p_obj, int p_peer_id, int &r_id) { Node *node = Object::cast_to(p_obj); - ERR_FAIL_COND_V(!node, false); + ERR_FAIL_NULL_V(node, false); r_id = make_object_cache(p_obj); ERR_FAIL_COND_V(r_id < 0, false); @@ -233,7 +233,7 @@ bool SceneCacheInterface::send_object_cache(Object *p_obj, int p_peer_id, int &r Object *SceneCacheInterface::get_cached_object(int p_from, uint32_t p_cache_id) { Node *root_node = SceneTree::get_singleton()->get_root()->get_node(multiplayer->get_root_path()); - ERR_FAIL_COND_V(!root_node, nullptr); + ERR_FAIL_NULL_V(root_node, nullptr); HashMap::Iterator E = path_get_cache.find(p_from); ERR_FAIL_COND_V_MSG(!E, nullptr, vformat("No cache found for peer %d.", p_from)); diff --git a/modules/multiplayer/scene_replication_interface.cpp b/modules/multiplayer/scene_replication_interface.cpp index 7f12fea4bf3..e350f2f68be 100644 --- a/modules/multiplayer/scene_replication_interface.cpp +++ b/modules/multiplayer/scene_replication_interface.cpp @@ -155,7 +155,7 @@ Error SceneReplicationInterface::on_spawn(Object *p_obj, Variant p_config) { Node *node = Object::cast_to(p_obj); ERR_FAIL_COND_V(!node || p_config.get_type() != Variant::OBJECT, ERR_INVALID_PARAMETER); MultiplayerSpawner *spawner = Object::cast_to(p_config.get_validated_object()); - ERR_FAIL_COND_V(!spawner, ERR_INVALID_PARAMETER); + ERR_FAIL_NULL_V(spawner, ERR_INVALID_PARAMETER); // Track node. const ObjectID oid = node->get_instance_id(); TrackedNode &tobj = _track(oid); @@ -226,7 +226,7 @@ Error SceneReplicationInterface::on_replication_start(Object *p_obj, Variant p_c Node *node = Object::cast_to(p_obj); ERR_FAIL_COND_V(!node || p_config.get_type() != Variant::OBJECT, ERR_INVALID_PARAMETER); MultiplayerSynchronizer *sync = Object::cast_to(p_config.get_validated_object()); - ERR_FAIL_COND_V(!sync, ERR_INVALID_PARAMETER); + ERR_FAIL_NULL_V(sync, ERR_INVALID_PARAMETER); // Add to synchronizer list. TrackedNode &tobj = _track(p_obj->get_instance_id()); @@ -270,7 +270,7 @@ Error SceneReplicationInterface::on_replication_stop(Object *p_obj, Variant p_co Node *node = Object::cast_to(p_obj); ERR_FAIL_COND_V(!node || p_config.get_type() != Variant::OBJECT, ERR_INVALID_PARAMETER); MultiplayerSynchronizer *sync = Object::cast_to(p_config.get_validated_object()); - ERR_FAIL_COND_V(!sync, ERR_INVALID_PARAMETER); + ERR_FAIL_NULL_V(sync, ERR_INVALID_PARAMETER); sync->disconnect("visibility_changed", callable_mp(this, &SceneReplicationInterface::_visibility_changed)); // Untrack synchronizer. const ObjectID oid = node->get_instance_id(); @@ -291,9 +291,9 @@ Error SceneReplicationInterface::on_replication_stop(Object *p_obj, Variant p_co void SceneReplicationInterface::_visibility_changed(int p_peer, ObjectID p_sid) { MultiplayerSynchronizer *sync = get_id_as(p_sid); - ERR_FAIL_COND(!sync); // Bug. + ERR_FAIL_NULL(sync); // Bug. Node *node = sync->get_root_node(); - ERR_FAIL_COND(!node); // Bug. + ERR_FAIL_NULL(node); // Bug. const ObjectID oid = node->get_instance_id(); if (spawned_nodes.has(oid) && p_peer != multiplayer->get_unique_id()) { _update_spawn_visibility(p_peer, oid); @@ -341,7 +341,7 @@ bool SceneReplicationInterface::is_rpc_visible(const ObjectID &p_oid, int p_peer } Error SceneReplicationInterface::_update_sync_visibility(int p_peer, MultiplayerSynchronizer *p_sync) { - ERR_FAIL_COND_V(!p_sync, ERR_BUG); + ERR_FAIL_NULL_V(p_sync, ERR_BUG); if (!multiplayer->has_multiplayer_peer() || !p_sync->is_multiplayer_authority() || p_peer == multiplayer->get_unique_id()) { return OK; } @@ -380,7 +380,7 @@ Error SceneReplicationInterface::_update_sync_visibility(int p_peer, Multiplayer Error SceneReplicationInterface::_update_spawn_visibility(int p_peer, const ObjectID &p_oid) { const TrackedNode *tnode = tracked_nodes.getptr(p_oid); - ERR_FAIL_COND_V(!tnode, ERR_BUG); + ERR_FAIL_NULL_V(tnode, ERR_BUG); MultiplayerSpawner *spawner = get_id_as(tnode->spawner); Node *node = get_id_as(p_oid); ERR_FAIL_COND_V(!node || !spawner || !spawner->is_multiplayer_authority(), ERR_BUG); @@ -467,7 +467,7 @@ Error SceneReplicationInterface::_make_spawn_packet(Node *p_node, MultiplayerSpa const ObjectID oid = p_node->get_instance_id(); const TrackedNode *tnode = tracked_nodes.getptr(oid); - ERR_FAIL_COND_V(!tnode, ERR_INVALID_PARAMETER); + ERR_FAIL_NULL_V(tnode, ERR_INVALID_PARAMETER); uint32_t nid = tnode->net_id; ERR_FAIL_COND_V(!nid, ERR_UNCONFIGURED); @@ -549,7 +549,7 @@ Error SceneReplicationInterface::_make_spawn_packet(Node *p_node, MultiplayerSpa Error SceneReplicationInterface::_make_despawn_packet(Node *p_node, int &r_len) { const ObjectID oid = p_node->get_instance_id(); const TrackedNode *tnode = tracked_nodes.getptr(oid); - ERR_FAIL_COND_V(!tnode, ERR_INVALID_PARAMETER); + ERR_FAIL_NULL_V(tnode, ERR_INVALID_PARAMETER); MAKE_ROOM(5); uint8_t *ptr = packet_cache.ptrw(); ptr[0] = (uint8_t)SceneMultiplayer::NETWORK_COMMAND_DESPAWN; @@ -568,7 +568,7 @@ Error SceneReplicationInterface::on_spawn_receive(int p_from, const uint8_t *p_b uint32_t node_target = decode_uint32(&p_buffer[ofs]); ofs += 4; MultiplayerSpawner *spawner = Object::cast_to(multiplayer->get_path_cache()->get_cached_object(p_from, node_target)); - ERR_FAIL_COND_V(!spawner, ERR_DOES_NOT_EXIST); + ERR_FAIL_NULL_V(spawner, ERR_DOES_NOT_EXIST); ERR_FAIL_COND_V(p_from != spawner->get_multiplayer_authority(), ERR_UNAUTHORIZED); uint32_t net_id = decode_uint32(&p_buffer[ofs]); @@ -592,7 +592,7 @@ Error SceneReplicationInterface::on_spawn_receive(int p_from, const uint8_t *p_b // Check that we can spawn. Node *parent = spawner->get_node_or_null(spawner->get_spawn_path()); - ERR_FAIL_COND_V(!parent, ERR_UNCONFIGURED); + ERR_FAIL_NULL_V(parent, ERR_UNCONFIGURED); ERR_FAIL_COND_V(parent->has_node(name), ERR_INVALID_DATA); Node *node = nullptr; @@ -611,7 +611,7 @@ Error SceneReplicationInterface::on_spawn_receive(int p_from, const uint8_t *p_b // Scene based spawn. node = spawner->instantiate_scene(scene_id); } - ERR_FAIL_COND_V(!node, ERR_UNAUTHORIZED); + ERR_FAIL_NULL_V(node, ERR_UNAUTHORIZED); node->set_name(name); // Add and track remote @@ -656,13 +656,13 @@ Error SceneReplicationInterface::on_despawn_receive(int p_from, const uint8_t *p PeerInfo &pinfo = peers_info[p_from]; ERR_FAIL_COND_V(!pinfo.recv_nodes.has(net_id), ERR_UNAUTHORIZED); Node *node = get_id_as(pinfo.recv_nodes[net_id]); - ERR_FAIL_COND_V(!node, ERR_BUG); + ERR_FAIL_NULL_V(node, ERR_BUG); pinfo.recv_nodes.erase(net_id); const ObjectID oid = node->get_instance_id(); ERR_FAIL_COND_V(!tracked_nodes.has(oid), ERR_BUG); MultiplayerSpawner *spawner = get_id_as(tracked_nodes[oid].spawner); - ERR_FAIL_COND_V(!spawner, ERR_DOES_NOT_EXIST); + ERR_FAIL_NULL_V(spawner, ERR_DOES_NOT_EXIST); ERR_FAIL_COND_V(p_from != spawner->get_multiplayer_authority(), ERR_UNAUTHORIZED); if (node->get_parent() != nullptr) { diff --git a/modules/multiplayer/scene_rpc_interface.cpp b/modules/multiplayer/scene_rpc_interface.cpp index da1a044c9d2..48e1d13f9cf 100644 --- a/modules/multiplayer/scene_rpc_interface.cpp +++ b/modules/multiplayer/scene_rpc_interface.cpp @@ -134,7 +134,7 @@ _FORCE_INLINE_ bool _can_call_mode(Node *p_node, MultiplayerAPI::RPCMode mode, i String SceneRPCInterface::get_rpc_md5(const Object *p_obj) { const Node *node = Object::cast_to(p_obj); - ERR_FAIL_COND_V(!node, ""); + ERR_FAIL_NULL_V(node, ""); const RPCConfigCache cache = _get_node_config(node); String rpc_list; for (const KeyValue &config : cache.configs) { @@ -145,7 +145,7 @@ String SceneRPCInterface::get_rpc_md5(const Object *p_obj) { Node *SceneRPCInterface::_process_get_node(int p_from, const uint8_t *p_packet, uint32_t p_node_target, int p_packet_len) { Node *root_node = SceneTree::get_singleton()->get_root()->get_node(multiplayer->get_root_path()); - ERR_FAIL_COND_V(!root_node, nullptr); + ERR_FAIL_NULL_V(root_node, nullptr); Node *node = nullptr; if (p_node_target & 0x80000000) { @@ -225,7 +225,7 @@ void SceneRPCInterface::process_rpc(int p_from, const uint8_t *p_packet, int p_p } Node *node = _process_get_node(p_from, p_packet, node_target, p_packet_len); - ERR_FAIL_COND_MSG(node == nullptr, "Invalid packet received. Requested node was not found."); + ERR_FAIL_NULL_MSG(node, "Invalid packet received. Requested node was not found."); uint16_t name_id = 0; switch (name_id_compression) { diff --git a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp index d6c31ca35e5..18d66c7b690 100644 --- a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp +++ b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp @@ -64,7 +64,7 @@ void NavigationMeshEditor::_notification(int p_what) { void NavigationMeshEditor::_bake_pressed() { button_bake->set_pressed(false); - ERR_FAIL_COND(!node); + ERR_FAIL_NULL(node); Ref navmesh = node->get_navigation_mesh(); if (!navmesh.is_valid()) { err_dialog->set_text(TTR("A NavigationMesh resource must be set or created for this node to work.")); diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp index 32482e0c9d0..6a3bf6793e4 100644 --- a/modules/navigation/godot_navigation_server.cpp +++ b/modules/navigation/godot_navigation_server.cpp @@ -116,7 +116,7 @@ RID GodotNavigationServer::map_create() { COMMAND_2(map_set_active, RID, p_map, bool, p_active) { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + ERR_FAIL_NULL(map); if (p_active) { if (!map_is_active(p_map)) { @@ -133,126 +133,126 @@ COMMAND_2(map_set_active, RID, p_map, bool, p_active) { bool GodotNavigationServer::map_is_active(RID p_map) const { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, false); + ERR_FAIL_NULL_V(map, false); return active_maps.find(map) >= 0; } COMMAND_2(map_set_up, RID, p_map, Vector3, p_up) { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + ERR_FAIL_NULL(map); map->set_up(p_up); } Vector3 GodotNavigationServer::map_get_up(RID p_map) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, Vector3()); + ERR_FAIL_NULL_V(map, Vector3()); return map->get_up(); } COMMAND_2(map_set_cell_size, RID, p_map, real_t, p_cell_size) { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + ERR_FAIL_NULL(map); map->set_cell_size(p_cell_size); } real_t GodotNavigationServer::map_get_cell_size(RID p_map) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, 0); + ERR_FAIL_NULL_V(map, 0); return map->get_cell_size(); } COMMAND_2(map_set_cell_height, RID, p_map, real_t, p_cell_height) { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + ERR_FAIL_NULL(map); map->set_cell_height(p_cell_height); } real_t GodotNavigationServer::map_get_cell_height(RID p_map) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, 0); + ERR_FAIL_NULL_V(map, 0); return map->get_cell_height(); } COMMAND_2(map_set_use_edge_connections, RID, p_map, bool, p_enabled) { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + ERR_FAIL_NULL(map); map->set_use_edge_connections(p_enabled); } bool GodotNavigationServer::map_get_use_edge_connections(RID p_map) const { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, false); + ERR_FAIL_NULL_V(map, false); return map->get_use_edge_connections(); } COMMAND_2(map_set_edge_connection_margin, RID, p_map, real_t, p_connection_margin) { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + ERR_FAIL_NULL(map); map->set_edge_connection_margin(p_connection_margin); } real_t GodotNavigationServer::map_get_edge_connection_margin(RID p_map) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, 0); + ERR_FAIL_NULL_V(map, 0); return map->get_edge_connection_margin(); } COMMAND_2(map_set_link_connection_radius, RID, p_map, real_t, p_connection_radius) { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + ERR_FAIL_NULL(map); map->set_link_connection_radius(p_connection_radius); } real_t GodotNavigationServer::map_get_link_connection_radius(RID p_map) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, 0); + ERR_FAIL_NULL_V(map, 0); return map->get_link_connection_radius(); } Vector GodotNavigationServer::map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_navigation_layers) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, Vector()); + ERR_FAIL_NULL_V(map, Vector()); return map->get_path(p_origin, p_destination, p_optimize, p_navigation_layers, nullptr, nullptr, nullptr); } Vector3 GodotNavigationServer::map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, Vector3()); + ERR_FAIL_NULL_V(map, Vector3()); return map->get_closest_point_to_segment(p_from, p_to, p_use_collision); } Vector3 GodotNavigationServer::map_get_closest_point(RID p_map, const Vector3 &p_point) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, Vector3()); + ERR_FAIL_NULL_V(map, Vector3()); return map->get_closest_point(p_point); } Vector3 GodotNavigationServer::map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, Vector3()); + ERR_FAIL_NULL_V(map, Vector3()); return map->get_closest_point_normal(p_point); } RID GodotNavigationServer::map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const { const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, RID()); + ERR_FAIL_NULL_V(map, RID()); return map->get_closest_point_owner(p_point); } @@ -260,7 +260,7 @@ RID GodotNavigationServer::map_get_closest_point_owner(RID p_map, const Vector3 TypedArray GodotNavigationServer::map_get_links(RID p_map) const { TypedArray link_rids; const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, link_rids); + ERR_FAIL_NULL_V(map, link_rids); const LocalVector &links = map->get_links(); link_rids.resize(links.size()); @@ -274,7 +274,7 @@ TypedArray GodotNavigationServer::map_get_links(RID p_map) const { TypedArray GodotNavigationServer::map_get_regions(RID p_map) const { TypedArray regions_rids; const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, regions_rids); + ERR_FAIL_NULL_V(map, regions_rids); const LocalVector ®ions = map->get_regions(); regions_rids.resize(regions.size()); @@ -288,7 +288,7 @@ TypedArray GodotNavigationServer::map_get_regions(RID p_map) const { TypedArray GodotNavigationServer::map_get_agents(RID p_map) const { TypedArray agents_rids; const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, agents_rids); + ERR_FAIL_NULL_V(map, agents_rids); const LocalVector &agents = map->get_agents(); agents_rids.resize(agents.size()); @@ -302,7 +302,7 @@ TypedArray GodotNavigationServer::map_get_agents(RID p_map) const { TypedArray GodotNavigationServer::map_get_obstacles(RID p_map) const { TypedArray obstacles_rids; const NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND_V(map == nullptr, obstacles_rids); + ERR_FAIL_NULL_V(map, obstacles_rids); const LocalVector obstacles = map->get_obstacles(); obstacles_rids.resize(obstacles.size()); for (uint32_t i = 0; i < obstacles.size(); i++) { @@ -313,7 +313,7 @@ TypedArray GodotNavigationServer::map_get_obstacles(RID p_map) const { RID GodotNavigationServer::region_get_map(RID p_region) const { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(region == nullptr, RID()); + ERR_FAIL_NULL_V(region, RID()); if (region->get_map()) { return region->get_map()->get_self(); @@ -323,7 +323,7 @@ RID GodotNavigationServer::region_get_map(RID p_region) const { RID GodotNavigationServer::agent_get_map(RID p_agent) const { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND_V(agent == nullptr, RID()); + ERR_FAIL_NULL_V(agent, RID()); if (agent->get_map()) { return agent->get_map()->get_self(); @@ -342,35 +342,35 @@ RID GodotNavigationServer::region_create() { COMMAND_2(region_set_enabled, RID, p_region, bool, p_enabled) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); region->set_enabled(p_enabled); } bool GodotNavigationServer::region_get_enabled(RID p_region) const { const NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(region == nullptr, false); + ERR_FAIL_NULL_V(region, false); return region->get_enabled(); } COMMAND_2(region_set_use_edge_connections, RID, p_region, bool, p_enabled) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); region->set_use_edge_connections(p_enabled); } bool GodotNavigationServer::region_get_use_edge_connections(RID p_region) const { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(region == nullptr, false); + ERR_FAIL_NULL_V(region, false); return region->get_use_edge_connections(); } COMMAND_2(region_set_map, RID, p_region, RID, p_map) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); NavMap *map = map_owner.get_or_null(p_map); @@ -379,14 +379,14 @@ COMMAND_2(region_set_map, RID, p_region, RID, p_map) { COMMAND_2(region_set_transform, RID, p_region, Transform3D, p_transform) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); region->set_transform(p_transform); } COMMAND_2(region_set_enter_cost, RID, p_region, real_t, p_enter_cost) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); ERR_FAIL_COND(p_enter_cost < 0.0); region->set_enter_cost(p_enter_cost); @@ -394,14 +394,14 @@ COMMAND_2(region_set_enter_cost, RID, p_region, real_t, p_enter_cost) { real_t GodotNavigationServer::region_get_enter_cost(RID p_region) const { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(region == nullptr, 0); + ERR_FAIL_NULL_V(region, 0); return region->get_enter_cost(); } COMMAND_2(region_set_travel_cost, RID, p_region, real_t, p_travel_cost) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); ERR_FAIL_COND(p_travel_cost < 0.0); region->set_travel_cost(p_travel_cost); @@ -409,28 +409,28 @@ COMMAND_2(region_set_travel_cost, RID, p_region, real_t, p_travel_cost) { real_t GodotNavigationServer::region_get_travel_cost(RID p_region) const { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(region == nullptr, 0); + ERR_FAIL_NULL_V(region, 0); return region->get_travel_cost(); } COMMAND_2(region_set_owner_id, RID, p_region, ObjectID, p_owner_id) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); region->set_owner_id(p_owner_id); } ObjectID GodotNavigationServer::region_get_owner_id(RID p_region) const { const NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(region == nullptr, ObjectID()); + ERR_FAIL_NULL_V(region, ObjectID()); return region->get_owner_id(); } bool GodotNavigationServer::region_owns_point(RID p_region, const Vector3 &p_point) const { const NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(region == nullptr, false); + ERR_FAIL_NULL_V(region, false); if (region->get_map()) { RID closest_point_owner = map_get_closest_point_owner(region->get_map()->get_self(), p_point); @@ -441,21 +441,21 @@ bool GodotNavigationServer::region_owns_point(RID p_region, const Vector3 &p_poi COMMAND_2(region_set_navigation_layers, RID, p_region, uint32_t, p_navigation_layers) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); region->set_navigation_layers(p_navigation_layers); } uint32_t GodotNavigationServer::region_get_navigation_layers(RID p_region) const { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(region == nullptr, 0); + ERR_FAIL_NULL_V(region, 0); return region->get_navigation_layers(); } COMMAND_2(region_set_navigation_mesh, RID, p_region, Ref, p_navigation_mesh) { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND(region == nullptr); + ERR_FAIL_NULL(region); region->set_mesh(p_navigation_mesh); } @@ -463,7 +463,7 @@ COMMAND_2(region_set_navigation_mesh, RID, p_region, Ref, p_navi #ifndef DISABLE_DEPRECATED void GodotNavigationServer::region_bake_navigation_mesh(Ref p_navigation_mesh, Node *p_root_node) { ERR_FAIL_COND(p_navigation_mesh.is_null()); - ERR_FAIL_COND(p_root_node == nullptr); + ERR_FAIL_NULL(p_root_node); WARN_PRINT_ONCE("NavigationServer3D::region_bake_navigation_mesh() is deprecated due to core threading changes. To upgrade existing code, first create a NavigationMeshSourceGeometryData3D resource. Use this resource with method parse_source_geometry_data() to parse the SceneTree for nodes that should contribute to the navigation mesh baking. The SceneTree parsing needs to happen on the main thread. After the parsing is finished use the resource with method bake_from_source_geometry_data() to bake a navigation mesh.."); @@ -479,21 +479,21 @@ void GodotNavigationServer::region_bake_navigation_mesh(Ref p_na int GodotNavigationServer::region_get_connections_count(RID p_region) const { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(!region, 0); + ERR_FAIL_NULL_V(region, 0); return region->get_connections_count(); } Vector3 GodotNavigationServer::region_get_connection_pathway_start(RID p_region, int p_connection_id) const { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(!region, Vector3()); + ERR_FAIL_NULL_V(region, Vector3()); return region->get_connection_pathway_start(p_connection_id); } Vector3 GodotNavigationServer::region_get_connection_pathway_end(RID p_region, int p_connection_id) const { NavRegion *region = region_owner.get_or_null(p_region); - ERR_FAIL_COND_V(!region, Vector3()); + ERR_FAIL_NULL_V(region, Vector3()); return region->get_connection_pathway_end(p_connection_id); } @@ -509,7 +509,7 @@ RID GodotNavigationServer::link_create() { COMMAND_2(link_set_map, RID, p_link, RID, p_map) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); NavMap *map = map_owner.get_or_null(p_map); @@ -518,7 +518,7 @@ COMMAND_2(link_set_map, RID, p_link, RID, p_map) { RID GodotNavigationServer::link_get_map(const RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, RID()); + ERR_FAIL_NULL_V(link, RID()); if (link->get_map()) { return link->get_map()->get_self(); @@ -528,112 +528,112 @@ RID GodotNavigationServer::link_get_map(const RID p_link) const { COMMAND_2(link_set_enabled, RID, p_link, bool, p_enabled) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); link->set_enabled(p_enabled); } bool GodotNavigationServer::link_get_enabled(RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, false); + ERR_FAIL_NULL_V(link, false); return link->get_enabled(); } COMMAND_2(link_set_bidirectional, RID, p_link, bool, p_bidirectional) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); link->set_bidirectional(p_bidirectional); } bool GodotNavigationServer::link_is_bidirectional(RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, false); + ERR_FAIL_NULL_V(link, false); return link->is_bidirectional(); } COMMAND_2(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); link->set_navigation_layers(p_navigation_layers); } uint32_t GodotNavigationServer::link_get_navigation_layers(const RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, 0); + ERR_FAIL_NULL_V(link, 0); return link->get_navigation_layers(); } COMMAND_2(link_set_start_position, RID, p_link, Vector3, p_position) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); link->set_start_position(p_position); } Vector3 GodotNavigationServer::link_get_start_position(RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, Vector3()); + ERR_FAIL_NULL_V(link, Vector3()); return link->get_start_position(); } COMMAND_2(link_set_end_position, RID, p_link, Vector3, p_position) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); link->set_end_position(p_position); } Vector3 GodotNavigationServer::link_get_end_position(RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, Vector3()); + ERR_FAIL_NULL_V(link, Vector3()); return link->get_end_position(); } COMMAND_2(link_set_enter_cost, RID, p_link, real_t, p_enter_cost) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); link->set_enter_cost(p_enter_cost); } real_t GodotNavigationServer::link_get_enter_cost(const RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, 0); + ERR_FAIL_NULL_V(link, 0); return link->get_enter_cost(); } COMMAND_2(link_set_travel_cost, RID, p_link, real_t, p_travel_cost) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); link->set_travel_cost(p_travel_cost); } real_t GodotNavigationServer::link_get_travel_cost(const RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, 0); + ERR_FAIL_NULL_V(link, 0); return link->get_travel_cost(); } COMMAND_2(link_set_owner_id, RID, p_link, ObjectID, p_owner_id) { NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND(link == nullptr); + ERR_FAIL_NULL(link); link->set_owner_id(p_owner_id); } ObjectID GodotNavigationServer::link_get_owner_id(RID p_link) const { const NavLink *link = link_owner.get_or_null(p_link); - ERR_FAIL_COND_V(link == nullptr, ObjectID()); + ERR_FAIL_NULL_V(link, ObjectID()); return link->get_owner_id(); } @@ -649,35 +649,35 @@ RID GodotNavigationServer::agent_create() { COMMAND_2(agent_set_avoidance_enabled, RID, p_agent, bool, p_enabled) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_avoidance_enabled(p_enabled); } bool GodotNavigationServer::agent_get_avoidance_enabled(RID p_agent) const { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND_V(agent == nullptr, false); + ERR_FAIL_NULL_V(agent, false); return agent->is_avoidance_enabled(); } COMMAND_2(agent_set_use_3d_avoidance, RID, p_agent, bool, p_enabled) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_use_3d_avoidance(p_enabled); } bool GodotNavigationServer::agent_get_use_3d_avoidance(RID p_agent) const { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND_V(agent == nullptr, false); + ERR_FAIL_NULL_V(agent, false); return agent->get_use_3d_avoidance(); } COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); NavMap *map = map_owner.get_or_null(p_map); @@ -686,28 +686,28 @@ COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) { COMMAND_2(agent_set_paused, RID, p_agent, bool, p_paused) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_paused(p_paused); } bool GodotNavigationServer::agent_get_paused(RID p_agent) const { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND_V(agent == nullptr, false); + ERR_FAIL_NULL_V(agent, false); return agent->get_paused(); } COMMAND_2(agent_set_neighbor_distance, RID, p_agent, real_t, p_distance) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_neighbor_distance(p_distance); } COMMAND_2(agent_set_max_neighbors, RID, p_agent, int, p_count) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_max_neighbors(p_count); } @@ -715,7 +715,7 @@ COMMAND_2(agent_set_max_neighbors, RID, p_agent, int, p_count) { COMMAND_2(agent_set_time_horizon_agents, RID, p_agent, real_t, p_time_horizon) { ERR_FAIL_COND_MSG(p_time_horizon < 0.0, "Time horizion must be positive."); NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_time_horizon_agents(p_time_horizon); } @@ -723,7 +723,7 @@ COMMAND_2(agent_set_time_horizon_agents, RID, p_agent, real_t, p_time_horizon) { COMMAND_2(agent_set_time_horizon_obstacles, RID, p_agent, real_t, p_time_horizon) { ERR_FAIL_COND_MSG(p_time_horizon < 0.0, "Time horizion must be positive."); NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_time_horizon_obstacles(p_time_horizon); } @@ -731,7 +731,7 @@ COMMAND_2(agent_set_time_horizon_obstacles, RID, p_agent, real_t, p_time_horizon COMMAND_2(agent_set_radius, RID, p_agent, real_t, p_radius) { ERR_FAIL_COND_MSG(p_radius < 0.0, "Radius must be positive."); NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_radius(p_radius); } @@ -739,7 +739,7 @@ COMMAND_2(agent_set_radius, RID, p_agent, real_t, p_radius) { COMMAND_2(agent_set_height, RID, p_agent, real_t, p_height) { ERR_FAIL_COND_MSG(p_height < 0.0, "Height must be positive."); NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_height(p_height); } @@ -747,42 +747,42 @@ COMMAND_2(agent_set_height, RID, p_agent, real_t, p_height) { COMMAND_2(agent_set_max_speed, RID, p_agent, real_t, p_max_speed) { ERR_FAIL_COND_MSG(p_max_speed < 0.0, "Max speed must be positive."); NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_max_speed(p_max_speed); } COMMAND_2(agent_set_velocity, RID, p_agent, Vector3, p_velocity) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_velocity(p_velocity); } COMMAND_2(agent_set_velocity_forced, RID, p_agent, Vector3, p_velocity) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_velocity_forced(p_velocity); } COMMAND_2(agent_set_position, RID, p_agent, Vector3, p_position) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_position(p_position); } bool GodotNavigationServer::agent_is_map_changed(RID p_agent) const { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND_V(agent == nullptr, false); + ERR_FAIL_NULL_V(agent, false); return agent->is_map_changed(); } COMMAND_2(agent_set_avoidance_callback, RID, p_agent, Callable, p_callback) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_avoidance_callback(p_callback); @@ -797,13 +797,13 @@ COMMAND_2(agent_set_avoidance_callback, RID, p_agent, Callable, p_callback) { COMMAND_2(agent_set_avoidance_layers, RID, p_agent, uint32_t, p_layers) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_avoidance_layers(p_layers); } COMMAND_2(agent_set_avoidance_mask, RID, p_agent, uint32_t, p_mask) { NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_avoidance_mask(p_mask); } @@ -811,7 +811,7 @@ COMMAND_2(agent_set_avoidance_priority, RID, p_agent, real_t, p_priority) { ERR_FAIL_COND_MSG(p_priority < 0.0, "Avoidance priority must be between 0.0 and 1.0 inclusive."); ERR_FAIL_COND_MSG(p_priority > 1.0, "Avoidance priority must be between 0.0 and 1.0 inclusive."); NavAgent *agent = agent_owner.get_or_null(p_agent); - ERR_FAIL_COND(agent == nullptr); + ERR_FAIL_NULL(agent); agent->set_avoidance_priority(p_priority); } @@ -833,35 +833,35 @@ RID GodotNavigationServer::obstacle_create() { COMMAND_2(obstacle_set_avoidance_enabled, RID, p_obstacle, bool, p_enabled) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_avoidance_enabled(p_enabled); } bool GodotNavigationServer::obstacle_get_avoidance_enabled(RID p_obstacle) const { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND_V(obstacle == nullptr, false); + ERR_FAIL_NULL_V(obstacle, false); return obstacle->is_avoidance_enabled(); } COMMAND_2(obstacle_set_use_3d_avoidance, RID, p_obstacle, bool, p_enabled) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_use_3d_avoidance(p_enabled); } bool GodotNavigationServer::obstacle_get_use_3d_avoidance(RID p_obstacle) const { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND_V(obstacle == nullptr, false); + ERR_FAIL_NULL_V(obstacle, false); return obstacle->get_use_3d_avoidance(); } COMMAND_2(obstacle_set_map, RID, p_obstacle, RID, p_map) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); NavMap *map = map_owner.get_or_null(p_map); @@ -870,7 +870,7 @@ COMMAND_2(obstacle_set_map, RID, p_obstacle, RID, p_map) { RID GodotNavigationServer::obstacle_get_map(RID p_obstacle) const { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND_V(obstacle == nullptr, RID()); + ERR_FAIL_NULL_V(obstacle, RID()); if (obstacle->get_map()) { return obstacle->get_map()->get_self(); } @@ -879,14 +879,14 @@ RID GodotNavigationServer::obstacle_get_map(RID p_obstacle) const { COMMAND_2(obstacle_set_paused, RID, p_obstacle, bool, p_paused) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_paused(p_paused); } bool GodotNavigationServer::obstacle_get_paused(RID p_obstacle) const { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND_V(obstacle == nullptr, false); + ERR_FAIL_NULL_V(obstacle, false); return obstacle->get_paused(); } @@ -894,39 +894,39 @@ bool GodotNavigationServer::obstacle_get_paused(RID p_obstacle) const { COMMAND_2(obstacle_set_radius, RID, p_obstacle, real_t, p_radius) { ERR_FAIL_COND_MSG(p_radius < 0.0, "Radius must be positive."); NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_radius(p_radius); } COMMAND_2(obstacle_set_height, RID, p_obstacle, real_t, p_height) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_height(p_height); } COMMAND_2(obstacle_set_velocity, RID, p_obstacle, Vector3, p_velocity) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_velocity(p_velocity); } COMMAND_2(obstacle_set_position, RID, p_obstacle, Vector3, p_position) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_position(p_position); } void GodotNavigationServer::obstacle_set_vertices(RID p_obstacle, const Vector &p_vertices) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_vertices(p_vertices); } COMMAND_2(obstacle_set_avoidance_layers, RID, p_obstacle, uint32_t, p_layers) { NavObstacle *obstacle = obstacle_owner.get_or_null(p_obstacle); - ERR_FAIL_COND(obstacle == nullptr); + ERR_FAIL_NULL(obstacle); obstacle->set_avoidance_layers(p_layers); } @@ -934,7 +934,7 @@ void GodotNavigationServer::parse_source_geometry_data(const Ref #ifndef _3D_DISABLED ERR_FAIL_COND_MSG(!Thread::is_main_thread(), "The SceneTree can only be parsed on the main thread. Call this function from the main thread or use call_deferred()."); ERR_FAIL_COND_MSG(!p_navigation_mesh.is_valid(), "Invalid navigation mesh."); - ERR_FAIL_COND_MSG(p_root_node == nullptr, "No parsing root node specified."); + ERR_FAIL_NULL_MSG(p_root_node, "No parsing root node specified."); ERR_FAIL_COND_MSG(!p_root_node->is_inside_tree(), "The root node needs to be inside the SceneTree."); ERR_FAIL_NULL(NavMeshGenerator3D::get_singleton()); @@ -1079,7 +1079,7 @@ void GodotNavigationServer::flush_queries() { void GodotNavigationServer::map_force_update(RID p_map) { NavMap *map = map_owner.get_or_null(p_map); - ERR_FAIL_COND(map == nullptr); + ERR_FAIL_NULL(map); flush_queries(); @@ -1166,7 +1166,7 @@ PathQueryResult GodotNavigationServer::_query_path(const PathQueryParameters &p_ PathQueryResult r_query_result; const NavMap *map = map_owner.get_or_null(p_parameters.map); - ERR_FAIL_COND_V(map == nullptr, r_query_result); + ERR_FAIL_NULL_V(map, r_query_result); // run the pathfinding diff --git a/modules/navigation/nav_mesh_generator_3d.cpp b/modules/navigation/nav_mesh_generator_3d.cpp index 7c27417e5f8..5de1c4cba94 100644 --- a/modules/navigation/nav_mesh_generator_3d.cpp +++ b/modules/navigation/nav_mesh_generator_3d.cpp @@ -149,7 +149,7 @@ void NavMeshGenerator3D::finish() { void NavMeshGenerator3D::parse_source_geometry_data(Ref p_navigation_mesh, Ref p_source_geometry_data, Node *p_root_node, const Callable &p_callback) { ERR_FAIL_COND(!Thread::is_main_thread()); ERR_FAIL_COND(!p_navigation_mesh.is_valid()); - ERR_FAIL_COND(p_root_node == nullptr); + ERR_FAIL_NULL(p_root_node); ERR_FAIL_COND(!p_root_node->is_inside_tree()); ERR_FAIL_COND(!p_source_geometry_data.is_valid()); @@ -714,7 +714,7 @@ void NavMeshGenerator3D::generator_bake_from_source_geometry_data(Refvertices = p_vertices; occluder->indices = p_indices; @@ -242,7 +242,7 @@ void RaycastOcclusionCull::occluder_set_mesh(RID p_occluder, const PackedVector3 void RaycastOcclusionCull::free_occluder(RID p_occluder) { Occluder *occluder = occluder_owner.get_or_null(p_occluder); - ERR_FAIL_COND(!occluder); + ERR_FAIL_NULL(occluder); memdelete(occluder); occluder_owner.free(p_occluder); } @@ -291,7 +291,7 @@ void RaycastOcclusionCull::scenario_set_instance(RID p_scenario, RID p_instance, if (p_occluder.is_valid()) { Occluder *occluder = occluder_owner.get_or_null(p_occluder); - ERR_FAIL_COND(!occluder); + ERR_FAIL_NULL(occluder); occluder->users.insert(InstanceID(p_scenario, p_instance)); } changed = true; @@ -398,7 +398,7 @@ void RaycastOcclusionCull::Scenario::_commit_scene(void *p_ud) { } bool RaycastOcclusionCull::Scenario::update() { - ERR_FAIL_COND_V(singleton == nullptr, false); + ERR_FAIL_NULL_V(singleton, false); if (commit_thread == nullptr) { commit_thread = memnew(Thread); @@ -492,7 +492,7 @@ void RaycastOcclusionCull::Scenario::_raycast(uint32_t p_idx, const RaycastThrea } void RaycastOcclusionCull::Scenario::raycast(CameraRayTile *r_rays, const uint32_t *p_valid_masks, uint32_t p_tile_count) const { - ERR_FAIL_COND(singleton == nullptr); + ERR_FAIL_NULL(singleton); if (raycast_singleton->ebr_device == nullptr) { return; // Embree is initialized on demand when there is some scenario with occluders in it. } diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 3cbc3009467..9adb10236ec 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -1810,7 +1810,7 @@ _FORCE_INLINE_ void TextServerAdvanced::_font_clear_cache(FontAdvanced *p_font_d hb_font_t *TextServerAdvanced::_font_get_hb_handle(const RID &p_font_rid, int64_t p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, nullptr); + ERR_FAIL_NULL_V(fd, nullptr); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1830,7 +1830,7 @@ RID TextServerAdvanced::_create_font() { void TextServerAdvanced::_font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); _font_clear_cache(fd); @@ -1841,7 +1841,7 @@ void TextServerAdvanced::_font_set_data(const RID &p_font_rid, const PackedByteA void TextServerAdvanced::_font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); _font_clear_cache(fd); @@ -1855,7 +1855,7 @@ void TextServerAdvanced::_font_set_face_index(const RID &p_font_rid, int64_t p_f ERR_FAIL_COND(p_face_index >= 0x7FFF); FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->face_index != p_face_index) { @@ -1866,7 +1866,7 @@ void TextServerAdvanced::_font_set_face_index(const RID &p_font_rid, int64_t p_f int64_t TextServerAdvanced::_font_get_face_index(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); return fd->face_index; @@ -1874,7 +1874,7 @@ int64_t TextServerAdvanced::_font_get_face_index(const RID &p_font_rid) const { int64_t TextServerAdvanced::_font_get_face_count(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); int face_count = 0; @@ -1920,7 +1920,7 @@ int64_t TextServerAdvanced::_font_get_face_count(const RID &p_font_rid) const { void TextServerAdvanced::_font_set_style(const RID &p_font_rid, BitField p_style) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1930,7 +1930,7 @@ void TextServerAdvanced::_font_set_style(const RID &p_font_rid, BitField TextServerAdvanced::_font_get_style(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1940,7 +1940,7 @@ BitField TextServerAdvanced::_font_get_style(const RID &p void TextServerAdvanced::_font_set_style_name(const RID &p_font_rid, const String &p_name) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1950,7 +1950,7 @@ void TextServerAdvanced::_font_set_style_name(const RID &p_font_rid, const Strin String TextServerAdvanced::_font_get_style_name(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, String()); + ERR_FAIL_NULL_V(fd, String()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1960,7 +1960,7 @@ String TextServerAdvanced::_font_get_style_name(const RID &p_font_rid) const { void TextServerAdvanced::_font_set_weight(const RID &p_font_rid, int64_t p_weight) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1970,7 +1970,7 @@ void TextServerAdvanced::_font_set_weight(const RID &p_font_rid, int64_t p_weigh int64_t TextServerAdvanced::_font_get_weight(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 400); + ERR_FAIL_NULL_V(fd, 400); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1980,7 +1980,7 @@ int64_t TextServerAdvanced::_font_get_weight(const RID &p_font_rid) const { void TextServerAdvanced::_font_set_stretch(const RID &p_font_rid, int64_t p_stretch) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1990,7 +1990,7 @@ void TextServerAdvanced::_font_set_stretch(const RID &p_font_rid, int64_t p_stre int64_t TextServerAdvanced::_font_get_stretch(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 100); + ERR_FAIL_NULL_V(fd, 100); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -2000,7 +2000,7 @@ int64_t TextServerAdvanced::_font_get_stretch(const RID &p_font_rid) const { void TextServerAdvanced::_font_set_name(const RID &p_font_rid, const String &p_name) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -2010,7 +2010,7 @@ void TextServerAdvanced::_font_set_name(const RID &p_font_rid, const String &p_n String TextServerAdvanced::_font_get_name(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, String()); + ERR_FAIL_NULL_V(fd, String()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -2020,7 +2020,7 @@ String TextServerAdvanced::_font_get_name(const RID &p_font_rid) const { Dictionary TextServerAdvanced::_font_get_ot_name_strings(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -2133,7 +2133,7 @@ Dictionary TextServerAdvanced::_font_get_ot_name_strings(const RID &p_font_rid) void TextServerAdvanced::_font_set_antialiasing(const RID &p_font_rid, TextServer::FontAntialiasing p_antialiasing) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->antialiasing != p_antialiasing) { @@ -2144,7 +2144,7 @@ void TextServerAdvanced::_font_set_antialiasing(const RID &p_font_rid, TextServe TextServer::FontAntialiasing TextServerAdvanced::_font_get_antialiasing(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, TextServer::FONT_ANTIALIASING_NONE); + ERR_FAIL_NULL_V(fd, TextServer::FONT_ANTIALIASING_NONE); MutexLock lock(fd->mutex); return fd->antialiasing; @@ -2152,7 +2152,7 @@ TextServer::FontAntialiasing TextServerAdvanced::_font_get_antialiasing(const RI void TextServerAdvanced::_font_set_generate_mipmaps(const RID &p_font_rid, bool p_generate_mipmaps) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->mipmaps != p_generate_mipmaps) { @@ -2168,7 +2168,7 @@ void TextServerAdvanced::_font_set_generate_mipmaps(const RID &p_font_rid, bool bool TextServerAdvanced::_font_get_generate_mipmaps(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->mipmaps; @@ -2176,7 +2176,7 @@ bool TextServerAdvanced::_font_get_generate_mipmaps(const RID &p_font_rid) const void TextServerAdvanced::_font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->msdf != p_msdf) { @@ -2187,7 +2187,7 @@ void TextServerAdvanced::_font_set_multichannel_signed_distance_field(const RID bool TextServerAdvanced::_font_is_multichannel_signed_distance_field(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->msdf; @@ -2195,7 +2195,7 @@ bool TextServerAdvanced::_font_is_multichannel_signed_distance_field(const RID & void TextServerAdvanced::_font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->msdf_range != p_msdf_pixel_range) { @@ -2206,7 +2206,7 @@ void TextServerAdvanced::_font_set_msdf_pixel_range(const RID &p_font_rid, int64 int64_t TextServerAdvanced::_font_get_msdf_pixel_range(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->msdf_range; @@ -2214,7 +2214,7 @@ int64_t TextServerAdvanced::_font_get_msdf_pixel_range(const RID &p_font_rid) co void TextServerAdvanced::_font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->msdf_source_size != p_msdf_size) { @@ -2225,7 +2225,7 @@ void TextServerAdvanced::_font_set_msdf_size(const RID &p_font_rid, int64_t p_ms int64_t TextServerAdvanced::_font_get_msdf_size(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->msdf_source_size; @@ -2233,7 +2233,7 @@ int64_t TextServerAdvanced::_font_get_msdf_size(const RID &p_font_rid) const { void TextServerAdvanced::_font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->fixed_size = p_fixed_size; @@ -2241,7 +2241,7 @@ void TextServerAdvanced::_font_set_fixed_size(const RID &p_font_rid, int64_t p_f int64_t TextServerAdvanced::_font_get_fixed_size(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->fixed_size; @@ -2249,7 +2249,7 @@ int64_t TextServerAdvanced::_font_get_fixed_size(const RID &p_font_rid) const { void TextServerAdvanced::_font_set_allow_system_fallback(const RID &p_font_rid, bool p_allow_system_fallback) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->allow_system_fallback = p_allow_system_fallback; @@ -2257,7 +2257,7 @@ void TextServerAdvanced::_font_set_allow_system_fallback(const RID &p_font_rid, bool TextServerAdvanced::_font_is_allow_system_fallback(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->allow_system_fallback; @@ -2265,7 +2265,7 @@ bool TextServerAdvanced::_font_is_allow_system_fallback(const RID &p_font_rid) c void TextServerAdvanced::_font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->force_autohinter != p_force_autohinter) { @@ -2276,7 +2276,7 @@ void TextServerAdvanced::_font_set_force_autohinter(const RID &p_font_rid, bool bool TextServerAdvanced::_font_is_force_autohinter(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->force_autohinter; @@ -2284,7 +2284,7 @@ bool TextServerAdvanced::_font_is_force_autohinter(const RID &p_font_rid) const void TextServerAdvanced::_font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->hinting != p_hinting) { @@ -2295,7 +2295,7 @@ void TextServerAdvanced::_font_set_hinting(const RID &p_font_rid, TextServer::Hi TextServer::Hinting TextServerAdvanced::_font_get_hinting(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, HINTING_NONE); + ERR_FAIL_NULL_V(fd, HINTING_NONE); MutexLock lock(fd->mutex); return fd->hinting; @@ -2303,7 +2303,7 @@ TextServer::Hinting TextServerAdvanced::_font_get_hinting(const RID &p_font_rid) void TextServerAdvanced::_font_set_subpixel_positioning(const RID &p_font_rid, TextServer::SubpixelPositioning p_subpixel) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->subpixel_positioning = p_subpixel; @@ -2311,7 +2311,7 @@ void TextServerAdvanced::_font_set_subpixel_positioning(const RID &p_font_rid, T TextServer::SubpixelPositioning TextServerAdvanced::_font_get_subpixel_positioning(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, SUBPIXEL_POSITIONING_DISABLED); + ERR_FAIL_NULL_V(fd, SUBPIXEL_POSITIONING_DISABLED); MutexLock lock(fd->mutex); return fd->subpixel_positioning; @@ -2319,7 +2319,7 @@ TextServer::SubpixelPositioning TextServerAdvanced::_font_get_subpixel_positioni void TextServerAdvanced::_font_set_embolden(const RID &p_font_rid, double p_strength) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->embolden != p_strength) { @@ -2330,7 +2330,7 @@ void TextServerAdvanced::_font_set_embolden(const RID &p_font_rid, double p_stre double TextServerAdvanced::_font_get_embolden(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); return fd->embolden; @@ -2339,7 +2339,7 @@ double TextServerAdvanced::_font_get_embolden(const RID &p_font_rid) const { void TextServerAdvanced::_font_set_spacing(const RID &p_font_rid, SpacingType p_spacing, int64_t p_value) { ERR_FAIL_INDEX((int)p_spacing, 4); FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->extra_spacing[p_spacing] != p_value) { @@ -2352,7 +2352,7 @@ int64_t TextServerAdvanced::_font_get_spacing(const RID &p_font_rid, SpacingType ERR_FAIL_INDEX_V((int)p_spacing, 4, 0); FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); @@ -2361,7 +2361,7 @@ int64_t TextServerAdvanced::_font_get_spacing(const RID &p_font_rid, SpacingType void TextServerAdvanced::_font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->transform != p_transform) { @@ -2372,7 +2372,7 @@ void TextServerAdvanced::_font_set_transform(const RID &p_font_rid, const Transf Transform2D TextServerAdvanced::_font_get_transform(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Transform2D()); + ERR_FAIL_NULL_V(fd, Transform2D()); MutexLock lock(fd->mutex); return fd->transform; @@ -2380,7 +2380,7 @@ Transform2D TextServerAdvanced::_font_get_transform(const RID &p_font_rid) const void TextServerAdvanced::_font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (!fd->variation_coordinates.recursive_equal(p_variation_coordinates, 1)) { @@ -2391,7 +2391,7 @@ void TextServerAdvanced::_font_set_variation_coordinates(const RID &p_font_rid, Dictionary TextServerAdvanced::_font_get_variation_coordinates(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); return fd->variation_coordinates; @@ -2399,7 +2399,7 @@ Dictionary TextServerAdvanced::_font_get_variation_coordinates(const RID &p_font void TextServerAdvanced::_font_set_oversampling(const RID &p_font_rid, double p_oversampling) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->oversampling != p_oversampling) { @@ -2410,7 +2410,7 @@ void TextServerAdvanced::_font_set_oversampling(const RID &p_font_rid, double p_ double TextServerAdvanced::_font_get_oversampling(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); return fd->oversampling; @@ -2418,7 +2418,7 @@ double TextServerAdvanced::_font_get_oversampling(const RID &p_font_rid) const { TypedArray TextServerAdvanced::_font_get_size_cache_list(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, TypedArray()); + ERR_FAIL_NULL_V(fd, TypedArray()); MutexLock lock(fd->mutex); TypedArray ret; @@ -2430,7 +2430,7 @@ TypedArray TextServerAdvanced::_font_get_size_cache_list(const RID &p_ void TextServerAdvanced::_font_clear_size_cache(const RID &p_font_rid) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); MutexLock ftlock(ft_mutex); @@ -2442,7 +2442,7 @@ void TextServerAdvanced::_font_clear_size_cache(const RID &p_font_rid) { void TextServerAdvanced::_font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); MutexLock ftlock(ft_mutex); @@ -2454,7 +2454,7 @@ void TextServerAdvanced::_font_remove_size_cache(const RID &p_font_rid, const Ve void TextServerAdvanced::_font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2465,7 +2465,7 @@ void TextServerAdvanced::_font_set_ascent(const RID &p_font_rid, int64_t p_size, double TextServerAdvanced::_font_get_ascent(const RID &p_font_rid, int64_t p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2481,7 +2481,7 @@ double TextServerAdvanced::_font_get_ascent(const RID &p_font_rid, int64_t p_siz void TextServerAdvanced::_font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); Vector2i size = _get_size(fd, p_size); @@ -2491,7 +2491,7 @@ void TextServerAdvanced::_font_set_descent(const RID &p_font_rid, int64_t p_size double TextServerAdvanced::_font_get_descent(const RID &p_font_rid, int64_t p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2507,7 +2507,7 @@ double TextServerAdvanced::_font_get_descent(const RID &p_font_rid, int64_t p_si void TextServerAdvanced::_font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2518,7 +2518,7 @@ void TextServerAdvanced::_font_set_underline_position(const RID &p_font_rid, int double TextServerAdvanced::_font_get_underline_position(const RID &p_font_rid, int64_t p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2534,7 +2534,7 @@ double TextServerAdvanced::_font_get_underline_position(const RID &p_font_rid, i void TextServerAdvanced::_font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2545,7 +2545,7 @@ void TextServerAdvanced::_font_set_underline_thickness(const RID &p_font_rid, in double TextServerAdvanced::_font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2561,7 +2561,7 @@ double TextServerAdvanced::_font_get_underline_thickness(const RID &p_font_rid, void TextServerAdvanced::_font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2577,7 +2577,7 @@ void TextServerAdvanced::_font_set_scale(const RID &p_font_rid, int64_t p_size, double TextServerAdvanced::_font_get_scale(const RID &p_font_rid, int64_t p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2593,7 +2593,7 @@ double TextServerAdvanced::_font_get_scale(const RID &p_font_rid, int64_t p_size int64_t TextServerAdvanced::_font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2605,7 +2605,7 @@ int64_t TextServerAdvanced::_font_get_texture_count(const RID &p_font_rid, const void TextServerAdvanced::_font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2615,7 +2615,7 @@ void TextServerAdvanced::_font_clear_textures(const RID &p_font_rid, const Vecto void TextServerAdvanced::_font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2627,7 +2627,7 @@ void TextServerAdvanced::_font_remove_texture(const RID &p_font_rid, const Vecto void TextServerAdvanced::_font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref &p_image) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); ERR_FAIL_COND(p_image.is_null()); MutexLock lock(fd->mutex); @@ -2656,7 +2656,7 @@ void TextServerAdvanced::_font_set_texture_image(const RID &p_font_rid, const Ve Ref TextServerAdvanced::_font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Ref()); + ERR_FAIL_NULL_V(fd, Ref()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2670,7 +2670,7 @@ Ref TextServerAdvanced::_font_get_texture_image(const RID &p_font_rid, co void TextServerAdvanced::_font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offsets) { ERR_FAIL_COND(p_offsets.size() % 4 != 0); FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2689,7 +2689,7 @@ void TextServerAdvanced::_font_set_texture_offsets(const RID &p_font_rid, const PackedInt32Array TextServerAdvanced::_font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, PackedInt32Array()); + ERR_FAIL_NULL_V(fd, PackedInt32Array()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2714,7 +2714,7 @@ PackedInt32Array TextServerAdvanced::_font_get_texture_offsets(const RID &p_font PackedInt32Array TextServerAdvanced::_font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, PackedInt32Array()); + ERR_FAIL_NULL_V(fd, PackedInt32Array()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2730,7 +2730,7 @@ PackedInt32Array TextServerAdvanced::_font_get_glyph_list(const RID &p_font_rid, void TextServerAdvanced::_font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2741,7 +2741,7 @@ void TextServerAdvanced::_font_clear_glyphs(const RID &p_font_rid, const Vector2 void TextServerAdvanced::_font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2752,7 +2752,7 @@ void TextServerAdvanced::_font_remove_glyph(const RID &p_font_rid, const Vector2 double TextServerAdvanced::_get_extra_advance(RID p_font_rid, int p_font_size) const { const FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_font_size); @@ -2766,7 +2766,7 @@ double TextServerAdvanced::_get_extra_advance(RID p_font_rid, int p_font_size) c Vector2 TextServerAdvanced::_font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector2()); + ERR_FAIL_NULL_V(fd, Vector2()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2804,7 +2804,7 @@ Vector2 TextServerAdvanced::_font_get_glyph_advance(const RID &p_font_rid, int64 void TextServerAdvanced::_font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2819,7 +2819,7 @@ void TextServerAdvanced::_font_set_glyph_advance(const RID &p_font_rid, int64_t Vector2 TextServerAdvanced::_font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector2()); + ERR_FAIL_NULL_V(fd, Vector2()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2849,7 +2849,7 @@ Vector2 TextServerAdvanced::_font_get_glyph_offset(const RID &p_font_rid, const void TextServerAdvanced::_font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2864,7 +2864,7 @@ void TextServerAdvanced::_font_set_glyph_offset(const RID &p_font_rid, const Vec Vector2 TextServerAdvanced::_font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector2()); + ERR_FAIL_NULL_V(fd, Vector2()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2894,7 +2894,7 @@ Vector2 TextServerAdvanced::_font_get_glyph_size(const RID &p_font_rid, const Ve void TextServerAdvanced::_font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2909,7 +2909,7 @@ void TextServerAdvanced::_font_set_glyph_size(const RID &p_font_rid, const Vecto Rect2 TextServerAdvanced::_font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Rect2()); + ERR_FAIL_NULL_V(fd, Rect2()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2934,7 +2934,7 @@ Rect2 TextServerAdvanced::_font_get_glyph_uv_rect(const RID &p_font_rid, const V void TextServerAdvanced::_font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2949,7 +2949,7 @@ void TextServerAdvanced::_font_set_glyph_uv_rect(const RID &p_font_rid, const Ve int64_t TextServerAdvanced::_font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, -1); + ERR_FAIL_NULL_V(fd, -1); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2974,7 +2974,7 @@ int64_t TextServerAdvanced::_font_get_glyph_texture_idx(const RID &p_font_rid, c void TextServerAdvanced::_font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2989,7 +2989,7 @@ void TextServerAdvanced::_font_set_glyph_texture_idx(const RID &p_font_rid, cons RID TextServerAdvanced::_font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, RID()); + ERR_FAIL_NULL_V(fd, RID()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -3035,7 +3035,7 @@ RID TextServerAdvanced::_font_get_glyph_texture_rid(const RID &p_font_rid, const Size2 TextServerAdvanced::_font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Size2()); + ERR_FAIL_NULL_V(fd, Size2()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -3081,7 +3081,7 @@ Size2 TextServerAdvanced::_font_get_glyph_texture_size(const RID &p_font_rid, co Dictionary TextServerAdvanced::_font_get_glyph_contours(const RID &p_font_rid, int64_t p_size, int64_t p_index) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -3131,7 +3131,7 @@ Dictionary TextServerAdvanced::_font_get_glyph_contours(const RID &p_font_rid, i TypedArray TextServerAdvanced::_font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, TypedArray()); + ERR_FAIL_NULL_V(fd, TypedArray()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -3147,7 +3147,7 @@ TypedArray TextServerAdvanced::_font_get_kerning_list(const RID &p_fon void TextServerAdvanced::_font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -3158,7 +3158,7 @@ void TextServerAdvanced::_font_clear_kerning_map(const RID &p_font_rid, int64_t void TextServerAdvanced::_font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -3169,7 +3169,7 @@ void TextServerAdvanced::_font_remove_kerning(const RID &p_font_rid, int64_t p_s void TextServerAdvanced::_font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -3180,7 +3180,7 @@ void TextServerAdvanced::_font_set_kerning(const RID &p_font_rid, int64_t p_size Vector2 TextServerAdvanced::_font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector2()); + ERR_FAIL_NULL_V(fd, Vector2()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -3213,7 +3213,7 @@ Vector2 TextServerAdvanced::_font_get_kerning(const RID &p_font_rid, int64_t p_s int64_t TextServerAdvanced::_font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); ERR_FAIL_COND_V_MSG((p_char >= 0xd800 && p_char <= 0xdfff) || (p_char > 0x10ffff), 0, "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_char, 16) + "."); ERR_FAIL_COND_V_MSG((p_variation_selector >= 0xd800 && p_variation_selector <= 0xdfff) || (p_variation_selector > 0x10ffff), 0, "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_variation_selector, 16) + "."); @@ -3238,7 +3238,7 @@ int64_t TextServerAdvanced::_font_get_glyph_index(const RID &p_font_rid, int64_t int64_t TextServerAdvanced::_font_get_char_from_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_glyph_index) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -3290,7 +3290,7 @@ bool TextServerAdvanced::_font_has_char(const RID &p_font_rid, int64_t p_char) c String TextServerAdvanced::_font_get_supported_chars(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, String()); + ERR_FAIL_NULL_V(fd, String()); MutexLock lock(fd->mutex); if (fd->cache.is_empty()) { @@ -3323,7 +3323,7 @@ String TextServerAdvanced::_font_get_supported_chars(const RID &p_font_rid) cons void TextServerAdvanced::_font_render_range(const RID &p_font_rid, const Vector2i &p_size, int64_t p_start, int64_t p_end) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); ERR_FAIL_COND_MSG((p_start >= 0xd800 && p_start <= 0xdfff) || (p_start > 0x10ffff), "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_start, 16) + "."); ERR_FAIL_COND_MSG((p_end >= 0xd800 && p_end <= 0xdfff) || (p_end > 0x10ffff), "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_end, 16) + "."); @@ -3358,7 +3358,7 @@ void TextServerAdvanced::_font_render_range(const RID &p_font_rid, const Vector2 void TextServerAdvanced::_font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -3389,7 +3389,7 @@ void TextServerAdvanced::_font_render_glyph(const RID &p_font_rid, const Vector2 void TextServerAdvanced::_font_draw_glyph(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -3481,7 +3481,7 @@ void TextServerAdvanced::_font_draw_glyph(const RID &p_font_rid, const RID &p_ca void TextServerAdvanced::_font_draw_glyph_outline(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, Vector2i(p_size, p_outline_size)); @@ -3573,7 +3573,7 @@ void TextServerAdvanced::_font_draw_glyph_outline(const RID &p_font_rid, const R bool TextServerAdvanced::_font_is_language_supported(const RID &p_font_rid, const String &p_language) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); if (fd->language_support_overrides.has(p_language)) { @@ -3585,7 +3585,7 @@ bool TextServerAdvanced::_font_is_language_supported(const RID &p_font_rid, cons void TextServerAdvanced::_font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->language_support_overrides[p_language] = p_supported; @@ -3593,7 +3593,7 @@ void TextServerAdvanced::_font_set_language_support_override(const RID &p_font_r bool TextServerAdvanced::_font_get_language_support_override(const RID &p_font_rid, const String &p_language) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->language_support_overrides[p_language]; @@ -3601,7 +3601,7 @@ bool TextServerAdvanced::_font_get_language_support_override(const RID &p_font_r void TextServerAdvanced::_font_remove_language_support_override(const RID &p_font_rid, const String &p_language) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->language_support_overrides.erase(p_language); @@ -3609,7 +3609,7 @@ void TextServerAdvanced::_font_remove_language_support_override(const RID &p_fon PackedStringArray TextServerAdvanced::_font_get_language_support_overrides(const RID &p_font_rid) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, PackedStringArray()); + ERR_FAIL_NULL_V(fd, PackedStringArray()); MutexLock lock(fd->mutex); PackedStringArray out; @@ -3621,7 +3621,7 @@ PackedStringArray TextServerAdvanced::_font_get_language_support_overrides(const bool TextServerAdvanced::_font_is_script_supported(const RID &p_font_rid, const String &p_script) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); if (fd->script_support_overrides.has(p_script)) { @@ -3635,7 +3635,7 @@ bool TextServerAdvanced::_font_is_script_supported(const RID &p_font_rid, const void TextServerAdvanced::_font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->script_support_overrides[p_script] = p_supported; @@ -3643,7 +3643,7 @@ void TextServerAdvanced::_font_set_script_support_override(const RID &p_font_rid bool TextServerAdvanced::_font_get_script_support_override(const RID &p_font_rid, const String &p_script) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->script_support_overrides[p_script]; @@ -3651,7 +3651,7 @@ bool TextServerAdvanced::_font_get_script_support_override(const RID &p_font_rid void TextServerAdvanced::_font_remove_script_support_override(const RID &p_font_rid, const String &p_script) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->script_support_overrides.erase(p_script); @@ -3659,7 +3659,7 @@ void TextServerAdvanced::_font_remove_script_support_override(const RID &p_font_ PackedStringArray TextServerAdvanced::_font_get_script_support_overrides(const RID &p_font_rid) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, PackedStringArray()); + ERR_FAIL_NULL_V(fd, PackedStringArray()); MutexLock lock(fd->mutex); PackedStringArray out; @@ -3671,7 +3671,7 @@ PackedStringArray TextServerAdvanced::_font_get_script_support_overrides(const R void TextServerAdvanced::_font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -3681,7 +3681,7 @@ void TextServerAdvanced::_font_set_opentype_feature_overrides(const RID &p_font_ Dictionary TextServerAdvanced::_font_get_opentype_feature_overrides(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); return fd->feature_overrides; @@ -3689,7 +3689,7 @@ Dictionary TextServerAdvanced::_font_get_opentype_feature_overrides(const RID &p Dictionary TextServerAdvanced::_font_supported_feature_list(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -3699,7 +3699,7 @@ Dictionary TextServerAdvanced::_font_supported_feature_list(const RID &p_font_ri Dictionary TextServerAdvanced::_font_supported_variation_list(const RID &p_font_rid) const { FontAdvanced *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -3843,7 +3843,7 @@ RID TextServerAdvanced::_create_shaped_text(TextServer::Direction p_direction, T void TextServerAdvanced::_shaped_text_clear(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); sd->parent = RID(); @@ -3859,7 +3859,7 @@ void TextServerAdvanced::_shaped_text_clear(const RID &p_shaped) { void TextServerAdvanced::_shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_MSG(p_direction == DIRECTION_INHERITED, "Invalid text direction."); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); if (sd->direction != p_direction) { @@ -3873,7 +3873,7 @@ void TextServerAdvanced::_shaped_text_set_direction(const RID &p_shaped, TextSer TextServer::Direction TextServerAdvanced::_shaped_text_get_direction(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, TextServer::DIRECTION_LTR); + ERR_FAIL_NULL_V(sd, TextServer::DIRECTION_LTR); MutexLock lock(sd->mutex); return sd->direction; @@ -3881,7 +3881,7 @@ TextServer::Direction TextServerAdvanced::_shaped_text_get_direction(const RID & TextServer::Direction TextServerAdvanced::_shaped_text_get_inferred_direction(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, TextServer::DIRECTION_LTR); + ERR_FAIL_NULL_V(sd, TextServer::DIRECTION_LTR); MutexLock lock(sd->mutex); return sd->para_direction; @@ -3890,7 +3890,7 @@ TextServer::Direction TextServerAdvanced::_shaped_text_get_inferred_direction(co void TextServerAdvanced::_shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) { _THREAD_SAFE_METHOD_ ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); if (sd->custom_punct != p_punct) { if (sd->parent != RID()) { @@ -3904,13 +3904,13 @@ void TextServerAdvanced::_shaped_text_set_custom_punctuation(const RID &p_shaped String TextServerAdvanced::_shaped_text_get_custom_punctuation(const RID &p_shaped) const { _THREAD_SAFE_METHOD_ const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, String()); + ERR_FAIL_NULL_V(sd, String()); return sd->custom_punct; } void TextServerAdvanced::_shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); if (sd->parent != RID()) { @@ -3931,7 +3931,7 @@ void TextServerAdvanced::_shaped_text_set_bidi_override(const RID &p_shaped, con void TextServerAdvanced::_shaped_text_set_orientation(const RID &p_shaped, TextServer::Orientation p_orientation) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); if (sd->orientation != p_orientation) { @@ -3945,7 +3945,7 @@ void TextServerAdvanced::_shaped_text_set_orientation(const RID &p_shaped, TextS void TextServerAdvanced::_shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); ERR_FAIL_COND(sd->parent != RID()); @@ -3957,7 +3957,7 @@ void TextServerAdvanced::_shaped_text_set_preserve_invalid(const RID &p_shaped, bool TextServerAdvanced::_shaped_text_get_preserve_invalid(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); return sd->preserve_invalid; @@ -3965,7 +3965,7 @@ bool TextServerAdvanced::_shaped_text_get_preserve_invalid(const RID &p_shaped) void TextServerAdvanced::_shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); if (sd->preserve_control != p_enabled) { @@ -3979,7 +3979,7 @@ void TextServerAdvanced::_shaped_text_set_preserve_control(const RID &p_shaped, bool TextServerAdvanced::_shaped_text_get_preserve_control(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); return sd->preserve_control; @@ -3988,7 +3988,7 @@ bool TextServerAdvanced::_shaped_text_get_preserve_control(const RID &p_shaped) void TextServerAdvanced::_shaped_text_set_spacing(const RID &p_shaped, SpacingType p_spacing, int64_t p_value) { ERR_FAIL_INDEX((int)p_spacing, 4); ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); if (sd->extra_spacing[p_spacing] != p_value) { @@ -4004,7 +4004,7 @@ int64_t TextServerAdvanced::_shaped_text_get_spacing(const RID &p_shaped, Spacin ERR_FAIL_INDEX_V((int)p_spacing, 4, 0); const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0); + ERR_FAIL_NULL_V(sd, 0); MutexLock lock(sd->mutex); return sd->extra_spacing[p_spacing]; @@ -4012,7 +4012,7 @@ int64_t TextServerAdvanced::_shaped_text_get_spacing(const RID &p_shaped, Spacin TextServer::Orientation TextServerAdvanced::_shaped_text_get_orientation(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, TextServer::ORIENTATION_HORIZONTAL); + ERR_FAIL_NULL_V(sd, TextServer::ORIENTATION_HORIZONTAL); MutexLock lock(sd->mutex); return sd->orientation; @@ -4020,20 +4020,20 @@ TextServer::Orientation TextServerAdvanced::_shaped_text_get_orientation(const R int64_t TextServerAdvanced::_shaped_get_span_count(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0); + ERR_FAIL_NULL_V(sd, 0); return sd->spans.size(); } Variant TextServerAdvanced::_shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, Variant()); + ERR_FAIL_NULL_V(sd, Variant()); ERR_FAIL_INDEX_V(p_index, sd->spans.size(), Variant()); return sd->spans[p_index].meta; } void TextServerAdvanced::_shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); ERR_FAIL_INDEX(p_index, sd->spans.size()); ShapedTextDataAdvanced::Span &span = sd->spans.ptrw()[p_index]; @@ -4046,7 +4046,7 @@ void TextServerAdvanced::_shaped_set_span_update_font(const RID &p_shaped, int64 bool TextServerAdvanced::_shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); ERR_FAIL_COND_V(p_size <= 0, false); MutexLock lock(sd->mutex); @@ -4082,7 +4082,7 @@ bool TextServerAdvanced::_shaped_text_add_string(const RID &p_shaped, const Stri bool TextServerAdvanced::_shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, double p_baseline) { _THREAD_SAFE_METHOD_ ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); ERR_FAIL_COND_V(p_key == Variant(), false); ERR_FAIL_COND_V(sd->objects.has(p_key), false); @@ -4112,7 +4112,7 @@ bool TextServerAdvanced::_shaped_text_add_object(const RID &p_shaped, const Vari bool TextServerAdvanced::_shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); ERR_FAIL_COND_V(!sd->objects.has(p_key), false); @@ -4255,7 +4255,7 @@ void TextServerAdvanced::_realign(ShapedTextDataAdvanced *p_sd) const { RID TextServerAdvanced::_shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const { _THREAD_SAFE_METHOD_ const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, RID()); + ERR_FAIL_NULL_V(sd, RID()); MutexLock lock(sd->mutex); if (sd->parent != RID()) { @@ -4439,7 +4439,7 @@ bool TextServerAdvanced::_shape_substr(ShapedTextDataAdvanced *p_new_sd, const S RID TextServerAdvanced::_shaped_text_get_parent(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, RID()); + ERR_FAIL_NULL_V(sd, RID()); MutexLock lock(sd->mutex); return sd->parent; @@ -4447,7 +4447,7 @@ RID TextServerAdvanced::_shaped_text_get_parent(const RID &p_shaped) const { double TextServerAdvanced::_shaped_text_fit_to_width(const RID &p_shaped, double p_width, BitField p_jst_flags) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4604,7 +4604,7 @@ double TextServerAdvanced::_shaped_text_fit_to_width(const RID &p_shaped, double double TextServerAdvanced::_shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4660,7 +4660,7 @@ double TextServerAdvanced::_shaped_text_tab_align(const RID &p_shaped, const Pac void TextServerAdvanced::_shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, BitField p_trim_flags) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped_line); - ERR_FAIL_COND_MSG(!sd, "ShapedTextDataAdvanced invalid."); + ERR_FAIL_NULL_MSG(sd, "ShapedTextDataAdvanced invalid."); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4827,7 +4827,7 @@ void TextServerAdvanced::_shaped_text_overrun_trim_to_width(const RID &p_shaped_ int64_t TextServerAdvanced::_shaped_text_get_trim_pos(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V_MSG(!sd, -1, "ShapedTextDataAdvanced invalid."); + ERR_FAIL_NULL_V_MSG(sd, -1, "ShapedTextDataAdvanced invalid."); MutexLock lock(sd->mutex); return sd->overrun_trim_data.trim_pos; @@ -4835,7 +4835,7 @@ int64_t TextServerAdvanced::_shaped_text_get_trim_pos(const RID &p_shaped) const int64_t TextServerAdvanced::_shaped_text_get_ellipsis_pos(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V_MSG(!sd, -1, "ShapedTextDataAdvanced invalid."); + ERR_FAIL_NULL_V_MSG(sd, -1, "ShapedTextDataAdvanced invalid."); MutexLock lock(sd->mutex); return sd->overrun_trim_data.ellipsis_pos; @@ -4843,7 +4843,7 @@ int64_t TextServerAdvanced::_shaped_text_get_ellipsis_pos(const RID &p_shaped) c const Glyph *TextServerAdvanced::_shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V_MSG(!sd, nullptr, "ShapedTextDataAdvanced invalid."); + ERR_FAIL_NULL_V_MSG(sd, nullptr, "ShapedTextDataAdvanced invalid."); MutexLock lock(sd->mutex); return sd->overrun_trim_data.ellipsis_glyph_buf.ptr(); @@ -4851,7 +4851,7 @@ const Glyph *TextServerAdvanced::_shaped_text_get_ellipsis_glyphs(const RID &p_s int64_t TextServerAdvanced::_shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V_MSG(!sd, 0, "ShapedTextDataAdvanced invalid."); + ERR_FAIL_NULL_V_MSG(sd, 0, "ShapedTextDataAdvanced invalid."); MutexLock lock(sd->mutex); return sd->overrun_trim_data.ellipsis_glyph_buf.size(); @@ -4914,7 +4914,7 @@ void TextServerAdvanced::_update_chars(ShapedTextDataAdvanced *p_sd) const { PackedInt32Array TextServerAdvanced::_shaped_text_get_character_breaks(const RID &p_shaped) const { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, PackedInt32Array()); + ERR_FAIL_NULL_V(sd, PackedInt32Array()); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4928,7 +4928,7 @@ PackedInt32Array TextServerAdvanced::_shaped_text_get_character_breaks(const RID bool TextServerAdvanced::_shaped_text_update_breaks(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -5193,7 +5193,7 @@ _FORCE_INLINE_ int64_t _generate_kashida_justification_opportunies(const String bool TextServerAdvanced::_shaped_text_update_justification_ops(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -5347,7 +5347,7 @@ Glyph TextServerAdvanced::_shape_single_glyph(ShapedTextDataAdvanced *p_sd, char hb_font_t *hb_font = _font_get_hb_handle(p_font, p_font_size); double scale = _font_get_scale(p_font, p_font_size); bool subpos = (scale != 1.0) || (_font_get_subpixel_positioning(p_font) == SUBPIXEL_POSITIONING_ONE_HALF) || (_font_get_subpixel_positioning(p_font) == SUBPIXEL_POSITIONING_ONE_QUARTER) || (_font_get_subpixel_positioning(p_font) == SUBPIXEL_POSITIONING_AUTO && p_font_size <= SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE); - ERR_FAIL_COND_V(hb_font == nullptr, Glyph()); + ERR_FAIL_NULL_V(hb_font, Glyph()); hb_buffer_clear_contents(p_sd->hb_buffer); hb_buffer_set_direction(p_sd->hb_buffer, p_direction); @@ -5634,7 +5634,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star } FontAdvanced *fd = font_owner.get_or_null(f); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i fss = _get_size(fd, fs); @@ -5645,7 +5645,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star bool last_run = (p_sd->end == p_end); double ea = _get_extra_advance(f, fs); bool subpos = (scale != 1.0) || (_font_get_subpixel_positioning(f) == SUBPIXEL_POSITIONING_ONE_HALF) || (_font_get_subpixel_positioning(f) == SUBPIXEL_POSITIONING_ONE_QUARTER) || (_font_get_subpixel_positioning(f) == SUBPIXEL_POSITIONING_AUTO && fs <= SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE); - ERR_FAIL_COND(hb_font == nullptr); + ERR_FAIL_NULL(hb_font); hb_buffer_clear_contents(p_sd->hb_buffer); hb_buffer_set_direction(p_sd->hb_buffer, p_direction); @@ -5836,7 +5836,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) { _THREAD_SAFE_METHOD_ ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); if (sd->valid) { @@ -6052,7 +6052,7 @@ bool TextServerAdvanced::_shaped_text_shape(const RID &p_shaped) { bool TextServerAdvanced::_shaped_text_is_ready(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); return sd->valid; @@ -6060,7 +6060,7 @@ bool TextServerAdvanced::_shaped_text_is_ready(const RID &p_shaped) const { const Glyph *TextServerAdvanced::_shaped_text_get_glyphs(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, nullptr); + ERR_FAIL_NULL_V(sd, nullptr); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -6071,7 +6071,7 @@ const Glyph *TextServerAdvanced::_shaped_text_get_glyphs(const RID &p_shaped) co int64_t TextServerAdvanced::_shaped_text_get_glyph_count(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0); + ERR_FAIL_NULL_V(sd, 0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -6082,7 +6082,7 @@ int64_t TextServerAdvanced::_shaped_text_get_glyph_count(const RID &p_shaped) co const Glyph *TextServerAdvanced::_shaped_text_sort_logical(const RID &p_shaped) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, nullptr); + ERR_FAIL_NULL_V(sd, nullptr); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -6100,7 +6100,7 @@ const Glyph *TextServerAdvanced::_shaped_text_sort_logical(const RID &p_shaped) Vector2i TextServerAdvanced::_shaped_text_get_range(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, Vector2i()); + ERR_FAIL_NULL_V(sd, Vector2i()); MutexLock lock(sd->mutex); return Vector2(sd->start, sd->end); @@ -6109,7 +6109,7 @@ Vector2i TextServerAdvanced::_shaped_text_get_range(const RID &p_shaped) const { Array TextServerAdvanced::_shaped_text_get_objects(const RID &p_shaped) const { Array ret; const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, ret); + ERR_FAIL_NULL_V(sd, ret); MutexLock lock(sd->mutex); for (const KeyValue &E : sd->objects) { @@ -6121,7 +6121,7 @@ Array TextServerAdvanced::_shaped_text_get_objects(const RID &p_shaped) const { Rect2 TextServerAdvanced::_shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, Rect2()); + ERR_FAIL_NULL_V(sd, Rect2()); MutexLock lock(sd->mutex); ERR_FAIL_COND_V(!sd->objects.has(p_key), Rect2()); @@ -6133,7 +6133,7 @@ Rect2 TextServerAdvanced::_shaped_text_get_object_rect(const RID &p_shaped, cons Size2 TextServerAdvanced::_shaped_text_get_size(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, Size2()); + ERR_FAIL_NULL_V(sd, Size2()); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -6148,7 +6148,7 @@ Size2 TextServerAdvanced::_shaped_text_get_size(const RID &p_shaped) const { double TextServerAdvanced::_shaped_text_get_ascent(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -6159,7 +6159,7 @@ double TextServerAdvanced::_shaped_text_get_ascent(const RID &p_shaped) const { double TextServerAdvanced::_shaped_text_get_descent(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -6170,7 +6170,7 @@ double TextServerAdvanced::_shaped_text_get_descent(const RID &p_shaped) const { double TextServerAdvanced::_shaped_text_get_width(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -6181,7 +6181,7 @@ double TextServerAdvanced::_shaped_text_get_width(const RID &p_shaped) const { double TextServerAdvanced::_shaped_text_get_underline_position(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -6193,7 +6193,7 @@ double TextServerAdvanced::_shaped_text_get_underline_position(const RID &p_shap double TextServerAdvanced::_shaped_text_get_underline_thickness(const RID &p_shaped) const { const ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 26d16a1ec9d..c3b64929a9a 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -937,7 +937,7 @@ RID TextServerFallback::_create_font() { void TextServerFallback::_font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); _font_clear_cache(fd); @@ -948,7 +948,7 @@ void TextServerFallback::_font_set_data(const RID &p_font_rid, const PackedByteA void TextServerFallback::_font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); _font_clear_cache(fd); @@ -959,7 +959,7 @@ void TextServerFallback::_font_set_data_ptr(const RID &p_font_rid, const uint8_t void TextServerFallback::_font_set_style(const RID &p_font_rid, BitField p_style) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -972,7 +972,7 @@ void TextServerFallback::_font_set_face_index(const RID &p_font_rid, int64_t p_f ERR_FAIL_COND(p_face_index >= 0x7FFF); FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->face_index != p_face_index) { @@ -983,7 +983,7 @@ void TextServerFallback::_font_set_face_index(const RID &p_font_rid, int64_t p_f int64_t TextServerFallback::_font_get_face_index(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); return fd->face_index; @@ -991,7 +991,7 @@ int64_t TextServerFallback::_font_get_face_index(const RID &p_font_rid) const { int64_t TextServerFallback::_font_get_face_count(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); int face_count = 0; @@ -1037,7 +1037,7 @@ int64_t TextServerFallback::_font_get_face_count(const RID &p_font_rid) const { BitField TextServerFallback::_font_get_style(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1047,7 +1047,7 @@ BitField TextServerFallback::_font_get_style(const RID &p void TextServerFallback::_font_set_style_name(const RID &p_font_rid, const String &p_name) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1057,7 +1057,7 @@ void TextServerFallback::_font_set_style_name(const RID &p_font_rid, const Strin String TextServerFallback::_font_get_style_name(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, String()); + ERR_FAIL_NULL_V(fd, String()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1067,7 +1067,7 @@ String TextServerFallback::_font_get_style_name(const RID &p_font_rid) const { void TextServerFallback::_font_set_weight(const RID &p_font_rid, int64_t p_weight) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1077,7 +1077,7 @@ void TextServerFallback::_font_set_weight(const RID &p_font_rid, int64_t p_weigh int64_t TextServerFallback::_font_get_weight(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 400); + ERR_FAIL_NULL_V(fd, 400); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1087,7 +1087,7 @@ int64_t TextServerFallback::_font_get_weight(const RID &p_font_rid) const { void TextServerFallback::_font_set_stretch(const RID &p_font_rid, int64_t p_stretch) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1097,7 +1097,7 @@ void TextServerFallback::_font_set_stretch(const RID &p_font_rid, int64_t p_stre int64_t TextServerFallback::_font_get_stretch(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 100); + ERR_FAIL_NULL_V(fd, 100); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1107,7 +1107,7 @@ int64_t TextServerFallback::_font_get_stretch(const RID &p_font_rid) const { void TextServerFallback::_font_set_name(const RID &p_font_rid, const String &p_name) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1117,7 +1117,7 @@ void TextServerFallback::_font_set_name(const RID &p_font_rid, const String &p_n String TextServerFallback::_font_get_name(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, String()); + ERR_FAIL_NULL_V(fd, String()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -1127,7 +1127,7 @@ String TextServerFallback::_font_get_name(const RID &p_font_rid) const { void TextServerFallback::_font_set_antialiasing(const RID &p_font_rid, TextServer::FontAntialiasing p_antialiasing) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->antialiasing != p_antialiasing) { @@ -1138,7 +1138,7 @@ void TextServerFallback::_font_set_antialiasing(const RID &p_font_rid, TextServe TextServer::FontAntialiasing TextServerFallback::_font_get_antialiasing(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, TextServer::FONT_ANTIALIASING_NONE); + ERR_FAIL_NULL_V(fd, TextServer::FONT_ANTIALIASING_NONE); MutexLock lock(fd->mutex); return fd->antialiasing; @@ -1146,7 +1146,7 @@ TextServer::FontAntialiasing TextServerFallback::_font_get_antialiasing(const RI void TextServerFallback::_font_set_generate_mipmaps(const RID &p_font_rid, bool p_generate_mipmaps) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->mipmaps != p_generate_mipmaps) { @@ -1162,7 +1162,7 @@ void TextServerFallback::_font_set_generate_mipmaps(const RID &p_font_rid, bool bool TextServerFallback::_font_get_generate_mipmaps(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->mipmaps; @@ -1170,7 +1170,7 @@ bool TextServerFallback::_font_get_generate_mipmaps(const RID &p_font_rid) const void TextServerFallback::_font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->msdf != p_msdf) { @@ -1181,7 +1181,7 @@ void TextServerFallback::_font_set_multichannel_signed_distance_field(const RID bool TextServerFallback::_font_is_multichannel_signed_distance_field(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->msdf; @@ -1189,7 +1189,7 @@ bool TextServerFallback::_font_is_multichannel_signed_distance_field(const RID & void TextServerFallback::_font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->msdf_range != p_msdf_pixel_range) { @@ -1200,7 +1200,7 @@ void TextServerFallback::_font_set_msdf_pixel_range(const RID &p_font_rid, int64 int64_t TextServerFallback::_font_get_msdf_pixel_range(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->msdf_range; @@ -1208,7 +1208,7 @@ int64_t TextServerFallback::_font_get_msdf_pixel_range(const RID &p_font_rid) co void TextServerFallback::_font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->msdf_source_size != p_msdf_size) { @@ -1219,7 +1219,7 @@ void TextServerFallback::_font_set_msdf_size(const RID &p_font_rid, int64_t p_ms int64_t TextServerFallback::_font_get_msdf_size(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->msdf_source_size; @@ -1227,7 +1227,7 @@ int64_t TextServerFallback::_font_get_msdf_size(const RID &p_font_rid) const { void TextServerFallback::_font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->fixed_size = p_fixed_size; @@ -1235,7 +1235,7 @@ void TextServerFallback::_font_set_fixed_size(const RID &p_font_rid, int64_t p_f int64_t TextServerFallback::_font_get_fixed_size(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->fixed_size; @@ -1243,7 +1243,7 @@ int64_t TextServerFallback::_font_get_fixed_size(const RID &p_font_rid) const { void TextServerFallback::_font_set_allow_system_fallback(const RID &p_font_rid, bool p_allow_system_fallback) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->allow_system_fallback = p_allow_system_fallback; @@ -1251,7 +1251,7 @@ void TextServerFallback::_font_set_allow_system_fallback(const RID &p_font_rid, bool TextServerFallback::_font_is_allow_system_fallback(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->allow_system_fallback; @@ -1259,7 +1259,7 @@ bool TextServerFallback::_font_is_allow_system_fallback(const RID &p_font_rid) c void TextServerFallback::_font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->force_autohinter != p_force_autohinter) { @@ -1270,7 +1270,7 @@ void TextServerFallback::_font_set_force_autohinter(const RID &p_font_rid, bool bool TextServerFallback::_font_is_force_autohinter(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->force_autohinter; @@ -1278,7 +1278,7 @@ bool TextServerFallback::_font_is_force_autohinter(const RID &p_font_rid) const void TextServerFallback::_font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->hinting != p_hinting) { @@ -1289,7 +1289,7 @@ void TextServerFallback::_font_set_hinting(const RID &p_font_rid, TextServer::Hi TextServer::Hinting TextServerFallback::_font_get_hinting(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, HINTING_NONE); + ERR_FAIL_NULL_V(fd, HINTING_NONE); MutexLock lock(fd->mutex); return fd->hinting; @@ -1297,7 +1297,7 @@ TextServer::Hinting TextServerFallback::_font_get_hinting(const RID &p_font_rid) void TextServerFallback::_font_set_subpixel_positioning(const RID &p_font_rid, TextServer::SubpixelPositioning p_subpixel) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->subpixel_positioning = p_subpixel; @@ -1305,7 +1305,7 @@ void TextServerFallback::_font_set_subpixel_positioning(const RID &p_font_rid, T TextServer::SubpixelPositioning TextServerFallback::_font_get_subpixel_positioning(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, SUBPIXEL_POSITIONING_DISABLED); + ERR_FAIL_NULL_V(fd, SUBPIXEL_POSITIONING_DISABLED); MutexLock lock(fd->mutex); return fd->subpixel_positioning; @@ -1313,7 +1313,7 @@ TextServer::SubpixelPositioning TextServerFallback::_font_get_subpixel_positioni void TextServerFallback::_font_set_embolden(const RID &p_font_rid, double p_strength) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->embolden != p_strength) { @@ -1324,7 +1324,7 @@ void TextServerFallback::_font_set_embolden(const RID &p_font_rid, double p_stre double TextServerFallback::_font_get_embolden(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); return fd->embolden; @@ -1333,7 +1333,7 @@ double TextServerFallback::_font_get_embolden(const RID &p_font_rid) const { void TextServerFallback::_font_set_spacing(const RID &p_font_rid, SpacingType p_spacing, int64_t p_value) { ERR_FAIL_INDEX((int)p_spacing, 4); FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->extra_spacing[p_spacing] != p_value) { @@ -1346,7 +1346,7 @@ int64_t TextServerFallback::_font_get_spacing(const RID &p_font_rid, SpacingType ERR_FAIL_INDEX_V((int)p_spacing, 4, 0); FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); return fd->extra_spacing[p_spacing]; @@ -1354,7 +1354,7 @@ int64_t TextServerFallback::_font_get_spacing(const RID &p_font_rid, SpacingType void TextServerFallback::_font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->transform != p_transform) { @@ -1365,7 +1365,7 @@ void TextServerFallback::_font_set_transform(const RID &p_font_rid, const Transf Transform2D TextServerFallback::_font_get_transform(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Transform2D()); + ERR_FAIL_NULL_V(fd, Transform2D()); MutexLock lock(fd->mutex); return fd->transform; @@ -1373,7 +1373,7 @@ Transform2D TextServerFallback::_font_get_transform(const RID &p_font_rid) const void TextServerFallback::_font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (!fd->variation_coordinates.recursive_equal(p_variation_coordinates, 1)) { @@ -1384,7 +1384,7 @@ void TextServerFallback::_font_set_variation_coordinates(const RID &p_font_rid, Dictionary TextServerFallback::_font_get_variation_coordinates(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); return fd->variation_coordinates; @@ -1392,7 +1392,7 @@ Dictionary TextServerFallback::_font_get_variation_coordinates(const RID &p_font void TextServerFallback::_font_set_oversampling(const RID &p_font_rid, double p_oversampling) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); if (fd->oversampling != p_oversampling) { @@ -1403,7 +1403,7 @@ void TextServerFallback::_font_set_oversampling(const RID &p_font_rid, double p_ double TextServerFallback::_font_get_oversampling(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); return fd->oversampling; @@ -1411,7 +1411,7 @@ double TextServerFallback::_font_get_oversampling(const RID &p_font_rid) const { TypedArray TextServerFallback::_font_get_size_cache_list(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, TypedArray()); + ERR_FAIL_NULL_V(fd, TypedArray()); MutexLock lock(fd->mutex); TypedArray ret; @@ -1423,7 +1423,7 @@ TypedArray TextServerFallback::_font_get_size_cache_list(const RID &p_ void TextServerFallback::_font_clear_size_cache(const RID &p_font_rid) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); MutexLock ftlock(ft_mutex); @@ -1435,7 +1435,7 @@ void TextServerFallback::_font_clear_size_cache(const RID &p_font_rid) { void TextServerFallback::_font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); MutexLock ftlock(ft_mutex); @@ -1447,7 +1447,7 @@ void TextServerFallback::_font_remove_size_cache(const RID &p_font_rid, const Ve void TextServerFallback::_font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1458,7 +1458,7 @@ void TextServerFallback::_font_set_ascent(const RID &p_font_rid, int64_t p_size, double TextServerFallback::_font_get_ascent(const RID &p_font_rid, int64_t p_size) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1474,7 +1474,7 @@ double TextServerFallback::_font_get_ascent(const RID &p_font_rid, int64_t p_siz void TextServerFallback::_font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); Vector2i size = _get_size(fd, p_size); @@ -1484,7 +1484,7 @@ void TextServerFallback::_font_set_descent(const RID &p_font_rid, int64_t p_size double TextServerFallback::_font_get_descent(const RID &p_font_rid, int64_t p_size) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1500,7 +1500,7 @@ double TextServerFallback::_font_get_descent(const RID &p_font_rid, int64_t p_si void TextServerFallback::_font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1511,7 +1511,7 @@ void TextServerFallback::_font_set_underline_position(const RID &p_font_rid, int double TextServerFallback::_font_get_underline_position(const RID &p_font_rid, int64_t p_size) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1527,7 +1527,7 @@ double TextServerFallback::_font_get_underline_position(const RID &p_font_rid, i void TextServerFallback::_font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1538,7 +1538,7 @@ void TextServerFallback::_font_set_underline_thickness(const RID &p_font_rid, in double TextServerFallback::_font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1554,7 +1554,7 @@ double TextServerFallback::_font_get_underline_thickness(const RID &p_font_rid, void TextServerFallback::_font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1570,7 +1570,7 @@ void TextServerFallback::_font_set_scale(const RID &p_font_rid, int64_t p_size, double TextServerFallback::_font_get_scale(const RID &p_font_rid, int64_t p_size) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0.0); + ERR_FAIL_NULL_V(fd, 0.0); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1586,7 +1586,7 @@ double TextServerFallback::_font_get_scale(const RID &p_font_rid, int64_t p_size int64_t TextServerFallback::_font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, 0); + ERR_FAIL_NULL_V(fd, 0); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1598,7 +1598,7 @@ int64_t TextServerFallback::_font_get_texture_count(const RID &p_font_rid, const void TextServerFallback::_font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1608,7 +1608,7 @@ void TextServerFallback::_font_clear_textures(const RID &p_font_rid, const Vecto void TextServerFallback::_font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1620,7 +1620,7 @@ void TextServerFallback::_font_remove_texture(const RID &p_font_rid, const Vecto void TextServerFallback::_font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref &p_image) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); ERR_FAIL_COND(p_image.is_null()); MutexLock lock(fd->mutex); @@ -1649,7 +1649,7 @@ void TextServerFallback::_font_set_texture_image(const RID &p_font_rid, const Ve Ref TextServerFallback::_font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Ref()); + ERR_FAIL_NULL_V(fd, Ref()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1663,7 +1663,7 @@ Ref TextServerFallback::_font_get_texture_image(const RID &p_font_rid, co void TextServerFallback::_font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offsets) { ERR_FAIL_COND(p_offsets.size() % 4 != 0); FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1682,7 +1682,7 @@ void TextServerFallback::_font_set_texture_offsets(const RID &p_font_rid, const PackedInt32Array TextServerFallback::_font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, PackedInt32Array()); + ERR_FAIL_NULL_V(fd, PackedInt32Array()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1707,7 +1707,7 @@ PackedInt32Array TextServerFallback::_font_get_texture_offsets(const RID &p_font PackedInt32Array TextServerFallback::_font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, PackedInt32Array()); + ERR_FAIL_NULL_V(fd, PackedInt32Array()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1723,7 +1723,7 @@ PackedInt32Array TextServerFallback::_font_get_glyph_list(const RID &p_font_rid, void TextServerFallback::_font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1734,7 +1734,7 @@ void TextServerFallback::_font_clear_glyphs(const RID &p_font_rid, const Vector2 void TextServerFallback::_font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1745,7 +1745,7 @@ void TextServerFallback::_font_remove_glyph(const RID &p_font_rid, const Vector2 Vector2 TextServerFallback::_font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector2()); + ERR_FAIL_NULL_V(fd, Vector2()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1783,7 +1783,7 @@ Vector2 TextServerFallback::_font_get_glyph_advance(const RID &p_font_rid, int64 void TextServerFallback::_font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -1798,7 +1798,7 @@ void TextServerFallback::_font_set_glyph_advance(const RID &p_font_rid, int64_t Vector2 TextServerFallback::_font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector2()); + ERR_FAIL_NULL_V(fd, Vector2()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1828,7 +1828,7 @@ Vector2 TextServerFallback::_font_get_glyph_offset(const RID &p_font_rid, const void TextServerFallback::_font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1843,7 +1843,7 @@ void TextServerFallback::_font_set_glyph_offset(const RID &p_font_rid, const Vec Vector2 TextServerFallback::_font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector2()); + ERR_FAIL_NULL_V(fd, Vector2()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1873,7 +1873,7 @@ Vector2 TextServerFallback::_font_get_glyph_size(const RID &p_font_rid, const Ve void TextServerFallback::_font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1888,7 +1888,7 @@ void TextServerFallback::_font_set_glyph_size(const RID &p_font_rid, const Vecto Rect2 TextServerFallback::_font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Rect2()); + ERR_FAIL_NULL_V(fd, Rect2()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1913,7 +1913,7 @@ Rect2 TextServerFallback::_font_get_glyph_uv_rect(const RID &p_font_rid, const V void TextServerFallback::_font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1928,7 +1928,7 @@ void TextServerFallback::_font_set_glyph_uv_rect(const RID &p_font_rid, const Ve int64_t TextServerFallback::_font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, -1); + ERR_FAIL_NULL_V(fd, -1); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1953,7 +1953,7 @@ int64_t TextServerFallback::_font_get_glyph_texture_idx(const RID &p_font_rid, c void TextServerFallback::_font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -1968,7 +1968,7 @@ void TextServerFallback::_font_set_glyph_texture_idx(const RID &p_font_rid, cons RID TextServerFallback::_font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, RID()); + ERR_FAIL_NULL_V(fd, RID()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2014,7 +2014,7 @@ RID TextServerFallback::_font_get_glyph_texture_rid(const RID &p_font_rid, const Size2 TextServerFallback::_font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Size2()); + ERR_FAIL_NULL_V(fd, Size2()); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2060,7 +2060,7 @@ Size2 TextServerFallback::_font_get_glyph_texture_size(const RID &p_font_rid, co Dictionary TextServerFallback::_font_get_glyph_contours(const RID &p_font_rid, int64_t p_size, int64_t p_index) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2110,7 +2110,7 @@ Dictionary TextServerFallback::_font_get_glyph_contours(const RID &p_font_rid, i TypedArray TextServerFallback::_font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, TypedArray()); + ERR_FAIL_NULL_V(fd, TypedArray()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2126,7 +2126,7 @@ TypedArray TextServerFallback::_font_get_kerning_list(const RID &p_fon void TextServerFallback::_font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2137,7 +2137,7 @@ void TextServerFallback::_font_clear_kerning_map(const RID &p_font_rid, int64_t void TextServerFallback::_font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2148,7 +2148,7 @@ void TextServerFallback::_font_remove_kerning(const RID &p_font_rid, int64_t p_s void TextServerFallback::_font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2159,7 +2159,7 @@ void TextServerFallback::_font_set_kerning(const RID &p_font_rid, int64_t p_size Vector2 TextServerFallback::_font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Vector2()); + ERR_FAIL_NULL_V(fd, Vector2()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2224,7 +2224,7 @@ bool TextServerFallback::_font_has_char(const RID &p_font_rid, int64_t p_char) c String TextServerFallback::_font_get_supported_chars(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, String()); + ERR_FAIL_NULL_V(fd, String()); MutexLock lock(fd->mutex); if (fd->cache.is_empty()) { @@ -2257,7 +2257,7 @@ String TextServerFallback::_font_get_supported_chars(const RID &p_font_rid) cons void TextServerFallback::_font_render_range(const RID &p_font_rid, const Vector2i &p_size, int64_t p_start, int64_t p_end) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); ERR_FAIL_COND_MSG((p_start >= 0xd800 && p_start <= 0xdfff) || (p_start > 0x10ffff), "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_start, 16) + "."); ERR_FAIL_COND_MSG((p_end >= 0xd800 && p_end <= 0xdfff) || (p_end > 0x10ffff), "Unicode parsing error: Invalid unicode codepoint " + String::num_int64(p_end, 16) + "."); @@ -2292,7 +2292,7 @@ void TextServerFallback::_font_render_range(const RID &p_font_rid, const Vector2 void TextServerFallback::_font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, p_size); @@ -2323,7 +2323,7 @@ void TextServerFallback::_font_render_glyph(const RID &p_font_rid, const Vector2 void TextServerFallback::_font_draw_glyph(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, p_size); @@ -2415,7 +2415,7 @@ void TextServerFallback::_font_draw_glyph(const RID &p_font_rid, const RID &p_ca void TextServerFallback::_font_draw_glyph_outline(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size_outline(fd, Vector2i(p_size, p_outline_size)); @@ -2507,7 +2507,7 @@ void TextServerFallback::_font_draw_glyph_outline(const RID &p_font_rid, const R bool TextServerFallback::_font_is_language_supported(const RID &p_font_rid, const String &p_language) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); if (fd->language_support_overrides.has(p_language)) { @@ -2519,7 +2519,7 @@ bool TextServerFallback::_font_is_language_supported(const RID &p_font_rid, cons void TextServerFallback::_font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->language_support_overrides[p_language] = p_supported; @@ -2527,7 +2527,7 @@ void TextServerFallback::_font_set_language_support_override(const RID &p_font_r bool TextServerFallback::_font_get_language_support_override(const RID &p_font_rid, const String &p_language) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->language_support_overrides[p_language]; @@ -2535,7 +2535,7 @@ bool TextServerFallback::_font_get_language_support_override(const RID &p_font_r void TextServerFallback::_font_remove_language_support_override(const RID &p_font_rid, const String &p_language) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->language_support_overrides.erase(p_language); @@ -2543,7 +2543,7 @@ void TextServerFallback::_font_remove_language_support_override(const RID &p_fon PackedStringArray TextServerFallback::_font_get_language_support_overrides(const RID &p_font_rid) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, PackedStringArray()); + ERR_FAIL_NULL_V(fd, PackedStringArray()); MutexLock lock(fd->mutex); PackedStringArray out; @@ -2555,7 +2555,7 @@ PackedStringArray TextServerFallback::_font_get_language_support_overrides(const bool TextServerFallback::_font_is_script_supported(const RID &p_font_rid, const String &p_script) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); if (fd->script_support_overrides.has(p_script)) { @@ -2567,7 +2567,7 @@ bool TextServerFallback::_font_is_script_supported(const RID &p_font_rid, const void TextServerFallback::_font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); fd->script_support_overrides[p_script] = p_supported; @@ -2575,7 +2575,7 @@ void TextServerFallback::_font_set_script_support_override(const RID &p_font_rid bool TextServerFallback::_font_get_script_support_override(const RID &p_font_rid, const String &p_script) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, false); + ERR_FAIL_NULL_V(fd, false); MutexLock lock(fd->mutex); return fd->script_support_overrides[p_script]; @@ -2583,7 +2583,7 @@ bool TextServerFallback::_font_get_script_support_override(const RID &p_font_rid void TextServerFallback::_font_remove_script_support_override(const RID &p_font_rid, const String &p_script) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -2593,7 +2593,7 @@ void TextServerFallback::_font_remove_script_support_override(const RID &p_font_ PackedStringArray TextServerFallback::_font_get_script_support_overrides(const RID &p_font_rid) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, PackedStringArray()); + ERR_FAIL_NULL_V(fd, PackedStringArray()); MutexLock lock(fd->mutex); PackedStringArray out; @@ -2605,7 +2605,7 @@ PackedStringArray TextServerFallback::_font_get_script_support_overrides(const R void TextServerFallback::_font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND(!fd); + ERR_FAIL_NULL(fd); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -2615,7 +2615,7 @@ void TextServerFallback::_font_set_opentype_feature_overrides(const RID &p_font_ Dictionary TextServerFallback::_font_get_opentype_feature_overrides(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); return fd->feature_overrides; @@ -2627,7 +2627,7 @@ Dictionary TextServerFallback::_font_supported_feature_list(const RID &p_font_ri Dictionary TextServerFallback::_font_supported_variation_list(const RID &p_font_rid) const { FontFallback *fd = font_owner.get_or_null(p_font_rid); - ERR_FAIL_COND_V(!fd, Dictionary()); + ERR_FAIL_NULL_V(fd, Dictionary()); MutexLock lock(fd->mutex); Vector2i size = _get_size(fd, 16); @@ -2716,7 +2716,7 @@ RID TextServerFallback::_create_shaped_text(TextServer::Direction p_direction, T void TextServerFallback::_shaped_text_clear(const RID &p_shaped) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); sd->parent = RID(); @@ -2746,7 +2746,7 @@ TextServer::Direction TextServerFallback::_shaped_text_get_inferred_direction(co void TextServerFallback::_shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) { _THREAD_SAFE_METHOD_ ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); if (sd->custom_punct != p_punct) { if (sd->parent != RID()) { @@ -2760,13 +2760,13 @@ void TextServerFallback::_shaped_text_set_custom_punctuation(const RID &p_shaped String TextServerFallback::_shaped_text_get_custom_punctuation(const RID &p_shaped) const { _THREAD_SAFE_METHOD_ const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, String()); + ERR_FAIL_NULL_V(sd, String()); return sd->custom_punct; } void TextServerFallback::_shaped_text_set_orientation(const RID &p_shaped, TextServer::Orientation p_orientation) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); if (sd->orientation != p_orientation) { @@ -2784,7 +2784,7 @@ void TextServerFallback::_shaped_text_set_bidi_override(const RID &p_shaped, con TextServer::Orientation TextServerFallback::_shaped_text_get_orientation(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, TextServer::ORIENTATION_HORIZONTAL); + ERR_FAIL_NULL_V(sd, TextServer::ORIENTATION_HORIZONTAL); MutexLock lock(sd->mutex); return sd->orientation; @@ -2794,7 +2794,7 @@ void TextServerFallback::_shaped_text_set_preserve_invalid(const RID &p_shaped, ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); MutexLock lock(sd->mutex); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); if (sd->preserve_invalid != p_enabled) { if (sd->parent != RID()) { full_copy(sd); @@ -2806,7 +2806,7 @@ void TextServerFallback::_shaped_text_set_preserve_invalid(const RID &p_shaped, bool TextServerFallback::_shaped_text_get_preserve_invalid(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); return sd->preserve_invalid; @@ -2814,7 +2814,7 @@ bool TextServerFallback::_shaped_text_get_preserve_invalid(const RID &p_shaped) void TextServerFallback::_shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); if (sd->preserve_control != p_enabled) { @@ -2828,7 +2828,7 @@ void TextServerFallback::_shaped_text_set_preserve_control(const RID &p_shaped, bool TextServerFallback::_shaped_text_get_preserve_control(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); return sd->preserve_control; @@ -2837,7 +2837,7 @@ bool TextServerFallback::_shaped_text_get_preserve_control(const RID &p_shaped) void TextServerFallback::_shaped_text_set_spacing(const RID &p_shaped, SpacingType p_spacing, int64_t p_value) { ERR_FAIL_INDEX((int)p_spacing, 4); ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); MutexLock lock(sd->mutex); if (sd->extra_spacing[p_spacing] != p_value) { @@ -2853,7 +2853,7 @@ int64_t TextServerFallback::_shaped_text_get_spacing(const RID &p_shaped, Spacin ERR_FAIL_INDEX_V((int)p_spacing, 4, 0); const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0); + ERR_FAIL_NULL_V(sd, 0); MutexLock lock(sd->mutex); return sd->extra_spacing[p_spacing]; @@ -2861,20 +2861,20 @@ int64_t TextServerFallback::_shaped_text_get_spacing(const RID &p_shaped, Spacin int64_t TextServerFallback::_shaped_get_span_count(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0); + ERR_FAIL_NULL_V(sd, 0); return sd->spans.size(); } Variant TextServerFallback::_shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, Variant()); + ERR_FAIL_NULL_V(sd, Variant()); ERR_FAIL_INDEX_V(p_index, sd->spans.size(), Variant()); return sd->spans[p_index].meta; } void TextServerFallback::_shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND(!sd); + ERR_FAIL_NULL(sd); ERR_FAIL_INDEX(p_index, sd->spans.size()); ShapedTextDataFallback::Span &span = sd->spans.ptrw()[p_index]; @@ -2898,7 +2898,7 @@ void TextServerFallback::_shaped_set_span_update_font(const RID &p_shaped, int64 bool TextServerFallback::_shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); ERR_FAIL_COND_V(p_size <= 0, false); @@ -2949,7 +2949,7 @@ bool TextServerFallback::_shaped_text_add_string(const RID &p_shaped, const Stri bool TextServerFallback::_shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, double p_baseline) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); ERR_FAIL_COND_V(p_key == Variant(), false); @@ -2981,7 +2981,7 @@ bool TextServerFallback::_shaped_text_add_object(const RID &p_shaped, const Vari bool TextServerFallback::_shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); ERR_FAIL_COND_V(!sd->objects.has(p_key), false); @@ -3125,7 +3125,7 @@ RID TextServerFallback::_shaped_text_substr(const RID &p_shaped, int64_t p_start _THREAD_SAFE_METHOD_ const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, RID()); + ERR_FAIL_NULL_V(sd, RID()); MutexLock lock(sd->mutex); if (sd->parent != RID()) { @@ -3217,7 +3217,7 @@ RID TextServerFallback::_shaped_text_substr(const RID &p_shaped, int64_t p_start RID TextServerFallback::_shaped_text_get_parent(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, RID()); + ERR_FAIL_NULL_V(sd, RID()); MutexLock lock(sd->mutex); return sd->parent; @@ -3225,7 +3225,7 @@ RID TextServerFallback::_shaped_text_get_parent(const RID &p_shaped) const { double TextServerFallback::_shaped_text_fit_to_width(const RID &p_shaped, double p_width, BitField p_jst_flags) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3334,7 +3334,7 @@ double TextServerFallback::_shaped_text_fit_to_width(const RID &p_shaped, double double TextServerFallback::_shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3390,7 +3390,7 @@ double TextServerFallback::_shaped_text_tab_align(const RID &p_shaped, const Pac bool TextServerFallback::_shaped_text_update_breaks(const RID &p_shaped) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3446,7 +3446,7 @@ bool TextServerFallback::_shaped_text_update_breaks(const RID &p_shaped) { bool TextServerFallback::_shaped_text_update_justification_ops(const RID &p_shaped) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3462,7 +3462,7 @@ bool TextServerFallback::_shaped_text_update_justification_ops(const RID &p_shap void TextServerFallback::_shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, BitField p_trim_flags) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped_line); - ERR_FAIL_COND_MSG(!sd, "ShapedTextDataFallback invalid."); + ERR_FAIL_NULL_MSG(sd, "ShapedTextDataFallback invalid."); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3619,7 +3619,7 @@ void TextServerFallback::_shaped_text_overrun_trim_to_width(const RID &p_shaped_ int64_t TextServerFallback::_shaped_text_get_trim_pos(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V_MSG(!sd, -1, "ShapedTextDataFallback invalid."); + ERR_FAIL_NULL_V_MSG(sd, -1, "ShapedTextDataFallback invalid."); MutexLock lock(sd->mutex); return sd->overrun_trim_data.trim_pos; @@ -3627,7 +3627,7 @@ int64_t TextServerFallback::_shaped_text_get_trim_pos(const RID &p_shaped) const int64_t TextServerFallback::_shaped_text_get_ellipsis_pos(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V_MSG(!sd, -1, "ShapedTextDataFallback invalid."); + ERR_FAIL_NULL_V_MSG(sd, -1, "ShapedTextDataFallback invalid."); MutexLock lock(sd->mutex); return sd->overrun_trim_data.ellipsis_pos; @@ -3635,7 +3635,7 @@ int64_t TextServerFallback::_shaped_text_get_ellipsis_pos(const RID &p_shaped) c const Glyph *TextServerFallback::_shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V_MSG(!sd, nullptr, "ShapedTextDataFallback invalid."); + ERR_FAIL_NULL_V_MSG(sd, nullptr, "ShapedTextDataFallback invalid."); MutexLock lock(sd->mutex); return sd->overrun_trim_data.ellipsis_glyph_buf.ptr(); @@ -3643,7 +3643,7 @@ const Glyph *TextServerFallback::_shaped_text_get_ellipsis_glyphs(const RID &p_s int64_t TextServerFallback::_shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V_MSG(!sd, 0, "ShapedTextDataFallback invalid."); + ERR_FAIL_NULL_V_MSG(sd, 0, "ShapedTextDataFallback invalid."); MutexLock lock(sd->mutex); return sd->overrun_trim_data.ellipsis_glyph_buf.size(); @@ -3651,7 +3651,7 @@ int64_t TextServerFallback::_shaped_text_get_ellipsis_glyph_count(const RID &p_s bool TextServerFallback::_shaped_text_shape(const RID &p_shaped) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); if (sd->valid) { @@ -3960,7 +3960,7 @@ bool TextServerFallback::_shaped_text_shape(const RID &p_shaped) { bool TextServerFallback::_shaped_text_is_ready(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, false); + ERR_FAIL_NULL_V(sd, false); MutexLock lock(sd->mutex); return sd->valid; @@ -3968,7 +3968,7 @@ bool TextServerFallback::_shaped_text_is_ready(const RID &p_shaped) const { const Glyph *TextServerFallback::_shaped_text_get_glyphs(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, nullptr); + ERR_FAIL_NULL_V(sd, nullptr); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3979,7 +3979,7 @@ const Glyph *TextServerFallback::_shaped_text_get_glyphs(const RID &p_shaped) co int64_t TextServerFallback::_shaped_text_get_glyph_count(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0); + ERR_FAIL_NULL_V(sd, 0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -3990,7 +3990,7 @@ int64_t TextServerFallback::_shaped_text_get_glyph_count(const RID &p_shaped) co const Glyph *TextServerFallback::_shaped_text_sort_logical(const RID &p_shaped) { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, nullptr); + ERR_FAIL_NULL_V(sd, nullptr); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4002,7 +4002,7 @@ const Glyph *TextServerFallback::_shaped_text_sort_logical(const RID &p_shaped) Vector2i TextServerFallback::_shaped_text_get_range(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, Vector2i()); + ERR_FAIL_NULL_V(sd, Vector2i()); MutexLock lock(sd->mutex); return Vector2(sd->start, sd->end); @@ -4011,7 +4011,7 @@ Vector2i TextServerFallback::_shaped_text_get_range(const RID &p_shaped) const { Array TextServerFallback::_shaped_text_get_objects(const RID &p_shaped) const { Array ret; const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, ret); + ERR_FAIL_NULL_V(sd, ret); MutexLock lock(sd->mutex); for (const KeyValue &E : sd->objects) { @@ -4023,7 +4023,7 @@ Array TextServerFallback::_shaped_text_get_objects(const RID &p_shaped) const { Rect2 TextServerFallback::_shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, Rect2()); + ERR_FAIL_NULL_V(sd, Rect2()); MutexLock lock(sd->mutex); ERR_FAIL_COND_V(!sd->objects.has(p_key), Rect2()); @@ -4035,7 +4035,7 @@ Rect2 TextServerFallback::_shaped_text_get_object_rect(const RID &p_shaped, cons Size2 TextServerFallback::_shaped_text_get_size(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, Size2()); + ERR_FAIL_NULL_V(sd, Size2()); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4050,7 +4050,7 @@ Size2 TextServerFallback::_shaped_text_get_size(const RID &p_shaped) const { double TextServerFallback::_shaped_text_get_ascent(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4061,7 +4061,7 @@ double TextServerFallback::_shaped_text_get_ascent(const RID &p_shaped) const { double TextServerFallback::_shaped_text_get_descent(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4072,7 +4072,7 @@ double TextServerFallback::_shaped_text_get_descent(const RID &p_shaped) const { double TextServerFallback::_shaped_text_get_width(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4083,7 +4083,7 @@ double TextServerFallback::_shaped_text_get_width(const RID &p_shaped) const { double TextServerFallback::_shaped_text_get_underline_position(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4095,7 +4095,7 @@ double TextServerFallback::_shaped_text_get_underline_position(const RID &p_shap double TextServerFallback::_shaped_text_get_underline_thickness(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, 0.0); + ERR_FAIL_NULL_V(sd, 0.0); MutexLock lock(sd->mutex); if (!sd->valid) { @@ -4107,7 +4107,7 @@ double TextServerFallback::_shaped_text_get_underline_thickness(const RID &p_sha PackedInt32Array TextServerFallback::_shaped_text_get_character_breaks(const RID &p_shaped) const { const ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); - ERR_FAIL_COND_V(!sd, PackedInt32Array()); + ERR_FAIL_NULL_V(sd, PackedInt32Array()); MutexLock lock(sd->mutex); if (!sd->valid) { diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp index df7672754be..aef4f394b26 100644 --- a/modules/upnp/upnp.cpp +++ b/modules/upnp/upnp.cpp @@ -242,14 +242,14 @@ Ref UPNP::get_device(int index) const { } void UPNP::add_device(Ref device) { - ERR_FAIL_COND(device == nullptr); + ERR_FAIL_NULL(device); devices.push_back(device); } void UPNP::set_device(int index, Ref device) { ERR_FAIL_INDEX(index, devices.size()); - ERR_FAIL_COND(device == nullptr); + ERR_FAIL_NULL(device); devices.set(index, device); } diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp index a127a6b75ab..38cb6148470 100644 --- a/modules/websocket/wsl_peer.cpp +++ b/modules/websocket/wsl_peer.cpp @@ -600,7 +600,7 @@ ssize_t WSLPeer::_wsl_send_callback(wslay_event_context_ptr ctx, const uint8_t * } int WSLPeer::_wsl_genmask_callback(wslay_event_context_ptr ctx, uint8_t *buf, size_t len, void *user_data) { - ERR_FAIL_COND_V(!_static_rng, WSLAY_ERR_CALLBACK_FAILURE); + ERR_FAIL_NULL_V(_static_rng, WSLAY_ERR_CALLBACK_FAILURE); Error err = _static_rng->get_random_bytes(buf, len); ERR_FAIL_COND_V(err != OK, WSLAY_ERR_CALLBACK_FAILURE); return 0; @@ -676,7 +676,7 @@ void WSLPeer::poll() { } if (ready_state == STATE_OPEN || ready_state == STATE_CLOSING) { - ERR_FAIL_COND(!wsl_ctx); + ERR_FAIL_NULL(wsl_ctx); int err = 0; if ((err = wslay_event_recv(wsl_ctx)) != 0 || (err = wslay_event_send(wsl_ctx)) != 0) { // Error close. diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 2989f8d1c00..56cb4938ec5 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -1763,37 +1763,37 @@ void DisplayServerMacOS::global_menu_clear(const String &p_menu_root) { } bool DisplayServerMacOS::tts_is_speaking() const { - ERR_FAIL_COND_V_MSG(!tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); + ERR_FAIL_NULL_V_MSG(tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); return [tts isSpeaking]; } bool DisplayServerMacOS::tts_is_paused() const { - ERR_FAIL_COND_V_MSG(!tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); + ERR_FAIL_NULL_V_MSG(tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); return [tts isPaused]; } TypedArray DisplayServerMacOS::tts_get_voices() const { - ERR_FAIL_COND_V_MSG(!tts, Array(), "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); + ERR_FAIL_NULL_V_MSG(tts, Array(), "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); return [tts getVoices]; } void DisplayServerMacOS::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) { - ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); + ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); [tts speak:p_text voice:p_voice volume:p_volume pitch:p_pitch rate:p_rate utterance_id:p_utterance_id interrupt:p_interrupt]; } void DisplayServerMacOS::tts_pause() { - ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); + ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); [tts pauseSpeaking]; } void DisplayServerMacOS::tts_resume() { - ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); + ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); [tts resumeSpeaking]; } void DisplayServerMacOS::tts_stop() { - ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); + ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech."); [tts stopSpeaking]; } diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 113f7779644..1a1bba833d7 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2407,7 +2407,7 @@ void DisplayServerWindows::set_native_icon(const String &p_filename) { f->seek(pos); f->get_buffer((uint8_t *)&data_big.write[0], bytecount_big); HICON icon_big = CreateIconFromResource((PBYTE)&data_big.write[0], bytecount_big, TRUE, 0x00030000); - ERR_FAIL_COND_MSG(!icon_big, "Could not create " + itos(big_icon_width) + "x" + itos(big_icon_width) + " @" + itos(big_icon_cc) + " icon, error: " + format_error_message(GetLastError()) + "."); + ERR_FAIL_NULL_MSG(icon_big, "Could not create " + itos(big_icon_width) + "x" + itos(big_icon_width) + " @" + itos(big_icon_cc) + " icon, error: " + format_error_message(GetLastError()) + "."); // Read the small icon. DWORD bytecount_small = icon_dir->idEntries[small_icon_index].dwBytesInRes; @@ -2417,7 +2417,7 @@ void DisplayServerWindows::set_native_icon(const String &p_filename) { f->seek(pos); f->get_buffer((uint8_t *)&data_small.write[0], bytecount_small); HICON icon_small = CreateIconFromResource((PBYTE)&data_small.write[0], bytecount_small, TRUE, 0x00030000); - ERR_FAIL_COND_MSG(!icon_small, "Could not create 16x16 @" + itos(small_icon_cc) + " icon, error: " + format_error_message(GetLastError()) + "."); + ERR_FAIL_NULL_MSG(icon_small, "Could not create 16x16 @" + itos(small_icon_cc) + " icon, error: " + format_error_message(GetLastError()) + "."); // Online tradition says to be sure last error is cleared and set the small icon first. int err = 0; diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index 9ce126a475d..37239e8462b 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -484,7 +484,7 @@ void enet_socket_destroy(ENetSocket socket) { } int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBuffer *buffers, size_t bufferCount) { - ERR_FAIL_COND_V(address == nullptr, -1); + ERR_FAIL_NULL_V(address, -1); ENetGodotSocket *sock = (ENetGodotSocket *)socket; IPAddress dest;