summaryrefslogtreecommitdiffstats
path: root/src/entities
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2021-01-31 20:44:39 +0100
committerFilip Gawin <filip.gawin@zoho.com>2021-01-31 20:44:39 +0100
commit7a3b80a9b7f414967fe59f89ab0fe5416735babe (patch)
treea84fb5e1dbdb00959d6916594d43b9c82c9bef23 /src/entities
parentfix realloc (diff)
downloadre3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.gz
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.bz2
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.lz
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.xz
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.tar.zst
re3-7a3b80a9b7f414967fe59f89ab0fe5416735babe.zip
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/Entity.cpp6
-rw-r--r--src/entities/Physical.cpp27
2 files changed, 22 insertions, 11 deletions
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 4885d631..dc70a31a 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -504,6 +504,9 @@ CEntity::Add(void)
case ENTITY_TYPE_DUMMY:
list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP];
break;
+#ifdef FIX_BUGS
+ default: debug("This shouldn't happen"); return;
+#endif
}
list->InsertItem(this);
}
@@ -564,6 +567,9 @@ CEntity::Remove(void)
case ENTITY_TYPE_DUMMY:
list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP];
break;
+#ifdef FIX_BUGS
+ default: debug("This shouldn't happen"); return;
+#endif
}
list->RemoveItem(this);
}
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index ed01297e..4088f1d1 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -126,6 +126,8 @@ CPhysical::Add(void)
break;
default:
assert(0);
+ debug("This shouldn't happen");
+ return;
}
CPtrNode *node = list->InsertItem(this);
assert(node);
@@ -191,17 +193,20 @@ CPhysical::RemoveAndAdd(void)
list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP];
break;
}
- if(next){
- // If we still have old nodes, use them
- next->list->RemoveNode(next->listnode);
- list->InsertNode(next->listnode);
- next->list = list;
- next->sector = s;
- next = next->next;
- }else{
- CPtrNode *node = list->InsertItem(this);
- m_entryInfoList.InsertItem(list, node, s);
- }
+#ifdef FIX_BUGS
+ if(list)
+#endif
+ if(next) {
+ // If we still have old nodes, use them
+ next->list->RemoveNode(next->listnode);
+ list->InsertNode(next->listnode);
+ next->list = list;
+ next->sector = s;
+ next = next->next;
+ } else {
+ CPtrNode *node = list->InsertItem(this);
+ m_entryInfoList.InsertItem(list, node, s);
+ }
}
// Remove old nodes we no longer need