worked on grid creation

fixed some issues with stairs
fixed/added LINT
This commit is contained in:
k-a-z-u
2017-07-27 18:40:56 +02:00
parent 3a92199777
commit c21925e86f
5 changed files with 114 additions and 38 deletions

View File

@@ -268,7 +268,7 @@ public:
}
/** remove the connection from n1 to n2 (not the other way round!) */
void disconnectUniDir(T& n1, T& n2) {
void disconnectUniDir(T& n1, const T& n2) {
for (int n = 0; n < n1._numNeighbors; ++n) {
if (n1._neighbors[n] == n2._idx) {
arrayRemove(n1._neighbors, n, n1._numNeighbors);
@@ -301,12 +301,16 @@ public:
void remove(T& node) {
// disconnect from all neighbors
int cnt = 0;
while (node._numNeighbors) {
// by removing one neighbor, all others are shifted to close the gap within the array
// its therefor ok to always delete array index [0]
disconnectBiDir(node._idx, node._neighbors[0]);
if (++cnt > node.MAX_NEIGHBORS) {
Log::add(name, "WARNING! found unsolveable neighboring! " + node.asString(), true);
break;
}
}
// remove from hash-list