mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 13:21:10 +01:00
Add error messages for collision exception functions
Adds error messages to collision exception functions when used with the wrong object/node instead of failing silently.
This commit is contained in:
parent
0b5e773f02
commit
90f81c0013
@ -257,9 +257,7 @@ void RayCast2D::add_exception_rid(const RID &p_rid) {
|
|||||||
void RayCast2D::add_exception(const Object *p_object) {
|
void RayCast2D::add_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
|
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject2D.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
add_exception_rid(co->get_rid());
|
add_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,9 +268,7 @@ void RayCast2D::remove_exception_rid(const RID &p_rid) {
|
|||||||
void RayCast2D::remove_exception(const Object *p_object) {
|
void RayCast2D::remove_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
|
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject2D.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
remove_exception_rid(co->get_rid());
|
remove_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,9 +323,7 @@ void ShapeCast2D::add_exception_rid(const RID &p_rid) {
|
|||||||
void ShapeCast2D::add_exception(const Object *p_object) {
|
void ShapeCast2D::add_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
|
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject2D.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
add_exception_rid(co->get_rid());
|
add_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,9 +334,7 @@ void ShapeCast2D::remove_exception_rid(const RID &p_rid) {
|
|||||||
void ShapeCast2D::remove_exception(const Object *p_object) {
|
void ShapeCast2D::remove_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
|
const CollisionObject2D *co = Object::cast_to<CollisionObject2D>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject2D.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
remove_exception_rid(co->get_rid());
|
remove_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,9 +808,7 @@ void ClippedCamera::add_exception_rid(const RID &p_rid) {
|
|||||||
void ClippedCamera::add_exception(const Object *p_object) {
|
void ClippedCamera::add_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
add_exception_rid(co->get_rid());
|
add_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,9 +819,7 @@ void ClippedCamera::remove_exception_rid(const RID &p_rid) {
|
|||||||
void ClippedCamera::remove_exception(const Object *p_object) {
|
void ClippedCamera::remove_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
remove_exception_rid(co->get_rid());
|
remove_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,9 +238,7 @@ void RayCast::add_exception_rid(const RID &p_rid) {
|
|||||||
void RayCast::add_exception(const Object *p_object) {
|
void RayCast::add_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
add_exception_rid(co->get_rid());
|
add_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,9 +249,7 @@ void RayCast::remove_exception_rid(const RID &p_rid) {
|
|||||||
void RayCast::remove_exception(const Object *p_object) {
|
void RayCast::remove_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
remove_exception_rid(co->get_rid());
|
remove_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,9 +430,7 @@ void ShapeCast::add_exception_rid(const RID &p_rid) {
|
|||||||
void ShapeCast::add_exception(const Object *p_object) {
|
void ShapeCast::add_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
add_exception_rid(co->get_rid());
|
add_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,9 +441,7 @@ void ShapeCast::remove_exception_rid(const RID &p_rid) {
|
|||||||
void ShapeCast::remove_exception(const Object *p_object) {
|
void ShapeCast::remove_exception(const Object *p_object) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL(p_object);
|
||||||
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
|
||||||
if (!co) {
|
ERR_FAIL_COND_MSG(!co, "The passed Node must be an instance of CollisionObject.");
|
||||||
return;
|
|
||||||
}
|
|
||||||
remove_exception_rid(co->get_rid());
|
remove_exception_rid(co->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user