mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-20 22:20:59 -04:00
better assertions
This commit is contained in:
parent
bc1d195613
commit
c9cbb60c2a
@ -654,6 +654,7 @@ get_next_visible_child(int n) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
int PandaNode::
|
int PandaNode::
|
||||||
find_child(PandaNode *node) const {
|
find_child(PandaNode *node) const {
|
||||||
|
nassertr(node != (PandaNode *)NULL, -1);
|
||||||
CDReader cdata(_cycler);
|
CDReader cdata(_cycler);
|
||||||
|
|
||||||
// We have to search for the child by brute force, since we don't
|
// We have to search for the child by brute force, since we don't
|
||||||
@ -681,6 +682,7 @@ find_child(PandaNode *node) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void PandaNode::
|
void PandaNode::
|
||||||
add_child(PandaNode *child_node, int sort) {
|
add_child(PandaNode *child_node, int sort) {
|
||||||
|
nassertv(child_node != (PandaNode *)NULL);
|
||||||
// Ensure the child_node is not deleted while we do this.
|
// Ensure the child_node is not deleted while we do this.
|
||||||
PT(PandaNode) keep_child = child_node;
|
PT(PandaNode) keep_child = child_node;
|
||||||
remove_child(child_node);
|
remove_child(child_node);
|
||||||
@ -738,6 +740,7 @@ remove_child(int n) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool PandaNode::
|
bool PandaNode::
|
||||||
remove_child(PandaNode *child_node) {
|
remove_child(PandaNode *child_node) {
|
||||||
|
nassertr(child_node != (PandaNode *)NULL, false);
|
||||||
// First, look for the parent in the child's up list, to ensure the
|
// First, look for the parent in the child's up list, to ensure the
|
||||||
// child is known.
|
// child is known.
|
||||||
int parent_index = child_node->find_parent(this);
|
int parent_index = child_node->find_parent(this);
|
||||||
@ -777,6 +780,8 @@ remove_child(PandaNode *child_node) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool PandaNode::
|
bool PandaNode::
|
||||||
replace_child(PandaNode *orig_child, PandaNode *new_child) {
|
replace_child(PandaNode *orig_child, PandaNode *new_child) {
|
||||||
|
nassertr(orig_child != (PandaNode *)NULL, false);
|
||||||
|
nassertr(new_child != (PandaNode *)NULL, false);
|
||||||
// First, look for the parent in the child's up list, to ensure the
|
// First, look for the parent in the child's up list, to ensure the
|
||||||
// child is known.
|
// child is known.
|
||||||
int parent_index = orig_child->find_parent(this);
|
int parent_index = orig_child->find_parent(this);
|
||||||
|
@ -228,14 +228,11 @@ get_error_type() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: qpNodePath::node
|
// Function: qpNodePath::node
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns the referenced node of the path, or NULL if the
|
// Description: Returns the referenced node of the path.
|
||||||
// path is empty.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE PandaNode *qpNodePath::
|
INLINE PandaNode *qpNodePath::
|
||||||
node() const {
|
node() const {
|
||||||
if (is_empty()) {
|
nassertr(!is_empty(), (PandaNode *)NULL);
|
||||||
return (PandaNode *)NULL;
|
|
||||||
}
|
|
||||||
return _head->get_node();
|
return _head->get_node();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ INLINE qpNodePathComponent::
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE PandaNode *qpNodePathComponent::
|
INLINE PandaNode *qpNodePathComponent::
|
||||||
get_node() const {
|
get_node() const {
|
||||||
|
nassertr(_node != (PandaNode *)NULL, _node);
|
||||||
return _node;
|
return _node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user