summaryrefslogtreecommitdiff
path: root/servers/physics
diff options
context:
space:
mode:
authorMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2019-08-08 17:08:27 -0300
committerMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2019-08-09 11:27:39 -0300
commit5ca74604217758d91e344b052fe87c9eda8940a9 (patch)
tree863c635081277814250bbca958ea6e74100ca65b /servers/physics
parent7bb2215ed0d7415179a8b59ad4766a3b573cf696 (diff)
Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "main" and "servers" directories
Diffstat (limited to 'servers/physics')
-rw-r--r--servers/physics/collision_object_sw.h6
-rw-r--r--servers/physics/physics_server_sw.cpp26
2 files changed, 7 insertions, 25 deletions
diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h
index 895eda8528..b9912f0ba2 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -86,13 +86,9 @@ protected:
void _unregister_shapes();
_FORCE_INLINE_ void _set_transform(const Transform &p_transform, bool p_update_shapes = true) {
-
#ifdef DEBUG_ENABLED
- if (p_transform.origin.length_squared() > MAX_OBJECT_DISTANCE_X2) {
- ERR_EXPLAIN("Object went too far away (more than " + itos(MAX_OBJECT_DISTANCE) + "mts from origin).");
- ERR_FAIL();
- }
+ ERR_FAIL_COND_MSG(p_transform.origin.length_squared() > MAX_OBJECT_DISTANCE_X2, "Object went too far away (more than " + itos(MAX_OBJECT_DISTANCE) + " units from origin).");
#endif
transform = p_transform;
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index 7b982e7015..09872977b6 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -40,11 +40,8 @@
#include "joints/pin_joint_sw.h"
#include "joints/slider_joint_sw.h"
-#define FLUSH_QUERY_CHECK(m_object) \
- if (m_object->get_space() && flushing_queries) { \
- ERR_EXPLAIN("Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead"); \
- ERR_FAIL(); \
- }
+#define FLUSH_QUERY_CHECK(m_object) \
+ ERR_FAIL_COND_MSG(m_object->get_space() && flushing_queries, "Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.");
RID PhysicsServerSW::shape_create(ShapeType p_shape) {
@@ -73,8 +70,7 @@ RID PhysicsServerSW::shape_create(ShapeType p_shape) {
} break;
case SHAPE_CYLINDER: {
- ERR_EXPLAIN("CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings.");
- ERR_FAIL_V(RID());
+ ERR_FAIL_V_MSG(RID(), "CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings.");
} break;
case SHAPE_CONVEX_POLYGON: {
@@ -200,11 +196,7 @@ PhysicsDirectSpaceState *PhysicsServerSW::space_get_direct_state(RID p_space) {
SpaceSW *space = space_owner.get(p_space);
ERR_FAIL_COND_V(!space, NULL);
- if (!doing_sync || space->is_locked()) {
-
- ERR_EXPLAIN("Space state is inaccessible right now, wait for iteration or physics process notification.");
- ERR_FAIL_V(NULL);
- }
+ ERR_FAIL_COND_V_MSG(!doing_sync || space->is_locked(), NULL, "Space state is inaccessible right now, wait for iteration or physics process notification.");
return space->get_direct_state();
}
@@ -987,12 +979,7 @@ PhysicsDirectBodyState *PhysicsServerSW::body_get_direct_state(RID p_body) {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND_V(!body, NULL);
-
- if (!doing_sync || body->get_space()->is_locked()) {
-
- ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification.");
- ERR_FAIL_V(NULL);
- }
+ ERR_FAIL_COND_V_MSG(!doing_sync || body->get_space()->is_locked(), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
direct_state->body = body;
return direct_state;
@@ -1410,8 +1397,7 @@ void PhysicsServerSW::free(RID p_rid) {
} else {
- ERR_EXPLAIN("Invalid ID");
- ERR_FAIL();
+ ERR_FAIL_MSG("Invalid ID.");
}
};