Oolite
Loading...
Searching...
No Matches
Entity(OOPrivate) Category Reference

Instance Methods

(BOOL) - checkLinkedLists

Detailed Description

Definition at line 56 of file Entity.m.

Method Documentation

◆ checkLinkedLists

- (BOOL) checkLinkedLists

Extends class Entity.

Definition at line 321 of file Entity.m.

322{
323 // DEBUG check for loops
324 if (UNIVERSE->n_entities > 0) {
325 int n;
326 Entity *check, *last;
327 //
328 last = nil;
329 //
330 n = UNIVERSE->n_entities;
331 check = UNIVERSE->x_list_start;
332 while ((n--) && (check)) {
333 last = check;
334 check = check->x_next;
335 }
336 if ((check) || (n > 0)) {
337 OOLog(kOOLogEntityVerificationError, @"Broken x_next %@ list (%d) ***", UNIVERSE->x_list_start, n);
338 return NO;
339 }
340 //
341 n = UNIVERSE->n_entities;
342 check = last;
343 while ((n--) && (check))
344 check = check->x_previous;
345 if ((check) || (n > 0)) {
346 OOLog(kOOLogEntityVerificationError, @"Broken x_previous %@ list (%d) ***", UNIVERSE->x_list_start, n);
347 return NO;
348 }
349 //
350 n = UNIVERSE->n_entities;
351 check = UNIVERSE->y_list_start;
352 while ((n--) && (check)) {
353 last = check;
354 check = check->y_next;
355 }
356 if ((check) || (n > 0)) {
357 OOLog(kOOLogEntityVerificationError, @"Broken y_next %@ list (%d) ***", UNIVERSE->y_list_start, n);
358 return NO;
359 }
360 //
361 n = UNIVERSE->n_entities;
362 check = last;
363 while ((n--) && (check))
364 check = check->y_previous;
365 if ((check) || (n > 0)) {
366 OOLog(kOOLogEntityVerificationError, @"Broken y_previous %@ list (%d) ***", UNIVERSE->y_list_start, n);
367 return NO;
368 }
369 //
370 n = UNIVERSE->n_entities;
371 check = UNIVERSE->z_list_start;
372 while ((n--) && (check)) {
373 last = check;
374 check = check->z_next;
375 }
376 if ((check) || (n > 0)) {
377 OOLog(kOOLogEntityVerificationError, @"Broken z_next %@ list (%d) ***", UNIVERSE->z_list_start, n);
378 return NO;
379 }
380 //
381 n = UNIVERSE->n_entities;
382 check = last;
383 while ((n--) && (check))
384 check = check->z_previous;
385 if ((check) || (n > 0)) {
386 OOLog(kOOLogEntityVerificationError, @"Broken z_previous %@ list (%d) ***", UNIVERSE->z_list_start, n);
387 return NO;
388 }
389 }
390 return YES;
391}
static NSString *const kOOLogEntityVerificationError
Definition Entity.m:54
#define OOLog(class, format,...)
Definition OOLogging.h:84
return nil
#define UNIVERSE
Definition Universe.h:827
Entity * z_next
Definition Entity.h:118
Entity * z_previous
Definition Entity.h:118
Entity * x_previous
Definition Entity.h:116
Entity * x_next
Definition Entity.h:116
Entity * y_next
Definition Entity.h:117
Entity * y_previous
Definition Entity.h:117

References checkLinkedLists, kOOLogEntityVerificationError, nil, OOLog, UNIVERSE, Entity::x_next, Entity::x_previous, Entity::y_next, Entity::y_previous, Entity::z_next, and Entity::z_previous.

Referenced by Entity::addToLinkedLists, checkLinkedLists, Entity::removeFromLinkedLists, and Entity::updateLinkedLists.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this category was generated from the following file: